List of usage examples for com.google.gwt.event.logical.shared SelectionEvent getSelectedItem
public T getSelectedItem()
From source file:org.activityinfo.ui.client.page.app.AppFrameSet.java
License:Open Source License
private void setupTabs() { appBar.getSectionTabStrip().addSelectionHandler(new SelectionHandler<Section>() { @Override/* w w w. j a va2 s . c o m*/ public void onSelection(SelectionEvent<Section> event) { onSectionClicked(event.getSelectedItem()); } }); eventBus.addListener(NavigationHandler.NAVIGATION_AGREED, new Listener<NavigationEvent>() { @Override public void handleEvent(NavigationEvent event) { appBar.getSectionTabStrip().setSelection(event.getPlace().getSection()); } }); BorderLayoutData layout = new BorderLayoutData(LayoutRegion.NORTH); layout.setSize(AppBar.HEIGHT); viewport.add(appBar, layout); }
From source file:org.aksw.TripleCheckMate.client.widgets.EvaluationItemDialog.java
License:Apache License
private void setupTree() { // Get all error items from DB async callback AsyncCallback<List<ErrorItem>> errorCallback = new AsyncCallback<List<ErrorItem>>() { public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); // SessionContext.hidePopup(); }/*ww w. ja v a 2 s. c om*/ public void onSuccess(List<ErrorItem> items) { arrangeErrorTreeItems(items, null); } }; // Get all error items from DB call SessionContext.evaluationReqSrv.getErrorChildren(-1, errorCallback); treeError.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { // TODO Auto-generated method stub final TreeItem treeItem = event.getSelectedItem(); itemSelected(((ErrorItem) treeItem.getUserObject())); } }); }
From source file:org.apache.oozie.tools.workflowgenerator.client.OozieWorkflowGenerator.java
License:Apache License
/** * Initialize workflow tree-view menu on left side * * @return//from w ww. j a v a 2 s .com */ public Tree initWrkflowTree() { Tree t = new Tree(); TreeItem actionTree = new TreeItem("Property"); t.addItem(actionTree); t.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { TreeItem item = event.getSelectedItem(); String name = item.getText(); if (name.equals("Property") && wrkflowtable != null) { setPropertyTable(wrkflowtable); } } }); return t; }
From source file:org.apache.oozie.tools.workflowgenerator.client.OozieWorkflowGenerator.java
License:Apache License
/** * Initialize node tree-view menu on left side * * @return/*from w ww.ja va 2 s.co m*/ */ public Tree initNodeTree() { Tree t = new Tree(); // Action Node Tree TreeItem actionTree = new TreeItem("Action Node"); TreeItem mrTree = new TreeItem("MapReduce"); mrTree.addItem("Streaming"); mrTree.addItem("Pipes"); actionTree.addItem(mrTree); actionTree.addItem("Pig"); actionTree.addItem("Java"); actionTree.addItem("FS"); actionTree.addItem("Subworkflow"); actionTree.addItem("SSH"); actionTree.addItem("Shell"); actionTree.addItem("Email"); // Control Node Tree TreeItem controlTree = new TreeItem("Control Node"); controlTree.addItem("Start"); controlTree.addItem("End"); controlTree.addItem("Kill"); controlTree.addItem("Fork/Join"); controlTree.addItem("Decision"); t.addItem(actionTree); t.addItem(controlTree); // Event Handler t.addSelectionHandler(new SelectionHandler<TreeItem>() { @Override public void onSelection(SelectionEvent<TreeItem> event) { TreeItem item = event.getSelectedItem(); String name = item.getText(); if (name.equals("MapReduce")) { MapReduceActionWidget w = new MapReduceActionWidget(OozieWorkflowGenerator.this); w.setName("MR_".concat( nodeCount.get(NodeType.MAPREDUCE) != null ? nodeCount.get(NodeType.MAPREDUCE).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Streaming")) { StreamingActionWidget w = new StreamingActionWidget(OozieWorkflowGenerator.this); w.setName("Streaming_".concat( nodeCount.get(NodeType.STREAMING) != null ? nodeCount.get(NodeType.STREAMING).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Pipes")) { PipesActionWidget w = new PipesActionWidget(OozieWorkflowGenerator.this); w.setName("Pipes_" .concat(nodeCount.get(NodeType.PIPES) != null ? nodeCount.get(NodeType.PIPES).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Pig")) { PigActionWidget w = new PigActionWidget(OozieWorkflowGenerator.this); w.setName("Pig_".concat( nodeCount.get(NodeType.PIG) != null ? nodeCount.get(NodeType.PIG).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Java")) { JavaActionWidget w = new JavaActionWidget(OozieWorkflowGenerator.this); w.setName("Java_".concat( nodeCount.get(NodeType.JAVA) != null ? nodeCount.get(NodeType.JAVA).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("FS")) { FSActionWidget w = new FSActionWidget(OozieWorkflowGenerator.this); w.setName("FS_".concat( nodeCount.get(NodeType.FS) != null ? nodeCount.get(NodeType.FS).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("SSH")) { SSHActionWidget w = new SSHActionWidget(OozieWorkflowGenerator.this); w.setName("SSH_".concat( nodeCount.get(NodeType.SSH) != null ? nodeCount.get(NodeType.SSH).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Email")) { EmailActionWidget w = new EmailActionWidget(OozieWorkflowGenerator.this); w.setName("Email_" .concat(nodeCount.get(NodeType.EMAIL) != null ? nodeCount.get(NodeType.EMAIL).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Shell")) { ShellActionWidget w = new ShellActionWidget(OozieWorkflowGenerator.this); w.setName("Shell_" .concat(nodeCount.get(NodeType.SHELL) != null ? nodeCount.get(NodeType.SHELL).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Subworkflow")) { SubWFActionWidget w = new SubWFActionWidget(OozieWorkflowGenerator.this); w.setName("SubWF_" .concat(nodeCount.get(NodeType.SUBWF) != null ? nodeCount.get(NodeType.SUBWF).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Start")) { if (start == null) { StartNodeWidget w = new StartNodeWidget(OozieWorkflowGenerator.this); start = w; addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } } else if (name.equals("End")) { if (end == null) { EndNodeWidget w = new EndNodeWidget(OozieWorkflowGenerator.this); w.setName("End"); end = w; addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } } else if (name.equals("Kill")) { if (kill == null) { KillNodeWidget w = new KillNodeWidget(OozieWorkflowGenerator.this); w.setName("Kill"); kill = w; addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } } else if (name.equals("Fork/Join")) { ForkNodeWidget fork = new ForkNodeWidget(OozieWorkflowGenerator.this); fork.setName("Fork_".concat( nodeCount.get(NodeType.FORK) != null ? nodeCount.get(NodeType.FORK).toString() : "0")); addWidget(fork, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); JoinNodeWidget join = new JoinNodeWidget(OozieWorkflowGenerator.this); join.setName("Join_".concat( nodeCount.get(NodeType.JOIN) != null ? nodeCount.get(NodeType.JOIN).toString() : "0")); addWidget(join, 90 + Random.nextInt(30), 30 + Random.nextInt(30)); } else if (name.equals("Decision")) { DecisionNodeWidget w = new DecisionNodeWidget(OozieWorkflowGenerator.this); w.setName("Decision_".concat( nodeCount.get(NodeType.DECISION) != null ? nodeCount.get(NodeType.DECISION).toString() : "0")); addWidget(w, 30 + Random.nextInt(30), 30 + Random.nextInt(30)); } } }); return t; }
From source file:org.apache.solr.explorer.client.core.ui.consolepane.log.LogPane.java
License:Apache License
public LogPane() { logger = new AbstractLogger() { public void log(Level level, String message, Throwable t) { LogPane.this.log(level, message, t); }// w w w . ja v a 2 s . c o m }; HorizontalPanel toolbar = new HorizontalPanel(); toolbar.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); toolbar.add(new Label("Level:")); addGap(toolbar, "3px"); levelDropDown = new DropDownBox<AbstractLogger.Level>(); for (AbstractLogger.Level level : AbstractLogger.Level.values()) { levelDropDown.addOption(level.name(), level); } levelDropDown.addSelectionHandler(new SelectionHandler<AbstractLogger.Level>() { public void onSelection(SelectionEvent<Logger.Level> event) { logger.setLevel(event.getSelectedItem()); } }); toolbar.add(levelDropDown); addGap(toolbar, "10px"); SimpleButton clearButton = new SimpleButton("Clear", new ClickHandler() { public void onClick(ClickEvent event) { doClear(); } }); toolbar.add(clearButton); logEntries = new FlowPanel(); logEntries.setStylePrimaryName("LogEntries"); logEntriesScrollPanel = new ScrollPanel(logEntries); DOM.setStyleAttribute(logEntriesScrollPanel.getElement(), "border", "2px inset gray"); LayoutPanel main = new LayoutPanel(); main.add(toolbar); main.setWidgetLeftRight(toolbar, 10, Style.Unit.PX, 10, Style.Unit.PX); main.setWidgetTopHeight(toolbar, 10, Style.Unit.PX, 25, Style.Unit.PX); main.add(logEntriesScrollPanel); main.setWidgetLeftRight(logEntriesScrollPanel, 10, Style.Unit.PX, 10, Style.Unit.PX); main.setWidgetTopBottom(logEntriesScrollPanel, 45, Style.Unit.PX, 10, Style.Unit.PX); initWidget(main); setStylePrimaryName("LogPane"); }
From source file:org.apache.solr.explorer.client.core.ui.consolepane.SchemaPane.java
License:Apache License
public SchemaPane() { SplitLayout main = new SplitLayout(); tree = new Tree(); tree.setAnimationEnabled(true);/*from w w w. j av a 2s.c o m*/ tree.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { TreeItem item = event.getSelectedItem(); Object userObject = item.getUserObject(); if (userObject instanceof Field) { handleFieldClicked((Field) userObject); return; } if (userObject instanceof Type) { handleTypeClicked((Type) userObject); return; } // otherwise we just clean the infopane infoPane.clear(); } }); tree.addOpenHandler(new OpenHandler<TreeItem>() { public void onOpen(OpenEvent<TreeItem> event) { TreeItem item = event.getTarget(); if (item.getState() && currentOpenItem != item) { if (currentOpenItem != null) { currentOpenItem.setState(false, false); } currentOpenItem = item; } } }); typeInfoTable = new BasicTable(); typeInfoTable.setHeaderHTML(0, "Name"); typeInfoTable.setHeaderHTML(1, "Value"); typeInfoTable.setWidth("400px"); typeInfoTable.getColumnFormatter().setWidth(0, "100px"); fieldInfoTable = new BasicTable(); fieldInfoTable.setHeaderHTML(0, "Name"); fieldInfoTable.setHeaderHTML(1, "Value"); fieldInfoTable.setWidth("400px"); fieldInfoTable.getColumnFormatter().setWidth(0, "200px"); main.addWest(new ScrollPanel(tree), 300); infoPane = new SimplePanel(); infoPane.setSize("100%", "100%"); main.add(new ScrollPanel(infoPane)); initWidget(main); addStyleName("SchemaPane"); }
From source file:org.apache.solr.explorer.client.core.ui.resultspane.ResultsPane.java
License:Apache License
@Initializer public void init() { main.addNorth(headerBar, 25);// w w w. j a v a 2s . c o m tabs = new TabLayout(); main.add(tabs); tabs.addSelectionHandler(new SelectionHandler<TabBar.Tab>() { public void onSelection(SelectionEvent<TabBar.Tab> event) { String id = event.getSelectedItem().getId(); ResultsPaneView view = viewById.get(id); view.afterShowing(); } }); }
From source file:org.apache.solr.explorer.client.core.ui.searchpane.SearchPane.java
License:Apache License
@Initializer public void init() { HorizontalPanel coresSelectionPanel = new HorizontalPanel(); coresSelectionPanel.setStylePrimaryName("CoresSelectionPanel"); coresSelectionPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); coresSelectionPanel.add(new Label("Solr Core: ")); addGap(coresSelectionPanel, "3px"); coresDropDown = new DropDownBox<SolrCoreConfiguration>(); coresDropDown.addSelectionHandler(new SelectionHandler<SolrCoreConfiguration>() { public void onSelection(SelectionEvent<SolrCoreConfiguration> event) { switchCore(event.getSelectedItem()); }//from w ww . j a v a2 s.c o m }); coresSelectionPanel.add(coresDropDown); addGap(coresSelectionPanel, "5px"); aboutLink = new SimpleLinkButton("About", new ClickHandler() { public void onClick(ClickEvent event) { // Window.open(helpUrl, "_blank", "scrollbars=yes"); AboutDialog dialog = new AboutDialog(); dialog.setClosable(true); dialog.center(); dialog.show(); } }); aboutLink.setVisible(false); coresSelectionPanel.add(aboutLink); addGap(coresSelectionPanel, "5px"); main.add(coresSelectionPanel); main.setCellHorizontalAlignment(coresSelectionPanel, VerticalPanel.ALIGN_RIGHT); searchTextBoxHolder = new SimplePanel(); TextBox box = new TextBox(); box.addKeyDownHandler(new EnterKeyHandler() { protected void onEnter(KeyDownEvent keyDownEvent) { executeSearch(); } }); setSearchTextBox(box); SimpleButton searchButton = new SimpleButton("Search", new ClickHandler() { public void onClick(ClickEvent event) { executeSearch(); } }); optionsButton = new SimpleMenuButton("Options", true); HorizontalPanel queryPanel = new HorizontalPanel(); queryPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); queryPanel.add(new Label("Query:")); LayoutUtils.addGap(queryPanel, "10px"); queryPanel.add(searchTextBoxHolder); LayoutUtils.addGap(queryPanel, "15px"); queryPanel.add(searchButton); LayoutUtils.addGap(queryPanel, "15px"); queryPanel.add(optionsButton); filtersPanel = new HorizontalPanel(); hintsPanel = new VerticalPanel(); hintsPanel.setWidth("100%"); hintsPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); hintsPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); main.add(queryPanel); main.setCellHorizontalAlignment(queryPanel, VerticalPanel.ALIGN_CENTER); main.setCellVerticalAlignment(queryPanel, VerticalPanel.ALIGN_MIDDLE); addGap(main, "5px"); main.add(hintsPanel); addGap(main, "10px"); main.add(filtersPanel); main.setCellHorizontalAlignment(filtersPanel, VerticalPanel.ALIGN_CENTER); main.setCellVerticalAlignment(filtersPanel, VerticalPanel.ALIGN_MIDDLE); }
From source file:org.artificer.ui.client.local.pages.OntologiesPage.java
License:Apache License
/** * Post construct.//from w w w. j a va2 s .c om */ @PostConstruct protected void postConstruct() { ontologySummaryPanel.addSelectionHandler(new SelectionHandler<OntologySummaryBean>() { @Override public void onSelection(SelectionEvent<OntologySummaryBean> event) { OntologySummaryBean bean = event.getSelectedItem(); onOntologyClicked(bean); } }); }
From source file:org.cimav.client.ui.departamentos.DepartamentosUI.java
public DepartamentosUI() { buildGrid();//from w w w . j ava 2 s .c o m initWidget(uiBinder.createAndBindUi(this)); // 1era carga de Datos DeptoDatabase.get().load(); // de inicio, poner en Nulo this.clearSelection(); this.updateWidgets(); tabLayout.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { if (event.getSelectedItem() == 0) { // Tab del Grid // DataGrid es un Widget tipo RequireSize; por lo tanto debe ser hijo de un widget tipo ProvidesResize. // De lo contrario se "desaparece" al no poder ajustar a los cambios de tamao. dataGrid.setWidth("100%"); dataGrid.setHeight("100%"); dataGrid.redraw(); } else if (event.getSelectedItem() == 1) { // Tab del Editor } } }); btnReload.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { clearSelection(); DeptoDatabase.get().load(); } }); btnAdd.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // el nuevo debe ser id < 0 y garantizar que si el anterior tambien es nuevo, lo sustituya int idNegativo = DeptoDatabase.currentDepto != null && DeptoDatabase.currentDepto.getId() != null && DeptoDatabase.currentDepto.getId() <= 0 ? DeptoDatabase.currentDepto.getId() - 1 : -1; // crear nuevo Departamento Departamento nuevoDepto = new Departamento(); // con -1 para indicar que es nuevo nuevoDepto.setId(idNegativo); nuevoDepto.setCodigo(""); DeptoDatabase.currentDepto = nuevoDepto; // en vez del clearSelection dataGrid.getSelectionModel().setSelected(DeptoDatabase.currentDepto, true); // dispara el OnSelect (si cambia dado que ) //clearSelection(); tabLayout.selectTab(1); } }); btnEditar.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // simple selecciona el tab del Editor tabLayout.selectTab(1); } }); btnEliminar.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Falta msg de autorizacin de remove // keep el depto a remove Departamento deptoToRemove = DeptoDatabase.currentDepto; // limpia la seleccin clearSelection(); updateWidgets(); // elimina el depto a remove DeptoDatabase.get().removeDepto(deptoToRemove); InfoView.show("Registro " + deptoToRemove.getCodigo() + " eliminado"); } }); btnExtra.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { DeptoDatabase.get().extra(); } }); }