com.google.gwt.user.client.ui.TreeItem Java Examples

The following examples show how to use com.google.gwt.user.client.ui.TreeItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FolderTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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++;
		}
	}
}
 
Example #2
Source File: AccessLogView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void updateTreee() {
    tree.removeItems();

    Iterator<String> keys = log.getKeys();

    while(keys.hasNext())
    {
        String token = keys.next();
        Set<String> addresses = log.getAddresses(token);

        SafeHtmlBuilder sh = new SafeHtmlBuilder();
        TreeItem parent = tree.addItem(sh.appendEscaped(token+" ("+addresses.size()+")").toSafeHtml());

        for(String address : addresses)
        {
            SafeHtmlBuilder sh2 = new SafeHtmlBuilder();
            parent.addItem(sh2.appendEscaped(address).toSafeHtml());
        }
    }
}
 
Example #3
Source File: BlockSelectorBox.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: BlockSelectorBox.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a tree item for built-in blocks.
 *
 * @return tree item
 */
public TreeItem getBuiltInBlocksTree(MockForm form) {
  initBundledImages();
  TreeItem builtinNode = new TreeItem(new HTML("<span>" + MESSAGES.builtinBlocksLabel()
      + "</span>"));
  for (final String drawerName : getSubsetDrawerNames(form)) {
    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;
}
 
Example #5
Source File: CopyOfModuleTree.java    From EasyML with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: ModelBrowserView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void addChildrenTypes(ModelTreeItem rootItem, List<ModelNode> modelNodes) {

        rootItem.removeItems();

        final ChildInformation childInformation = parseChildrenTypes(modelNodes);

        for(String child : childInformation.getNames())
        {
            final ModelNode address = getNodeAddress(rootItem, child);

            SafeHtmlBuilder html = new SafeHtmlBuilder();
            html.appendHtmlConstant("<i class='icon-folder-close-alt'></i>&nbsp;");
            html.appendEscaped(child);
            TreeItem childItem = new ModelTreeItem(html.toSafeHtml(), child, address, childInformation.isSingleton(child));
            childItem.addItem(new PlaceholderItem());
            rootItem.addItem(childItem);
            rootItem.updateChildInfo(childInformation);
        }

        rootItem.setState(true);
    }
 
Example #7
Source File: MockComponent.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a tree item for the component which will be displayed in the
 * source structure explorer.
 *
 * @return  tree item for this component
 */
protected TreeItem buildTree() {
  // Instantiate new tree item for this component
  // Note: We create a ClippedImagePrototype because we need something that can be
  // used to get HTML for the iconImage. AbstractImagePrototype requires
  // an ImageResource, which we don't necessarily have.
  TreeItem itemNode = new TreeItem(
      new HTML("<span>" + iconImage.getElement().getString() + SafeHtmlUtils.htmlEscapeAllowEntities(getName()) + "</span>")) {
    @Override
    protected Focusable getFocusable() {
      return nullFocusable;
    }
  };
  itemNode.setUserObject(sourceStructureExplorerItem);
  return itemNode;
}
 
Example #8
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
	}
}
 
Example #9
Source File: FolderTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
	}
}
 
Example #11
Source File: BaseTree.java    From EasyML with Apache License 2.0 6 votes vote down vote up
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);
		}
	});
}
 
Example #12
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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"));
		}
	}
}
 
Example #13
Source File: ModelBrowserView.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private static TreeItem findTreeItem(TreeItem tree, Iterator<String> iterator)
{
    TreeItem next = null;
    if(iterator.hasNext())
    {
        final String pathName = iterator.next();
        for(int i=0; i<tree.getChildCount(); i++)
        {

            if(tree.getChild(i).getText().equals(pathName))
            {
                next = tree.getChild(i);
                break;
            }
        }
    }

    if(next==null)
        return null;
    else if (!iterator.hasNext())
        return next;
    else
        return findTreeItem(next, iterator);

}
 
Example #14
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
	}
}
 
Example #15
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
	}
}
 
Example #16
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
	}
}
 
Example #17
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hides all items on a brach
 *
 * @param actualItem The actual item active
 */
public void hideAllBranch(TreeItem actualItem) {
	int i = 0;
	int count = actualItem.getChildCount();

	for (i = 0; i < count; i++) {
		actualItem.getChild(i).setVisible(false);
	}
}
 
