List of usage examples for com.google.gwt.event.logical.shared SelectionEvent getSelectedItem
public T getSelectedItem()
From source file:org.geowe.client.local.main.tool.edition.CopyElementDialog.java
License:Open Source License
private ComboBox<VectorLayerInfo> initLayerCombo1() { VectorLayerProperties properties = GWT.create(VectorLayerProperties.class); layerStore1 = new ListStore<VectorLayerInfo>(properties.key()); layerCombo1 = new ComboBox<VectorLayerInfo>(layerStore1, properties.name()); layerCombo1.setEmptyText((UIMessages.INSTANCE.sbLayerComboEmptyText())); layerCombo1.setTypeAhead(true);//from w w w. j av a2s . co m layerCombo1.setTriggerAction(TriggerAction.ALL); layerCombo1.setForceSelection(true); layerCombo1.setEditable(false); layerCombo1.enableEvents(); layerCombo1.setWidth(width); layerCombo1.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() { @Override public void onSelection(SelectionEvent<VectorLayerInfo> event) { layerCombo1.setValue(event.getSelectedItem(), true); } }); return layerCombo1; }
From source file:org.geowe.client.local.main.tool.spatial.geoprocess.dialog.GeoprocessComboBox.java
License:Open Source License
private void createSelectionHandler() { addSelectionHandler(new SelectionHandler<Geoprocess>() { @Override/*from www. java 2 s . co m*/ public void onSelection(SelectionEvent<Geoprocess> event) { setValue(event.getSelectedItem(), true); } }); }
From source file:org.geowe.client.local.main.tool.spatial.geoprocess.dialog.GeoprocessDialog.java
License:Open Source License
private void createComboLayer(final ComboBox<VectorLayerInfo> combo, final String numCombo, final TextButton validateButton) { clearLayerComboBox(combo);//from w w w .j av a 2 s . co m combo.setTypeAhead(true); combo.setTriggerAction(TriggerAction.ALL); combo.setForceSelection(true); combo.setEditable(false); combo.enableEvents(); combo.setWidth(WIDTH_COMBO_LAYER); combo.setId(numCombo); combo.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() { @Override public void onSelection(SelectionEvent<VectorLayerInfo> event) { combo.setValue(event.getSelectedItem(), true); List<VectorLayerInfo> updatedLayers = removeLayer(event.getSelectedItem()); if (COMBO1_ID.equals(combo.getId())) { updateCombo(LAYER_COMBO_2, LAYER_STORE_2, updatedLayers); } else { updateCombo(LAYER_COMBO_1, LAYER_STORE_1, updatedLayers); } } }); validateButton.setToolTip(UIMessages.INSTANCE.descriptionValidationToolText()); final HorizontalPanel horizontalGroup = getHorizontalPanel(); horizontalGroup.add(combo); horizontalGroup.add(validateButton); panel.add(new Label(UIMessages.INSTANCE.layerLabelText(numCombo))); panel.add(horizontalGroup); }
From source file:org.geowe.client.local.main.tool.spatial.geoprocess.dialog.GeoprocessDialog.java
License:Open Source License
private void createGeoprocessAndDistanceField(final Geoprocesses spatialOperation) { spatialOperationComboBox = new GeoprocessComboBox(spatialOperation.getAll()); spatialOperationComboBox.setWidth(WIDTH_SPATIAL_OPERATION_COMBO); clearSpatialOperationComboBox();//w w w.j ava 2 s .com spatialOperationComboBox.addSelectionHandler(new SelectionHandler<Geoprocess>() { @Override public void onSelection(SelectionEvent<Geoprocess> event) { spatialOperationComboBox.setValue(event.getSelectedItem(), true); if (event.getSelectedItem() instanceof BufferGeoprocess) { LAYER_COMBO_2.setValue(null); LAYER_COMBO_2.setEnabled(false); distanceTextField.setText("0"); distanceTextField.setEnabled(true); distanceTextField.setVisible(true); } else { LAYER_COMBO_2.setEnabled(true); distanceTextField.setText(""); distanceTextField.setEnabled(false); distanceTextField.setVisible(false); } } }); initDistanceTextField(); final HorizontalPanel horizontalGroup = getHorizontalPanel(); horizontalGroup.add(spatialOperationComboBox); horizontalGroup.add(distanceTextField); panel.add(horizontalGroup); }
From source file:org.geowe.client.local.ui.VectorFormatComboBox.java
License:Open Source License
private void createSelectionHandler() { addSelectionHandler(new SelectionHandler<VectorFormat>() { @Override/*from w w w . ja va 2 s. c o m*/ public void onSelection(SelectionEvent<VectorFormat> event) { setValue(event.getSelectedItem(), true); } }); }
From source file:org.gss_project.gss.web.client.Groups.java
License:Open Source License
@Override public void onSelection(SelectionEvent event) { final TreeItem item = (TreeItem) event.getSelectedItem(); onSelection(item); }
From source file:org.gss_project.gss.web.client.GSS.java
License:Open Source License
@Override public void onModuleLoad() { // Initialize the singleton before calling the constructors of the // various widgets that might call GSS.get(). singleton = this; parseUserCredentials();//from w ww . j a v a2s .c om topPanel = new TopPanel(GSS.images); topPanel.setWidth("100%"); messagePanel.setWidth("100%"); messagePanel.setVisible(false); search = new Search(images); searchStatus.add(search, DockPanel.WEST); searchStatus.add(userDetailsPanel, DockPanel.EAST); searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT); searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE); searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE); searchStatus.setWidth("100%"); fileList = new FileList(images); searchResults = new SearchResults(images); // Inner contains the various lists. inner.sinkEvents(Event.ONCONTEXTMENU); inner.setAnimationEnabled(true); inner.getTabBar().addStyleName("gss-MainTabBar"); inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom"); inner.add(fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true); inner.add(groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true); inner.add(searchResults, createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"), true); //inner.add(new CellTreeView(images), createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true); inner.setWidth("100%"); inner.selectTab(0); inner.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int tabIndex = event.getSelectedItem(); // TreeItem treeItem = GSS.get().getFolders().getCurrent(); switch (tabIndex) { case 0: // Files tab selected //fileList.clearSelectedRows(); fileList.updateCurrentlyShowingStats(); break; case 1: // Groups tab selected groups.updateCurrentlyShowingStats(); updateHistory("Groups"); break; case 2: // Search tab selected searchResults.clearSelectedRows(); searchResults.updateCurrentlyShowingStats(); updateHistory("Search"); break; } } }); // If the application starts with no history token, redirect to a new "Files" state String initToken = History.getToken(); if (initToken.length() == 0) History.newItem("Files"); // Add history listener to handle any history events History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String tokenInput = event.getValue(); String historyToken = handleSpecialFolderNames(tokenInput); try { if (historyToken.equals("Search")) inner.selectTab(2); else if (historyToken.equals("Groups")) inner.selectTab(1); else if (historyToken.equals("Files") || historyToken.length() == 0) inner.selectTab(0); else { /*TODO: CELLTREE PopupTree popupTree = GSS.get().getFolders().getPopupTree(); TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken); SelectionEvent.fire(popupTree, treeObj); */ } } catch (IndexOutOfBoundsException e) { inner.selectTab(0); } } }); // Add the left and right panels to the split panel. splitPanel.setLeftWidget(treeView); splitPanel.setRightWidget(inner); splitPanel.setSplitPosition("25%"); splitPanel.setSize("100%", "100%"); splitPanel.addStyleName("gss-splitPanel"); // Create a dock panel that will contain the menu bar at the top, // the shortcuts to the left, the status bar at the bottom and the // right panel taking the rest. VerticalPanel outer = new VerticalPanel(); outer.add(topPanel); outer.add(searchStatus); outer.add(messagePanel); outer.add(splitPanel); outer.add(statusPanel); outer.setWidth("100%"); outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER); outer.setSpacing(4); // Hook the window resize event, so that we can adjust the UI. Window.addResizeHandler(this); // Clear out the window's built-in margin, because we want to take // advantage of the entire client area. Window.setMargin("0px"); // Finally, add the outer panel to the RootPanel, so that it will be // displayed. RootPanel.get().add(outer); // Call the window resized handler to get the initial sizes setup. Doing // this in a deferred command causes it to occur after all widgets' // sizes have been computed by the browser. DeferredCommand.addCommand(new Command() { @Override public void execute() { onWindowResized(Window.getClientHeight()); } }); }
From source file:org.gwtcmis.sample.client.application.SampleForm.java
License:Open Source License
/** * Create tab panel for displaying objects *//*from w ww . jav a 2 s . co m*/ private void createTabPanel() { tabPanel = new DecoratedTabPanel(); tabPanel.setWidth("100%"); tabPanel.setHeight("100%"); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> event) { selectedItem = event.getSelectedItem(); deleteButton.setEnabled(true); } }); mainPanel.add(tabPanel); }
From source file:org.gwtlib.samples.showcase.client.ui.ShowcaseEntryPoint.java
License:Apache License
private void init(RootPanel root) { _deckPanel = new DeckPanel(); _tree = createTree();//from w ww . j a v a2 s.c om _tree.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { TreeItem item = event.getSelectedItem(); if (item.getUserObject() != null) { ContentWidget widget = (ContentWidget) item.getUserObject(); widget.init(); int i = _deckPanel.getWidgetIndex(widget); if (i != -1) _deckPanel.showWidget(i); } } }); FlexTable table = new FlexTable(); table.setWidget(0, 0, _tree); table.setWidget(0, 1, _deckPanel); table.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP); root.add(table); }
From source file:org.jboss.as.console.client.shared.subsys.jca.wizard.DatasourceStep2.java
License:Open Source License
Widget asWidget() { VerticalPanel layout = new VerticalPanel(); layout.getElement().setAttribute("style", "margin:10px; vertical-align:center;width:95%"); HTML desc = new HTML("<h3>" + Console.CONSTANTS.subsys_jca_dataSource_step2() + "</h3>"); desc.getElement().setAttribute("style", "padding-bottom:10px;"); layout.add(desc);/* w ww .ja v a 2 s.c o m*/ layout.add(new ContentDescription("Select one of the deployed JDBC driver.")); // --- table = new DefaultCellTable<JDBCDriver>(5); TextColumn<JDBCDriver> nameColumn = new TextColumn<JDBCDriver>() { @Override public String getValue(JDBCDriver record) { return record.getName(); } }; TextColumn<JDBCDriver> groupColumn = new TextColumn<JDBCDriver>() { @Override public String getValue(JDBCDriver record) { return record.getGroup(); } }; table.addColumn(nameColumn, "Name"); if (!isStandalone) table.addColumn(groupColumn, "Server Group"); selectionModel = new SingleSelectionModel<JDBCDriver>(); table.setSelectionModel(selectionModel); provisionTable(table); DefaultPager pager = new DefaultPager(); pager.setDisplay(table); VerticalPanel driverPanel = new VerticalPanel(); driverPanel.add(table); driverPanel.add(pager); // -- final Form<JDBCDriver> form = new Form<JDBCDriver>(JDBCDriver.class); TextBoxItem name = new TextBoxItem("name", "Name"); TextBoxItem driverClass = new TextBoxItem("driverClass", "Driver Class"); NumberBoxItem major = new NumberBoxItem("majorVersion", "Major Version"); NumberBoxItem minor = new NumberBoxItem("minorVersion", "Minor Version"); form.setFields(name, driverClass, major, minor); // -- TabPanel tabs = new TabPanel(); tabs.setStyleName("default-tabpanel"); tabs.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { selectedTab = event.getSelectedItem(); } }); tabs.add(driverPanel, "Chose Driver"); //tabs.add(form.asWidget(), "Specify Driver"); layout.add(tabs); tabs.selectTab(0); // ---- ClickHandler submitHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { JDBCDriver driver = null; if (selectedTab == 0) { // reset state form.clearValues(); SingleSelectionModel<JDBCDriver> selection = (SingleSelectionModel<JDBCDriver>) table .getSelectionModel(); driver = selection.getSelectedObject(); } else { FormValidation formValidation = form.validate(); if (!formValidation.hasErrors()) { driver = form.getUpdatedEntity(); } } if (driver != null) { // force selected driver editedEntity.setDriverName(driver.getName()); editedEntity.setDriverClass(driver.getDriverClass()); editedEntity.setMajorVersion(driver.getMajorVersion()); editedEntity.setMinorVersion(driver.getMinorVersion()); wizard.onConfigureDriver(editedEntity); } else { Console.warning(Console.CONSTANTS.subsys_jca_dataSource_select_driver(), "If no driver is available you may need to deploy one!"); } } }; ClickHandler cancelHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { wizard.getPresenter().closeDialogue(); } }; DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_next(), submitHandler, Console.CONSTANTS.common_label_cancel(), cancelHandler); return new WindowContentBuilder(layout, options).build(); }