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:org.overlord.sramp.ui.client.local.pages.ontologies.OntologyEditorTier.java
License:Apache License
/** * Selects a specific item in the tier.//from w ww . ja v a 2 s .c om * @param item */ protected void selectTierItem(OntologyEditorTierItem item) { OntologyEditorTierItem oldSelection = selected; OntologyEditorTierItem newSelection = item; if (oldSelection != null) { oldSelection.getElement().getParentElement().removeClassName("active"); //$NON-NLS-1$ } if (oldSelection == newSelection) { selected = null; SelectionEvent.fire(this, null); } else { newSelection.getElement().getParentElement().addClassName("active"); //$NON-NLS-1$ selected = newSelection; OntologyClassBean bean = selected.getValue(); SelectionEvent.fire(this, bean); } }
From source file:org.overlord.sramp.ui.client.local.pages.ontologies.OntologySummaryPanel.java
License:Apache License
/** * Selects a specific item in the tier./*from w w w . j ava2 s . c o m*/ * @param item */ protected void selectItem(OntologySummaryPanelItem item) { OntologySummaryPanelItem oldSelection = selected; OntologySummaryPanelItem newSelection = item; if (oldSelection != null) { oldSelection.getElement().removeClassName("active"); //$NON-NLS-1$ oldSelection.hideActions(); } if (oldSelection == newSelection) { selected = null; SelectionEvent.fire(this, null); } else { newSelection.getElement().addClassName("active"); //$NON-NLS-1$ selected = newSelection; OntologySummaryBean bean = selected.getValue(); SelectionEvent.fire(this, bean); } }
From source file:org.rstudio.core.client.files.filedialog.DirectoryContentsWidget.java
License:Open Source License
public void setSelectedRow(Integer row) { if (selectedRow_ != null) { table_.getRowFormatter().removeStyleName(selectedRow_.intValue(), "gwt-MenuItem-selected"); selectedRow_ = null;/*ww w . j av a 2 s .c o m*/ selectedValue_ = null; } if (row != null && row.intValue() >= 0 && row.intValue() < table_.getRowCount()) { selectedRow_ = row.intValue(); table_.getRowFormatter().addStyleName(selectedRow_, "gwt-MenuItem-selected"); selectedValue_ = table_.getText(row.intValue(), COL_NAME); TableRowElement rowEl = ((TableElement) table_.getElement().cast()).getRows().getItem(selectedRow_); int horizScroll = scrollPanel_.getHorizontalScrollPosition(); rowEl.scrollIntoView(); scrollPanel_.setHorizontalScrollPosition(horizScroll); } SelectionEvent.fire(DirectoryContentsWidget.this, getSelectedItem()); }
From source file:org.rstudio.core.client.prefs.SectionChooser.java
License:Open Source License
public void select(Integer index) { if (selectedIndex_ != null) inner_.getWidget(selectedIndex_).removeStyleName(res_.styles().activeSection()); selectedIndex_ = index;/*www.j a va 2 s . co m*/ if (index != null) inner_.getWidget(index).addStyleName(res_.styles().activeSection()); SelectionEvent.fire(this, index); }
From source file:org.rstudio.core.client.theme.MinimizedModuleTabLayoutPanel.java
License:Open Source License
public void setTabs(String[] tabNames) { HorizontalPanel horiz = (HorizontalPanel) getExtraWidget(); horiz.clear();/* w ww .java 2 s .c om*/ ThemeStyles styles = ThemeResources.INSTANCE.themeStyles(); for (int i = 0; i < tabNames.length; i++) { String tabName = tabNames[i]; if (tabName == null) continue; ModuleTabLayoutPanel.ModuleTab tab = new ModuleTabLayoutPanel.ModuleTab(tabName, styles, false); tab.addStyleName("gwt-TabLayoutPanelTab"); final Integer thisIndex = i; tab.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { event.preventDefault(); SelectionEvent.fire(MinimizedModuleTabLayoutPanel.this, thisIndex); } }); horiz.add(tab); } }
From source file:org.rstudio.studio.client.workbench.views.console.shell.assist.CompletionList.java
License:Open Source License
public void setSelectedIndex(int index) { if (selectedIndex_ != index) { CellFormatter cf = grid_.getCellFormatter(); if (selectedIndex_ >= 0) cf.removeStyleName(selectedIndex_, 0, styles_.selected()); selectedIndex_ = index;/*from ww w . ja v a2s.com*/ if (index >= 0) { cf.addStyleName(selectedIndex_, 0, styles_.selected()); com.google.gwt.dom.client.Element el = DomUtils.getTableCell(grid_.getElement(), index, 0); DomUtils.ensureVisibleVert(scrollPanel_.getElement(), el, 2); SelectionEvent.fire(this, getSelectedItem()); } } }
From source file:org.rstudio.studio.client.workbench.views.console.shell.assist.CompletionPopupPanel.java
License:Open Source License
@Override public void showCompletionValues(QualifiedName[] values, PositionCallback callback, boolean truncated) { CompletionList<QualifiedName> list = new CompletionList<QualifiedName>(values, 6, true, true); list.addSelectionCommitHandler(new SelectionCommitHandler<QualifiedName>() { public void onSelectionCommit(SelectionCommitEvent<QualifiedName> event) { lastSelectedValue_ = event.getSelectedItem(); SelectionCommitEvent.fire(CompletionPopupPanel.this, event.getSelectedItem()); }//www . ja va 2 s. c o m }); list.addSelectionHandler(new SelectionHandler<QualifiedName>() { public void onSelection(SelectionEvent<QualifiedName> event) { lastSelectedValue_ = event.getSelectedItem(); SelectionEvent.fire(CompletionPopupPanel.this, event.getSelectedItem()); } }); list_ = list; container_ = new VerticalPanel(); container_.add(list_); if (truncated) container_.add(truncated_); setWidget(container_); ElementIds.assignElementId(list_.getElement(), ElementIds.POPUP_COMPLETIONS); show(callback); }
From source file:org.rstudio.studio.client.workbench.views.plots.Locator.java
License:Open Source License
public void locate(String url, Size size) { if (currentUrl_ == null || !currentUrl_.equals(url) || currentSize_ == null || !currentSize_.equals(size) || display_ == null || !display_.isVisible()) { clearDisplay();/*from ww w . j av a2s . c o m*/ display_ = new LocatorPanel(); hreg_ = display_.addSelectionHandler(new SelectionHandler<Point>() { public void onSelection(SelectionEvent<Point> event) { SelectionEvent.fire(Locator.this, event.getSelectedItem()); } }); currentUrl_ = url; currentSize_ = size; display_.showLocator(parent_); } }
From source file:org.rstudio.studio.client.workbench.views.plots.LocatorPanel.java
License:Open Source License
public LocatorPanel() { setStylePrimaryName(ThemeStyles.INSTANCE.locatorPanel()); feedbackImage_ = new Image(StandardIcons.INSTANCE.click_feedback()); feedbackImage_.setVisible(false);//from w w w. j av a2s . c o m add(feedbackImage_); setWidgetTopHeight(feedbackImage_, 0, Unit.PX, FB_HEIGHT, Unit.PX); setWidgetLeftWidth(feedbackImage_, 0, Unit.PX, FB_WIDTH, Unit.PX); inputPanel_ = new InputPanel(); inputPanel_.setSize("100%", "100%"); add(inputPanel_); setWidgetLeftRight(inputPanel_, 0, Unit.PX, 0, Unit.PX); setWidgetTopBottom(inputPanel_, 0, Unit.PX, 0, Unit.PX); inputPanel_.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Element el = inputPanel_.getElement(); int x = event.getNativeEvent().getClientX(); int y = event.getNativeEvent().getClientY(); Point p = new Point(x - el.getAbsoluteLeft(), y - el.getAbsoluteTop()); showFeedbackAt(p); SelectionEvent.fire(LocatorPanel.this, p); } }); // fill entire area of parent container setSize("100%", "100%"); }
From source file:org.rstudio.studio.client.workbench.views.plots.LocatorPanel.java
License:Open Source License
public void showLocator(Plots.Parent parent) { // set parent parent_ = parent;//from w w w . j ava 2 s. co m // add to parent parent_.add(this); // add custom locator toolbar to parent installCustomToolbar(); // subscribe to ESC key browser-wide for dismissal of the Locator UI // (unhook any existing subscription first) unhookNativePreviewHandler(); escHandlerReg_ = Event.addNativePreviewHandler(new NativePreviewHandler() { public void onPreviewNativeEvent(NativePreviewEvent event) { if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { event.cancel(); SelectionEvent.fire(LocatorPanel.this, null); } } }); }