开发者

Issue in making composite widget draggable

开发者 https://www.devze.com 2022-12-14 19:03 出处:网络
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

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消