Examples of IUserLayoutNodeDescription


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

                                  String nextSiblingId )
        throws PortalException
    {
        // make sure sibling exists and is a child of nodeId
        if(nextSiblingId!=null && ! nextSiblingId.equals("")) {
            IUserLayoutNodeDescription sibling=getNode(nextSiblingId);
            if(sibling==null) {
                throw new PortalException("Unable to find a sibling node " +
                        "with id=\""+nextSiblingId+"\".  Occurred " +
                            "in layout for "
                            + owner.getAttribute(IPerson.USERNAME) + ".");
            }
            if(!parent.getId().equals(getParentId(nextSiblingId))) {
                throw new PortalException("Given sibling (\""+nextSiblingId
                        +"\") is not a child of a given parentId (\""
                        +parent.getId()+"\"). Occurred " +
                            "in layout for "
                            + owner.getAttribute(IPerson.USERNAME) + ".");
            }
        }

        if ( parent == null ||
             ! node.isMoveAllowed() )
            return false;

        if ( parent instanceof IUserLayoutFolderDescription &&
             ! ( (IUserLayoutFolderDescription) parent).isAddChildAllowed() )
            return false;

        if ( nextSiblingId == null || nextSiblingId.equals("")) // end of list targeted
            return true;

        // so lets see if we can place it at the end of the sibling list and
        // hop left until we get into the correct position.

        Enumeration sibIds = getVisibleChildIds( parent.getId() );
        List sibs = Collections.list(sibIds);

        if ( sibs.size() == 0 ) // last node in list so should be ok
            return true;

        // reverse scan so that as changes are made the order of the, as yet,
        // unprocessed nodes is not altered.
        for( int idx = sibs.size() - 1;
             idx >= 0;
             idx-- )
        {
            IUserLayoutNodeDescription prev = getNode((String) sibs.get(idx));

            if ( ! MovementRules.canHopLeft( node, prev ) )
                return false;
            if ( prev.getId().equals( nextSiblingId ) )
                return true;
        }
        return false; // oops never found the sib
    }
View Full Code Here

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

    }

    private boolean canMoveRight( String nodeId, String targetNextSibId )
        throws PortalException
    {
        IUserLayoutNodeDescription node = getNode( nodeId );
        Enumeration sibIds = getVisibleChildIds( getParentId( nodeId ) );
        List sibs = Collections.list(sibIds);

        for ( int idx = sibs.indexOf( nodeId ) + 1;
              idx > 0 && idx < sibs.size();
              idx++ )
        {
            String nextSibId = (String) sibs.get( idx );
            IUserLayoutNodeDescription next = getNode( nextSibId );

            if ( nextSibId != null &&
                 next.getId().equals( targetNextSibId ) )
                return true;
            else if ( ! MovementRules.canHopRight( node, next ) )
                return false;
        }
View Full Code Here

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

    }

    private boolean canMoveLeft( String nodeId, String targetNextSibId )
        throws PortalException
    {
        IUserLayoutNodeDescription node = getNode( nodeId );
        Enumeration sibIds = getVisibleChildIds( getParentId( nodeId ) );
        List sibs = Collections.list(sibIds);

        for ( int idx = sibs.indexOf( nodeId ) - 1;
              idx >= 0;
              idx-- )
        {
            String prevSibId = (String) sibs.get( idx );
            IUserLayoutNodeDescription prev = getNode( prevSibId );

            if ( ! MovementRules.canHopLeft( node, prev ) )
                return false;
            if ( targetNextSibId != null &&
                 prev.getId().equals( targetNextSibId ) )
                return true;
        }
        return false; // oops never found the sib
    }
