mthomason12 / macwidgets

Automatically exported from code.google.com/p/macwidgets
0 stars 0 forks source link

Add always expanded SourceList categories #161

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'd love to see a way to make SourceList categories always expanded, like some 
of them are in 
iTunes (e.g. Library, Store).

One would have to remove the little open/close triangle and make sure that the 
node is expanded 
by default. This could be an attribute of the SourceListCategory class.

Original issue reported on code.google.com by hendrik....@gmail.com on 7 Apr 2010 at 11:09

Attachments:

GoogleCodeExporter commented 9 years ago
This could be achieved by a combination of things:

1) add a property boolean isAlwaysExpanded to SourceListCategory (and perhaps 
add an interface 
ExpansionControlProvider for the DefaultMutableTreeNode use case)
2) overwrite boolean shouldPaintExpandControl in SourceListTreeUI, so that it 
somehow checks for isAlwaysExpanded in potential nodes
3) make sure that the always expanded nodes are always expanded - maybe when 
you add them to the model
4) prevent the clickable space where the ExpandControl would be from firing an 
expansion/contraction event. 
this can be done by adding a TreeWillExpandListener to the JTree, that throws 
an ExpandVetoException, if the 
clicked on node corresponds to a SourceListCategory with isAlwaysExpanded == 
true

What's not solved in this approach, is that the always expanded categories are 
indented by the amount of 
space the little triangle would have taken up (and they shouldn't be).

Original comment by hendrik....@gmail.com on 7 Apr 2010 at 3:52