Examples of IUserLayoutNodeDescription


Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

            if(nextSiblingId!=null) {
                Document ulm=this.getUserLayoutDOM();
                nextSibling=ulm.getElementById(nextSiblingId);
            }

            IUserLayoutNodeDescription oldNode=getNode(nodeId);

            if(oldNode instanceof IUserLayoutChannelDescription) {
                if(node instanceof IUserLayoutChannelDescription) {
                    Document ulm=this.getUserLayoutDOM();
                    // generate new XML Element
                    Element newChannelElement=node.getXML(ulm);
                    Element oldChannelElement=(Element)ulm.getElementById(nodeId);
                    Node parent=oldChannelElement.getParentNode();
                    parent.removeChild(oldChannelElement);
                    parent.insertBefore(newChannelElement,nextSibling);
                   
                    // register new child instead
                    newChannelElement.setIdAttribute("ID", true);
                    newChannelElement.setAttribute("ID",node.getId());

                    // inform the listeners
                    final String parentNodeId = this.getParentId(nodeId);
                    final IUserLayoutNodeDescription parentNode = this.getNode(parentNodeId);
                    LayoutEvent ev = new LayoutEvent(this, parentNode, node);
                    for(Iterator i=listeners.iterator();i.hasNext();) {
                        LayoutEventListener lel=(LayoutEventListener)i.next();
                        lel.channelUpdated(ev);
                    }
                } else {
                    throw new PortalException("Change channel to folder is not allowed by updateNode() method!");
                }
            } else {
                 // must be a folder
                if(node instanceof IUserLayoutFolderDescription) {
                    Document ulm=this.getUserLayoutDOM();
                    // generate new XML Element
                    Element newFolderElement=node.getXML(ulm);
                    Element oldFolderElement=(Element)ulm.getElementById(nodeId);
                    Node parent=oldFolderElement.getParentNode();

                    // move children
                    Vector children=new Vector();
                    for(Node n=oldFolderElement.getFirstChild(); n!=null;n=n.getNextSibling()) {
                        children.add(n);
                    }

                    for(int i=0;i<children.size();i++) {
                        newFolderElement.appendChild((Node)children.get(i));
                    }

                    // replace the actual node
                    parent.removeChild(oldFolderElement);
                    parent.insertBefore(newFolderElement,nextSibling);
                   
                    // register new child instead
                    newFolderElement.setIdAttribute("ID", true);
                     newFolderElement.setAttribute("ID",node.getId());

                    // inform the listeners
                     final String parentNodeId = this.getParentId(nodeId);
                     final IUserLayoutNodeDescription parentNode = this.getNode(parentNodeId);
                     LayoutEvent ev=new LayoutEvent(this, parentNode, node);
                    for(Iterator i=listeners.iterator();i.hasNext();) {
                        LayoutEventListener lel=(LayoutEventListener)i.next();
                        lel.folderUpdated(ev);
                    }
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

    }

    protected boolean canAddNode(IUserLayoutNodeDescription node,IUserLayoutNodeDescription parent, String nextSiblingId) throws PortalException {
        // make sure sibling exists and is a child of nodeId
        if(nextSiblingId!=null) {
            IUserLayoutNodeDescription sibling=getNode(nextSiblingId);
            if(sibling==null) {
                throw new PortalException("Unable to find a sibling node with id=\""+nextSiblingId+"\"");
            }
            if(!parent.getId().equals(getParentId(nextSiblingId))) {
                throw new PortalException("Given sibling (\""+nextSiblingId+"\") is not a child of a given parentId (\""+parent.getId()+"\")");
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

        return this.canMoveNode(this.getNode(nodeId),this.getNode(parentId),nextSiblingId);
    }

    protected boolean canMoveNode(IUserLayoutNodeDescription node,IUserLayoutNodeDescription parent, String nextSiblingId) throws PortalException {
        // is the current parent immutable ?
        IUserLayoutNodeDescription currentParent=getNode(getParentId(node.getId()));
        if(currentParent==null) {
            throw new PortalException("Unable to determine a parent node for node with id=\""+node.getId()+"\"");
        }
        return (!currentParent.isImmutable() && canAddNode(node,parent,nextSiblingId));
    }
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

        }
    }

    public Enumeration getChildIds(String nodeId) throws PortalException {
        Vector v=new Vector();
        IUserLayoutNodeDescription node=getNode(nodeId);
        if(node instanceof IUserLayoutFolderDescription) {
            Document ulm=this.getUserLayoutDOM();
            Element felement=(Element)ulm.getElementById(nodeId);
            for(Node n=felement.getFirstChild(); n!=null;n=n.getNextSibling()) {
                if(n.getNodeType()==Node.ELEMENT_NODE) {
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

               }

             if ((values = req.getParameterValues("uP_request_add_targets")) != null) {
                 String value;
                 int nodeType = values[0].equals("folder")?IUserLayoutNodeDescription.FOLDER:IUserLayoutNodeDescription.CHANNEL;
                 IUserLayoutNodeDescription nodeDesc = this.createNodeDescription(nodeType);
                 nodeDesc.setName("Unnamed");
                 if ( nodeType == IUserLayoutNodeDescription.CHANNEL && (value = req.getParameter("channelPublishID")) != null ) {
                  String contentPublishId = value.trim();
                  if ( contentPublishId.length() > 0 ) {
                   ((IUserLayoutChannelDescription)nodeDesc).setChannelPublishId(contentPublishId);
                   themePrefs.putParameterValue("channelPublishID",contentPublishId);
                  }
                 }
                 newNodeDescription = nodeDesc;
                 this.markAddTargets(newNodeDescription);
             } else {
                 this.markAddTargets(null);
               }

             if ((values = req.getParameterValues("uP_add_target")) != null) {
              String[] values1, values2;
              String value = null;
              values1 =  req.getParameterValues("targetNextID");
              if ( values1 != null && values1.length > 0 )
                 value = values1[0];
              if ( (values2 = req.getParameterValues("targetParentID")) != null ) {
               if newNodeDescription != null ) {
                 if ( CommonUtils.nvl(value).trim().length() == 0 )
                  value = null;

                 // Adding a new node
                 newNodeId = this.addNode(newNodeDescription,values2[0],value).getId();
               }
              }
                 newNodeDescription = null;
             }

             if ((values = req.getParameterValues("uP_move_target")) != null) {
              String[] values1, values2;
              String value = null;
              values1 = req.getParameterValues("targetNextID");
              if ( values1 != null && values1.length > 0 )
                 value = values1[0];
              if ( (values2 = req.getParameterValues("targetParentID")) != null ) {
                 if ( CommonUtils.nvl(value).trim().length() == 0 ) value = null;
                 this.moveNode(values[0],values2[0],value);
              }
             }

             if ((values = req.getParameterValues("uP_rename_target")) != null) {
              String[] values1;
              if ( (values1 = req.getParameterValues("uP_target_name")) != null ) {
                 IUserLayoutNodeDescription nodeDesc = this.getNode(values[0]);
                 if ( nodeDesc != null ) {
                  String oldName = nodeDesc.getName();
                  nodeDesc.setName(values1[0]);
                  if ( !this.updateNode(nodeDesc) )
                   nodeDesc.setName(oldName);
                 }
              }
             }

             if ((values = req.getParameterValues("uP_remove_target")) != null) {
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

                + channelDescription.getChannelSubscribeId()
                + "]";
    }
   
    protected String getParentDescriptionString() {
        final IUserLayoutNodeDescription parentDescription = getParentDescription();
       
        if (parentDescription == null) {
            return "[transient parent]";
        }
       
        return "[" + parentDescription.getId() + "," + parentDescription.getName() + "]";
    }
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

    public void getUserLayout(ContentHandler ch) throws PortalException {
        man.getUserLayout(new TransientUserLayoutManagerSAXFilter(ch));
    }

    public void getUserLayout(String nodeId, ContentHandler ch) throws PortalException {
        IUserLayoutNodeDescription node = this.getNode(nodeId);
        if ( null != node ) {
          IUserLayoutNodeDescription layoutNode = null;
          try
          {
              layoutNode = man.getNode(nodeId);
          }
          catch(PortalException pe)
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

    }

    public IUserLayoutNodeDescription getNode(String nodeId) throws PortalException {
        // check to see if it's in the layout first, if not then
        // build it..
        IUserLayoutNodeDescription ulnd = null;

        // assume that not finding it in the implementation
        // means that it may be a requested (transient) node.
        try {
            ulnd = man.getNode(nodeId);
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

    protected String verifyFolderId(HttpServletRequest request, String folderNodeId) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
        final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
        final IUserLayoutNodeDescription node = userLayoutManager.getNode(folderNodeId);
       
        if (node == null) {
            throw new IllegalArgumentException("No layout node exists for id: " + folderNodeId);
        }
        if (node.getType() != IUserLayoutNodeDescription.FOLDER) {
            throw new IllegalArgumentException("Layout node is not a folder for id: " + folderNodeId);
        }
       
        final String resolvedFolderId = node.getId();
        return resolvedFolderId;
    }
View Full Code Here

Examples of org.jasig.portal.layout.node.IUserLayoutNodeDescription

        // we have to tell EasyMock to expect ANY instance of XPathExpression as XPathExpression equals is based on instance equality
        expect(mockUserLayout.findNodeId(EasyMock.isA(XPathExpression.class))).andReturn(expressionText);
        replay(mockUserLayout);
       
        // BEGIN only expect IUserLayoutNodeDescription calls if folderName is defined
        IUserLayoutNodeDescription mockUserLayoutNodeDescription = createMock(IUserLayoutNodeDescription.class);
        if(null != details.getFolderName()) {
            expect(mockUserLayoutNodeDescription.getType()).andReturn(IUserLayoutNodeDescription.FOLDER);
            expect(mockUserLayoutNodeDescription.getId()).andReturn(details.getFolderName());
        }
        replay(mockUserLayoutNodeDescription);
        // END only expect IUserLayoutNodeDescription calls if folderName is defined
       
        IUserLayoutManager mockUserLayoutManager = createMock(IUserLayoutManager.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.