本文整理了Java中com.google.gwt.user.client.ui.Widget.sinkEvents()
方法的一些代码示例,展示了Widget.sinkEvents()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Widget.sinkEvents()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Widget
类名称:Widget
方法名:sinkEvents
[英]Overridden to defer the call to super.sinkEvents until the first time this widget is attached to the dom, as a performance enhancement. Subclasses wishing to customize sinkEvents can preserve this deferred sink behavior by putting their implementation behind a check of isOrWasAttached()
:
@Override
public void sinkEvents(int eventBitsToAdd) {
if (isOrWasAttached()) {
/
* customized sink code goes here
*/
} else {
super.sinkEvents(eventBitsToAdd);
}
}
[中]
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Sink events on the widget.
*
* @param widget the {@link Widget} that will handle the events
* @param typeNames the names of the events to sink
*/
public final void sinkEvents(Widget widget, Set<String> typeNames) {
if (typeNames == null) {
return;
}
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);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
eventsToSink = -1;
if (bitsToAdd > 0) {
sinkEvents(bitsToAdd);
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Adds a native event handler to the widget and sinks the corresponding
* native event. If you do not want to sink the native event, use the generic
* addHandler method instead.
*
* @param <H> the type of handler to add
* @param type the event key
* @param handler the handler
* @return {@link HandlerRegistration} used to remove the handler
*/
public final <H extends EventHandler> HandlerRegistration addDomHandler(
final H handler, DomEvent.Type<H> type) {
assert handler != null : "handler must not be null";
assert type != null : "type must not be null";
int typeInt = Event.getTypeInt(type.getName());
if (typeInt == -1) {
sinkBitlessEvent(type.getName());
} else {
sinkEvents(typeInt);
}
return ensureHandlers().addHandler(type, handler);
}
代码示例来源:origin: com.extjs/gxt
@Override
public void sinkEvents(int eventBitsToAdd) {
if (!rendered) {
this.events |= eventBitsToAdd;
} else {
super.sinkEvents(eventBitsToAdd);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onAttach() {
checkInit();
if (!isOrWasAttached()) {
widget.sinkEvents(eventsToSink);
eventsToSink = -1;
}
widget.onAttach();
// Clobber the widget's call to setEventListener(), causing all events to
// be routed to this composite, which will delegate back to the widget by
// default (note: it's not necessary to clear this in onDetach(), because
// the widget's onDetach will do so).
DOM.setEventListener(getElement(), this);
// Call doAttachChildren() and then onLoad() directly, because we're not
// calling super.onAttach().
doAttachChildren();
onLoad();
AttachEvent.fire(this, true);
}
代码示例来源:origin: org.jbpm/jbpm-gwt-form-api
public static HandlerRegistration addBlurHandler(Widget widget, final BlurHandler handler) {
widget.sinkEvents(Event.ONBLUR);
List<BlurHandler> handlers = BLUR_HANDLERS.get(widget);
if (handlers == null) {
handlers = new ArrayList<BlurHandler>();
BLUR_HANDLERS.put(widget, handlers);
}
handlers.add(handler);
final List<BlurHandler> _handlers = handlers;
return new HandlerRegistration() {
@Override
public void removeHandler() {
_handlers.remove(handler);
}
};
}
代码示例来源:origin: org.jbpm/jbpm-gwt-form-api
public static HandlerRegistration addFocusHandler(Widget widget, final FocusHandler handler) {
widget.sinkEvents(Event.ONFOCUS);
List<FocusHandler> handlers = FOCUS_HANDLERS.get(widget);
if (handlers == null) {
handlers = new ArrayList<FocusHandler>();
FOCUS_HANDLERS.put(widget, handlers);
}
handlers.add(handler);
final List<FocusHandler> _handlers = handlers;
return new HandlerRegistration() {
@Override
public void removeHandler() {
_handlers.remove(handler);
}
};
}
代码示例来源:origin: org.jbpm/jbpm-gwt-form-api
public static HandlerRegistration addKeyboardCutHandler(Widget widget, final ControlKeyHandler handler) {
widget.sinkEvents(Event.ONKEYPRESS);
List<ControlKeyHandler> handlers = KCUT_HANDLERS.get(widget);
if (handlers == null) {
handlers = new ArrayList<ControlKeyHandler>();
KCUT_HANDLERS.put(widget, handlers);
}
handlers.add(handler);
final List<ControlKeyHandler> _handlers = handlers;
return new HandlerRegistration() {
@Override
public void removeHandler() {
_handlers.remove(handler);
}
};
}
代码示例来源:origin: org.jbpm/jbpm-gwt-form-api
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);
}
handlers.add(handler);
final List<ControlKeyHandler> _handlers = handlers;
return new HandlerRegistration() {
@Override
public void removeHandler() {
_handlers.remove(handler);
}
};
}
代码示例来源:origin: org.jbpm/jbpm-gwt-form-api
public static HandlerRegistration addKeyboardPasteHandler(Widget widget, final ControlKeyHandler handler) {
widget.sinkEvents(Event.ONKEYPRESS);
List<ControlKeyHandler> handlers = KPASTE_HANDLERS.get(widget);
if (handlers == null) {
handlers = new ArrayList<ControlKeyHandler>();
KPASTE_HANDLERS.put(widget, handlers);
}
handlers.add(handler);
final List<ControlKeyHandler> _handlers = handlers;
return new HandlerRegistration() {
@Override
public void removeHandler() {
_handlers.remove(handler);
}
};
}
代码示例来源:origin: fr.putnami.pwt/pwt
public void resetSinkEvents() {
if (this.source instanceof Widget) {
Widget widget = (Widget) this.source;
widget.sinkEvents(this.eventsToSink);
widget.addHandler(null, null);
}
}
}
代码示例来源:origin: Putnami/putnami-web-toolkit
public void resetSinkEvents() {
if (this.source instanceof Widget) {
Widget widget = (Widget) this.source;
widget.sinkEvents(this.eventsToSink);
widget.addHandler(null, null);
}
}
}
代码示例来源:origin: Putnami/putnami-web-toolkit
@Override
public void sinkEvents(int eventBitsToAdd) {
super.sinkEvents(eventBitsToAdd);
this.createHandlerManager().sinkEvents(eventBitsToAdd);
}
代码示例来源:origin: fr.putnami.pwt/pwt
@Override
public void unsinkEvents(int eventBitsToRemove) {
super.sinkEvents(eventBitsToRemove);
this.createHandlerManager().unsinkEvents(eventBitsToRemove);
}
代码示例来源:origin: fr.putnami.pwt/pwt
@Override
public void unsinkEvents(int eventBitsToRemove) {
super.sinkEvents(eventBitsToRemove);
this.createHandlerManager().unsinkEvents(eventBitsToRemove);
}
代码示例来源:origin: fr.putnami.pwt/pwt
@Override
public void sinkEvents(int eventBitsToAdd) {
super.sinkEvents(eventBitsToAdd);
this.createHandlerManager().sinkEvents(eventBitsToAdd);
}
代码示例来源:origin: Putnami/putnami-web-toolkit
@Override
public void sinkEvents(int eventBitsToAdd) {
super.sinkEvents(eventBitsToAdd);
this.createHandlerManager().sinkEvents(eventBitsToAdd);
}
代码示例来源:origin: fr.putnami.pwt/pwt
@Override
public void sinkEvents(int eventBitsToAdd) {
super.sinkEvents(eventBitsToAdd);
this.createHandlerManager().sinkEvents(eventBitsToAdd);
}
代码示例来源:origin: Putnami/putnami-web-toolkit
@Override
public void unsinkEvents(int eventBitsToRemove) {
super.sinkEvents(eventBitsToRemove);
this.createHandlerManager().unsinkEvents(eventBitsToRemove);
}
代码示例来源:origin: Putnami/putnami-web-toolkit
@Override
public void unsinkEvents(int eventBitsToRemove) {
super.sinkEvents(eventBitsToRemove);
this.createHandlerManager().unsinkEvents(eventBitsToRemove);
}
内容来源于网络,如有侵权,请联系作者删除!