Java Code Examples for com.google.gwt.user.client.ui.Widget#addDomHandler()

The following examples show how to use com.google.gwt.user.client.ui.Widget#addDomHandler() . 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: CubaTooltip.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void connectHandlersToWidget(Widget widget) {
    Profiler.enter("VTooltip.connectHandlersToWidget");
    widget.addDomHandler(tooltipEventHandler, MouseOutEvent.getType());
    widget.addDomHandler(tooltipEventHandler, MouseDownEvent.getType());
    widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());

    if (!BrowserInfo.get().isIOS()) {
        widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
        widget.addDomHandler(tooltipEventHandler, FocusEvent.getType());
        widget.addDomHandler(tooltipEventHandler, BlurEvent.getType());
    }
    Profiler.leave("VTooltip.connectHandlersToWidget");
}
 
Example 2
Source File: SinglePageLayout.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
public PanController(Widget widget) {
	super(widget);
	widget.addDomHandler(this, MouseWheelEvent.getType());
	widget.addDomHandler(this, KeyDownEvent.getType());
	
	app.getHorizontalScrollbar().addScrollPanListener(this);
	app.getVerticalScrollbar().addScrollPanListener(this);
}
 
Example 3
Source File: UIHider.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
public UIHider(int uiHideDelay, Widget textLayer) {
	this.uiHideDelay = uiHideDelay;
	textLayer.addDomHandler(this, MouseMoveEvent.getType());
	textLayer.addDomHandler(this, KeyDownEvent.getType());
	textLayer.addDomHandler(this, ScrollEvent.getType());
	textLayer.addDomHandler(this, TouchStartEvent.getType());
}
 
Example 4
Source File: PanListener.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
public PanListener(Widget widget) {
	this.widget = widget;
	widget.addDomHandler(this, MouseDownEvent.getType());
	widget.addDomHandler(this, MouseUpEvent.getType());
	widget.addDomHandler(this, MouseMoveEvent.getType());
	widget.addDomHandler(this, TouchStartEvent.getType());
	widget.addDomHandler(this, TouchEndEvent.getType());
	widget.addDomHandler(this, TouchMoveEvent.getType());
}
 
Example 5
Source File: CompositeFocusHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private CompositeFocusHelper(Widget containerWidget, HasFocusHandlers... hasFocusContents) {
	this.containerWidget = containerWidget;
	containerWidget.addDomHandler(this.keyDownHandler, KeyDownEvent.getType());
	if (hasFocusContents != null) {
		for (HasFocusHandlers hasFocus : hasFocusContents) {
			this.addHasFocusContent(hasFocus);
		}
	}

	this.handlerManager = new HandlerManager(containerWidget);
}
 
Example 6
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Add a widget on the diagram
 * 
 * @param w the widget to add
 * @param left left margin with the absolute panel
 * @param top top margin with the absolute panel
 * 
 * @return the shape
 */
public FunctionShape addWidget(final Widget w, int left, int top) {

	w.getElement().getStyle().setZIndex(3);
	final FunctionShape shape = new FunctionShape(this, w);

	shapes.add(shape);
	widgetShapeMap.put(w, shape);
	functionsMap.put(w, new HashMap<Widget, Connection>());

	if (w instanceof HasContextMenu) {
		w.addDomHandler(new MouseUpHandler() {
			@Override
			public void onMouseUp(MouseUpEvent event) {
				if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
					showMenu((HasContextMenu) w, event.getClientX(), event.getClientY());
				}
			}
		}, MouseUpEvent.getType());
	}
	widgetPanel.add(w, left, top);

	// Register the drag handler
	if (dragController != null) {
		registerDragHandler(shape);
	}

	// If the is mouse is over the widget, clear the topCanvas
	w.addDomHandler(new MouseOverHandler() {
		@Override
		public void onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent arg0) {
			topCanvas.clear();
			mousePoint.setLeft(-30);
			mousePoint.setTop(-30);
		}
	}, com.google.gwt.event.dom.client.MouseOverEvent.getType());
	shape.draw();

	// Send event
	handlerManager.fireEvent(new NewFunctionEvent(w));
	return shape;
}
 
Example 7
Source File: MaterialCollapsibleBody.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
protected void provideActiveClickHandler(final Widget child) {
    // Active click handler
    child.addDomHandler(event -> makeActive(child), ClickEvent.getType());
}
 
Example 8
Source File: UIHider.java    From djvu-html5 with GNU General Public License v2.0 4 votes vote down vote up
public void addUIElement(Widget widget, String hiddenStyleName) {
	uiElements.add(new UIElement(widget, hiddenStyleName));
	widget.addDomHandler(this, MouseOverEvent.getType());
	widget.addDomHandler(this, MouseOutEvent.getType());
}
 
Example 9
Source File: CollapseHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CollapseHelper(Widget toggleWidget, Element collapsableElement) {
	this.collapsableElement = collapsableElement;
	StyleUtils.addStyle(collapsableElement, CollapseHelper.STYLE_COLLAPSE);
	toggleWidget.addDomHandler(this, ClickEvent.getType());
	this.setInitialCollapse(this.collapsed);
}