List of usage examples for com.google.gwt.event.logical.shared BeforeSelectionEvent isCanceled
public boolean isCanceled()
From source file:at.ac.fhcampuswien.atom.client.gui.frames.TabLayoutPanelCopy.java
License:Apache License
/** * Programmatically selects the specified tab. * * @param index the index of the tab to be selected * @param fireEvents true to fire events, false not to *///w w w . j a v a 2 s .com public void selectTab(int index, 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; } } // Update the tabs being selected and unselected. if (selectedIndex != -1) { tabs.get(selectedIndex).setSelected(false); } deckPanel.showWidget(index); tabs.get(index).setSelected(true); selectedIndex = index; // Fire the selection event. if (fireEvents) { SelectionEvent.fire(this, index); } }
From source file:bufferings.ktr.wjr.client.ui.widget.WjrTabPanel.java
License:Apache License
/** * Selects the tab and show its contents. * // ww w. j a va 2s . c o m * @param index * The index of the tab to show. */ public void selectTab(int index) { checkIndex(index); if (index == selectedIndex) { return; } BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index); if ((event != null) && event.isCanceled()) { return; } if (selectedIndex != -1) { Widget child = children.get(selectedIndex); Element container = panel.getWidgetContainerElement(child); container.getStyle().setDisplay(Display.NONE); child.setVisible(false); tabs.get(selectedIndex).setSelected(false); } Widget child = children.get(index); Element container = panel.getWidgetContainerElement(child); container.getStyle().clearDisplay(); child.setVisible(true); tabs.get(index).setSelected(true); selectedIndex = index; SelectionEvent.fire(this, index); }
From source file:cc.alcina.framework.gwt.client.widget.CustomisableTabPanel.java
License:Apache License
/** * @deprecated Use {@link BeforeSelectionHandler#onBeforeSelection} instead *///ww w .j a va 2s . c o m @Deprecated public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) { BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, tabIndex); return event == null || !event.isCanceled(); }
From source file:cc.alcina.framework.gwt.client.widget.FlowTabBar.java
License:Apache License
/** * Programmatically selects the specified tab. Use index -1 to specify that * no tab should be selected.// ww w . java2s.c o m * * @param index * the index of the tab to be selected. * @return <code>true</code> if successful, <code>false</code> if the change * is denied by the {@link TabListener}. */ public boolean selectTab(int index) { 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 = tabs.get(index); setSelectionStyle(selectedTab, true); SelectionEvent.fire(this, index); return true; }
From source file:com.agnie.gwt.common.client.widget.TabBar.java
License:Open Source License
/** * Programmatically selects the specified tab. Use index -1 to specify that no tab should be selected. * // w ww. ja v a2 s .c om * @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); setSelectionStyle(selectedTab, true); if (fireEvents) { SelectionEvent.fire(this, index); } return true; }
From source file:com.agnie.gwt.common.client.widget.WizardBar.java
License:Open Source License
private boolean checkForBeforeSelectionEvent(int index) { BeforeSelectionEvent<?> event = BeforeSelectionEvent.fire(this, index); if (event != null && event.isCanceled()) { return false; }//from ww w . ja v a2 s .c o m return true; }
From source file:com.edgenius.wiki.gwt.client.widgets.URLTabBar.java
License:Open Source License
public int addTab(String title, Image icon) { FlowPanel tab = new FlowPanel(); if (icon != null) tab.add(icon);/*from w w w . j a v a 2s. com*/ ClickLink link = new ClickLink(title); Label label = new Label(title); tab.add(link); tab.add(label); link.setStyleName(Css.TEXT); label.setStyleName(Css.TEXT); //init status: only show link label.setVisible(false); //tab.setStyleName(Css.DESELECTED); tabBar.add(tab); //increase uniqueID every new tab final int tabIndex = uniqueID++; link.setObject(tabIndex); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { BeforeSelectionEvent<Integer> evt = BeforeSelectionEvent.fire(URLTabBar.this, tabIndex); if (evt != null && !evt.isCanceled()) { select(tabIndex); SelectionEvent.fire(URLTabBar.this, tabIndex); } } }); return tabIndex; }
From source file:com.edgenius.wiki.gwt.client.widgets.URLTabPanel.java
License:Open Source License
/** * !!! This method must call after the widget is put into HMTL body. Please refer to * URLPanel.setURL()/*w w w .ja v a 2s . co m*/ * * @param uniqueID * @param fireEvent: TODO: */ public void setSelected(int uniqueID, boolean fireEvent) { boolean go = true; if (fireEvent) { BeforeSelectionEvent<Integer> evt = BeforeSelectionEvent.fire(this, uniqueID); go = evt != null ? !evt.isCanceled() : false; } if (go) { tabBar.select(uniqueID); select(uniqueID); if (fireEvent) SelectionEvent.fire(this, uniqueID); } }
From source file:com.sencha.gxt.widget.core.client.menu.Item.java
License:sencha.com license
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void onClick(NativeEvent be) {
be.<XEvent>cast().stopEvent();
BeforeSelectionEvent<Item> itemEvent = BeforeSelectionEvent.fire(this, this);
BeforeSelectionEvent<Item> menuEvent = null;
if (getParent() instanceof HasBeforeSelectionHandlers<?>) {
menuEvent = BeforeSelectionEvent.fire((HasBeforeSelectionHandlers) getParent(), this);
}// ww w . j a v a 2 s . co m
if (!disabled && (itemEvent == null || !itemEvent.isCanceled())
&& (menuEvent == null || !menuEvent.isCanceled())) {
if (getParent() instanceof HasSelectionHandlers<?>) {
SelectionEvent.fire((HasSelectionHandlers) getParent(), this);
}
SelectionEvent.fire(this, this);
handleClick(be);
}
}
From source file:com.sencha.gxt.widget.core.client.selection.AbstractStoreSelectionModel.java
License:sencha.com license
protected void doMultiSelect(List<M> models, boolean keepExisting, boolean suppressEvent) { if (locked)/*from w w w. j av a 2 s. c o m*/ return; boolean change = false; if (!keepExisting && selected.size() > 0) { change = true; doDeselect(new ArrayList<M>(selected), true); } for (M m : models) { boolean isSelected = isSelected(m); if (!suppressEvent && !isSelected) { BeforeSelectionEvent<M> evt = BeforeSelectionEvent.fire(this, m); if (evt != null && evt.isCanceled()) { continue; } } change = true; lastSelected = m; selected.add(m); setLastFocused(lastSelected); if (!isSelected) { onSelectChange(m, true); if (!suppressEvent) { SelectionEvent.fire(this, m); } } } if (change && !suppressEvent) { fireSelectionChange(); } }