List of usage examples for com.google.gwt.user.client.ui TreeItem TreeItem
TreeItem(boolean isRoot)
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 w w. jav a2 s .c o 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.openjpa.trader.client.ui.ErrorDialog.java
License:Apache License
private Tree addStackTrace(Throwable t) { TreeItem root = new TreeItem(t.getClass().getName()); root.addItem(createMessageLabel(t)); StackTraceElement[] traces = t.getStackTrace(); for (int i = 0; i < traces.length; i++) { root.addItem(createStackTrace(traces[i])); }/*from w w w .j a v a2s. c om*/ tree.addItem(root); Throwable cause = t.getCause(); if (cause == null || cause == t) { return tree; } return addStackTrace(cause); }
From source file:org.apache.sling.explorer.client.widgets.tree.resource.ResourceTree.java
License:Apache License
public void populate() { root = new TreeItem(constants.rootItemDescription()); // try { ///*from ww w . j a v a 2s . co m*/ // SessionInfo info = (SessionInfo) this.getClass().getClassLoader().loadClass("org.apache.sling.explorer.client.sling.SessionInfo").newInstance(); // // root = new TreeItem(info.getUser()); // } // catch(Exception ex) { // return; // } addItem(root); this.loadChildren(root, URL.encode(ExplorerConstants.CONTENT_ROOT + ExplorerConstants.JSON_TREE_REQUEST_EXTENSION)); if (properties != null) { properties.populate(ExplorerConstants.CONTENT_ROOT); } }
From source file:org.apache.solr.explorer.client.core.ui.consolepane.SchemaPane.java
License:Apache License
private void update(Schema schema) { infoPane.clear();/* ww w . j a va2 s . c om*/ tree.removeItems(); TreeItem defaultSearchFieldItem = new TreeItem( "<b>Default Search Field:</b> " + schema.getDefaultSearchField()); tree.addItem(defaultSearchFieldItem); TreeItem uniqueKeyFieldItem = new TreeItem("<b>Unique Key Field:</b> " + schema.getUniqueKeyField()); tree.addItem(uniqueKeyFieldItem); TreeItem typesItem = new TreeItem("<b>Types</b>"); for (Type type : schema.getTypes()) { TreeItem typeItem = new TreeItem(type.getName()); typeItem.setUserObject(type); typesItem.addItem(typeItem); } tree.addItem(typesItem); TreeItem fieldsItem = new TreeItem("<b>Fields</b>"); for (Field field : schema.getFields()) { TreeItem fieldItem = new TreeItem(field.getName()); fieldItem.setUserObject(field); fieldsItem.addItem(fieldItem); } tree.addItem(fieldsItem); }
From source file:org.apache.solr.explorer.client.plugin.debug.ui.DebugConsoleTab.java
License:Apache License
public DebugConsoleTab() { FlowPanel main = new FlowPanel(); BasicTable table = new BasicTable(); table.setHeaderHTML(0, "Name"); table.setHeaderHTML(1, "Value"); table.setText(0, 0, "Raw Query"); table.setWidet(0, 1, rawQueryStringLabel = new Label()); table.setText(1, 0, "Query"); table.setWidet(1, 1, queryStringLabel = new Label()); table.setText(2, 0, "Parsed Query"); table.setWidet(2, 1, parsedQueryStringLabel = new Label()); table.setText(3, 0, "Parsed Query (ToString)"); table.setWidet(3, 1, parsedQueryStringToStringLabel = new Label()); table.setText(4, 0, "Query Parser"); table.setWidet(4, 1, qParserLabel = new Label()); table.getColumnFormatter().setWidth(0, "200px"); table.getCellFormatter().setStyleName(0, 0, "PropertiesTableNameCell"); table.getCellFormatter().setStyleName(1, 0, "PropertiesTableNameCell"); table.getCellFormatter().setStyleName(2, 0, "PropertiesTableNameCell"); table.getCellFormatter().setStyleName(3, 0, "PropertiesTableNameCell"); table.getCellFormatter().setStyleName(4, 0, "PropertiesTableNameCell"); main.add(table);/* www.j a va 2 s . c o m*/ HTML gap = new HTML(); gap.setSize("10px", "10px"); main.add(gap); timingRootLabel = new HTML(); TreeItem root = new TreeItem(timingRootLabel); prepareItem = new TreeItem("Prepare"); root.addItem(prepareItem); processItem = new TreeItem("Process"); root.addItem(processItem); Tree tree = new Tree(); tree.setAnimationEnabled(true); tree.addItem(root); main.add(tree); gap = new HTML(); gap.setSize("10px", "10px"); main.add(gap); ScrollPanel sp = new ScrollPanel(main); sp.setSize("100%", "100%"); initWidget(sp); }
From source file:org.codesearch.searcher.client.ui.fileview.sidebar.SidebarImpl.java
License:Open Source License
private TreeItem convertSidebarNodeToTreeItem(SidebarNode sidebarNode) { TreeItem treeItem = new TreeItem(sidebarNode.getDisplayText()); treeItem.setUserObject(sidebarNode); String cssClasses = sidebarNode.getCssClasses(); if (cssClasses != null) { treeItem.getElement().setClassName(cssClasses.toLowerCase()); }/* w w w . j a va 2 s . c o m*/ treeItem.setState(true); for (SidebarNode s : sidebarNode.getChilds()) { if (s != null) { treeItem.addItem(convertSidebarNodeToTreeItem(s)); } } return treeItem; }
From source file:org.drools.guvnor.client.asseteditor.drools.changeset.CreatePackageResourceWidget.java
License:Apache License
private void populatePackageTree(final Module packageConfigData, final TreeItem rootItem) { final TreeItem packageItem = new TreeItem(packageConfigData.getName()); packageItem.addItem(createTreeItem("LATEST", PackageBuilderWidget.getDownloadLink(packageConfigData))); this.packageService.listSnapshots(packageConfigData.getName(), new AsyncCallback<SnapshotInfo[]>() { public void onFailure(Throwable caught) { ErrorPopup.showMessage("Error listing snapshots information!"); }// w w w .j a va 2 s . com public void onSuccess(SnapshotInfo[] result) { for (int j = 0; j < result.length; j++) { final SnapshotInfo snapshotInfo = result[j]; RepositoryServiceFactory.getPackageService().loadModule(snapshotInfo.getUuid(), new AsyncCallback<Module>() { public void onFailure(Throwable caught) { ErrorPopup.showMessage("Error listing snapshots information!"); } public void onSuccess(Module result) { packageItem.addItem(createTreeItem(snapshotInfo.getName(), PackageBuilderWidget.getDownloadLink(result))); } }); } } }); //if no rootItem, then add the node directly to the tree if (rootItem == null) { this.packageTree.addItem(packageItem); } else { rootItem.addItem(packageItem); } }
From source file:org.drools.guvnor.client.asseteditor.drools.changeset.CreatePackageResourceWidget.java
License:Apache License
private TreeItem createTreeItem(String label, String link) { TreeItem treeItem = new TreeItem(new RadioButton("pkgResourceGroup", label)); treeItem.setUserObject(link);/* w w w . ja v a2 s. c o m*/ return treeItem; }
From source file:org.drools.guvnor.client.asseteditor.drools.springcontext.SpringContextElementsBrowser.java
License:Apache License
private void doLayout() { mainPanel.add(new HTML("<b>Palette</b>")); for (Map.Entry<String, String> entry : springContextElements.entrySet()) { mainPanel.add(new PanelButton(entry.getKey(), entry.getValue())); }//from ww w .j a va 2 s. co m final Tree resourcesTree = new Tree(); mainPanel.add(resourcesTree); final TreeItem rootItem = new TreeItem(Constants.INSTANCE.Packages()); //Global Area Data ModuleServiceAsync moduleService = GWT.create(ModuleService.class); moduleService.loadGlobalModule(new AsyncCallback<Module>() { public void onFailure(Throwable caught) { ErrorPopup.showMessage("Error listing Global Area information!"); } public void onSuccess(Module result) { populatePackageTree(result, rootItem); } }); //Packages Data moduleService.listModules(new AsyncCallback<Module[]>() { public void onFailure(Throwable caught) { ErrorPopup.showMessage("Error listing package information!"); } public void onSuccess(Module[] result) { for (int i = 0; i < result.length; i++) { final Module packageConfigData = result[i]; populatePackageTree(packageConfigData, rootItem); } } }); resourcesTree.addItem(rootItem); resourcesTree.setStyleName("category-explorer-Tree"); //NON-NLS resourcesTree.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { Object o = event.getSelectedItem().getUserObject(); if (o instanceof String) { } } }); ScrollPanel scrollPanel = new ScrollPanel(resourcesTree); scrollPanel.setHeight("150px"); scrollPanel.setWidth("130px"); mainPanel.add(scrollPanel); mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); mainPanel.setSpacing(10); }
From source file:org.drools.guvnor.client.asseteditor.drools.springcontext.SpringContextElementsBrowser.java
License:Apache License
private void populatePackageTree(final Module packageConfigData, final TreeItem rootItem) { final String resourceElement = "<drools:resource type=\"PKG\" source=\"{url}\" basicAuthentication='enabled' username='|' password=''/>"; final TreeItem packageItem = new TreeItem(packageConfigData.getName()); TreeItem leafItem = new TreeItem(new ClickableLabel("LATEST", new LeafClickHandler( packageConfigData.getName(), resourceElement.replace("{url}", PackageBuilderWidget.getDownloadLink(packageConfigData))))); packageItem.addItem(leafItem);//from w w w . j a v a 2s. c om ModuleServiceAsync moduleService = GWT.create(ModuleService.class); moduleService.listSnapshots(packageConfigData.getName(), new AsyncCallback<SnapshotInfo[]>() { public void onFailure(Throwable caught) { ErrorPopup.showMessage("Error listing snapshots information!"); } public void onSuccess(SnapshotInfo[] result) { for (int j = 0; j < result.length; j++) { final SnapshotInfo snapshotInfo = result[j]; ModuleServiceAsync moduleService = GWT.create(ModuleService.class); moduleService.loadModule(snapshotInfo.getUuid(), new AsyncCallback<Module>() { public void onFailure(Throwable caught) { ErrorPopup.showMessage("Error listing snapshots information!"); } public void onSuccess(Module result) { TreeItem leafItem = new TreeItem(new ClickableLabel(snapshotInfo.getName(), new LeafClickHandler(packageConfigData.getName(), resourceElement .replace("{url}", PackageBuilderWidget.getDownloadLink(result))))); packageItem.addItem(leafItem); } }); } } }); rootItem.addItem(packageItem); }