Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

When adding a widget that doesn't have handlers, no error will be shown, it just wont work. #170

Open
GoogleCodeExporter opened this issue Mar 13, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Does the issue occur in "quirks mode", "standards mode" or both? If you
don't know, does your HTML page contains a DOCTYPE declaration?

What version of GWT are you using? 1.4.60? 2.0.4? Other?
2.5.1
What version of the gwt-dnd jar file or library file are you using?
3.1.2
What operating system(s) are you using? Windows? Linux? Mac?
windows
Does the issue occur in web mode, development mode (formerly "hosted
mode"), both or don't know?
both
What browser(s) do you use? Chrome, Firefox, IE, Safari, other?
chrome
What is the browser version (if you know) from Help->About?

What steps will reproduce the problem? Please attach sample code if you
can.
RegisterDraggable should be throwing expception when none of the handlers are 
implemented, instead it just does nothing:
RegisteredDraggable(Widget dragable, Widget dragHandle) {
      this.dragable = dragable;
      if (dragHandle instanceof HasTouchStartHandlers) {
        touchStartHandlerRegistration = ((HasTouchStartHandlers) dragHandle).addTouchStartHandler(MouseDragHandler.this);
      }
      if (dragHandle instanceof HasMouseDownHandlers) {
        mouseDownHandlerRegistration = ((HasMouseDownHandlers) dragHandle).addMouseDownHandler(MouseDragHandler.this);
      }
//SHOULD THROW EXCEPTION HERE, that would be cought level above.
    }


Do you have a workaround?
Yeah, throw an expection in place where I have commented.

Please provide any additional information below.

This part of code above is called from MouseDragHandler, line 205:
void makeDraggable(Widget draggable, Widget dragHandle) {
    if (draggable instanceof PopupPanel) {
      DOMUtil.reportFatalAndThrowRuntimeException("PopupPanel (and its subclasses) cannot be made draggable; See http://code.google.com/p/gwt-dnd/issues/detail?id=43");
    }
    try {
      RegisteredDraggable registeredDraggable = new RegisteredDraggable(draggable, dragHandle);
      dragHandleMap.put(dragHandle, registeredDraggable);
    } catch (Exception ex) {
      throw new RuntimeException("dragHandle must implement HasMouseDownHandlers to be draggable",
          ex);
    }
  }

But cus of not throwing exception, this catch wont be fired

Original issue reported on code.google.com by [email protected] on 2 May 2013 at 7:50

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant