Java Code Examples for com.google.gwt.user.client.ui.Tree#getItem()

The following examples show how to use com.google.gwt.user.client.ui.Tree#getItem() . 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: 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 2
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 3
Source File: ModelBrowserView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private TreeItem findTreeItem(Tree tree, ModelNode address) {
    List<Property> subAddress = getSubaddress(address);

    LinkedList<String> path = new LinkedList<String>();
    path.add(currentRootKey);

    for(Property prop : subAddress)
    {
        path.add(prop.getName());
        final String value = prop.getValue().asString();
        if(!WILDCARD.equals(value)) {
            path.add(value);
        }
    }

    final Iterator<String> iterator = path.iterator();

    TreeItem next = null;

    if(iterator.hasNext())
    {
        final String pathName = iterator.next();
        for(int i=0; i<tree.getItemCount(); i++)
        {
            if(tree.getItem(i).getText().equals(pathName))
            {
                next = tree.getItem(i);
                break;
            }
        }
    }

    if(next==null)
        return null;
    else if (!iterator.hasNext())
        return next;
    else
        return findTreeItem(next, iterator);
}
 
Example 4
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 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();

			// Enables or disables move button ( evalues security to move to folder with permissions )
			if (rootItem.equals(item)) {
				Main.get().categoriesPopup.enable(false);
			} else {
				Main.get().categoriesPopup.enable(true);
			}

			// 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 5
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 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();

			// Enables or disables move button ( evalues security to move to folder with permissions )
			if (rootItem.equals(item)) {
				Main.get().wizardPopup.categoriesWidget.enable(false);
			} else {
				Main.get().wizardPopup.categoriesWidget.enable(true);
			}

			// 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 6
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 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;
				}
			}

			// Enables or disables move button ( evalues security to move to folder with permissions )
			if (rootItem.equals(actualItem)) {
				Main.get().mainPanel.desktop.navigator.thesaurusTree.thesaurusSelectPopup.enable(false);
			} else {
				Main.get().mainPanel.desktop.navigator.thesaurusTree.thesaurusSelectPopup.enable(true);
			}

			if (refresh) {
				refresh(true);
			}
		}
	});
	actualItem = tree.getItem(0);
	initWidget(tree);
}
 
Example 7
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 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();

			// Enables or disables move button ( evalues security to move to folder with permissions )
			if (rootItem.equals(item)) {
				Main.get().mainPanel.desktop.navigator.categoriesTree.categoriesSelectPopup.enable(false);
			} else {
				Main.get().mainPanel.desktop.navigator.categoriesTree.categoriesSelectPopup.enable(true);
			}

			// 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 8
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 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();

			// Enables or disables move button ( evalues security to move to folder with permissions )
			evaluateSecurityToAction(item);

			// 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);
}