Re: Drag and Drop in TreeTableView

Tim Boudreau <[email protected]>
Newsgroups gmane.comp.java.netbeans.user-interface
Message-ID <[email protected]>
The tree table view's design is based on the (infamous) Swing Connection 
tree table article;  a rewrite based on a more reliable design is in 
progress (contrib/ttv).

Essentially, the tree you want to be talking to is the JTree that is the 
cell renderer for the tree - the design is based on taking an offscreen 
JTree and using it as a cell renderer for the tree column, doing some 
positioning magic to move it around so the right rectangle of the tree 
is painted for each cell in the table, and events are dispatched to it 
to expand/collapse.  So probably you can delegate to the tree in one way 
or another to accomplish this.

-Tim

Buch-Andersen Nicolai wrote:
> Hi
> 
> We are currently building a prototype application in order to evaluate
> the NetBeans 4.0 Platform for use in a large project.
> 
> During this effort we ran into the following problem: There's no support
> for reordering nodes using drag and drop in a TreeTableView (as opposed
> to a BeanTreeView). The platform code for TreeTableView (package
> org.openide.explorer.view) has the following lines:
> 
>     /* DnD is not implemented for treeTable.
>      */
>     public void setDragSource (boolean state) {
>     }
> 
>     /* DnD is not implemented for treeTable.
>      */
>     public void setDropTarget (boolean state) {
>     }
> 
> I tried naively to replace this with:
> 
>     /* DnD is not implemented for treeTable - fixed
>      */
>     public void setDragSource (boolean state) {
> 	super.setDragSource(state);
>     }
> 
>     /* DnD is not implemented for treeTable - fixed
>      */
>     public void setDropTarget (boolean state) {
> 	super.setDropTarget(state);
>     }
> 
> But that didn't solve the problem. Apparently there's more to it than
> that. 
> 
> * Does anyone know why DnD was disabled (or not implemented) in
> TreeTableView in the first place? 
> * Can anyone outline what would be required to add support for DnD in a
> TreeTableView?
> 
> Thanks!
> 
> Regards
> 
> Nicolai Buch-Andersen,
> [email protected]
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.