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 }
&& (newFolderDesc.isDeleteAllowed() != oldFolderDesc.isDeleteAllowed() || newFolderDesc.isEditAllowed() != oldFolderDesc.isEditAllowed() || newFolderDesc.isAddChildAllowed() != oldFolderDesc.isAddChildAllowed() || newFolderDesc.isMoveAllowed() != oldFolderDesc.isMoveAllowed())) { pendingActions.add( new LPAEditRestriction( owner, ilfNode, newFolderDesc.isMoveAllowed(), newFolderDesc.isDeleteAllowed(), newFolderDesc.isEditAllowed(), newFolderDesc.isAddChildAllowed())); nodeId, Constants.ATT_NAME, newFolderDesc.getName(), oldFolderDesc.getName(), pendingActions);
private IUserLayoutNodeDescription addNodeToTab( IUserLayoutManager ulm, IUserLayoutChannelDescription channel, String tabId) { IUserLayoutNodeDescription node = null; Enumeration<String> columns = ulm.getChildIds(tabId); if (columns.hasMoreElements()) { while (columns.hasMoreElements()) { // attempt to add this channel to the column node = ulm.addNode(channel, columns.nextElement(), null); // if it couldn't be added to this column, go on and try the next // one. otherwise, we're set. if (node != null) break; } } else { IUserLayoutFolderDescription newColumn = new UserLayoutFolderDescription(); newColumn.setName("Column"); newColumn.setId("tbd"); newColumn.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); newColumn.setHidden(false); newColumn.setUnremovable(false); newColumn.setImmutable(false); // add the column to our layout IUserLayoutNodeDescription col = ulm.addNode(newColumn, tabId, null); // add the channel node = ulm.addNode(channel, col.getId(), null); } return node; }
if (oldFolderDesc.getId().equals(getRootFolderId())) throw new PortalException("Update of root node is not currently allowed!");
(IUserLayoutFolderDescription) nodeDescription; if (FAVORITES_TYPE.equalsIgnoreCase(folderDescription.getFolderType())) {
&& !(((IUserLayoutFolderDescription) parent).isAddChildAllowed()) && !isFragmentOwner) return false;
if (StringUtils.isBlank(tabName)) tabName = DEFAULT_TAB_NAME; IUserLayoutFolderDescription newTab = new UserLayoutFolderDescription(); newTab.setName(tabName); newTab.setId(id); newTab.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); newTab.setHidden(false); newTab.setUnremovable(false); newTab.setImmutable(false); String tabId = newTab.getId(); newColumn.setName("Column"); newColumn.setId("tbd"); newColumn.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); newColumn.setHidden(false); newColumn.setUnremovable(false); newColumn.setImmutable(false); 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);
(IUserLayoutFolderDescription) nodeDescription; String folderType = folderDescription.getFolderType();
newColumn.setName("Column"); newColumn.setId("tbd"); newColumn.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); newColumn.setHidden(false); newColumn.setUnremovable(false); newColumn.setImmutable(false);
newColumn.setName("Column"); newColumn.setId("tbd"); newColumn.setFolderType(IUserLayoutFolderDescription.REGULAR_TYPE); newColumn.setHidden(false); newColumn.setUnremovable(false); newColumn.setImmutable(false);