@Override public IUserLayoutNodeDescription createNodeDescription(LayoutNodeType nodeType) throws PortalException { if (nodeType == LayoutNodeType.FOLDER) { return new UserLayoutFolderDescription(); } return new ChannelDescription(); }
public IUserLayoutNodeDescription createNodeDescription(Element node) throws PortalException { String type = node.getNodeName(); if (type.equals(Constants.ELM_CHANNEL)) { return new ChannelDescription(node); } else if (type.equals(Constants.ELM_FOLDER)) { return new UserLayoutFolderDescription(node); } else { throw new PortalException("Given XML Element is not a channel!"); } } }
/** * A factory method to create a <code>UserLayoutNodeDescription</code> instance, based on the * information provided in the user layout <code>Element</code>. * * @param xmlNode a user layout DTD folder/channel <code>Element</code> value * @return an <code>UserLayoutNodeDescription</code> value * @exception PortalException if the xml passed is somehow invalid. */ public static UserLayoutNodeDescription createUserLayoutNodeDescription(Element xmlNode) throws PortalException { // is this a folder or a channel ? String nodeName = xmlNode.getNodeName(); if (nodeName.equals("channel")) { return new UserLayoutChannelDescription(xmlNode); } else if (nodeName.equals("folder")) { return new UserLayoutFolderDescription(xmlNode); } else { throw new PortalException( "Given XML element '" + nodeName + "' is neither folder nor channel"); } }
UserLayoutFolderDescription newFolder = new UserLayoutFolderDescription(); newFolder.setHidden(false); newFolder.setImmutable(false);
final IUserLayoutFolderDescription newColumn = new UserLayoutFolderDescription(); newColumn.setName("Column"); newColumn.setId("tbd");
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; }
String tabName = request.getParameter("tabName"); if (StringUtils.isBlank(tabName)) tabName = DEFAULT_TAB_NAME; IUserLayoutFolderDescription newTab = new UserLayoutFolderDescription(); newTab.setName(tabName); newTab.setId(id); IUserLayoutFolderDescription newColumn = new UserLayoutFolderDescription(); newColumn.setName("Column"); newColumn.setId("tbd");
IUserLayoutFolderDescription newColumn = new UserLayoutFolderDescription(); newColumn.setName("Column"); newColumn.setId("tbd");