View Full Code Here

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

        return parentId;
    }

    public Enumeration getChildIds(String nodeId) throws PortalException {
        Vector v = new Vector();
        IUserLayoutNodeDescription node = getNodeDescription(nodeId);
        if (node instanceof IUserLayoutFolderDescription) {
            Element element = (Element)layout.getElementById(nodeId);
            for (Node n = element.getFirstChild(); n != null; n = n.getNextSibling()) {
                if (n.getNodeType() == Node.ELEMENT_NODE) {
                    Element e = (Element)n;
View Full Code Here

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

    private Enumeration<String> getChildIds( String nodeId,
                              boolean visibleOnly)
        throws PortalException
    {
        Vector<String> v=new Vector<String>();
        IUserLayoutNodeDescription node=getNode(nodeId);
        if(node instanceof IUserLayoutFolderDescription) {
            Document uld=this.getUserLayoutDOM();
            Element felement = uld.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

     * fragment folders purging those overrides if they are no longer allowed
     * or needed.
     */
    public String getFolderLabel(String nodeId)
    {
        IUserLayoutNodeDescription ndesc = getNode(nodeId);
        if (!(ndesc instanceof IUserLayoutFolderDescription))
            return null;
       
        IUserLayoutFolderDescription desc
            = (IUserLayoutFolderDescription) ndesc;
View Full Code Here

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

      }
    }

    private void prepareSaveEditedItem() throws PortalException {
      // update node name
      IUserLayoutNodeDescription node=getUserLayoutManager().getNode(editElementID);
      node.setName(runtimeData.getParameter("name"));
      getUserLayoutManager().updateNode(node);
     
      // reset the name
      if (node instanceof IUserLayoutChannelDescription) {
        // target is a channel
View Full Code Here

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

      bstate.setRuntimeData(runtimeData);
      context.setState(bstate);
    }

    public void renderXML(ContentHandler out) throws PortalException {
        IUserLayoutNodeDescription node=getUserLayoutManager().getNode(editElementID);
        String elType="folder";
        if(node instanceof IUserLayoutChannelDescription) {
            elType="channel";
        }

      // construct the descriptive XML
      Document doc = DocumentFactory.getNewDocument();
      Element edEl = doc.createElement("editelement");
      Element typeEl = doc.createElement("type");
      if (elType.equals("folder")) {
        typeEl.appendChild(doc.createTextNode("folder"));
      } else {
        typeEl.appendChild(doc.createTextNode("channel"));
      }

      edEl.appendChild(typeEl);
      Element nameEl = doc.createElement("name");
      nameEl.appendChild(doc.createTextNode(node.getName()));
      edEl.appendChild(nameEl);
      // determine element type
      if (elType.equals("folder")) {
        // target is a folder
        StructureStylesheetUserPreferences ssup = context.getUserPreferences().getStructureStylesheetUserPreferences();
View Full Code Here

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

        final IUserLayoutChannelDescription channelDescription = EasyMock.createMock(IUserLayoutChannelDescription.class);
        EasyMock.expect(channelDescription.getName()).andReturn("chanPub1").anyTimes();
        EasyMock.expect(channelDescription.getChannelPublishId()).andReturn("chanPub1").anyTimes();
        EasyMock.expect(channelDescription.getChannelSubscribeId()).andReturn("chanSub1").anyTimes();
       
        final IUserLayoutNodeDescription parentNodeDescription = EasyMock.createMock(IUserLayoutNodeDescription.class);
        EasyMock.expect(parentNodeDescription.getName()).andReturn("parentNode1").anyTimes();
        EasyMock.expect(parentNodeDescription.getId()).andReturn("parentNode1").anyTimes();
       
        EasyMock.replay(channelDescription, parentNodeDescription);
       
       
        portalEvent = new ChannelAddedToLayoutPortalEvent(this, person, userProfile, channelDescription, parentNodeDescription);
        this.jpaPortalEventStore.storePortalEvents(portalEvent);
        this.checkPoint();
       
        assertEquals(1, this.countRowsInTable("STATS_SESSION"));
        assertEquals(0, this.countRowsInTable("STATS_SESSION_GROUPS"));
        assertEquals(8, this.countRowsInTable("STATS_EVENT"));
        assertEquals(8, this.countRowsInTable("STATS_EVENT_TYPE"));
        assertEquals(4, this.countRowsInTable("STATS_CHANNEL"));
        assertEquals(1, this.countRowsInTable("STATS_FOLDER"));
        assertEquals(0, this.countRowsInTable("STATS_RENDER_TIME"));
       
       
        portalEvent = new ChannelUpdatedInLayoutPortalEvent(this, person, userProfile, channelDescription, parentNodeDescription);
        this.jpaPortalEventStore.storePortalEvents(portalEvent);
        this.checkPoint();
       
        assertEquals(1, this.countRowsInTable("STATS_SESSION"));
        assertEquals(0, this.countRowsInTable("STATS_SESSION_GROUPS"));
        assertEquals(9, this.countRowsInTable("STATS_EVENT"));
        assertEquals(9, this.countRowsInTable("STATS_EVENT_TYPE"));
        assertEquals(5, this.countRowsInTable("STATS_CHANNEL"));
        assertEquals(2, this.countRowsInTable("STATS_FOLDER"));
        assertEquals(0, this.countRowsInTable("STATS_RENDER_TIME"));
       
       

        final IUserLayoutNodeDescription oldParentNodeDescription = EasyMock.createMock(IUserLayoutNodeDescription.class);
        EasyMock.expect(oldParentNodeDescription.getId()).andReturn("oldParentNode1").anyTimes();
        EasyMock.expect(oldParentNodeDescription.getName()).andReturn("oldParentNode1").anyTimes();
       
        EasyMock.replay(oldParentNodeDescription);
       
       
        portalEvent = new ChannelMovedInLayoutPortalEvent(this, person, userProfile, channelDescription, oldParentNodeDescription, parentNodeDescription);
View Full Code Here

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

        }

        // get a folder
        {
            String id="s4";
            IUserLayoutNodeDescription node=man.getNode(id);
            assertTrue(node!=null);
            if(node!=null) {
                // make up a fake node, with the same id
                UserLayoutFolderDescription ts=new UserLayoutFolderDescription();
                ts.setId(node.getId());
                ts.setName("Main");
                ts.setHidden(false);
                ts.setImmutable(true);
                ts.setUnremovable(true);
                ts.setFolderType(UserLayoutFolderDescription.REGULAR_TYPE);
                assertEquals(ts,node);
            }
        }

        // get a channel
        {
            String id="n6";
            IUserLayoutNodeDescription node=man.getNode(id);
            assertTrue(node!=null);
            if(node!=null) {
                // make up a fake node, with the same id
                UserLayoutChannelDescription ts=new UserLayoutChannelDescription();
                ts.setId(node.getId());
                ts.setName("uPortal-Powered Sites");
                ts.setTitle("uPortal-Powered Sites");
                ts.setHidden(false);
                ts.setImmutable(true);
                ts.setUnremovable(true);
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.