Java Code Examples for com.google.gwt.event.logical.shared.AttachEvent#Handler
The following examples show how to use
com.google.gwt.event.logical.shared.AttachEvent#Handler .
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: MaterialWidget.java From gwt-material with Apache License 2.0 | 6 votes |
/** * Add an {@code AttachHandler} for attachment events. * * @param handler Attach event handler. * @param oneTime Only execute this handler once, then detach handler. * @return The events handler registration. */ public HandlerRegistration addAttachHandler(final AttachEvent.Handler handler, boolean oneTime) { if (!oneTime) { return addAttachHandler(handler); } else { final HandlerRegistration[] registration = {null}; registration[0] = addAttachHandler(event -> { handler.onAttachOrDetach(event); if (registration[0] != null) { registration[0].removeHandler(); } }); return registration[0]; } }
Example 2
Source File: EventHelper.java From gwt-material with Apache License 2.0 | 6 votes |
public static void onAttachOnce(HasAttachHandlers has, AttachEvent.Handler handler) { HandlerRegistration[] reg = new HandlerRegistration[1]; if (has.isAttached()) { handler.onAttachOrDetach(null); } else { reg[0] = has.addAttachHandler(event -> { if (event.isAttached()) { handler.onAttachOrDetach(event); if (reg[0] != null) { reg[0].removeHandler(); } } }); } }
Example 3
Source File: MaterialTooltip.java From gwt-material with Apache License 2.0 | 5 votes |
public void setAttribute(String attr, String value) { if (widget != null) { AttachEvent.Handler handler = event -> { widget.getElement().setAttribute(attr, value); }; if (widget.isAttached()) { handler.onAttachOrDetach(null); } else { EventHelper.onAttachOnce(widget, handler); } } else { GWT.log("Please initialize the Target widget.", new IllegalStateException()); } }
Example 4
Source File: ToggleButton.java From gwt-material-addins with Apache License 2.0 | 5 votes |
@Override public void setActive(boolean active) { AttachEvent.Handler handler = event -> getActiveMixin().setActive(active); if (!isAttached()) { EventHelper.onAttachOnce(this, handler); } else { handler.onAttachOrDetach(null); } }
Example 5
Source File: FinderColumn.java From core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public HandlerRegistration addAttachHandler(AttachEvent.Handler handler) { return layout.addAttachHandler(handler); }