I want to handle the drag & drop of hyperlinks in my app. The hyperlink could be from any where, therefore I cannot make it setDragable(true)
and setData("link", "the URL")
to mark it.
A very similar scenario would be Google Image search by image, where you can drag & drop a link of image to the search box.
The sample code,
Label lblDropLink = new Label("Drop a link here"); lblDropLink.addDragOverHandler(new DragOverHandler() { @Override public void onDragOver(DragOverEvent event) { lblDropLink.setText("Drop here to add the link."); lblDropLink.setStyleName("dragOverFade"); } }); lblDropLink.addDropHandler(new DropHandler() { @Override public void onDrop(DropEvent event) { event.preventDefault(); // QUESTION: how to get the link, and even its text? } });
Thanks!