PDA

View Full Version : Listening to a drag and drop between two different model types without crashing



grp500
13 Dec 2010, 10:59 AM
Hi,
I have a grid based on my 'File' model and I'm trying to drag the rows into a tree based on my 'Folder' model. So the grid is set up and then:
new GridDragSource(_fileGrid);
is ran.
The tree is set up and then:
final TreePanelDropTarget target = new TreePanelDropTarget(_folderTree);
target.setAllowDropOnLeaf(true);
target.addDNDListener(some_listener);
is ran.

I don't want gxt to try and help me update the grid or tree or the associated models, they are different types and a casting exception is thrown. I just want to use a DNDListener to listen to the dragDrop event and use my own code to update everything. How can I turn off everything except for the event? I've tried target.setOperation(null); and it doesn't work.

Thank you for your time.

sven
13 Dec 2010, 11:01 AM
How can I turn off everything except for the event?

Dont use the TreePanelDropTarget than but use your own DropTarget class.

What kind of exception do you have now? What are you doing exactly? Do you have a testcase implementing EntryPoint of what you are doing?

grp500
13 Dec 2010, 11:06 AM
Great! That seems to be a very good start! Thanks for the prompt reply!

sven
13 Dec 2010, 11:07 AM
DropTarget still has all the events, just no logic. So it should be exactly what you use.

vbjain
8 Oct 2011, 11:16 PM
Can you tell me how exactly you solve this? I am also having same kind of requirement where Tree will have different model and Grid will have different model. When i drag from Grid to Tree the dragged model should updated to the Tree compatible model.

I have override the TreePanelDropTarget but dont know exactly which methods to override for this requirement.

Thanks.