List of usage examples for com.google.gwt.event.logical.shared SelectionEvent fire
public static <T> void fire(HasSelectionHandlers<T> source, T selectedItem)
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 *//*from ww w . j ava 2 s . co m*/ 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. * /*from w ww . j a va 2 s . 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:bufferings.ktr.wjr.client.ui.widget.WjrTreeItem.java
License:Apache License
/** * Sets whether if this tree item is selected or not. * //from w w w . j av a 2 s . c o m * @param selected * True if selected, false if not. * @param fireEvent * True if you want to fire {@link SelectionEvent}, false if not. */ public void setSelected(boolean selected, boolean fireEvent) { if (this.selected != selected) { this.selected = selected; if (fireEvent) { SelectionEvent.fire(this, this); } } }
From source file:cc.alcina.framework.gwt.client.widget.CustomisableTabPanel.java
License:Apache License
/** * @deprecated Use {@link SelectionHandler#onSelection} instead *//*from w ww . ja va2 s . c o m*/ @Deprecated public void onTabSelected(SourcesTabEvents sender, int tabIndex) { deck.showWidget(tabIndex); SelectionEvent.fire(this, tabIndex); }
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.// w ww. j a v a 2 s . com * * @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:cc.alcina.framework.gwt.client.widget.SelectWithSearch.java
License:Apache License
protected void itemSelected(T item) { SelectionEvent.fire(this, item); }
From source file:cc.alcina.framework.gwt.client.widget.ToggleLink.java
License:Apache License
public void onClick(ClickEvent event) { setSelectedIndex(Math.abs((event.getSource() == link1 ? 0 : 1) - 1)); SelectionEvent.fire(this, selectedIndex); }
From source file:client.dashboard.Dashboard.java
License:Open Source License
/** * Connect views and history to the main {@code IntervalManager}. *///from w w w .ja v a 2 s .c om private void initSeriesComponents() { seriesManager.connect(intervalManager); seriesManager.connect(indicatorManager); seriesManager.connect(countryManager); final TabCoordinator<SeriesManager> seriesTabCoordinator = new TabCoordinator<SeriesManager>(seriesManager, seriesPanel); seriesTabCoordinator.addTab("table", "Table", new TableSeriesView()); seriesTabCoordinator.addTab("chart", "Chart", new ChartSeriesView()); seriesTabCoordinator.addTab("map:world", "Map: World", new MapSeriesView(VectorMap.Visual.WORLD)); seriesTabCoordinator.addTab("map:europe", "Map: Europe", new MapSeriesView(VectorMap.Visual.EUROPE)); /* * Serializers */ addSeriesSerializer("CSV", new CSVSeriesSerializer()); addSeriesSerializer("XML", new XMLSeriesSerializer()); addSeriesSerializer("JSON", new JSONSeriesSerializer()); /* * Tabs */ new SeriesPanelHistory().connect(seriesTabCoordinator); autoEnableScroll(seriesTabCoordinator, seriesPanel.getSelectedIndex()); seriesPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { autoEnableScroll(seriesTabCoordinator, event.getSelectedItem()); } }); SelectionEvent.fire(seriesPanel, seriesPanel.getSelectedIndex()); }
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. * /*from w w w. j a va 2s . c o m*/ * @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
/** * /*from ww w.ja va 2 s . c o m*/ * Go to back Step * * @param fireEvent * Indicator to fire the selection event or not * * @return <code>true</code> if successful, <code>false</code> if the change is denied by the * {@link BeforeSelectionHandler}. */ public boolean backStep(boolean fireEvents) { int currentlySelectedIndex = getSelectedStep(); int index = currentlySelectedIndex - 1; checkStepIndex(index); if (fireEvents & !checkForBeforeSelectionEvent(index)) { return false; } if (currentlySelectedIndex > -1) { ClickDelegatePanel p = (ClickDelegatePanel) panel.getWidget(currentlySelectedIndex); p.removeStyleName(resource.css().active()); p.addStyleName(resource.css().inactive()); } if (currentlySelectedIndex > 1) { ClickDelegatePanel p = (ClickDelegatePanel) panel.getWidget(currentlySelectedIndex - 2); p.removeStyleName(resource.css().done()); p.addStyleName(resource.css().lastDone()); } selected = panel.getWidget(index); selected.removeStyleName(resource.css().inactive()); selected.removeStyleName(resource.css().lastDone()); selected.addStyleName(resource.css().active()); if (index != (panel.getWidgetCount() - 1)) { panel.getWidget(panel.getWidgetCount() - 1).removeStyleName(resource.css().lastActiveElement()); } if (fireEvents) { SelectionEvent.fire(this, index); } return true; }