Example #18
Source File: YaBlocksEditor.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private void updateBlocksTree(MockForm form, SourceStructureExplorerItem itemToSelect) {
  TreeItem items[] = new TreeItem[3];
  items[0] = BlockSelectorBox.getBlockSelectorBox().getBuiltInBlocksTree(form);
  items[1] = form.buildComponentsTree();
  items[2] = BlockSelectorBox.getBlockSelectorBox().getGenericComponentsTree(form);
  sourceStructureExplorer.updateTree(items, itemToSelect);
}
 
Example #19
Source File: ModelBrowserView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * When a tree item is clicked we load the resource.
 *
 * @param treeItem
 */
private void onItemSelected(TreeItem treeItem) {

    treeItem.getElement().focus();
    final LinkedList<String> path = resolvePath(treeItem);

    formView.clearDisplay();
    descView.clearDisplay();

    ModelNode address = toAddress(path);
    ModelNode displayAddress = address.clone();

    boolean isPlaceHolder = (treeItem instanceof PlaceholderItem);
    //ChildInformation childInfo = findChildInfo(treeItem);

    if(path.size()%2==0) {

        /*String denominatorType = AddressUtils.getDenominatorType(address.asPropertyList());
        boolean isSingleton = denominatorType!=null ? childInfo.isSingleton(denominatorType) : false; // false==root*/

        // addressable resources
        presenter.readResource(address, isPlaceHolder);

        toggleEditor(true);
        filter.setEnabled(true);

    }
    else {
        toggleEditor(false);
        // display tweaks
        displayAddress.add(path.getLast(), WILDCARD);

        // force loading of children upon selection
        loadChildren((ModelTreeItem)treeItem, false);
        filter.setEnabled(false);
    }

    nodeHeader.updateDescription(displayAddress);
}
 
Example #20
Source File: MockContainer.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
@Override
protected TreeItem buildTree() {
  TreeItem itemNode = super.buildTree();

  // Recursively build the tree for child components
  for (MockComponent child : children) {
    itemNode.addItem(child.buildTree());
  }

  itemNode.setState(expanded);

  return itemNode;
}
 
Example #21
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Folder Tree
 */
public FolderSelectTree() {
	tree = new Tree();
	rootItem.setHTML(Util.imageItemHTML("img/menuitem_childs.gif", "root_schema", "top"));
	rootItem.setStyleName("okm-TreeItem");
	rootItem.setUserObject(new GWTFolder());
	rootItem.setSelected(true);
	rootItem.setState(true);
	tree.setStyleName("okm-Tree");
	tree.addItem(rootItem);
	tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
		@Override
		public void onSelection(SelectionEvent<TreeItem> event) {
			boolean refresh = true;
			TreeItem item = event.getSelectedItem();

			// Case that not refreshing tree and file browser ( right click )
			if (actualItem.equals(item)) {
				refresh = false;
			} else {
				// Disables actual item because on changing active node by
				// application this it's not changed automatically
				if (!actualItem.equals(item)) {
					actualItem.setSelected(false);
					actualItem = item;
				} else {
					refresh = false;
				}
			}

			if (refresh) {
				refresh(true);
			}
		}
	});
	actualItem = tree.getItem(0);
	initWidget(tree);
}
 
Example #22
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);

	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"));
	}
}
 
Example #23
Source File: ServerGroupSection.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ServerGroupSection() {

        panel = new DisclosureStackPanel(Console.CONSTANTS.common_label_serverGroups()).asWidget();
        serverGroupTree = new LHSNavTree("groups");

        final String token = "domain/" + NameTokens.ServerGroupPresenter;
        final TreeItem item = new LHSNavTreeItem(Console.CONSTANTS.common_label_serverGroupConfigurations(), token);
        serverGroupTree.addItem(item);

        panel.setContent(serverGroupTree);
    }
 
