Example usage for com.google.gwt.user.client.ui Widget sinkEvents

List of usage examples for com.google.gwt.user.client.ui Widget sinkEvents

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget sinkEvents.

Prototype

@Override
public void sinkEvents(int eventBitsToAdd) 

Source Link

Document

Overridden to defer the call to super.sinkEvents until the first time this widget is attached to the dom, as a performance enhancement.

Usage

From source file:org.jbpm.form.builder.ng.model.common.handler.EventHelper.java

License:Apache License

public static HandlerRegistration addKeyboardCopyHandler(Widget widget, final ControlKeyHandler handler) {
    widget.sinkEvents(Event.ONKEYPRESS);
    List<ControlKeyHandler> handlers = KCOPY_HANDLERS.get(widget);
    if (handlers == null) {
        handlers = new ArrayList<ControlKeyHandler>();
        KCOPY_HANDLERS.put(widget, handlers);
    }/*from www  . j  a  v  a  2 s  .  com*/
    handlers.add(handler);
    final List<ControlKeyHandler> _handlers = handlers;
    return new HandlerRegistration() {
        @Override
        public void removeHandler() {
            _handlers.remove(handler);
        }
    };
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.StringFilterHeaderBuilder.java

License:Apache License

public final void sinkEvents(Widget widget, Set<String> typeNames) {
    if (typeNames == null) {
        return;//from   ww w  . j av  a2  s .  co m
    }

    int eventsToSink = 0;
    for (String typeName : typeNames) {
        int typeInt = Event.getTypeInt(typeName);
        if (typeInt < 0) {
            widget.sinkBitlessEvent(typeName);
        } else {
            typeInt = sinkEvent(widget, typeName);
            if (typeInt > 0) {
                eventsToSink |= typeInt;
            }
        }
    }
    if (eventsToSink > 0) {
        widget.sinkEvents(eventsToSink);
    }
}