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

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

	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: 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 9
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 10
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	boolean directAdd = true;

	// If has no childs directly add values is permited
	if (actualItem.getChildCount() > 0) {
		directAdd = false;
		// to prevent remote folder remove it disables all tree branch
		// items and after sequentially activate
		hideAllBranch(actualItem);
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (result.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = result.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// If has no childs directly add values is permited, else
		// evalues each node to refresh, remove or add
		if (directAdd) {
			evaluesFolderIcon(folderItem);
			actualItem.addItem(folderItem);
		} else {
			// sequentially activate items and refreshes values
			addFolder(actualItem, folderItem);
		}
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);
}
 
Example 11
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	boolean directAdd = true;

	// If has no childs directly add values is permited
	if (actualItem.getChildCount() > 0) {
		directAdd = false;
		// to prevent remote folder remove it disables all tree branch
		// items and after sequentially activate
		hideAllBranch(actualItem);
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (result.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = result.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// If has no childs directly add values is permited, else
		// evalues each node to refresh, remove or add
		if (directAdd) {
			evaluesFolderIcon(folderItem);
			actualItem.addItem(folderItem);
		} else {
			// sequentially activate items and refreshes values
			addFolder(actualItem, folderItem);
		}
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);
	Main.get().mainPanel.desktop.navigator.thesaurusTree.thesaurusSelectPopup.thesaurusPanel.status.unsetFlagChilds();
}
 
Example 12
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	boolean directAdd = true;

	// If has no childs directly add values is permited
	if (actualItem.getChildCount() > 0) {
		directAdd = false;
		// to prevent remote folder remove it disables all tree branch
		// items and after sequentially activate
		hideAllBranch(actualItem);
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (result.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = result.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// If has no childs directly add values is permited, else
		// evalues each node to refresh, remove or add
		if (directAdd) {
			evaluesFolderIcon(folderItem);
			actualItem.addItem(folderItem);
		} else {
			// sequentially activate items and refreshes values
			addFolder(actualItem, folderItem);
		}
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);
}
 
Example 13
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	boolean directAdd = true;

	// If has no childs directly add values is permited
	if (actualItem.getChildCount() > 0) {
		directAdd = false;
		// to prevent remote folder remove it disables all tree branch
		// items and after sequentially activate
		hideAllBranch(actualItem);
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (result.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = result.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// If has no childs directly add values is permited, else
		// evalues each node to refresh, remove or add
		if (directAdd) {
			evaluesFolderIcon(folderItem);
			actualItem.addItem(folderItem);
		} else {
			// sequentially activate items and refreshes values
			addFolder(actualItem, folderItem);
		}
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);
	Main.get().mainPanel.desktop.navigator.categoriesTree.categoriesSelectPopup.status.unsetFlagChilds();
}
 
Example 14
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	boolean directAdd = true;

	// If has no childs directly add values is permited
	if (actualItem.getChildCount() > 0) {
		directAdd = false;
		// to prevent remote folder remove it disables all tree branch
		// items and after sequentially activate
		hideAllBranch(actualItem);
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (result.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = result.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// If has no childs directly add values is permited, else
		// evalues each node to refresh, remove or add
		if (directAdd) {
			evaluesFolderIcon(folderItem);
			actualItem.addItem(folderItem);
		} else {
			// sequentially activate items and refreshes values
			addFolder(actualItem, folderItem);
		}
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);
}
 
Example 15
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	boolean directAdd = true;

	// If has no childs directly add values is permited
	if (actualItem.getChildCount() > 0) {
		directAdd = false;
		// to prevent remote folder remove it disables all tree branch
		// items and after sequentially activate
		hideAllBranch(actualItem);
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (result.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = result.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// If has no childs directly add values is permited, else
		// evalues each node to refresh, remove or add
		if (directAdd) {
			evaluesFolderIcon(folderItem);
			actualItem.addItem(folderItem);
		} else {
			// sequentially activate items and refreshes values
			addFolder(actualItem, folderItem);
		}
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);
}
 
Example 16
Source File: FolderTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	List<GWTFolder> folderList = result;

	autoOpenFolder = actualItem.getState(); // Actual folder open state
	// Case first refreshing when (childcount = 0 or treeItem changed ) and results >0 must ensure enables auto open
	if ((actualItem.getChildCount() == 0 || treeItemChanged) && result.size() > 0) {
		autoOpenFolder = true;
	}

	// Remove all items
	if (actualItem.getChildCount() > 0) {
		actualItem.removeItems();
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (folderList.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = folderList.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// add values
		evaluesFolderIcon(folderItem);
		actualItem.addItem(folderItem);
	}
	// Evaluates special case has closed parent folder ( and selected folder was a child )
	if (!treeItemHasBeenClosed) {
		actualItem.setState(autoOpenFolder); // Enables auto open or close tree node
	} else {
		treeItemHasBeenClosed = false;
	}
	evaluesFolderIcon(actualItem);

	if (setTabFolderAfterRefresh) {
		// Refresh tab properties values on the last node
		showTabFolderProperties();
		setTabFolderAfterRefresh = false;
	}

	Main.get().mainPanel.desktop.navigator.status.unsetFlagChilds();
}
 
Example 17
Source File: FolderTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	List<GWTFolder> folderList = result;

	// Remove olders items
	if (actualItem.getChildCount() > 0) {
		actualItem.removeItems();
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (folderList.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = folderList.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// add values
		evaluesFolderIcon(folderItem);
		actualItem.addItem(folderItem);
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);

	if (!tmpAllPathFolder.isEmpty()) {
		int index = tmpAllPathFolder.size() - 1;
		String tmpPath = tmpAllPathFolder.get(index);
		tmpAllPathFolder.remove(index);
		if (index > 0) {
			setActiveNode(tmpPath, false, false);
		} else {
			setActiveNode(tmpPath, false, refreshFileBrowser);
		}
	} else {
		openingFldPath = false;
	}
}
 
Example 18
Source File: FolderSelectTree.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onSuccess(List<GWTFolder> result) {
	boolean directAdd = true;

	// If has no childs directly add values is permited
	if (actualItem.getChildCount() > 0) {
		directAdd = false;
		// to prevent remote folder remove it disables all tree branch
		// items and after sequentially activate
		hideAllBranch(actualItem);
	}

	// On refreshing not refreshed the actual item values but must
	// ensure that has childs value is consistent
	if (result.isEmpty()) {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(false);
	} else {
		((GWTFolder) actualItem.getUserObject()).setHasChildren(true);
	}

	// Ads folders childs if exists
	for (Iterator<GWTFolder> it = result.iterator(); it.hasNext(); ) {
		GWTFolder folder = it.next();
		TreeItem folderItem = new TreeItem();
		folderItem.setHTML(folder.getName());
		folderItem.setUserObject(folder);
		folderItem.setStyleName("okm-TreeItem");

		// If has no childs directly add values is permited, else
		// evalues each node to refresh, remove or add
		if (directAdd) {
			evaluesFolderIcon(folderItem);
			actualItem.addItem(folderItem);
		} else {
			// sequentially activate items and refreshes values
			addFolder(actualItem, folderItem);
		}
	}

	actualItem.setState(true);
	evaluesFolderIcon(actualItem);
}