当前位置: 首页>>代码示例>>Java>>正文


Java TreeItem类代码示例

本文整理汇总了Java中com.google.gwt.user.client.ui.TreeItem的典型用法代码示例。如果您正苦于以下问题:Java TreeItem类的具体用法?Java TreeItem怎么用?Java TreeItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreeItem类属于com.google.gwt.user.client.ui包,在下文中一共展示了TreeItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TreePanel

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
public TreePanel(GwtTree main) {
	this.main = main;
	
	this.addSelectionHandler(new SelectionHandler<TreeItem>() {
		
		@Override
		public void onSelection(SelectionEvent<TreeItem> event) {
			Object obj = event.getSelectedItem().getUserObject();
			if (obj instanceof CompanyItem) {
				TreePanel.this.main.showCompany(((CompanyItem)obj).getId());
			} else if (obj instanceof DepartmentItem) {
				TreePanel.this.main.showDepartment(((DepartmentItem)obj).getId());
			} else if (obj instanceof EmployeeItem) {
				TreePanel.this.main.showEmployee(((EmployeeItem)obj).getId());
			}
		}
	});
}
 
开发者ID:amritbhat786,项目名称:DocIT,代码行数:19,代码来源:TreePanel.java

示例2: findTreeItem

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Find the TreeItem for a category. If it not exists, create it.
 * TODO: reconstruct
 * @param category category of a moduleId
 * @return TreeItem of the moduleId corresponding to the category
 */
