fredsa / gwt-dnd

Library providing easy to use mouse or touch based drag-and-drop capabilities to GWT
43 stars 40 forks source link

New Feature: Use standard Event/EventLister/EventAdapter paradigm instead of on... methods for DropController #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This way, one can bind one or more listeners for onDrop, onEnter, onLeave, 
onMove, onPreviewDrop methods without having to create each time a 
subclass for the DropController implementation he/she is interested in.

Using GWT 1.3.3. and gwt-dragdrop-2007-03-14.jar.

Original issue reported on code.google.com by cvmoc...@gmail.com on 26 Mar 2007 at 12:49

GoogleCodeExporter commented 9 years ago
Please take a look at DragHandler which implements FiresDragEvents.

You can use:
  DragController#addDragHandler(DragHandler)
  DragController#removeDragHandler(DragHandler)

to receive:
  DragStartEvent
  DragEndEvent

Note that DragEndEvent does not yet include actual coordinates of a drop. 
However,
this is planned. Will leave this issue open until this happens.

Original comment by fredsa on 26 Mar 2007 at 5:32

GoogleCodeExporter commented 9 years ago
As of the 2007-03-31 jars, the drag end events contain additional information 
such
has an index or x/y coordinates.

Try adding this snippet to your project:

    dragController.addDragHandler(new DragHandler() {

      public void onDragEnd(DragEndEvent event) {
        Window.alert(event.toString());
      }

      public void onDragStart(DragStartEvent event) {
      }

      public void onPreviewDragEnd(DragEndEvent event) throws VetoDragException {
      }

      public void onPreviewDragStart(DragStartEvent event) throws VetoDragException {
      }
    });

Original comment by fredsa on 1 Apr 2007 at 2:27

GoogleCodeExporter commented 9 years ago
The event classes (both extend DragEndEvent) currently are:
  AbsolutePositionDragEndEvent - contains x/y coordinate of drop
  IndexedDragEndEvent - contains index of drop

Original comment by fredsa on 21 Apr 2007 at 8:43

GoogleCodeExporter commented 9 years ago

Original comment by fredsa on 23 Aug 2007 at 3:33