Lines 118-124
Link Here
|
118 |
public class OutlineView extends JScrollPane { |
118 |
public class OutlineView extends JScrollPane { |
119 |
|
119 |
|
120 |
/** The table */ |
120 |
/** The table */ |
121 |
private Outline outline; |
121 |
private OutlineViewOutline outline; |
122 |
/** Explorer manager, valid when this view is showing */ |
122 |
/** Explorer manager, valid when this view is showing */ |
123 |
ExplorerManager manager; |
123 |
ExplorerManager manager; |
124 |
/** not null if popup menu enabled */ |
124 |
/** not null if popup menu enabled */ |
Lines 284-289
Link Here
|
284 |
popupListener = null; |
284 |
popupListener = null; |
285 |
return; |
285 |
return; |
286 |
} |
286 |
} |
|
|
287 |
} |
288 |
|
289 |
/** |
290 |
* Set the tree column as sortable |
291 |
* @param treeSortable <code>true</code> to make the tree column sortable, |
292 |
* <code>false</code> otherwise. The tree column is sortable by default. |
293 |
* @since 6.24 |
294 |
*/ |
295 |
public void setTreeSortable(boolean treeSortable) { |
296 |
outline.setTreeSortable(treeSortable); |
287 |
} |
297 |
} |
288 |
|
298 |
|
289 |
/** Initializes the component and lookup explorer manager. |
299 |
/** Initializes the component and lookup explorer manager. |
Lines 882-887
Link Here
|
882 |
private static class OutlineViewOutline extends Outline { |
892 |
private static class OutlineViewOutline extends Outline { |
883 |
private final PropertiesRowModel rowModel; |
893 |
private final PropertiesRowModel rowModel; |
884 |
private static final String COLUMNS_SELECTOR_HINT = "ColumnsSelectorHint"; // NOI18N |
894 |
private static final String COLUMNS_SELECTOR_HINT = "ColumnsSelectorHint"; // NOI18N |
|
|
895 |
|
896 |
private boolean treeSortable = true; |
897 |
|
885 |
public OutlineViewOutline(OutlineModel mdl, PropertiesRowModel rowModel) { |
898 |
public OutlineViewOutline(OutlineModel mdl, PropertiesRowModel rowModel) { |
886 |
super(mdl); |
899 |
super(mdl); |
887 |
this.rowModel = rowModel; |
900 |
this.rowModel = rowModel; |
Lines 993-998
Link Here
|
993 |
return new OutlineViewOutlineColumn(modelIndex); |
1006 |
return new OutlineViewOutlineColumn(modelIndex); |
994 |
} |
1007 |
} |
995 |
|
1008 |
|
|
|
1009 |
boolean isTreeSortable() { |
1010 |
return this.treeSortable; |
1011 |
} |
1012 |
|
1013 |
void setTreeSortable(boolean treeSortable) { |
1014 |
this.treeSortable = treeSortable; |
1015 |
} |
1016 |
|
996 |
/** |
1017 |
/** |
997 |
* Extension of ETableColumn using TableViewRowComparator as |
1018 |
* Extension of ETableColumn using TableViewRowComparator as |
998 |
* comparator. |
1019 |
* comparator. |
Lines 1006-1025
Link Here
|
1006 |
} |
1027 |
} |
1007 |
@Override |
1028 |
@Override |
1008 |
public boolean isSortingAllowed() { |
1029 |
public boolean isSortingAllowed() { |
1009 |
boolean res = super.isSortingAllowed(); |
1030 |
int index = getModelIndex(); |
1010 |
TableModel model = getModel(); |
1031 |
Object sortable; |
1011 |
if (model.getRowCount() <= 0) { |
1032 |
if (index > 0) { |
1012 |
return res; |
1033 |
sortable = rowModel.getPropertyValue("SortableColumn", index - 1); // NOI18N |
|
|
1034 |
} else { |
1035 |
return isTreeSortable(); |
1013 |
} |
1036 |
} |
1014 |
Object sampleValue = model.getValueAt(0, getModelIndex()); |
1037 |
if (sortable != null) { |
1015 |
if (sampleValue instanceof Node.Property) { |
1038 |
return Boolean.TRUE.equals(sortable); |
1016 |
Node.Property prop = (Node.Property)sampleValue; |
|
|
1017 |
Object sortableColumnProperty = prop.getValue("SortableColumn"); |
1018 |
if (sortableColumnProperty instanceof Boolean) { |
1019 |
return ((Boolean)sortableColumnProperty).booleanValue(); |
1020 |
} |
1021 |
} |
1039 |
} |
1022 |
return res; |
1040 |
return super.isSortingAllowed(); |
1023 |
} |
1041 |
} |
1024 |
|
1042 |
|
1025 |
@Override |
1043 |
@Override |