public TreeItem findTreeItem(String category) {
	// default return the system Tree
	if (category.equals(""))
		return getSysTree();

	TreeItem treeItem = sysTreeMap.get(category);
	if (treeItem == null) {
		// Category doesn't exist, create new TreeItems
		int splitIdx = category.lastIndexOf('>');
		String parentCategory = category.substring(0, splitIdx);
		String cateName = category.substring(splitIdx + 1, category.length());
		TreeItem parentItem = findTreeItem(parentCategory);

		//      treeItem = parentItem.addTextItem(cateName);
		treeItem = parentItem.addTextItem(Globalization.getI18NString(cateName));
		treeItem.setState(true);
		sysTreeMap.put(category, treeItem);
	}
	return treeItem;
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:27,代码来源:CopyOfModuleTree.java

示例3: BaseTree

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
public BaseTree() {
	super(new TreeImageResources(), true);

	this.addStyleName("bda-treedir");

	this.addSelectionHandler(new SelectionHandler<TreeItem>() {
		@Override
		public void onSelection(SelectionEvent<TreeItem> event) {
			TreeItem item = event.getSelectedItem();
			Boolean state = item.getState();
			// [GWT Issue 3660] to avoid pass invoke onSection two times
			TreeItem parent = item.getParentItem();
			item.getTree().setSelectedItem(parent, false);
			if (parent != null)
				parent.setSelected(false);
			item.setState(!state);
		}
	});
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:20,代码来源:BaseTree.java

示例4: refreshAssetList

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
private void refreshAssetList() {
  OdeLog.log("AssetList: refreshing for project " + projectId);
  assetList.clear();

  if (assetsFolder != null) {
    for (ProjectNode node : assetsFolder.getChildren()) {
      // Add the name to the tree. We need to enclose it in a span
      // because the CSS style for selection specifies a span.
      String nodeName = node.getName();
      if (nodeName.length() > 20)
        nodeName = nodeName.substring(0, 8) + "..." + nodeName.substring(nodeName.length() - 9,
            nodeName.length());
      TreeItem treeItem = new TreeItem(
          new HTML("<span>" + nodeName + "</span>"));
      // keep a pointer from the tree item back to the actual node
      treeItem.setUserObject(node);
      assetList.addItem(treeItem);
    }
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:21,代码来源:AssetList.java

示例5: getBuiltInBlocksTree

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Constructs a tree item for built-in blocks.
 *
 * @return tree item
 */
public TreeItem getBuiltInBlocksTree() {
  initBundledImages();
  TreeItem builtinNode = new TreeItem(new HTML("<span>" + MESSAGES.builtinBlocksLabel()
      + "</span>"));
  for (final String drawerName : BUILTIN_DRAWER_NAMES) {
    Image drawerImage = new Image(bundledImages.get(drawerName));
    TreeItem itemNode = new TreeItem(new HTML("<span>" + drawerImage
        + getBuiltinDrawerNames(drawerName) + "</span>"));
    SourceStructureExplorerItem sourceItem = new BlockSelectorItem() {
      @Override
      public void onSelected() {
        fireBuiltinDrawerSelected(drawerName);
      }
    };
    itemNode.setUserObject(sourceItem);
    builtinNode.addItem(itemNode);
  }
  builtinNode.setState(true);
  return builtinNode;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:26,代码来源:BlockSelectorBox.java

示例6: getGenericComponentsTree

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Constructs a tree item for generic ("Advanced") component blocks for
 * component types that appear in form.
 *
 * @param form
 *          only component types that appear in this Form will be included
 * @return tree item for this form
 */
public TreeItem getGenericComponentsTree(MockForm form) {
  Map<String, String> typesAndIcons = Maps.newHashMap();
  form.collectTypesAndIcons(typesAndIcons);
  TreeItem advanced = new TreeItem(new HTML("<span>" + MESSAGES.anyComponentLabel() + "</span>"));
  List<String> typeList = new ArrayList<String>(typesAndIcons.keySet());
  Collections.sort(typeList);
  for (final String typeName : typeList) {
    TreeItem itemNode = new TreeItem(new HTML("<span>" + typesAndIcons.get(typeName)
        + MESSAGES.textAnyComponentLabel()
        + ComponentsTranslation.getComponentName(typeName) + "</span>"));
    SourceStructureExplorerItem sourceItem = new BlockSelectorItem() {
      @Override
      public void onSelected() {
        fireGenericDrawerSelected(typeName);
      }
    };
    itemNode.setUserObject(sourceItem);
    advanced.addItem(itemNode);
  }
  return advanced;
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:30,代码来源:BlockSelectorBox.java

示例7: onSelection

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    DatasetWidget datasetWidget = datasetButton.getDatasetWidget();
    boolean isFromMyDatasetWidget = event.getSource().equals(datasetWidget);
    if (isFromMyDatasetWidget) {
        TreeItem item = event.getSelectedItem();
        Object variableUserObject = item.getUserObject();
        if (variableUserObject instanceof VariableSerializable) {
            VariableSerializable variable = (VariableSerializable) variableUserObject;
            // Remove extra variable UserLists before
            // applyVariableChange
            // TODO: Replace this with a higher level method or use
            // events
            variableControls.removeListBoxesExceptFirst();
            if ( variable.getAttributes().get("grid_type").equals(vizGalVariable.getAttributes().get("grid_type") )) {
                applyVariableChange(variable, true);
            } else {
                Window.alert("LAS cannot compare data on a grid with in-situ data.");
            }
        }
    }
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:23,代码来源:OutputPanel.java

示例8: onSelection

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    TreeItem item = event.getSelectedItem();
    currentlySelected = item;
    TreeItem child = item.getChild(0);
    if ( child != null && child.getText().equals(DatasetWidget.LOADING) ) {
        CategorySerializable cat = (CategorySerializable) item.getUserObject();
        Util.getRPCService().getCategories(cat.getID(), null, categoryCallback);
    }
    // Open the item.  Work around double firing bug.
    // http://code.google.com/p/google-web-toolkit/issues/detail?id=3660&q=Tree%20selection&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
    TreeItem selItem = event.getSelectedItem();
    TreeItem parent = selItem.getParentItem();
    selItem.getTree().setSelectedItem(parent, false); // null is ok
    if(parent != null)
        parent.setSelected(false);  // not compulsory
    selItem.setState(!selItem.getState(), false);

}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:20,代码来源:DatasetWidget.java

示例9: addFolder

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Adds folders to actual item if not exists or refreshes it values
 *
 * @param actualItem The actual item active
 * @param newItem New item to be added, or refreshed
 */
public void addFolder(TreeItem actualItem, TreeItem newItem) {
	int i = 0;
	boolean found = false;
	int count = actualItem.getChildCount();
	GWTFolder folder;
	GWTFolder newFolder = (GWTFolder) newItem.getUserObject();
	String folderPath = newFolder.getPath();

	for (i = 0; i < count; i++) {
		folder = (GWTFolder) actualItem.getChild(i).getUserObject();
		// If item is found actualizate values
		if ((folder).getPath().equals(folderPath)) {
			found = true;
			actualItem.getChild(i).setVisible(true);
			actualItem.getChild(i).setUserObject(newFolder);
			evaluesFolderIcon(actualItem.getChild(i));
		}
	}

	if (!found) {
		evaluesFolderIcon(newItem);
		actualItem.addItem(newItem);
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:31,代码来源:FolderSelectTree.java

示例10: evaluesFolderIcon

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Evalues actual folder icon to prevent other user interaction with the same folder
 * this ensures icon and object hasChildsValue are consistent
 */
public void evaluesFolderIcon(TreeItem item) {
	GWTFolder folderItem = (GWTFolder) item.getUserObject();
	preventFolderInconsitences(item);

	// Looks if must change icon on parent if now has no childs and properties with user security atention
	if ((folderItem.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) {
		if (folderItem.isHasChildren()) {
			item.setHTML(Util.imageItemHTML("img/menuitem_childs.gif", folderItem.getName(), "top"));
		} else {
			item.setHTML(Util.imageItemHTML("img/menuitem_empty.gif", folderItem.getName(), "top"));
		}
	} else {
		if (folderItem.isHasChildren()) {
			item.setHTML(Util.imageItemHTML("img/menuitem_childs_ro.gif", folderItem.getName(), "top"));
		} else {
			item.setHTML(Util.imageItemHTML("img/menuitem_empty_ro.gif", folderItem.getName(), "top"));
		}
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:24,代码来源:FolderSelectTree.java

示例11: removeDeleted

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Remove folder from tree after deleted from repository ( normaly deleted
 * on file browser )
 *
 * @param path
 *            The folder
 */
public void removeDeleted(String path) {
	boolean found = false;
	int i = 0;

	while (!found && actualItem.getChildCount() > i) {
		TreeItem tmp = actualItem.getChild(i);

		if (((GWTFolder) tmp.getUserObject()).getPath().equals(path)) {
			actualItem.removeItem(tmp);
			found = true;
		}
		i++;
	}

	// Looks if must change icon on parent if now has no childs and
	// properties
	if (actualItem.getChildCount() < 1) {
		GWTFolder folderItem = (GWTFolder) actualItem.getUserObject();
		folderItem.setHasChildren(false);
	}

	evaluesFolderIcon(actualItem);
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:31,代码来源:FolderTree.java

示例12: getChildFolder

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Get the child folder if folder child path exists on actual tree Item
 * selected
 *
 * @param path
 *            The path
 * @return
 */
public TreeItem getChildFolder(String path) {
	boolean found = false;
	int i = 0;
	TreeItem tmp;

	while (!found && actualItem.getChildCount() > i) {
		tmp = actualItem.getChild(i);

		if (((GWTFolder) tmp.getUserObject()).getPath().equals(path)) {
			found = true;
			return tmp;
		}
		i++;
	}

	return null;
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:26,代码来源:FolderTree.java

示例13: addTmpFolderCreate

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Add temporary folder on creation
 */
public void addTmpFolderCreate() {
	if (folderAction == ACTION_NONE) {
		folderAction = ACTION_CREATE;
		FolderTextBox newFolder = new FolderTextBox();
		tmpFolder = new TreeItem();
		tmpFolder.setWidget(newFolder);
		tmpFolder.setStyleName("okm-TreeItem");
		newFolder.reset();
		newFolder.setText(Main.i18n("tree.folder.new"));
		actualItem.addItem(tmpFolder);
		actualItem.setState(true);
		actualItem.setSelected(false);
		tmpFolder.setSelected(true);
		actualItem = tmpFolder;
		// When we create a new folder we enables selection ( after it,
		// we'll return to disable) for a normal
		// use of the input (if not, cursor and selections not runs
		// propertly )
		rootItem.removeStyleName("okm-DisableSelect"); // Disables drag and
		// drop browser text
		// selection)
		newFolder.setFocus();
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:28,代码来源:FolderTree.java

示例14: refreshChildValues

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
/**
 * Refresh tree iten values when tree folder is changed ( normally on file
 * browser, or by security ).
 *
 * @param folder
 *            The new folder values
 */
public void refreshChildValues(GWTFolder folder) {
	TreeItem tmpItem;
	GWTFolder gWTFolder;

	if (actualItem.getChildCount() > 0) {
		boolean found = false;
		int i = 0;

		while (!found && i < actualItem.getChildCount()) {
			tmpItem = actualItem.getChild(i);
			gWTFolder = (GWTFolder) tmpItem.getUserObject();
			if (folder.getPath().equals(gWTFolder.getPath())) {
				tmpItem.setUserObject(folder);
				evaluesFolderIcon(tmpItem);
				found = true;
			}
			i++;
		}
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:28,代码来源:FolderTree.java

示例15: setImportFolderUI

import com.google.gwt.user.client.ui.TreeItem; //导入依赖的package包/类
private void setImportFolderUI(final TreeItem treeItem, final Node rootNode, final Node newRootNode) {
	for (Node childNode : rootNode.getChildren()) {
		if (rootNode != null && rootNode.getLabel() != null && rootNode.getLabel().getDisplayName() != null
				&& !rootNode.getLabel().getDisplayName().trim().isEmpty()) {
			Node node = new Node();
			node.getLabel().setDisplayName(childNode.getLabel().getDisplayName());
			node.getLabel().setKey(childNode.getLabel().getKey());
			node.setParent(childNode.getParent());
			CheckBox checkBox = new CheckBox();
			checkBox.setText(childNode.getLabel().getDisplayName().trim());
			TreeItem childTree = new TreeItem(checkBox);
			treeItem.addItem(childTree);
			createUI(childNode.getLabel().isMandatory(), checkBox, node, childTree);
			node.setParent(newRootNode);
			newRootNode.getChildren().add(node);
			if (childNode.getChildren() != null && !childNode.getChildren().isEmpty()) {
				setImportFolderUI(childTree, childNode, node);
			}
		}
	}
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:22,代码来源:ImportBatchClassView.java


注:本文中的com.google.gwt.user.client.ui.TreeItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。