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.rstudio.studio.client.workbench.views.plots.LocatorPanel.java
License:Open Source License
private void installCustomToolbar() { parent_.installCustomToolbar(new Customizer() { public void setToolbarContents(Toolbar toolbar) { toolbar.addLeftWidget(new Label("Locator active (Esc to finish)")); SmallButton doneButton = new SmallButton("Finish"); doneButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { SelectionEvent.fire(LocatorPanel.this, null); }/*from w w w . jav a 2 s . c o m*/ }); toolbar.addRightWidget(doneButton); toolbar.addRightWidget(new HTML(" ")); } }); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.codebrowser.CodeBrowserContextWidget.java
License:Open Source License
public CodeBrowserContextWidget(final CodeBrowserEditingTargetWidget.Styles styles) { HorizontalPanel panel = new HorizontalPanel(); captionLabel_ = new Label(); captionLabel_.addStyleName(styles.captionLabel()); panel.add(captionLabel_);/*from w ww .j ava 2s . c om*/ ClickHandler clickHandler = new ClickHandler() { public void onClick(ClickEvent event) { if (dropDownImage_.isVisible()) { CodeBrowserPopupMenu menu = new CodeBrowserPopupMenu(); JsArrayString methods = functionDef_.getMethods(); for (int i = 0; i < methods.length(); i++) { final String method = methods.get(i); MenuItem mi = new MenuItem(method, new Command() { @Override public void execute() { SelectionEvent.fire(CodeBrowserContextWidget.this, method); } }); mi.getElement().getStyle().setPaddingRight(20, Unit.PX); menu.addItem(mi); } menu.showRelativeTo(nameLabel_); menu.getElement().getStyle().setPaddingTop(3, Unit.PX); } } }; nameLabel_ = new Label(); nameLabel_.addStyleName(styles.menuElement()); nameLabel_.addStyleName(styles.functionName()); nameLabel_.addClickHandler(clickHandler); panel.add(nameLabel_); namespaceLabel_ = new Label(); namespaceLabel_.addStyleName(styles.menuElement()); namespaceLabel_.addStyleName(styles.functionNamespace()); namespaceLabel_.addClickHandler(clickHandler); panel.add(namespaceLabel_); dropDownImage_ = new Image(ThemeResources.INSTANCE.mediumDropDownArrow()); dropDownImage_.addStyleName(styles.menuElement()); dropDownImage_.addStyleName(styles.dropDownImage()); dropDownImage_.addClickHandler(clickHandler); panel.add(dropDownImage_); dropDownImage_.setVisible(false); initWidget(panel); }
From source file:org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBarElementWidget.java
License:Open Source License
public StatusBarElementWidget() { options_ = new ArrayList<String>(); label_ = new Label(); add(label_);/*from w w w . ja va 2s .co m*/ addDomHandler(new MouseDownHandler() { public void onMouseDown(MouseDownEvent event) { event.preventDefault(); event.stopPropagation(); if (options_.size() == 0) return; StatusBarPopupMenu menu = new StatusBarPopupMenu(); for (final String option : options_) menu.addItem(new MenuItem(option, new Command() { public void execute() { SelectionEvent.fire(StatusBarElementWidget.this, option); } })); menu.showRelativeToUpward(label_); } }, MouseDownEvent.getType()); }
From source file:org.synthful.gwt.widgets.client.ui.UITabLayoutPanel.java
License:Apache License
/** * Programmatically selects the specified tab. * /* w w w. j a v a 2 s . com*/ * @param index the index of the tab to be selected */ public void selectTab(int index) { checkIndex(index); if (index == selectedIndex) { return; } // Fire the before selection event, giving the recipients a chance to // cancel the selection. BeforeSelectionEvent<Integer> event = BeforeSelectionEvent.fire(this, index); if ((event != null) && event.isCanceled()) { return; } // Update the tabs being selected and unselected. 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; // Fire the selection event. SelectionEvent.fire(this, index); }
From source file:org.talend.mdm.webapp.browserecords.client.widget.treedetail.TreeEx.java
License:Open Source License
private void onSelection(TreeItemEx item, boolean fireEvents) { if (item == root) { return;//w w w .j a va 2 s . c o m } if (curSelection != null) { curSelection.setSelected(false); } curSelection = item; if (curSelection != null) { curSelection.setSelected(true); if (fireEvents) { SelectionEvent.fire(this, curSelection); } } }
From source file:org.uberfire.client.views.pfly.listbar.ListBarWidgetImpl.java
License:Apache License
@Override public boolean selectPart(final PartDefinition part) { if (!parts.contains(part)) { //not necessary to check if current is part return false; }// w w w .j av a 2s.co m if (currentPart != null) { if (currentPart.getK1().equals(part)) { return true; } parts.add(currentPart.getK1()); panelManager.onPartHidden(currentPart.getK1()); currentPart.getK2().getElement().getStyle().setDisplay(NONE); } currentPart = Pair.newPair(part, partContentView.get(part)); currentPart.getK2().getElement().getStyle().setDisplay(BLOCK); parts.remove(currentPart.getK1()); if (part.isSelectable()) { titleDropDown.selectPart(part); setupContextMenu(); header.setVisible(true); } else { header.setVisible(false); } scheduleResize(); resizePanelBody(); SelectionEvent.fire(ListBarWidgetImpl.this, part); return true; }
From source file:org.uberfire.client.views.pfly.listbar.PartListDropdown.java
License:Apache License
private ListItem buildTitleDropdownMenuItem(final String title, final PartDefinition part) { final Span span = new Span(); span.add(new Text(title)); final ListItem li = new ListItem() { @Override/*w w w . j a v a 2 s . c om*/ public void setText(String text) { span.clear(); span.add(new Text(text)); } }; li.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { SelectionEvent.fire(PartListDropdown.this, part); } }, ClickEvent.getType()); final Icon icon = new Icon(IconType.TIMES); icon.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { CloseEvent.fire(PartListDropdown.this, part); //Keep dropdown menu open when removing parts boolean openMenu = PartListDropdown.this.getElement().hasClassName("open"); if (openMenu) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { PartListDropdown.this.getElement().addClassName("open"); } }); } } }, ClickEvent.getType()); icon.addStyleName(Styles.PULL_RIGHT); final Anchor anchor = new Anchor(); anchor.add(icon); anchor.add(span); li.add(anchor); return li; }
From source file:org.uberfire.client.views.pfly.tab.UberTabPanel.java
License:Apache License
@PostConstruct public void init() { this.dropdownTab = tabPanel.addDropdownTab("More..."); tabPanel.addShowHandler(new TabShowHandler() { @Override/* w ww . ja v a2s. c om*/ 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()); } } }); tabPanel.addShownHandler(new TabShownHandler() { @Override public void onShown(TabShownEvent e) { onResize(); if (e.getTab() != null) { final TabPanelEntry selected = tabPanel.findEntryForTabWidget(e.getTab()); SelectionEvent.fire(UberTabPanel.this, tabInvertedIndex.get(selected).getPresenter().getDefinition()); } } }); tabPanel.addDomHandler(UberTabPanel.this, ClickEvent.getType()); initWidget(tabPanel); }
From source file:org.uberfire.client.views.pfly.tab.UberTabPanel.java
License:Apache License
@Override public void onClick(final ClickEvent event) { if (!hasFocus) { fireFocusGained();// ww w . j ava 2s . c o m View view = getSelectedPart(); if (view != null) { SelectionEvent.fire(UberTabPanel.this, view.getPresenter().getDefinition()); } } }
From source file:org.uberfire.client.workbench.widgets.panel.StaticFocusedResizePanel.java
License:Apache License
public StaticFocusedResizePanel() { initWidget(container);/*from w w w . j a v a 2s. c o m*/ container.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { if (partDefinition != null) { SelectionEvent.fire(StaticFocusedResizePanel.this, partDefinition); } } }); container.getElement().addClassName(CSSLocatorsUtils.buildLocator("qe", "static-workbench-panel-view")); }