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:gwt.material.design.incubator.client.toggle.GroupToggleButton.java
License:Apache License
public void fireSelectionEvent(ToggleButton toggleButton) { SelectionEvent.fire(this, items.indexOf(toggleButton)); }
From source file:hu.mapro.gwt.client.widget.MyTabLayoutPanel.java
License:Apache License
/** * Programmatically selects the specified tab. * // ww w . j a v a2 s .c o m * @param index the index of the tab to be selected * @param fireEvents true to fire events, false not to */ 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; addToQueue(index); // Fire the selection event. if (fireEvents) { SelectionEvent.fire(this, index); } }
From source file:mat.client.shared.ui.MATTabBar.java
License:Apache License
/** * Programmatically selects the specified tab. Use index -1 to specify that no * tab should be selected./*from w ww. j a v a2 s . co 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 BeforeSelectionHandler}. */ public boolean selectTab(int index) { checkTabIndex(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; } if (!MatContext.get().isErrorTab()) {// if there is any error to be thrown, do not fire Event. selectedTab = panel.getWidget(index + 1); setSelectionStyle(selectedTab, true); SelectionEvent.fire(this, index); } else { selectedTab = panel.getWidget(MatContext.get().getErrorTabIndex() + 1); setSelectionStyle(selectedTab, true); MatContext.get().setErrorTab(false); } return true; }
From source file:org.activityinfo.ui.client.page.app.SectionTabStrip.java
License:Open Source License
@Override public void onBrowserEvent(Event event) { El element = El.fly(Element.as(event.getEventTarget())); switch (DOM.eventGetType(event)) { case Event.ONMOUSEOVER: if (element.hasStyleName(style.section())) { unhighlight();/*from w w w . ja v a 2 s .c o m*/ highlight(element.dom); } break; case Event.ONMOUSEOUT: if (hoverElement != null && element.dom.isOrHasChild(hoverElement)) { unhighlight(); } // popup.delayedHide(); break; case Event.ONCLICK: if (element.hasStyleName(style.section())) { int index = element.getParent().getChildIndex(element.dom); SelectionEvent.fire(this, Section.values()[index]); } break; } }
From source file:org.artificer.ui.client.local.pages.ontologies.OntologyEditorTier.java
License:Apache License
/** * Removes the ontology item/class. This removes it both from the value {@link List} * as well as from the UI. //www. ja v a 2s .c o m * @param item */ protected void removeItem(OntologyEditorTierItem item) { // When deleting the currently selected item, make sure to fire a // "deselected" event so that any forward tiers are removed from the UI. if (item == selected) { selected = null; SelectionEvent.fire(this, null); } items.remove(item); value.remove(item.getValue()); }
From source file:org.artificer.ui.client.local.pages.ontologies.OntologyEditorTier.java
License:Apache License
/** * Selects a specific item in the tier.// w w w . j av a2 s . co m * @param item */ protected void selectTierItem(OntologyEditorTierItem item) { OntologyEditorTierItem oldSelection = selected; OntologyEditorTierItem newSelection = item; if (oldSelection != null) { oldSelection.getElement().removeClassName("active"); oldSelection.hideActions(); } if (oldSelection == newSelection) { selected = null; SelectionEvent.fire(this, null); } else { newSelection.getElement().addClassName("active"); selected = newSelection; OntologyClassBean bean = selected.getValue(); SelectionEvent.fire(this, bean); } }
From source file:org.artificer.ui.client.local.pages.ontologies.OntologySummaryPanel.java
License:Apache License
/** * Removes the ontology item/class. This removes it both from the value {@link List} * as well as from the UI. /*ww w . j av a 2 s .co m*/ * @param item */ protected void removeItem(OntologySummaryPanelItem item) { // When deleting the currently selected item, make sure to fire a // "deselected" event so that any forward tiers are removed from the UI. if (item == selected) { selected = null; SelectionEvent.fire(this, null); } items.remove(item); value.remove(item.getValue()); }
From source file:org.artificer.ui.client.local.pages.ontologies.OntologySummaryPanel.java
License:Apache License
/** * Selects a specific item in the tier.// w w w.j a va 2 s . c o m * @param item */ protected void selectItem(OntologySummaryPanelItem item) { OntologySummaryPanelItem oldSelection = selected; OntologySummaryPanelItem newSelection = item; if (oldSelection != null) { oldSelection.getElement().removeClassName("active"); oldSelection.hideActions(); } if (oldSelection == newSelection) { selected = null; SelectionEvent.fire(this, null); } else { newSelection.getElement().addClassName("active"); selected = newSelection; OntologySummaryBean bean = selected.getValue(); SelectionEvent.fire(this, bean); } }
From source file:org.cruxframework.crux.smartfaces.client.breadcrumb.BreadcrumbItem.java
License:Apache License
/** * Constructor/* w w w. j av a 2 s.c o m*/ */ public BreadcrumbItem() { itemPanel = new SelectablePanel(); itemPanel.addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { if (!isEnabled() || !breadcrumb.isEnabled()) { event.setCanceled(true); event.stopPropagation(); return; } if (isActive()) { if (breadcrumb.isCollapsible() && breadcrumb.size() > 1) { breadcrumb.setCollapsed(!breadcrumb.isCollapsed()); } } else if (breadcrumb.isActivateItemsOnSelectionEnabled()) { int index = breadcrumb.indexOf(BreadcrumbItem.this); if (breadcrumb.isCollapsible() && breadcrumb.size() > 1) { breadcrumb.setCollapsed(true); } breadcrumb.setActiveIndex(index, true, true); } SelectEvent.fire(BreadcrumbItem.this); SelectionEvent.fire(breadcrumb, BreadcrumbItem.this); } }); setElement(Document.get().createElement("li")); setStyleName(Breadcrumb.STYLE_BREADCRUMB_ITEM); getElement().appendChild(itemPanel.getElement()); }
From source file:org.cruxframework.crux.smartfaces.client.menu.MenuItem.java
License:Apache License
protected void addItem(final MenuItem menuItem) { if (childrenContainer == null) { childrenContainer = Document.get().createElement("ul"); getElement().appendChild(childrenContainer); setStyleName(childrenContainer, Menu.STYLE_FACES_UL); }/*from w ww.j av a2s .c o m*/ childrenContainer.appendChild(menuItem.getElement()); menuItem.parentItem = this; children.add(menuItem); menuItem.setMenu(menu); menuItem.getItemPanel().addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { if (!menuItem.enabled) { event.setCanceled(true); event.stopPropagation(); return; } if (!menu.isTree()) { if (menuItem.opened) { menuItem.close(); } else { menuItem.open(); } } SelectEvent.fire(menuItem); SelectionEvent.fire(menu, menuItem); } }); if (!root) { if (!getElement().getClassName().contains(Menu.STYLE_FACES_HAS_CHILDREN)) { getElement().appendChild(getOpenCloseTriggerHelper().getElement()); menu.adopt(this, getOpenCloseTriggerHelper()); getElement().addClassName(Menu.STYLE_FACES_HAS_CHILDREN); } } else { getElement().removeClassName(Menu.STYLE_FACES_EMPTY); } }