List of usage examples for com.google.gwt.user.client.ui TreeItem TreeItem
TreeItem(boolean isRoot)
From source file:org.drools.guvnor.client.explorer.AdminTree.java
License:Apache License
public AdminTree(Map<TreeItem, String> itemWidgets) { setAnimationEnabled(true);//from ww w. jav a 2 s . c om Object[][] adminStructure = new Object[][] { { constants.Category(), images.categorySmall(), "0" }, { constants.Status(), images.statusSmall(), "2" }, { constants.Archive(), images.backupSmall(), "1" }, { constants.EventLog(), images.eventLogSmall(), "4" }, { constants.UserPermission(), images.userPermissionsSmall(), "5" }, //Commented out for now, as we dont want this feature get into 5.2. //{constants.Workspaces(), images.emptyPackage(), "9"}, { constants.ImportExport(), images.saveEdit(), "3" }, { constants.RulesVerification(), images.ruleVerification(), "7" }, { constants.RepositoryConfiguration(), images.config(), "8" }, // {constants.PerspectivesConfiguration(), images.config(), "10"}, { constants.About(), images.information(), "6" } }; for (int i = 0; i < adminStructure.length; i++) { Object[] packageData = adminStructure[i]; TreeItem localChildNode = new TreeItem( Util.getHeader((ImageResource) packageData[1], (String) packageData[0])); itemWidgets.put(localChildNode, (String) packageData[2]); addItem(localChildNode); } }
From source file:org.drools.guvnor.client.explorer.DeploymentTree.java
License:Apache License
public void onOpen(OpenEvent<TreeItem> event) { final TreeItem node = event.getTarget(); if (ExplorerNodeConfig.PACKAGE_SNAPSHOTS.equals(itemWidgets.get(node))) { return;/*from w w w.j a v a2 s . c om*/ } final PackageConfigData conf = (PackageConfigData) node.getUserObject(); if (conf != null) { RepositoryServiceFactory.getService().listSnapshots(conf.name, new GenericCallback<SnapshotInfo[]>() { public void onSuccess(SnapshotInfo[] snaps) { node.removeItems(); for (final SnapshotInfo snapInfo : snaps) { TreeItem snap = new TreeItem(snapInfo.name); //snap.setTooltip(snapInfo.comment); snap.setUserObject(new Object[] { snapInfo, conf }); node.addItem(snap); } } }); } }
From source file:org.drools.guvnor.client.explorer.ExplorerNodeConfig.java
License:Apache License
private static void buildDeploymentTree(TreeItem root, Folder fldr) { if (fldr.getPackageConfigData() != null) { TreeItem pkg = new TreeItem( Util.getHeader(images.snapshotSmall(), fldr.getPackageConfigData().getName())); pkg.setUserObject(fldr.getPackageConfigData()); pkg.addItem(new TreeItem(constants.PleaseWaitDotDotDot())); root.addItem(pkg);/* ww w. j a v a 2 s .co m*/ } else { TreeItem tn = new TreeItem(Util.getHeader(images.emptyPackage(), fldr.getFolderName())); root.addItem(tn); for (Folder c : fldr.getChildren()) { buildDeploymentTree(tn, c); } } }
From source file:org.drools.guvnor.client.explorer.ExplorerNodeConfig.java
License:Apache License
private static GenericCallback<String[]> createGenericCallbackForLoadChildCategories(final TreeItem treeItem, final String path, final Map<TreeItem, String> itemWidgets) { return new GenericCallback<String[]>() { public void onSuccess(String[] value) { if (value.length == 0) { infanticide(treeItem);// w w w .j ava2s. c om } else { createChildNodes(treeItem, path, itemWidgets, value); } } private void createChildNodes(final TreeItem treeItem, final String path, final Map<TreeItem, String> itemWidgets, String[] value) { for (final String current : value) { final TreeItem childNode = new TreeItem(Util.getHeader(images.categorySmall(), current)); //ID for category tabs. String widgetId = CATEGORY_ID + "-" + ((path.equals("/")) ? current : path + "/" + current); itemWidgets.put(childNode, widgetId); treeItem.addItem(childNode); childNode.addItem( new TreeItem(Util.getHeader(images.categorySmall(), constants.PleaseWaitDotDotDot()))); childNode.getTree().addOpenHandler(createOpenHandlerForTree(itemWidgets, childNode)); } } private OpenHandler<TreeItem> createOpenHandlerForTree(final Map<TreeItem, String> itemWidgets, final TreeItem childNode) { return new OpenHandler<TreeItem>() { boolean expanding = false; public void onOpen(OpenEvent<TreeItem> event) { if (!expanding && event.getTarget() == childNode) { expanding = true; String widgetID = itemWidgets.get(event.getTarget()); String path = widgetID.substring(widgetID.indexOf("-") + 1); infanticide(childNode); doCategoryNode(childNode, path, itemWidgets); expanding = false; } } }; } }; }
From source file:org.drools.guvnor.client.explorer.ExplorerNodeConfig.java
License:Apache License
public static Tree getQAStructure(final Map<TreeItem, String> itemWidgets) { Tree tree = new Tree(); tree.setAnimationEnabled(true);//from w ww . j ava 2 s . c om final TreeItem scenarios = new TreeItem( Util.getHeader(images.testManager(), constants.TestScenariosInPackages())); scenarios.addItem(new TreeItem(constants.PleaseWaitDotDotDot())); tree.addItem(scenarios); itemWidgets.put(scenarios, TEST_SCENARIOS_ROOT_ID); final TreeItem analysis = new TreeItem(Util.getHeader(images.analyze(), constants.Analysis())); analysis.addItem(new TreeItem(constants.PleaseWaitDotDotDot())); itemWidgets.put(analysis, ANALYSIS_ROOT_ID); if (ApplicationPreferences.showVerifier()) { tree.addItem(analysis); } return tree; }
From source file:org.drools.guvnor.client.explorer.navigation.admin.AdminTree.java
License:Apache License
public AdminTree(Map<TreeItem, String> itemWidgets) { setAnimationEnabled(true);// w ww .ja v a2 s. c om Object[][] adminStructure = new Object[][] { { constants.Category(), images.categorySmall(), "0" }, { constants.Status(), images.statusSmall(), "2" }, { constants.Archive(), images.backupSmall(), "1" }, { constants.EventLog(), images.eventLogSmall(), "4" }, { constants.UserPermission(), images.userPermissionsSmall(), "5" }, { constants.ImportExport(), images.saveEdit(), "3" }, { constants.RepositoryConfiguration(), images.config(), "8" }, { constants.About(), images.information(), "6" } }; for (Object[] packageData : adminStructure) { TreeItem localChildNode = new TreeItem( Util.getHeader((ImageResource) packageData[1], (String) packageData[0])); itemWidgets.put(localChildNode, (String) packageData[2]); addItem(localChildNode); } }
From source file:org.drools.guvnor.client.explorer.navigation.deployment.DeploymentTree.java
License:Apache License
public void onOpen(OpenEvent<TreeItem> event) { final TreeItem node = event.getTarget(); if (ExplorerNodeConfig.PACKAGE_SNAPSHOTS.equals(itemWidgets.get(node))) { return;// w w w . j a v a 2 s . c o m } if (node.getUserObject() instanceof Module) { final Module packageConfigData = (Module) node.getUserObject(); ModuleServiceAsync moduleService = GWT.create(ModuleService.class); moduleService.listSnapshots(packageConfigData.getName(), new GenericCallback<SnapshotInfo[]>() { public void onSuccess(SnapshotInfo[] snaps) { node.removeItems(); for (final SnapshotInfo snapInfo : snaps) { TreeItem snap = new TreeItem(snapInfo.getName()); snap.setUserObject(new SnapshotPlace(packageConfigData.getName(), snapInfo.getName())); node.addItem(snap); } } }); } }
From source file:org.drools.guvnor.client.explorer.navigation.modules.ModuleTreeItemViewImpl.java
License:Apache License
public void add(ImageResource formatIcon, String formatText, ModuleFormatsGridPlace formatsPlace) { TreeItem treeItem = new TreeItem(Util.getHeader(formatIcon, formatText)); treeItem.setUserObject(formatsPlace); root.addItem(treeItem);//w ww .j a v a 2s . c o m }
From source file:org.drools.guvnor.client.explorer.navigation.qa.FactUsagesItem.java
License:Apache License
private void doFacts(AnalysisFactUsage[] factUsages) { for (AnalysisFactUsage factUsage : factUsages) { TreeItem fact = new TreeItem( createImageTag(DroolsGuvnorImageResources.INSTANCE.fact()) + factUsage.name); TreeItem fieldList = doFields(factUsage.fields); fact.addItem(fieldList);/*from w w w. j ava2 s. c o m*/ fieldList.setState(true); addItem(fact); fact.setState(true); } }
From source file:org.drools.guvnor.client.explorer.navigation.qa.FactUsagesItem.java
License:Apache License
private TreeItem doFields(AnalysisFieldUsage[] fields) { TreeItem fieldList = new TreeItem(Constants.INSTANCE.FieldsUsed()); for (AnalysisFieldUsage fieldUsage : fields) { TreeItem field = new TreeItem( createImageTag(DroolsGuvnorImageResources.INSTANCE.field()) + fieldUsage.name); fieldList.addItem(field);/*from w w w . j ava 2 s. c o m*/ TreeItem ruleList = doAffectedRules(fieldUsage); field.addItem(ruleList); field.setState(true); } return fieldList; }