List of usage examples for com.google.gwt.event.logical.shared SelectionEvent getSelectedItem
public T getSelectedItem()
From source file:py.edu.uca.intercajas.client.menumail.Mailboxes.java
License:Apache License
/** * Constructs a new mailboxes widget.//from w ww. j a v a 2s .c o m */ public Mailboxes() { Images images = GWT.create(Images.class); tree = new Tree(images); final TreeItem root = new TreeItem( imageItemHTML(images.home(), LoginService.Util.currentUser.getDescription())); tree.addItem(root); tree.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { // TreeItem item = event.getSelectedItem(); if (event.getSelectedItem().getText().trim().equals("Mis Pendientes")) { Mail m = AppUtils.Util.getMail(); // m.mostrar(); m.mostrarMisPendientes(); // AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent()); AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent(Mailboxes.this.beneficiarioIdFilter, Mailboxes.this.cajaIdFilter, Mailboxes.this.fechaDesde, Mailboxes.this.fechaHasta)); } else if (event.getSelectedItem().getText().trim().equals("Mis Finiquitados")) { Mail m = AppUtils.Util.getMail(); // m.mostrar(); m.mostrarMisFiniquitados(); // AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent()); AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent(Mailboxes.this.beneficiarioIdFilter, Mailboxes.this.cajaIdFilter, Mailboxes.this.fechaDesde, Mailboxes.this.fechaHasta)); } else if (event.getSelectedItem().getText().trim().equals("Pendientes")) { Mail m = AppUtils.Util.getMail(); // m.mostrar(); m.mostrarPendientes(); // AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent()); AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent(Mailboxes.this.beneficiarioIdFilter, Mailboxes.this.cajaIdFilter, Mailboxes.this.fechaDesde, Mailboxes.this.fechaHasta)); } else if (event.getSelectedItem().getText().trim().equals("Finiquitados")) { Mail m = AppUtils.Util.getMail(); m.mostrar(); m.mostrarFiniquitados(); // AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent()); AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent(Mailboxes.this.beneficiarioIdFilter, Mailboxes.this.cajaIdFilter, Mailboxes.this.fechaDesde, Mailboxes.this.fechaHasta)); } else if (event.getSelectedItem().getText().trim().equals("Anulados")) { Mail m = AppUtils.Util.getMail(); // m.mostrar(); m.mostrarAnulados(); // AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent()); AppUtils.EVENT_BUS.fireEvent(new RefreshMailEvent(Mailboxes.this.beneficiarioIdFilter, Mailboxes.this.cajaIdFilter, Mailboxes.this.fechaDesde, Mailboxes.this.fechaHasta)); } } }); addImageItem(root, "Mis Pendientes", images.inbox()); addImageItem(root, "Mis Finiquitados", images.sent()); addImageItem(root, "Pendientes", images.drafts()); addImageItem(root, "Finiquitados", images.templates()); // addImageItem(root, "Anulados", images.trash()); root.setState(true); // // Create a static tree and a container to hold it // Tree staticTree = createStaticTree(); // staticTree.setAnimationEnabled(true); // ScrollPanel staticTreeWrapper = new ScrollPanel(staticTree); // staticTreeWrapper.setSize("300px", "300px"); // // // Wrap the static tree in a DecoratorPanel // DecoratorPanel staticDecorator = new DecoratorPanel(); // staticDecorator.setWidget(staticTreeWrapper); VerticalPanel vp = new VerticalPanel(); vp.add(tree); vp.add(crearFiltros()); initWidget(vp); }
From source file:ro.zg.opengroups.gwt.client.views.EntityUserActionsTabView.java
License:Apache License
private void addCommandDefinitionsList(final CommandDefinitionsList cdl, final List<Integer> desiredActionPath, final TabPanel tabPanel) { final Map<Integer, CommandDefinition> commandsMap = new LinkedHashMap<Integer, CommandDefinition>(); final Map<Integer, BaseGwtView> viewsMap = new HashMap<Integer, BaseGwtView>(); if (cdl != null) { int tabIndex = 0; for (CommandDefinition cd : cdl.getCommandDefinitions().values()) { commandsMap.put(tabIndex, cd); if (cd instanceof CommandDefinitionsList) { EntityUserActionsTabView newView = (EntityUserActionsTabView) createViewForType( ViewsTypes.ENTITY_USER_ACTIONS_TAB_VIEW, this); TabPanel currentTabPanel = newView.construct(); currentTabPanel.getTabBar().setStylePrimaryName("og-CommandsTabBar"); currentTabPanel.getDeckPanel().setStylePrimaryName("og-CommandsTabPanelBottom"); tabPanel.add(currentTabPanel, cd.getDisplayName()); viewsMap.put(tabIndex, newView); } else { BaseGwtView newView = (BaseGwtView) createViewForCommand(cd.getActionName(), this); tabPanel.add(newView.construct(), cd.getDisplayName()); viewsMap.put(tabIndex, newView); }//from w ww .j a v a2 s . c om tabIndex++; } /* set the selection listener */ handlerReg = tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> event) { Integer si = event.getSelectedItem(); updateCurrentActionPath(si); BaseGwtView view = viewsMap.get(si); if (view instanceof EntityUserActionsTabView) { ((EntityUserActionsTabView) view).update((CommandDefinitionsList) commandsMap.get(si), desiredActionPath, new ArrayList<Integer>(currentActionPath)); } else { CommandDefinition cd = commandsMap.get(si); UserEvent userEvent = new UserEvent(); userEvent.setSourceViewType(getViewType()); userEvent.setElementId(COMMANDS_TAB); userEvent.setEventType(UserEvent.CLICK); userEvent.addEventParam(UserEventParams.COMMAND_ID, cd.getUniqueCommandDesc()); userEvent.addEventParam(OpenGroupsParams.CURRENT_TAB_ACTION_PATH, new ArrayList<Integer>(currentActionPath)); userEvent.setTargetViewId(view.getId()); System.out.println(userEvent.getFullEventType()); dispatchEventToManager(userEvent); } } }); /* if didn't tell otherwise, select the first action */ int nextIndex = 0; /* select the desired action */ if (desiredActionPath != null && desiredActionPath.size() > 0) { nextIndex = desiredActionPath.remove(0); } currentActionPath.add(nextIndex); tabPanel.selectTab(nextIndex); } }
From source file:ru.ksu.niimm.cll.mocassin.frontend.client.OntologyElementSuggestBoxPanel.java
License:Open Source License
@Override public void onSelection(SelectionEvent<Suggestion> event) { Suggestion selectedItem = event.getSelectedItem(); if (selectedItem instanceof OntologyElementSuggestion) { OntologyElementSuggestion selectedOntSuggestion = (OntologyElementSuggestion) selectedItem; this.selectedElement = selectedOntSuggestion.getOntologyElement(); }//from w w w . j a va2 s . c o m }
From source file:ru.ksu.niimm.cll.mocassin.frontend.client.widget.button.SelectedSuggestionButton.java
License:Open Source License
@Override public void onSelection(SelectionEvent<Suggestion> event) { Suggestion selectedItem = event.getSelectedItem(); setSelectedItem(selectedItem); }
From source file:ru.portal.gwt.gwtportal.client.AdminForm.java
private void addSelectionHandlers() { tableTreeView.addSelectionHandler(new SelectionHandler<TableFieldsDto>() { @Override/*from w ww . j a v a 2s. c om*/ public void onSelection(SelectionEvent<TableFieldsDto> event) { TableFieldsDto select = event.getSelectedItem(); // GWT.log(select.getClassName()); logsHtml.setHTML(select.getClassName()); if (TableDto.class.equals(select.getClass())) { tableGridView.refreshGrid(select.getClassName()); } } }); tableGridView.addSelectionHandler(new SelectionHandler() { @Override public void onSelection(SelectionEvent event) { // GWT.log(event.getSelectedItem().toString()); logsHtml.setHTML(event.getSelectedItem().toString()); //TODO ? ? ? ? ? ... TableFieldsDto item = tableTreeView.getSelectedItem(); dynamicEditorView.refreshEditForm(item, event.getSelectedItem()); } }); }
From source file:se.umu.cs.ldbn.client.Main.java
@Override public void onSelection(SelectionEvent<Integer> event) { int tabIndex = event.getSelectedItem(); if (tabIndex == 1) { loadSATab();/*from w w w . j a v a2 s . c om*/ } else if (tabIndex == 2 && !isTabCALoaded) { tabCA.add(CreateAssignmentWidget.get()); isTabCALoaded = true; } }
From source file:strat.mining.multipool.stats.client.mvp.view.impl.AbstractPoolView.java
License:Open Source License
public AbstractPoolView(final PoolView.PoolViewPresenter<? extends PoolView, ?> presenter) { this.presenter = presenter; mainContainer = new BorderLayoutContainer(); addressesContentPanel = new ContentPanel(); addressesContentPanel.setHeadingText("Addresses stats"); mainContainer.add(addressesContentPanel); addressesContainer = new VerticalLayoutContainer(); addressesContainer.setScrollSupport(new DefaultScrollSupport(addressesContainer.getElement())); addressesContainer.setScrollMode(ScrollMode.AUTOY); addressesContainer.addStyleName("textCenter"); addressesContentPanel.add(addressesContainer); addressesTextArea = new TextArea(); addressesTextArea.setValue(""); addressesTextArea.setOriginalValue("Addresses"); addressesTextArea.addStyleName("addressesTextArea"); Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { addressesTextArea.getElement().getElementsByTagName("textarea").getItem(0) .setAttribute("placeholder", "Line separated addresses"); }// ww w. j a va2s . com }); addressesContainer.add(addressesTextArea, new VerticalLayoutData(0.99, 80, new Margins(5))); addressSuggestBox = new SuggestBox(presenter.getAddressesSuggestOracle()); addressSuggestBox.setLimit(5); addressSuggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() { public void onSelection(SelectionEvent<Suggestion> event) { if (event.getSelectedItem() != null && !event.getSelectedItem().getReplacementString().isEmpty()) { suggestionSelected(event.getSelectedItem().getReplacementString()); } } }); addressSuggestBox.addStyleName("suggestBox"); addressSuggestBox.getElement().setAttribute("placeholder", "Address suggest box"); addressesContainer.add(addressSuggestBox, new VerticalLayoutData(0.99, 30, new Margins(0, 5, 0, 5))); mainToolbar = new ToolBar(); okAddressButton = new TextButton("Let's go !"); okAddressButton.setBorders(true); okAddressButton.addSelectHandler(new SelectHandler() { public void onSelect(SelectEvent event) { List<String> addresses = parseAddresses(); presenter.onValidate(addresses); } }); currencyMenu = new Menu(); currencyButton = new TextButton("Currency"); currencyButton.setEnabled(false); currencyButton.setMenu(currencyMenu); autoRefreshButton = new ToggleButton("Auto Refresh"); autoRefreshButton.setValue(true); autoRefreshButton.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { presenter.setAutoRefresh(event.getValue()); } }); mainToolbar.add(okAddressButton); mainToolbar.add(new FillToolItem()); mainToolbar.add(currencyButton); mainToolbar.add(new SeparatorToolItem()); mainToolbar.add(autoRefreshButton); mainToolbar.add(new SeparatorToolItem()); addressesContainer.add(mainToolbar, new VerticalLayoutData(0.99, 40, new Margins(5))); globalContentPanel = new ContentPanel(); globalContentPanel.setHeadingText("Global stats"); BorderLayoutData eastBorderLayoutData = new BorderLayoutData(Window.getClientWidth() / 3); eastBorderLayoutData.setCollapsible(true); eastBorderLayoutData.setSplit(true); eastBorderLayoutData.setCollapseMini(false); eastBorderLayoutData.setMargins(new Margins(0, 5, 0, 5)); eastBorderLayoutData.setMaxSize(2000); mainContainer.setEastWidget(globalContentPanel, eastBorderLayoutData); mainContainer.addCollapseHandler(new CollapseItemHandler<ContentPanel>() { public void onCollapse(CollapseItemEvent<ContentPanel> event) { presenter.onGlobalCollapse(isGlobalStatsCollapsed()); } }); mainContainer.addExpandHandler(new ExpandItemHandler<ContentPanel>() { public void onExpand(ExpandItemEvent<ContentPanel> event) { presenter.onGlobalCollapse(isGlobalStatsCollapsed()); } }); globalContainer = new VerticalLayoutContainer(); globalContainer.setScrollSupport(new DefaultScrollSupport(globalContainer.getElement())); globalContainer.setScrollMode(ScrollMode.AUTOY); globalContainer.getElement().getStyle().setTextAlign(TextAlign.CENTER); globalContentPanel.add(globalContainer); globalToolBar = new ToolBar(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { globalContainer.insert(globalToolBar, 0, new VerticalLayoutData(1, -1)); } }); }
From source file:strat.mining.multipool.stats.client.mvp.view.impl.PoolSelectionViewImpl.java
License:Open Source License
public PoolSelectionViewImpl(final List<String> poolNames, final List<String> poolDescription) { mainContainer = new ContentPanel(); mainContainer.setHeaderVisible(false); verticalContainer = new VerticalLayoutContainer(); mainContainer.setWidget(verticalContainer); poolNameComboBox = new SimpleComboBox<String>(new StringLabelProvider<String>()); poolNameComboBox.setAllowBlank(false); poolNameComboBox.setEditable(false); poolNameComboBox.setEmptyText("Select pool..."); poolNameComboBox.setTriggerAction(TriggerAction.ALL); poolNameComboBox.add(poolNames);// w ww . ja va 2s .c o m poolNameComboBox.getElement().getElementsByTagName("input").getItem(0).addClassName("poolComboBox"); verticalContainer.add(poolNameComboBox, new VerticalLayoutData(1, 30, new Margins(5, 50, 5, 50))); poolNameComboBox.addSelectionHandler(new SelectionHandler<String>() { public void onSelection(SelectionEvent<String> event) { int index = poolNames.indexOf(event.getSelectedItem()); updateDescription(poolDescription.get(index)); } }); poolNameComboBox.addFocusHandler(new FocusEvent.FocusHandler() { public void onFocus(FocusEvent event) { poolNameComboBox.expand(); } }); updateDescription("Please, select a pool."); }
From source file:stroom.dashboard.client.flexlayout.TabLayout.java
License:Apache License
public void bind() { handlerRegistrations.add(tabBar.addSelectionHandler(new SelectionHandler<TabData>() { @Override/*from w w w.j a v a2 s. c o m*/ public void onSelection(final SelectionEvent<TabData> event) { selectTab(event.getSelectedItem()); } })); handlerRegistrations.add(settings.addDomHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { if ((event.getNativeButton() & NativeEvent.BUTTON_LEFT) != 0) { final TabData selectedTab = tabBar.getSelectedTab(); if (selectedTab != null && selectedTab instanceof Component) { final Component component = (Component) selectedTab; component.showSettings(); } } } }, ClickEvent.getType())); }
From source file:stroom.dashboard.client.main.SettingsPresenter.java
License:Apache License
@Override protected void onBind() { super.onBind(); registerHandler(getView().getTabBar().addSelectionHandler(new SelectionHandler<TabData>() { @Override/*from w ww .j ava 2s . c o m*/ public void onSelection(final SelectionEvent<TabData> event) { final TabData tab = event.getSelectedItem(); if (tab != null && tab != selectedTab) { changeSelectedTab(tab); } } })); }