Example #24
Source File: FolderTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onSuccess(GWTFolder result) {
	actualItem = actualItem.getParentItem(); // Restores the real
	// actualItem
	tmpFolder.setSelected(false);
	actualItem.setSelected(true);
	actualItem.setState(true);
	GWTFolder folder = result;
	GWTFolder folderItem = (GWTFolder) actualItem.getUserObject();
	folderItem.setHasChildren(true);
	actualItem.removeItem(tmpFolder);
	TreeItem newFolder = new TreeItem();
	newFolder.setHTML(Util.imageItemHTML("img/menuitem_empty.gif", folder.getName(),"top"));
	newFolder.setUserObject(folder);
	newFolder.setStyleName("okm-TreeItem");
	actualItem.addItem(newFolder);
	evaluesFolderIcon(newFolder);
	evaluesFolderIcon(actualItem);
	Main.get().mainPanel.desktop.navigator.status.unsetFlagCreate();
	if (Main.get().mainPanel.desktop.navigator.getStackIndex() != UIDesktopConstants.NAVIGATOR_CATEGORIES) {
		Main.get().mainPanel.desktop.browser.fileBrowser.status.setFlagFolderChilds();
		Main.get().mainPanel.desktop.browser.fileBrowser.addFolder(folder);
	}

	// Special case when we are creating a folder and selects other tree
	// item before removing tmp folder
	// must changing to the real item selected
	if (otherTreeItemSelected != null) {
		onTreeItemSelected(otherTreeItemSelected);
		otherTreeItemSelected = null;
	}

	folderAction = ACTION_NONE;
}
 
Example #25
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hides all items on a brach
 *
 * @param actualItem The actual item active
 */
public void hideAllBranch(TreeItem actualItem) {
	int i = 0;
	int count = actualItem.getChildCount();

	for (i = 0; i < count; i++) {
		actualItem.getChild(i).setVisible(false);
	}
}
 
Example #26
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prevents folder incosistences between server ( multi user deletes folder ) and tree
 * nodes drawed
 *
 * @param item The tree node
 */
public void preventFolderInconsitences(TreeItem item) {
	GWTFolder folderItem = (GWTFolder) item.getUserObject();

	// Case that must remove all items node
	if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
		while (item.getChildCount() > 0) {
			item.getChild(0).remove();
		}
	}
	if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
		folderItem.setHasChildren(false);
	}
}
 
Example #27
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Hides all items on a brach
 *
 * @param actualItem The actual item active
 */
public void hideAllBranch(TreeItem actualItem) {
	int i = 0;
	int count = actualItem.getChildCount();

	for (i = 0; i < count; i++) {
		actualItem.getChild(i).setVisible(false);
	}
}
 
Example #28
Source File: ModelBrowserView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Child selection within editor components (outside left hand tree)
 * @param address
 * @param childName
 */
@Override
public void onViewChild(ModelNode address, String childName) {
    TreeItem rootNode = findTreeItem(tree, address);
    TreeItem childNode = null;
    for(int i=0; i<rootNode.getChildCount(); i++)
    {
        TreeItem candidate = rootNode.getChild(i);
        if(childName.equals(candidate.getText()))
        {
            childNode = candidate;
            break;
        }
    }

    if(null==childNode)
        throw new IllegalArgumentException("No such child "+ childName + " on "+ address.toString());


    // deselect previous
    tree.setSelectedItem(null, false);

    // select next
    tree.setSelectedItem(childNode, false);
    tree.ensureSelectedItemVisible();

    onItemSelected(childNode);
}
 
Example #29
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prevents folder inconsistences between server ( multi user deletes folder ) and tree
 * nodes drawn
 *
 * @param item The tree node
 */
public void preventFolderInconsitences(TreeItem item) {
	GWTFolder folderItem = (GWTFolder) item.getUserObject();

	// Case that must remove all items node
	if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
		while (item.getChildCount() > 0) {
			item.getChild(0).remove();
		}
	}

	if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
		folderItem.setHasChildren(false);
	}
}
 
Example #30
Source File: PlaygroundView.java    From caja with Apache License 2.0 5 votes vote down vote up
private static TreeItem addExampleItem(Map<Example.Type, TreeItem> menu,
    Example eg) {
  if (!menu.containsKey(eg.type)) {
    TreeItem menuItem = new TreeItem(eg.type.description);
    menu.put(eg.type, menuItem);
  }
  TreeItem egItem = new TreeItem(eg.description);
  menu.get(eg.type).addItem(egItem);
  return egItem;
}