GeeCON Prague 2014*
The moose likes GWT and the fly likes GWT drag&drop how to get widget source on drop event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWT drag&drop how to get widget source on drop event" Watch "GWT drag&drop how to get widget source on drop event" New topic
Author

GWT drag&drop how to get widget source on drop event

Roy Bean
Greenhorn

Joined: Jan 26, 2012
Posts: 5
I'm trying to implement an drag & drop in my project. I already managed, but now i want to distinguish the drag source.

I will have two widget from were i can drag lets call widget1 and widget2:

i made the handler for each one

now i had two absolute panels one only can receive from widget 1 and the other from widget 2

how can i manage to do that?

thanks for the help.
Julian Downes
Greenhorn

Joined: Mar 10, 2012
Posts: 1

Inside OnDragStart use event.setData("text", uniqueDragId); where uniqueDragId is a unique drag Id in your application eg "1" or "draggable:1" etc

Then inside OnDrop test event.getData("text"); to determine if it is equal to "1" or whatever.

To get the actual text you are trying to "drop" you reference the object that you know uses the drag Id of "1" and get the text directly from it.

Therefore this whole approach doesn't really drag anything, it just uses the drag metaphor to give your "onDrop" code an id.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GWT drag&drop how to get widget source on drop event