private String getTabIdFromName(IUserLayout userLayout, String tabName) { @SuppressWarnings("unchecked") Enumeration<String> childrenOfRoot = userLayout.getChildIds(userLayout.getRootId()); while (childrenOfRoot .hasMoreElements()) { // loop over folders that might be the favorites folder String nodeId = childrenOfRoot.nextElement(); try { IUserLayoutNodeDescription nodeDescription = userLayout.getNodeDescription(nodeId); IUserLayoutNodeDescription.LayoutNodeType nodeType = nodeDescription.getType(); if (IUserLayoutNodeDescription.LayoutNodeType.FOLDER.equals(nodeType) && nodeDescription instanceof IUserLayoutFolderDescription) { IUserLayoutFolderDescription folderDescription = (IUserLayoutFolderDescription) nodeDescription; if (tabName.equalsIgnoreCase(folderDescription.getName())) { return folderDescription.getId(); } } } catch (Exception e) { logger.error("Error getting the nodeID of the tab name " + tabName, e); } } logger.warn("Tab " + tabName + " was searched for but not found"); return null; // didn't find tab }
public String getFavoriteTabNodeId(IUserLayout userLayout) { @SuppressWarnings("unchecked") Enumeration<String> childrenOfRoot = userLayout.getChildIds(userLayout.getRootId()); while (childrenOfRoot .hasMoreElements()) { // loop over folders that might be the favorites folder String nodeId = childrenOfRoot.nextElement(); try { IUserLayoutNodeDescription nodeDescription = userLayout.getNodeDescription(nodeId); IUserLayoutNodeDescription.LayoutNodeType nodeType = nodeDescription.getType(); if (FOLDER.equals(nodeType) && nodeDescription instanceof IUserLayoutFolderDescription) { IUserLayoutFolderDescription folderDescription = (IUserLayoutFolderDescription) nodeDescription; if (FAVORITES_TYPE.equalsIgnoreCase(folderDescription.getFolderType())) { return folderDescription.getId(); } } } catch (Exception e) { logger.error( "Ignoring on error a node while examining for favorites: node ID is [{}]", nodeId, e); } } logger.warn("Favorite tab was searched for but not found"); return null; // didn't find favorite tab }
String tabId = newTab.getId(); request, PreferencesScope.STRUCTURE, newColumn.getId(), CLASSIC_COLUMNS_WIDTH_USER_PREFERENCE_NAME, width + "%"); Element folder = ulm.getUserLayoutDOM().getElementById(newColumn.getId()); UserPrefsHandler.setUserPreference( folder, CLASSIC_COLUMNS_WIDTH_USER_PREFERENCE_NAME, person);
if (oldFolderDesc.getId().equals(getRootFolderId())) throw new PortalException("Update of root node is not currently allowed!");