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

The following examples show how to use com.google.gwt.user.client.ui.Tree#addSelectionHandler() . 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: 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 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);
}