The ClientWebApp sample application in GWT 2.5 contains example
drag-and-drop code, as seen below.
When I use it, it works great the first time I drag a TaskTemplate. On
subsequent drags, event.getDataTransfer() fails because
event.dead=true. Halp?
public class DesktopTaskEditView extends Composite implements TaskEditView {
//...
static class TaskTemplateCell extends AbstractCell<TaskProxy> {
//...
public TaskTemplateCell() {
// Register the kinds of event this cell will manage.
super("dragstart");
}
//...
/**
* Handles "drag-start" events inside the element named "root".
*/
@UiHandler({"root"})
void onDragStart(DragStartEvent event, Element parent, Context context) {
// Save the ID of the TaskProxy.
DataTransfer dataTransfer = event.getDataTransfer();
dataTransfer.setData("text", String.valueOf(context.getIndex()));
// Set the image.
dataTransfer.setDragImage(parent, 25, 15);
}
}
//...
}
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment