Examples of Portlets


Examples of org.apache.jetspeed.om.profile.Portlets

        else if (profiles.size() > 0)
        {
            try
            {
                // Create an empty portlet container
                Portlets portlets = new PsmlPortlets();
                Control control = new PsmlControl();
                control.setName(this.rolemergeControl);
                portlets.setControl(control);
                Controller controller = new PsmlController();
                controller.setName(this.rolemergeController);
                portlets.setController(controller);

                // Set the skin
                Skin skin = new PsmlSkin();
                skin.setName(PortalToolkit.getSkin((String) null).getName());
                portlets.setSkin(skin);

                String mediaType = null;

                // Process each role profile
                int paneCount = 0;
                for (Iterator it = profiles.iterator(); it.hasNext();)
                {
                    Profile roleProfile = (Profile) it.next();
                    mediaType =
                        mediaType == null
                            ? roleProfile.getMediaType()
                            : mediaType;
                    Profile tmpProfile = (Profile) roleProfile.clone();
                    Portlets tmpPortlets =
                        tmpProfile.getDocument().getPortlets();

                    // If topmost control is a tab control, then add each tab to the container
                    Control paneControl = tmpPortlets.getControl();
                    if (paneControl != null
                        && paneControl.getName().equals(this.rolemergeControl))
                    {
                        for (int i = 0;
                            i < tmpPortlets.getPortletsCount();
                            i++)
                        {
                            Portlets pane = tmpPortlets.getPortlets(i);
                            pane.setLayout(null);
                            portlets.addPortlets(pane);
                            paneCount++;
                        }
                    }
                    // Otherwise, add the contents of profile as a pane
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

            });

            try
            {
                // Create an empty portlet container
                Portlets portlets = new PsmlPortlets();
                Control control = new PsmlControl();
                control.setName(this.groupmergeControl);
                portlets.setControl(control);
                Controller controller = new PsmlController();
                controller.setName(this.groupmergeController);
                portlets.setController(controller);

                // Set title
                portlets.setTitle("Home Page");

                // Set the skin
                Skin skin = new PsmlSkin();
                skin.setName(PortalToolkit.getSkin((String) null).getName());
                portlets.setSkin(skin);

                // Set top level security ref
                if (groupmergeSecurityref != null)
                {
                    SecurityEntry entry =
                        (SecurityEntry) Registry.getEntry(
                            Registry.SECURITY,
                            groupmergeSecurityref);
                    if (entry != null)
                    {
                        SecurityReference ref = new BaseSecurityReference();
                        ref.setParent(entry.getName());
                        portlets.setSecurityRef(ref);
                    }
                }

                String mediaType = null;

                // Process each group profile
                int paneCount = 0;
                for (Iterator it = profiles.iterator(); it.hasNext();)
                {
                    Profile groupProfile = (Profile) it.next();
                    mediaType =
                        mediaType == null
                            ? groupProfile.getMediaType()
                            : mediaType;
                    Profile tmpProfile = (Profile) groupProfile.clone();
                    Portlets tmpPortlets =
                        tmpProfile.getDocument().getPortlets();

                    // If topmost control is a tab control, then add each tab to the container
                    Control paneControl = tmpPortlets.getControl();
                    if (paneControl != null
                        && paneControl.getName().equals(this.groupmergeControl))
                    {
                        for (int i = 0;
                            i < tmpPortlets.getPortletsCount();
                            i++)
                        {
                            Portlets pane = tmpPortlets.getPortlets(i);
                            pane.setLayout(null);
                            portlets.addPortlets(pane);
                            paneCount++;
                        }
                    }
                    // Otherwise, add the contents of profile as a pane
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

            doc = new BasePSMLDocument();
            doc.setName(fileOrUrl);

            // now that we have a file reference, try to load the serialized PSML
            Portlets portlets = null;
            try
            {
                DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dbfactory.newDocumentBuilder();
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

     */
    protected Portlets load(Reader reader)
        throws IOException, MarshalException, ValidationException, MappingException
    {
        Unmarshaller unmarshaller = new Unmarshaller(this.mapping);
        Portlets portlets = (Portlets)unmarshaller.unmarshal(reader);
        return portlets;
    }
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        List list = new ArrayList();

        for (int i = 0; i < data.size(); i++)
        {
            Object obj = data.get(i);
            Portlets portlets = null;

            if (obj instanceof JetspeedUserProfile)
            {
                portlets = DBUtils.bytesToPortlets(((JetspeedUserProfile)obj).getProfile(), this.mapping);
                list.add(createUserProfile((JetspeedUserProfile)obj, portlets));
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        JetspeedUser user = locator.getUser();
        Role role = locator.getRole();
        Group group = locator.getGroup();
        String tableName = null;
        List records = null;
        Portlets portlets = null;
        PSMLDocument psmldoc = null;
        String page = null;

        Connection dbCon = getDbConnection();
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        super.buildCustomizeContext(controller, context, rundata);

        JetspeedRunData jdata = (JetspeedRunData)rundata;
        PortletSet set = (PortletSet)jdata.getCustomized();

        Portlets portlets = jdata.getCustomizedProfile()
                                 .getDocument()
                                 .getPortletsById(set.getID());

        List plist = new ArrayList();
        List work = new ArrayList();
        List filler = Collections.nCopies(portlets.getPortletsCount()+portlets.getEntryCount(),null);
        plist.addAll(filler);

        for (int i=0; i < portlets.getPortletsCount(); i++)
        {
            Portlets p = portlets.getPortlets(i);
            if (logger.isDebugEnabled())
            {
                logger.debug("RowColumnControllerAction: processing portlet: " + p.getTitle());
            }
            Layout layout = p.getLayout();
            if (layout == null)
            {
                // Pane should always have a layout with correct position
                if (logger.isDebugEnabled())
                {
                    logger.debug("RowColumnControllerAction: no layout, creating a new one");
                }
                layout = new PsmlLayout();
                layout.setPosition(i);
                p.setLayout(layout);
            }
            if (layout!=null)
            {
                try
                {
                    int pos = (int)layout.getPosition();
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("RowColumnControllerAction: layout has position: " + pos);
                    }
                    if (pos >= 0 && pos < plist.size())
                    {
                        plist.set(pos,p);
                    }
                    else
                    {
                        work.add(p);
                    }
                }
                catch (Exception e)
                {
                    logger.error("Layout error", e);
                    layout.setPosition(-1);
                    work.add(p);
                }
            }
            else
            {
                work.add(p);
            }
        }

        for (int i=0; i < portlets.getEntryCount(); i++)
        {
            Entry p = portlets.getEntry(i);
            Layout layout = p.getLayout();
            if (layout!=null)
            {
                try
                {
                    int pos = (int)layout.getPosition();
                    if (pos>=0)
                    {
                        plist.set(pos,p);
                    }
                    else
                    {
                        work.add(p);
                    }
                }
                catch (Exception e)
                {
                    layout.setPosition(-1);
                    work.add(p);
                }
            }
            else
            {
                work.add(p);
            }
        }

        Iterator i = work.iterator();
        for(int idx=0;idx < plist.size(); idx++)
        {
            if (plist.get(idx)==null)
            {
                if (i.hasNext())
                {
                    plist.set(idx,i.next());
                }
                else
                {
                    plist.remove(idx);
                }
            }
        }

        Map titles = new HashMap();
        i = plist.iterator();
        while(i.hasNext())
        {
            Object obj = i.next();

            if (obj instanceof Portlets)
            {
                Portlets entry = (Portlets)obj;
                if ((entry.getMetaInfo()!=null)&&(entry.getMetaInfo().getTitle()!=null))
                {
                    titles.put(entry.getId(),entry.getMetaInfo().getTitle());
                }
            }
            else
            {
                Entry entry = (Entry)obj;
                if ((entry.getMetaInfo()!=null)&&(entry.getMetaInfo().getTitle()!=null))
                {
           titles.put(entry.getId(), entry.getMetaInfo().getTitle());
                }
                else
                {
                    RegistryEntry pentry = Registry.getEntry(Registry.PORTLET,entry.getParent());

                    if (pentry!=null)
                    {
            titles.put(entry.getId(), pentry.getTitle());
                    }
                }
            }
        }
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        if (customizedSet == null) return;

        if (position > -1)
        {
            Portlets set = profile.getDocument()
                                  .getPortletsById(customizedSet.getID());
            if (set != null)
            {
                // first try explicit portlets position
                for(int i=0; i < set.getPortletsCount(); i++)
                {
                    Portlets p = set.getPortlets(i);
                    Layout layout = p.getLayout();
//
//                    if (layout == null)
//                    {
//                      Layout nl = new Layout ();
//                      nl.setPosition (String.valueOf(i));
//
//                    }
                    if ((layout!=null) && (layout.getPosition() != -1))
                    {

                        int lpos = (int)layout.getPosition();
                        if (lpos==position)
                        {
                            set.removePortlets(i);

                            updateLayoutPositions(set);

                            // MODIFIED: Save changes for wml profiles
                            //if (isWML)
                            //  doSave(data, null);

                            return;
                        }
                    }
                }

                // try explicit entry position
                for(int i=0; i < set.getEntryCount(); i++)
                {
                    Entry p = set.getEntry(i);
                    Layout layout = p.getLayout();

                    if ((layout!=null) && (layout.getPosition() != -1))
                    {
                        int lpos = (int)layout.getPosition();
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

    {
        // Load the panes into a list
        List list = new ArrayList();
        for(int i = 0; i < set.getPortletsCount(); i++)
        {
            Portlets pane = set.getPortlets(i);
            list.add(pane);
        }

        // Sort list using the current layout position
        Collections.sort(list,
                         new Comparator()
                         {
                             public int compare(Object pane1, Object pane2)
                             {
                                 Long pos1 = new Long(((Portlets) pane1).getLayout().getPosition());
                                 Long pos2 = new Long(((Portlets) pane2).getLayout().getPosition());
                                 return pos1.compareTo(pos2);
                             }
                         });

        // Update the layout position based on the physical order within the sorted list
        int position = 0;
        for (Iterator iter = list.iterator(); iter.hasNext();)
        {
            Portlets pane = (Portlets) iter.next();
            Layout layout = pane.getLayout();
            layout.setPosition(position++);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.om.profile.Portlets

        if (position > -1)
        {
            int target = -1;

            Portlets set = profile.getDocument()
                                  .getPortletsById(customizedSet.getID());
            Layout targetLayout = null;
            Layout baseLayout = null;

            if (set != null)
            {
                // check if we can possibly move as requested and calculate
                // target position
                if ( moveUp )
                {
                    if ( (position >= set.getPortletsCount())
                         && (position >= set.getEntryCount()) ) return;
                    target = position + 1;
                }
                else
                {
                    if (position ==0) return;
                    target = position - 1;
                }

                // first find objects at explicit portlets position
                for(int i=0; i < set.getPortletsCount(); i++)
                {
                    if ((targetLayout!=null) && (baseLayout!=null)) break;

                    Portlets p = set.getPortlets(i);
                    Layout layout = p.getLayout();
                    if ((layout!=null)&&(layout.getPosition()!=-1))
                    {
                        int lpos = (int)layout.getPosition();
                        if ((baseLayout == null) && (lpos==position))
                        {
                            baseLayout = layout;
                        }

                        if ((targetLayout == null) && (lpos==target))
                        {
                            targetLayout = layout;
                        }
                    }
                }

                // try explicit entry position
                for(int i=0; i < set.getEntryCount(); i++)
                {
                    if ((targetLayout!=null) && (baseLayout!=null)) break;

                    Entry p = set.getEntry(i);
                    Layout layout = p.getLayout();
                    if ((layout!=null)&&(layout.getPosition()!=-1))
                    {
                        int lpos = (int)layout.getPosition();
                        if ((baseLayout == null) && (lpos==position))
                        {
                            baseLayout = layout;
                        }

                        if ((targetLayout == null) && (lpos==target))
                        {
                            targetLayout = layout;
                        }
                    }
                }

                //else use implicit position
                if (baseLayout == null)
                {
                    if (position < set.getPortletsCount())
                    {
                        Portlets p = set.getPortlets(position);
                        if (p.getLayout()==null)
                        {
                            p.setLayout(new PsmlLayout());
                        }
                        baseLayout=p.getLayout();
                    }

                    if (position < set.getEntryCount())
                    {
                        Entry p = set.getEntry(position);
                        if (p.getLayout()==null)
                        {
                            p.setLayout(new PsmlLayout());
                        }
                        baseLayout=p.getLayout();
                    }
                }

                if (targetLayout == null)
                {
                    if (target < set.getPortletsCount())
                    {
                        Portlets p = set.getPortlets(target);
                        if (p.getLayout()==null)
                        {
                            p.setLayout(new PsmlLayout());
                        }
                        targetLayout=p.getLayout();
                    }

                    if (target < set.getEntryCount())
                    {
                        Entry p = set.getEntry(target);
                        if (p.getLayout()==null)
                        {
                            p.setLayout(new PsmlLayout());
                        }
                        targetLayout=p.getLayout();
                    }
                }

                //we should now have found both baseLayout and targetLayout, swap
                //their positions using explicit positioning
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.