Closed GoogleCodeExporter closed 9 years ago
Sounds like you want to add a SourceListSelectionListener.
http://exploding-
pixels.com/google_code/javadoc_0.9.5/com/explodingpixels/macwidgets/SourceListSe
lectionListener.html
Original comment by kenneth....@gmail.com
on 13 Oct 2009 at 5:23
Unless I'm mistaken, this doesn't give me the "path" (for lack of a better
term) of where the selection came
from. In the above example the SourceListItem for the selected account will
always give me the account name,
nothing more, because the makeup of SourceListItem is a text and an icon. So
if I as the end user want to
select an account "foo" from within the "Inbox" category it'll return "foo";
just as if I were to select "foo" from
within "Junk". It seems to me that the SourceListItem should have some kind of
indicator as to where it came
from so that an appropriate decision can be made.
In fact, this was how I resolved this. I created a custom SourceListItem by
extending SourceListItem and
adding a "parent" Object to it's contents. I create a new object and set the
parent reference. That way in the
SourceListSelectionListener I can cast it to my custom object and receive the
parent object and make my
decision of what I want it to do. This is by far not the best solution, but it
seems to work.
Original comment by jbhawe...@gmail.com
on 13 Oct 2009 at 5:44
You can certainly do what your trying to do without extending SourceListItem,
though ideally you would be able
to provide an action to be performed when a particular node is selected (this
has been asked for).
For now, you can simply keep a Map of SourceListItems to "paths".
Original comment by kenneth....@gmail.com
on 13 Oct 2009 at 5:52
I see what you are getting at and it worked like a charm. Thanks for the help!
BTW - I just have to say that this is a great library!
Original comment by jbhawe...@gmail.com
on 14 Oct 2009 at 3:39
Glad it worked for you!
Original comment by kenneth....@gmail.com
on 14 Oct 2009 at 9:29
Original issue reported on code.google.com by
jbhawe...@gmail.com
on 5 Oct 2009 at 10:46