Search in sources :

Example 1 with UmbrellaException

use of com.google.gwt.event.shared.UmbrellaException in project gwt-test-utils by gwt-test-utils.

the class Browser method dispatchEventInternal.

private static void dispatchEventInternal(IsWidget target, Event event) {
    try {
        // value
        if (CheckBox.class.isInstance(target) && event.getTypeInt() == Event.ONCLICK) {
            clickOnCheckBox((CheckBox) target);
        }
        // set the related target
        Element relatedTargetElement = JavaScriptObjects.getObject(event, JsoProperties.EVENT_RELATEDTARGET);
        if (relatedTargetElement == null) {
            switch(event.getTypeInt()) {
                case Event.ONMOUSEOVER:
                case Event.ONMOUSEOUT:
                    Widget parent = target.asWidget().getParent();
                    if (parent != null) {
                        relatedTargetElement = parent.getElement();
                    } else {
                        relatedTargetElement = Document.get().getDocumentElement();
                    }
                    JavaScriptObjects.setProperty(event, JsoProperties.EVENT_RELATEDTARGET, relatedTargetElement);
                    break;
            }
        }
        // fire with bubble support
        Set<Widget> applied = new HashSet<Widget>();
        dispatchEventWithBubble(target, event, applied);
    } catch (UmbrellaException e) {
        if (AssertionError.class.isInstance(e.getCause())) {
            throw (AssertionError) e.getCause();
        } else if (RuntimeException.class.isInstance(e.getCause())) {
            throw (RuntimeException) e.getCause();
        } else {
            throw e;
        }
    }
}
Also used : UmbrellaException(com.google.gwt.event.shared.UmbrellaException) Element(com.google.gwt.dom.client.Element) HashSet(java.util.HashSet)

Aggregations

Element (com.google.gwt.dom.client.Element)1 UmbrellaException (com.google.gwt.event.shared.UmbrellaException)1 HashSet (java.util.HashSet)1