Java Code Examples for com.google.gwt.user.client.ui.TreeItem#getUserObject()

The following examples show how to use com.google.gwt.user.client.ui.TreeItem#getUserObject() . 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 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 2
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 3
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 4
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 5
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 6
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 7
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);

	// Looks if must change icon on parent if now has no childs and properties with user security atention
	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 8
Source File: FolderTree.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 9
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 10
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);

	// Looks if must change icon on parent if now has no childs and properties with user security atention
	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 11
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 12
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);

	// Looks if must change icon on parent if now has no childs and properties with user security atention
	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 13
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 14
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 15
Source File: FolderTree.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);

	// On case folder is subscribed mus change icon
	String subscribed = "";
	if (folderItem.isSubscribed()) {
		subscribed = "_subscribed";
	}

	// 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" + subscribed + ".gif", folderItem
					.getName(), "top"));
		} else {
			item.setHTML(Util.imageItemHTML("img/menuitem_empty" + subscribed + ".gif", folderItem
					.getName(), "top"));
		}
	} else {
		if (folderItem.isHasChildren()) {
			item.setHTML(Util.imageItemHTML("img/menuitem_childs_ro" + subscribed + ".gif", folderItem
					.getName(), "top"));
		} else {
			item.setHTML(Util.imageItemHTML("img/menuitem_empty_ro" + subscribed + ".gif", folderItem
					.getName(), "top"));
		}
	}
}
 
Example 16
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 17
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);

	// Looks if must change icon on parent if now has no childs and properties with user security atention
	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 18
Source File: FolderTree.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Change recursivelly all the childs path
 *
 * @param oldPath
 *            The old path
 * @param newPath
 *            The new path
 * @param itemToChange
 *            The tree item to change the path
 */
public void changePathBeforeRenaming(String oldPath, String newPath, TreeItem itemToChange) {
	for (int i = 0; i < itemToChange.getChildCount(); i++) {
		TreeItem tmpItem = itemToChange.getChild(i);
		GWTFolder gwtFolder = ((GWTFolder) tmpItem.getUserObject());
		gwtFolder.setPath(gwtFolder.getPath().replaceAll(oldPath, newPath));
		gwtFolder.setParentPath(gwtFolder.getParentPath().replaceAll(oldPath, newPath));
		if (tmpItem.getChildCount() > 0) {
			changePathBeforeRenaming(oldPath, newPath, tmpItem);
		}
	}
}
 
Example 19
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 20
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"));
	}
}