christmo / macwidgets

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

Make JTree within SourceList accessable #50

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Maybe I just oversaw that, but I didn't find a getTree() methode in
SourceList, to get the internal tree.

Currently I implement drag&drop and need the tree control directly.

@Ken: I could check in my changed SourceList to updated that - if you give
me svn write access.

There are also some other minor changes that came up while developing (like
making ITunesTableHeaderRenderer public to the outside world for my
ITunesTreeTable)...

Best,
Peter

Original issue reported on code.google.com by studp...@gmail.com on 16 Jan 2009 at 1:26

GoogleCodeExporter commented 8 years ago
The tree is explicitly *not* exposed in order to hide the complexities of 
implementation. What methods on JTree 
do you need?

Feel free to email me you other changes and I can look at incorporating them 
back into the code base.

Original comment by kenneth....@gmail.com on 16 Jan 2009 at 11:50

GoogleCodeExporter commented 8 years ago
Well, for now, its this:

        // get internal tree
        JTree tree = sourceList.getTree();

        tree.setDragEnabled(true);
        tree.setDropMode(DropMode.ON_OR_INSERT);
        tree.setTransferHandler(new JakeSourceListTransferHandler());

Seems Drag&Drop won't be that easy! Saw the nice blue borders Apple's SourceList
draws when you drop something in? That would be awsome... at least some sort of
selection - using the new DropMode.ON_OR_INSERT of Java6 does not change your
selection instantly while dropping. Which is good. Bad is, on SourceList it 
does not
show any drop feedback.
But: the position markers between the items id drawn.

Original comment by studp...@gmail.com on 16 Jan 2009 at 12:03

GoogleCodeExporter commented 8 years ago
I'd rather have SourceList support D&D than to expose it's JTree so that 
developers can implement it themselves.

What methods would you need on SourceList to support this?

Original comment by kenneth....@gmail.com on 16 Jan 2009 at 12:10

GoogleCodeExporter commented 8 years ago
Ok, i'll be fine with that!

Those three functions passed-through are a good start.
Don't think there is a need for more.

For further infos about d&d, i recommend
http://weblogs.java.net/blog/shan_man/archive/2006/02/choosing_the_dr.html.

I could write those proxy-methods for you, need them anyway. Just tell me.

Original comment by studp...@gmail.com on 16 Jan 2009 at 12:24

GoogleCodeExporter commented 8 years ago
I added setTransferHandler to SourceList which automatically setDragEnabled 
true if the given handler is not null, 
and false otherwise. I'm not familiar with the setDropMode method, which isn't 
available in Java 1.5.

Let me know if this change meets your need, and I'll close this issue.

Original comment by kenneth....@gmail.com on 30 Jan 2009 at 12:10

GoogleCodeExporter commented 8 years ago
Hi Ken,

setDropMode is a new Handler for the MUCH(!) improved d&d in java 1.6. 
You need that e.g. when you want to keep tree selection and use dd, detect 
inserts between nodes, and so on.

Hmmm. Semms like trouble, as this isn't available in 1.5, so proxying it is not 
possible.
(Well, via reflection, but that's not a good idea)

I don't know what's best practice there.
Currently we use your framework and fork it a little, to get access to the 
inner components...
(as our project is 1.6 only; and yes, we're going open source, so you can see 
the changes)

So, for now, I've no problem closing the issue.

Original comment by studp...@gmail.com on 30 Jan 2009 at 12:36

GoogleCodeExporter commented 8 years ago

Original comment by kenneth....@gmail.com on 30 Jan 2009 at 12:57