Created attachment 115994 [details]
an example Suite with Nodes containing non-sortable Properties
If one sets the "SortableColumns" property value within a Property, it is completely ignored if the OutlineView has its columns set up via OutlineView.addPropertyColumn or OutlineView.setPropertyColumns().
This functions correctly if one creates a dummy node with the desired properies and then calls OutlineView.setProperties(properties). However, OutlineView.setProperties(properties) is deprecated.
1. Create a Node with at least one non-sortable Property
2. Set up columns via OutlineView.setPropertyColumns( .... ):
outlineView1.addPropertyColumn(FakeEntity.PROP_PAGE_NUMBER, "Page Number");
outlineView1.addPropertyColumn(FakeEntity.PROP_PAGE_LETTER, "Page Letter");
3. Set up an explorer view as normal.
In the attached FakeEntityNode class, the property PageLetterProperty will still sort in spite of having "SortableColumn" set.
Well, OutlineView.setProperties() was set as deprecated, but in cases when you need to provide a special instance of Node.Property, it needs to be used.
It's not much feasible to control sortability by Property objects attached to individual nodes. It's controled by Property objects passed as columns.
But when OutlineView.setProperties() is not used to set columns, there's no way how to change the Property attributes.
Therefore I'm proposing to add a new method:
OutlineView.setPropertyColumnAttribute(String columnName, String attributeName, Object value)
Then you could use this to change the sortability like:
OutlineView.setPropertyColumnAttribute("myColumn", "SortableColumn", Boolean.TRUE)
Created attachment 117412 [details]
The proposed API change.
Please review the proposed API change.
If there are no objections, I'm going to push this change today after COB. Thanks.
The API change is pushed as changeset: 217788:a07fe086ee8a
Integrated into 'main-golden', will be available in build *201204050400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: #208713: OutlineView.setPropertyColumnAttribute() method added.