/** * 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); } }
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(); } } }); } } }
@Override protected HandlerRegistration hookUpRunnable(final Runnable runnable) { return attachable.addAttachHandler(e -> { if (e.isAttached() == onAttach) { runnable.run(); } }); }
private void switchToAdvancedIfNeeded(final UnitVmModel model) { if (model.getAdvancedMode().getEntity() || model.getValid().getEntity()) { return; } List<HasValidation> invalidWidgets = getView().getInvalidWidgets(); if (invalidWidgets.size() == 0) { return; } for (HasValidation invalidWidget : invalidWidgets) { boolean isVisible = invalidWidget instanceof HasVisibility && ((HasVisibility) invalidWidget).isVisible(); boolean isAttached = invalidWidget instanceof HasAttachHandlers && ((HasAttachHandlers) invalidWidget).isAttached(); if (!isVisible || !isAttached) { model.getAdvancedMode().setEntity(true); break; } } }
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(); } } }); } } }
public static Observable<AttachEvent> attach(HasAttachHandlers source) { return Observable.create(s -> register(s, source.addAttachHandler(s::onNext)), uiBackpressureMode()); }
assertTrue(widget.isEnabled()); assertTrue(widget.isAttached());
public static <S extends HasAttachHandlers> void fire(S source) { TemplateInitializedEvent event = new TemplateInitializedEvent(); source.fireEvent(event); } }
@Override protected HandlerRegistration hookUpEventRunnable(final DomEventRunnable runnable) { return attachable.addAttachHandler(e -> { if (e.isAttached() == onAttach) { runnable.run(null); // AttachEvent is a GwtEvent, not DomEvent } }); }
assertTrue(widget.isEnabled()); assertTrue(widget.isAttached());
public static <S extends HasAttachHandlers> void fire(S source) { TemplateInitializedEvent event = new TemplateInitializedEvent(); source.fireEvent(event); } }
public static Observable<AttachEvent> attach(HasAttachHandlers source) { return Observable.create(s -> register(s, source.addAttachHandler(s::onNext))); }
public static <S extends HasAttachHandlers> Boolean fire(S source, FilterableState filterableState, String filterText, Element filteringElt, Integer filteringEltIdx) { if (TYPE != null) { JQMFilterableEvent event = new JQMFilterableEvent(filterableState, filterText, filteringElt, filteringEltIdx); source.fireEvent(event); return event.filteringResult; } return null; }
private void initListeners(HasAllDragAndDropHandlers dropZoneWidget) { removePreviousHandlers(dropZoneWidget); // final Handlers handlers = new Handlers(); rememberHandlerRegistration(dropZoneWidget, dropZoneWidget.addDropHandler(handlers)); rememberHandlerRegistration(dropZoneWidget, dropZoneWidget.addDragOverHandler(handlers)); rememberHandlerRegistration(dropZoneWidget, dropZoneWidget.addDragHandler(handlers)); rememberHandlerRegistration(dropZoneWidget, dropZoneWidget.addDragEndHandler(handlers)); rememberHandlerRegistration(dropZoneWidget, dropZoneWidget.addDragEnterHandler(handlers)); rememberHandlerRegistration(dropZoneWidget, dropZoneWidget.addDragLeaveHandler(handlers)); rememberHandlerRegistration(dropZoneWidget, dropZoneWidget.addDragStartHandler(handlers)); // to clean up on drop zone detach: if (dropZoneWidget instanceof HasAttachHandlers) { ((HasAttachHandlers) dropZoneWidget).addAttachHandler(handlers); } }
/** * Fires an {@link JQMCalBoxEvent} on all registered handlers in the handler source. * * @param <S> The handler source type * @param source - the source of the handlers */ public static <S extends HasAttachHandlers> void fire(S source, DisplayChangeData data) { if (TYPE != null) { JQMCalBoxEvent event = new JQMCalBoxEvent(data); source.fireEvent(event); } }
public static <S extends HasAttachHandlers> Boolean fire(S source, FilterableState filterableState, String filterText, Element filteringElt, Integer filteringEltIdx) { if (TYPE != null) { JQMFilterableEvent event = new JQMFilterableEvent(filterableState, filterText, filteringElt, filteringEltIdx); source.fireEvent(event); return event.filteringResult; } return null; }
/** * Fires an {@link JQMDataTableEnhancedEvent} on all registered handlers in the handler source. * * @param <S> The handler source type * @param source - the source of the handlers */ public static <S extends HasAttachHandlers> void fire(S source, boolean before) { if (TYPE != null) { JQMDataTableEnhancedEvent event = new JQMDataTableEnhancedEvent(before); source.fireEvent(event); } }
/** * Fires an {@link JQMDataTableRowSelChangedEvent} on all registered handlers in the handler source. * * @param <S> The handler source type * @param source - the source of the handlers */ public static <S extends HasAttachHandlers> void fire(S source, RowSelChangedData data) { if (TYPE != null) { JQMDataTableRowSelChangedEvent event = new JQMDataTableRowSelChangedEvent(data); source.fireEvent(event); } }
/** * Fires an {@link JQMCollapsibleEvent} on all registered handlers in the handler source. * * @param <S> The handler source type * @param source - the source of the handlers */ public static <S extends HasAttachHandlers> void fire(S source, CollapsibleState collapsibleState) { if (TYPE != null) { JQMCollapsibleEvent event = new JQMCollapsibleEvent(collapsibleState); source.fireEvent(event); } }
public static <S extends HasAttachHandlers> void fire(S source, OffsetData data) { if (TYPE != null) { JQMCalBoxEvent event = new JQMCalBoxEvent(data); source.fireEvent(event); } }