PDA

View Full Version : DragNDrop how to disable drop in TreePanel?



dealy663
1 Sep 2009, 3:08 PM
Hi

I've been searching around for a day now and am fried, so I'm asking for help. I've got a TreePanel that only goes 2 levels deep. I'm trying to make DragNDrop work for both the branches and leaves within this panel. Its easy to allow anything to be dropped anywhere else within the tree, but that is not how I need it to work. I need to disable the dropping of a branch within another branch. And I also need to disable dropping a leaf at the top level (which is only populated with branches).

From within the dragDrop listener created for the TreePanelDropTarget I have not been able to figure out both if the drop target is either a branch or a leaf, nor if the source is a branch or leaf. How do I do this? Also once I've figured out if the drop is supposed to be denied, how do I prevent it from happening and change the icon?

Example Starting condition

Root
|_B1
|_L11
|_L12
|_B2
|_L21
|_L22
|_B3

Illegal move of B2 as child of B1
Root
|_B1
|_L11
|_L12
|_B2
|_L21
|_L22
|_B3

Illegal move of L12 out to branch level
Root
|_B1
|_L11
|_B2
|_L21
|_L22
|_L12
|_B3

A legal reordring of B3 between B1 and B2
Root
|_B1
|_L11
|_L12
|_B3
|_B2
|_L21
|_L22




Thanks, Derek

Arno.Nyhm
2 Sep 2009, 2:38 AM
look at this (but this looks like in GXT 1.x) but it gives you a direction:
http://www.penguin-inn.com/blog/2009/04/16/drag-n-drop-grid-to-tree-in-ext-gwt-gxt/