Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue in making composite widget draggable

am relatively very new to gwt n dnd.. i have created a composite widget.. when i try to make the object of the composite widget draggable it throws an exception "dragHandle must implement HasMouseDownHandlers, HasMouseUpHandlers, HasMouseMoveHandlers and HasMouseOutHandlers to be draggable" am i missing something very importand?

Thanks, sindhu

like image 721
sindhu Avatar asked Dec 28 '09 06:12

sindhu


People also ask

When identifying a widget as a DragTarget which function will determine whether a draggable will be allowed accepted to the DragTarget?

This takes three parameters: BuildContext: Context of a Widget. candidateData: It contains the list of draggable data which will be accepted by DragTarget. rejectedData: It contains the list of Draggable data which will not be accepted by DragTarget.

How do you make a movable widget in flutter?

Draggable is a Flutter widget that you can drag or move around. As soon as the user click and starts dragging the Draggable widget, a new feedback widget appears and follows the user's finger or mouse pointer. When the user lifts the finger or mouse pointer, the feedback widget disappears.


1 Answers

You can implement them like this:

public class MyWidget extends Composite implements HasAllMouseHandlers, HasClickHandlers {

...

      public HandlerRegistration addClickHandler(ClickHandler handler) {
        return addDomHandler(handler, ClickEvent.getType());
      }

      public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
          return addDomHandler(handler, MouseDownEvent.getType());
      }

      public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
        return addDomHandler(handler, MouseMoveEvent.getType());
      }

      public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
        return addDomHandler(handler, MouseOutEvent.getType());
      }

      public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
        return addDomHandler(handler, MouseOverEvent.getType());
      }

      public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
        return addDomHandler(handler, MouseUpEvent.getType());
      }

      public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
        return addDomHandler(handler, MouseWheelEvent.getType());
      }

}

To get your widget d'n'd working, see this http://groups.google.com/group/gwt-dnd/browse_thread/thread/85039aaa229d53cf/f5ad10ff9a37ab9d?lnk=gst&q=custom+widget#f5ad10ff9a37ab9d

like image 169
Marius Avatar answered Nov 17 '22 03:11

Marius