protected void addSelectionHandler(HasSelectionHandlers<PartDefinition> widget) { widget.addSelectionHandler(new SelectionHandler<PartDefinition>() { @Override public void onSelection(final SelectionEvent<PartDefinition> event) { panelManager.onPartLostFocus(); panelManager.onPartFocus(event.getSelectedItem()); } }); }
/** * Fires a selection event on all registered handlers in the handler * manager.If no such handlers exist, this method will do nothing. * * @param <T> the selected item type * @param source the source of the handlers * @param selectedItem the selected item */ public static <T> void fire(HasSelectionHandlers<T> source, T selectedItem) { if (TYPE != null) { SelectionEvent<T> event = new SelectionEvent<T>(selectedItem); source.fireEvent(event); } }
/*************************************** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") protected HandlerRegistration initEventDispatching( Widget rWidget, EventType eEventType) { if (eEventType == EventType.SELECTION && rWidget instanceof HasSelectionHandlers) { return ((HasSelectionHandlers<Integer>) rWidget) .addSelectionHandler(this); } return super.initEventDispatching(rWidget, eEventType); } }
/** * Fires a selection event on all registered handlers in the handler * manager.If no such handlers exist, this method will do nothing. * * @param <T> the selected item type * @param source the source of the handlers * @param selectedItem the selected item */ public static <T> void fire(HasSelectionHandlers<T> source, T selectedItem) { if (TYPE != null) { SelectionEvent<T> event = new SelectionEvent<T>(selectedItem); source.fireEvent(event); } }
public static <T> Observable<SelectionEvent<T>> selection(HasSelectionHandlers<T> source) { return Observable.create(s -> register(s, source.addSelectionHandler(s::onNext)), uiBackpressureMode()); }
/** * Fires a selection event on all registered handlers in the handler * manager.If no such handlers exist, this method will do nothing. * * @param <T> the selected item type * @param source the source of the handlers * @param selectedItem the selected item */ public static <T> void fire(HasSelectionHandlers<T> source, T selectedItem) { if (TYPE != null) { SelectionEvent<T> event = new SelectionEvent<T>(selectedItem); source.fireEvent(event); } }
public static <T> Observable<SelectionEvent<T>> selection(HasSelectionHandlers<T> source) { return Observable.create(s -> register(s, source.addSelectionHandler(s::onNext))); }
protected <H extends MaterialWidget & HasSelectionHandlers> void checkSelectionHandler(H widget, Object selectedItem) { // Check Open Event final boolean[] fired = {false}; widget.addSelectionHandler(event -> { assertEquals(event.getSelectedItem(), selectedItem); fired[0] = true; }); fireSelectionHandler(widget, selectedItem); assertTrue(fired[0]); }
protected <H extends MaterialWidget & HasSelectionHandlers> void checkSelectionHandler(H widget, Object selectedItem) { // Check Open Event final boolean[] fired = {false}; widget.addSelectionHandler(event -> { assertEquals(event.getSelectedItem(), selectedItem); fired[0] = true; }); fireSelectionHandler(widget, selectedItem); assertTrue(fired[0]); }