@Override public HandlerRegistration addBeforeSelectionHandler( BeforeSelectionHandler<Integer> handler) { return addHandler(handler, BeforeSelectionEvent.getType()); }
/** * @deprecated Use {@link BeforeSelectionHandler#onBeforeSelection} instead */ @Override @Deprecated public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) { BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, tabIndex); return event == null || !event.isCanceled(); }
/** * Fires a before selection event on all registered handlers in the handler * manager. If no such handlers exist, this method will do nothing. * * @param <T> the item type * @param source the source of the handlers * @param item the item * @return the event so that the caller can check if it was canceled, or null * if no handlers of this event type have been registered */ public static <T> BeforeSelectionEvent<T> fire( HasBeforeSelectionHandlers<T> source, T item) { // If no handlers exist, then type can be null. if (TYPE != null) { BeforeSelectionEvent<T> event = new BeforeSelectionEvent<T>(); event.setItem(item); source.fireEvent(event); return event; } return null; }
@Override public void onShow(TabShowEvent e) { if (e.getTab() != null) { final TabPanelEntry selected = tabPanel.findEntryForTabWidget(e.getTab()); BeforeSelectionEvent .fire(UberTabPanel.this, tabInvertedIndex.get(selected).getPresenter().getDefinition()); } } });
public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) { clearError(); final int item = event.getItem(); switch (item) { case 1: refreshStats(); return; case 2: refreshLogs(); return; case 3: refreshVersion(); return; } } });
@Override public void onShow( final ShownEvent e ) { onResize(); if ( e.getRelatedTarget() != null ) { BeforeSelectionEvent.fire( UberTabPanel.this, tabInvertedIndex.get( e.getRelatedTarget() ).getPresenter().getDefinition() ); } } } );
public void onBeforeSelection(final BeforeSelectionEvent<Integer> event) { final int item = event.getItem(); final int nitems = metrics.getWidgetCount(); if (item == nitems - 1) { // Last item: the "+" was clicked. event.cancel(); final MetricForm metric = addMetricForm("metric " + nitems, item); metrics.selectTab(item); metric.setFocus(true); } } });
/** * Fires a before selection event on all registered handlers in the handler * manager. If no such handlers exist, this method will do nothing. * * @param <T> the item type * @param source the source of the handlers * @param item the item * @return the event so that the caller can check if it was canceled, or null * if no handlers of this event type have been registered */ public static <T> BeforeSelectionEvent<T> fire( HasBeforeSelectionHandlers<T> source, T item) { // If no handlers exist, then type can be null. if (TYPE != null) { BeforeSelectionEvent<T> event = new BeforeSelectionEvent<T>(); event.setItem(item); source.fireEvent(event); return event; } return null; }
private void showWidget(int index, final int duration, boolean fireEvents) { checkIndex(index); if (index == selectedIndex) { return; } // Fire the before selection event, giving the recipients a chance to // cancel the selection. if (fireEvents) { BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index); if ((event != null) && event.isCanceled()) { return; } } selectedIndex = index; if (isAttached()) { animate(duration); } // Fire the selection event. if (fireEvents) { SelectionEvent.fire(this, index); } } }
public HandlerRegistration addBeforeSelectionHandler( BeforeSelectionHandler<Integer> handler) { return addHandler(handler, BeforeSelectionEvent.getType()); }
@Override public void onShow(TabShowEvent e) { if (e.getTab() != null) { final TabPanelEntry selected = tabPanel.findEntryForTabWidget(e.getTab()); BeforeSelectionEvent .fire(UberTabPanel.this, tabInvertedIndex.get(selected).getPresenter().getDefinition()); } } });
/** * Fires a before selection event on all registered handlers in the handler * manager. If no such handlers exist, this method will do nothing. * * @param <T> the item type * @param source the source of the handlers * @param item the item * @return the event so that the caller can check if it was canceled, or null * if no handlers of this event type have been registered */ public static <T> BeforeSelectionEvent<T> fire( HasBeforeSelectionHandlers<T> source, T item) { // If no handlers exist, then type can be null. if (TYPE != null) { BeforeSelectionEvent<T> event = new BeforeSelectionEvent<T>(); event.setItem(item); source.fireEvent(event); return event; } return null; }
BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index); if ((event != null) && event.isCanceled()) { return;
public HandlerRegistration addBeforeSelectionHandler( BeforeSelectionHandler<Integer> handler) { return addHandler(handler, BeforeSelectionEvent.getType()); }
/** * Programmatically selects the specified tab. Use index -1 to specify that no * tab should be selected. * * @param index the index of the tab to be selected * @param fireEvents true to fire events, false not to * @return <code>true</code> if successful, <code>false</code> if the change * is denied by the {@link BeforeSelectionHandler}. */ public boolean selectTab(int index, boolean fireEvents) { checkTabIndex(index); if (fireEvents) { BeforeSelectionEvent<?> event = BeforeSelectionEvent.fire(this, index); if (event != null && event.isCanceled()) { return false; } } // Check for -1. setSelectionStyle(selectedTab, false); if (index == -1) { selectedTab = null; return true; } selectedTab = panel.getWidget(index + 1); setSelectionStyle(selectedTab, true); if (fireEvents) { SelectionEvent.fire(this, index); } return true; }
@Override public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<Integer> handler) { return addHandler(handler, BeforeSelectionEvent.getType()); }