Example usage for com.google.gwt.event.logical.shared AttachEvent getType

List of usage examples for com.google.gwt.event.logical.shared AttachEvent getType

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared AttachEvent getType.

Prototype

public static Type<AttachEvent.Handler> getType() 

Source Link

Document

Ensures the existence of the handler hook and then returns it.

Usage

From source file:com.googlecode.gwtmock.client.MockHasAttachHandlers.java

License:Apache License

@Override
public HandlerRegistration addAttachHandler(Handler handler) {
    return eventBus.addHandler(AttachEvent.getType(), handler);
}

From source file:com.mind.gwt.jclient.context.EventRepository.java

License:Apache License

/**
 * A few {@link GwtEvent} subclasses coming along with GWT-SDK initialize their {@link GwtEvent.Type TYPE} fields
 * lazily and in non thread-safe way. This method forces initialization immediately. To avoid a race condition,
 * memory writes that are made by this method, have to become visible to all threads before the first instance of
 * {@link Context} is created./*from w w w .  ja v  a 2  s. c o m*/
*/
static void instantiateLazyEventTypes() {
    AttachEvent.getType();
    BeforeSelectionEvent.getType();
    CloseEvent.getType();
    HighlightEvent.getType();
    InitializeEvent.getType();
    OpenEvent.getType();
    ResizeEvent.getType();
    SelectionEvent.getType();
    ShowRangeEvent.getType();
    ValueChangeEvent.getType();
    NativePreviewEvent.getType();
    ColumnSortEvent.getType();

    // LoadingStateChangeEvent is thread-safe
    // PlaceChangeEvent is thread-safe
    // PlaceChangeRequestEvent is thread-safe
    // ClosingEvent is thread-safe
    // ScrollEvent is thread-safe

    // SubmitEvent isn't publicly available but thread-safe by accident
    // SubmitCompleteEvent isn't publicly available and isn't thread-safe... 
}

From source file:com.sencha.gxt.widget.core.client.tips.ToolTip.java

License:sencha.com license

/**
 * Binds the tool tip to the target widget. Allows a tool tip to switch the target widget.
 *
 * @param widget the target widget//from  w w  w.  j  a  va  2 s.  c o  m
 */
public void initTarget(final Widget widget) {
    if (handlerRegistration != null) {
        handlerRegistration.removeHandler();
    }

    if (widget != null) {
        this.target = widget.getElement();

        Handler handler = new Handler();
        handlerRegistration = new GroupingHandlerRegistration();
        handlerRegistration.add(widget.addDomHandler(handler, MouseOverEvent.getType()));
        handlerRegistration.add(widget.addDomHandler(handler, MouseOutEvent.getType()));
        handlerRegistration.add(widget.addDomHandler(handler, MouseMoveEvent.getType()));
        handlerRegistration.add(widget.addDomHandler(handler, TouchMoveEvent.getType()));
        handlerRegistration.add(widget.addHandler(handler, HideEvent.getType()));
        handlerRegistration.add(widget.addHandler(handler, AttachEvent.getType()));

        // handles displaying tooltip on long press
        longPressOrTapGestureRecognizer = new LongPressOrTapGestureRecognizer() {
            @Override
            protected void onLongPress(TouchData touchData) {
                super.onLongPress(touchData);

                onTargetOver(touchData.getLastNativeEvent().<Event>cast());
            }

            @Override
            public boolean handleEnd(NativeEvent endEvent) {
                // cancel preventing default in this recognizer.
                cancel();

                return super.handleEnd(endEvent);
            }
        };

        // listen for touch events on the widget
        new TouchEventToGestureAdapter(widget, longPressOrTapGestureRecognizer);
    }
}