@Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { setupBustClickHandler(); } else { removeBustClickHandler(); } } });
@Override protected void onDetach() { try { onUnload(); doDetachChildren(); AttachEvent.fire(this, false); } finally { // We don't want an exception in user code to keep us from calling the // super implementation (or event listeners won't get cleaned up and // the attached flag will be wrong). widget.onDetach(); } }
public HandlerRegistration addAttachHandler(Handler handler) { return addHandler(handler, AttachEvent.getType()); }
public void onAttachOrDetach(AttachEvent event) { if (!event.isAttached()) { // on detach if (event.getSource() instanceof HasAllDragAndDropHandlers) { // clean up from handlerRegistrationsMap to avoid // potential memory leak: removePreviousHandlers((HasAllDragAndDropHandlers) event.getSource()); } } } }
@Override public String toDebugString() { assertLive(); return super.toDebugString() + " attached = " + attached; }
/** * Fires an {@link AttachEvent} on all registered handlers in the handler * source. * * @param <S> The handler source type * @param source the source of the handlers * @param attached whether to announce an attach or detach */ public static <S extends HasAttachHandlers> void fire(S source, boolean attached) { if (TYPE != null) { AttachEvent event = new AttachEvent(attached); source.fireEvent(event); } }
@Override public String toDebugString() { assertLive(); return super.toDebugString() + " attached = " + attached; }
/** * Fires an {@link AttachEvent} on all registered handlers in the handler * source. * * @param <S> The handler source type * @param source the source of the handlers * @param attached whether to announce an attach or detach */ public static <S extends HasAttachHandlers> void fire(S source, boolean attached) { if (TYPE != null) { AttachEvent event = new AttachEvent(attached); source.fireEvent(event); } }
@Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { assembleAndAttach(); } } });
AttachEvent.fire(this, false); } finally {
public HandlerRegistration addAttachHandler(Handler handler) { return addHandler(handler, AttachEvent.getType()); }
@Override public String toDebugString() { assertLive(); return super.toDebugString() + " attached = " + attached; }
/** * Fires an {@link AttachEvent} on all registered handlers in the handler * source. * * @param <S> The handler source type * @param source the source of the handlers * @param attached whether to announce an attach or detach */ public static <S extends HasAttachHandlers> void fire(S source, boolean attached) { if (TYPE != null) { AttachEvent event = new AttachEvent(attached); source.fireEvent(event); } }
@Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) initHref(toPage, state); } });
AttachEvent.fire(this, true);
public HandlerRegistration addAttachHandler(Handler handler) { return addHandler(handler, AttachEvent.getType()); }
public void onAttachOrDetach(AttachEvent event) { if (event.isAttached() && needsRender) { render(); } } }
@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); }
@Override public HandlerRegistration addAttachHandler(Handler handler) { return handlers.addHandler(AttachEvent.getType(), handler); }
myWidget.addAttachHandler(new Handler() { @Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { $(".choice_span").bind(Event.ONMOUSEUP, ...); } else { $(".choice_span").bind(Event.ONMOUSEUP); } } });