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

The following examples show how to use com.google.gwt.user.client.ui.Tree. 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: UniTimeMobileMenu.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void saveState() {
	List<String> nodes = new ArrayList<String>();
	nodes.add(iStackPanel.getStackText(iStackPanel.getSelectedIndex()));
	for (int i = 0; i < iStackPanel.getWidgetCount(); i++) {
		if (iStackPanel.getWidget(i) instanceof Tree) {
			Tree t = (Tree)iStackPanel.getWidget(i);
			for (int j = 0; j < t.getItemCount(); j++) {
				openedNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
			}
		}
	}
	String sideBarCookie = "";
	for (String node: nodes) {
		if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
		sideBarCookie += node;
	}
	Cookies.setCookie("UniTime:MobileMenu", sideBarCookie);
}
 
Example #2
Source File: UniTimeMobileMenu.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void restoreState() {
	Set<String> nodes = new HashSet<String>();
	String sideBarCookie = Cookies.getCookie("UniTime:MobileMenu");
	if (sideBarCookie != null)
		for (String node: sideBarCookie.split("\\|"))
			nodes.add(node);
	for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
		if (nodes.contains(iStackPanel.getStackText(i))) {
			iStackPanel.showStack(i);
		}
		if (iStackPanel.getWidget(i) instanceof Tree) {
			Tree t = (Tree)iStackPanel.getWidget(i);
			for (int j = 0; j < t.getItemCount(); j++) {
				openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
			}
		}
	}
}
 
Example #3
Source File: UniTimeSideBar.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void restoreState() {
	Set<String> nodes = new HashSet<String>();
	String sideBarCookie = Cookies.getCookie("UniTime:SideBar");
	if (sideBarCookie != null)
		for (String node: sideBarCookie.split("\\|"))
			nodes.add(node);
	iDisclosurePanel.setOpen(nodes.contains("Root") || sideBarCookie == null);
	if (iUseStackPanel)
		for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
			if (nodes.contains(iStackPanel.getStackText(i))) {
				iStackPanel.showStack(i);
			}
			if (iStackPanel.getWidget(i) instanceof Tree) {
				Tree t = (Tree)iStackPanel.getWidget(i);
				for (int j = 0; j < t.getItemCount(); j++) {
					openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
				}
			}
		}
	else
		for (int i = 0; i < iTree.getItemCount(); i++) {
			openNodes(nodes, iTree.getItem(i), null);
		}
}
 
Example #4
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 #5
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 #6
Source File: UniTimeSideBar.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void saveState() {
	List<String> nodes = new ArrayList<String>();
	if (iUseStackPanel) {
		nodes.add(iStackPanel.getStackText(iStackPanel.getSelectedIndex()));
		for (int i = 0; i < iStackPanel.getWidgetCount(); i++) {
			if (iStackPanel.getWidget(i) instanceof Tree) {
				Tree t = (Tree)iStackPanel.getWidget(i);
				for (int j = 0; j < t.getItemCount(); j++) {
					openedNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
				}
			}
		}
	} else {
		for (int i = 0; i < iTree.getItemCount(); i++) {
			openedNodes(nodes, iTree.getItem(i), null);
		}
	}
	String sideBarCookie = "";
	if (iDisclosurePanel.isOpen()) sideBarCookie += "Root";
	for (String node: nodes) {
		if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
		sideBarCookie += node;
	}
	sideBarCookie += "|W:" + iPanel.getElement().getClientWidth();
	Cookies.setCookie("UniTime:SideBar", sideBarCookie);
	resizeWideTables();
}
 
Example #7
Source File: GalleryTreeViewImpl.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
@PostConstruct
private void initUI() {
    initWidget(mainPanel);

    Tree tree = initNavigationTree();
    tree.setWidth("150px");
    Style leftStyle = mainPanel.getElement().getStyle();
    leftStyle.setPropertyPx("margin", 5);
    mainPanel.add(tree);
}
 
Example #8
Source File: GalleryTreeViewImpl.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
private Tree initNavigationTree() {
    Tree navTree = new Tree();

    List<GalleryTreeNode> mainNodes = galleryTree.getMainNodes();
    populateNavigationTree(mainNodes, navTree);

    navTree.addSelectionHandler(new SelectionHandler<TreeItem>() {
        public void onSelection(SelectionEvent<TreeItem> event) {
            TreeItem ti = event.getSelectedItem();
            GalleryTreeNode node = (GalleryTreeNode) ti.getUserObject();
            treeItemClicked(ti, node);
        }
    });
    return navTree;
}
 
Example #9
Source File: AccessLogView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public AccessLogView() {
    this.tree = new Tree();

    log.addListener(new ResourceAccessLog.Listener() {
        @Override
        public void onChange() {
            updateTreee();
        }
    });
}
 
Example #10
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 #11
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 #12
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 #13
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 #14
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 #15
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);
}