Java Code Examples for com.google.gwt.user.client.Event#getEventTarget()

The following examples show how to use com.google.gwt.user.client.Event#getEventTarget() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubaNotification.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onEventPreview(Event event) {
    int type = DOM.eventGetType(event);

    if ((type == Event.ONCLICK || type == Event.ONTOUCHEND)
            && event.getEventTarget() != null) {
        Element target = Element.as(event.getEventTarget());
        if (containsSubstring(target.getClassName(), CUBA_NOTIFICATION_MODALITY_CURTAIN)) {
            hide();
            return false;
        }
    }

    if (type == Event.ONKEYDOWN && event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
        if (!getElement().getClassName().contains(TRAY_STYLE)) {
            hide();
            return false;
        }
    }

    return super.onEventPreview(event);
}
 
Example 2
Source File: CubaScrollTableWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isShowBrowserContextMenu(Event event) {
    if (event != null) {
        EventTarget target = event.getEventTarget();
        if (Element.is(target)) {
            Element element = Element.as(target);
            Widget widget = WidgetUtil.findWidget(element);
            if (widget instanceof TextBoxBase) {
                return true;
            }
        }
    }

    return super.isShowBrowserContextMenu(event);
}
 
Example 3
Source File: SimpleDropdown.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean eventTargetsDropDown(NativePreviewEvent event) {
	Event nativeEvent = Event.as(event.getNativeEvent());
	EventTarget target = nativeEvent.getEventTarget();
	if (Element.is(target)) {
		return this.getElement().isOrHasChild(Element.as(target));
	}
	return false;
}
 
Example 4
Source File: CompositeFocusHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean eventTargetsContainerOrPartner(NativePreviewEvent event) {
	Event nativeEvent = Event.as(event.getNativeEvent());
	EventTarget target = nativeEvent.getEventTarget();
	if (Element.is(target)) {
		return this.isOrHasChildOfContainerOrPartner(Element.as(target));
	}
	return false;
}
 
Example 5
Source File: InputBoolean.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean eventTargetsLabelOrChild(DomEvent<?> event) {
	Event nativeEvent = Event.as(event.getNativeEvent());
	EventTarget target = nativeEvent.getEventTarget();
	if (Element.is(target)) {
		return this.labelElement.isOrHasChild(Element.as(target));
	}
	return false;
}