Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.BasePortletSet


     * @return a new instance of PortletSet
     */
    protected PortletSet getSet(Portlets portlets, VariableInteger theCount)
    {
        // Create a new BasePortletSet to handle the portlets
        BasePortletSet set = new BasePortletSet();
        PortletController controller = getController(portlets.getController());
        set.setController(controller);
        String name = portlets.getName();
        if (name != null)
        {
            set.setName(name);
        }
        else
            set.setName(String.valueOf(theCount.getValue()));

        set.setID(portlets.getId());

        theCount.setValue(theCount.getValue() + 1);

        //FIXME: this sucks ! we should either associate the portlet set
        //with its portlets peer or set the porpoerties directly on the portlet
        //set object
        //Unfortunately, this would change the API too drastically for now...
        set.setPortletConfig(getPortletConfig(portlets));

        // Add all sub portlet sets in the main set
        //        Portlets[] subsets = portlets.getPortlets();
        //        for (int i=0; i < subsets.length; i++ )

        for (Iterator it = portlets.getPortletsIterator(); it.hasNext();)
        {
            Portlets subset = (Portlets) it.next();
            // Set this subset's parent Portlets collection.         
            subset.setParentPortlets(portlets);

            Map constraints = getParameters(subset.getLayout());
            int position = getPosition(subset.getLayout());
            set.addPortlet(
                getSet(subset, theCount),
                controller.getConstraints(constraints),
                position);
        }

        // Populate the PortletSet with Portlets
        //        Entry[] entries = portlets.getEntry();
        //        for( int i = 0; i < entries.length; ++i )

        for (Iterator eit = portlets.getEntriesIterator(); eit.hasNext();)
        {
            try
            {

                Entry psmlEntry = (Entry) eit.next();
                PortletEntry entry =
                    (PortletEntry) Registry.getEntry(Registry.PORTLET, psmlEntry.getParent());

                if (entry != null)
                {
                    Portlet p = PortletFactory.getPortlet(psmlEntry);

                    if (p != null)
                    {
                        Map constraints = getParameters(psmlEntry.getLayout());
                        int position = getPosition(psmlEntry.getLayout());

                        PortletControl control = getControl(psmlEntry.getControl(), entry);

                        set.addPortlet(
                            initControl(control, p),
                            controller.getConstraints(constraints),
                            position);
                    }
                }
                else
                {
                    logger.error(
                        " The portlet "
                            + psmlEntry.getParent()
                            + " does not exist in the Registry ");
                    continue;
                }
            }
            catch (JetspeedException e)
            {
                logger.error("Exception", e);
                continue;
            }

        }

        // Decorate with a control if required and return
        if (portlets.getControl() != null)
        {
            PortletControl control = getControl(portlets.getControl());
            return initControl(control, set);
        }

        set.sortPortletSet();
        // Or return the set
        return set;
    }
View Full Code Here


     * @return a new instance of PortletSet
     */
    protected PortletSet getSet(Portlets portlets, VariableInteger theCount)
    {
        // Create a new BasePortletSet to handle the portlets
        BasePortletSet set = new BasePortletSet();
        PortletController controller = getController(portlets.getController());
        set.setController(controller);
        String name = portlets.getName();
        if (name != null)
        {
            set.setName(name);
        }
        else
            set.setName(String.valueOf(theCount.getValue()));

        set.setID(portlets.getId());

        theCount.setValue(theCount.getValue() + 1);

        //FIXME: this sucks ! we should either associate the portlet set
        //with its portlets peer or set the porpoerties directly on the portlet
        //set object
        //Unfortunately, this would change the API too drastically for now...
        set.setPortletConfig(getPortletConfig(portlets));

        // Add all sub portlet sets in the main set
        //        Portlets[] subsets = portlets.getPortlets();
        //        for (int i=0; i < subsets.length; i++ )

        for (Iterator it = portlets.getPortletsIterator(); it.hasNext();)
        {
            Portlets subset = (Portlets) it.next();
            // Set this subset's parent Portlets collection.         
            subset.setParentPortlets(portlets);

            Map constraints = getParameters(subset.getLayout());
            int position = getPosition(subset.getLayout());
            set.addPortlet(
                getSet(subset, theCount),
                controller.getConstraints(constraints),
                position);
        }

        // Populate the PortletSet with Portlets
        //        Entry[] entries = portlets.getEntry();
        //        for( int i = 0; i < entries.length; ++i )

        for (Iterator eit = portlets.getEntriesIterator(); eit.hasNext();)
        {
            try
            {

                Entry psmlEntry = (Entry) eit.next();
                PortletEntry entry =
                    (PortletEntry) Registry.getEntry(Registry.PORTLET, psmlEntry.getParent());

                if (entry != null)
                {
                    Portlet p = PortletFactory.getPortlet(psmlEntry);

                    if (p != null)
                    {
                        Map constraints = getParameters(psmlEntry.getLayout());
                        int position = getPosition(psmlEntry.getLayout());

                        PortletControl control = getControl(psmlEntry.getControl(), entry);

                        set.addPortlet(
                            initControl(control, p),
                            controller.getConstraints(constraints),
                            position);
                    }
                }
                else
                {
                    logger.error(
                        " The portlet "
                            + psmlEntry.getParent()
                            + " does not exist in the Registry ");
                    continue;
                }
            }
            catch (JetspeedException e)
            {
                logger.error("Exception", e);
                continue;
            }

        }

        // Decorate with a control if required and return
        if (portlets.getControl() != null)
        {
            PortletControl control = getControl(portlets.getControl());
            return initControl(control, set);
        }

        set.sortPortletSet();
        // Or return the set
        return set;
    }
View Full Code Here

     * @return a new instance of PortletSet
     */
    protected PortletSet getSet(Portlets portlets, VariableInteger theCount)
    {
        // Create a new BasePortletSet to handle the portlets
        BasePortletSet set = new BasePortletSet();
        PortletController controller = getController(portlets.getController());
        set.setController(controller);
        String name = portlets.getName();
        if (name != null)
        {
            set.setName(name);
        }
        else
            set.setName(String.valueOf(theCount.getValue()));

        set.setID(portlets.getId());

        theCount.setValue(theCount.getValue() + 1);

        //FIXME: this sucks ! we should either associate the portlet set
        //with its portlets peer or set the porpoerties directly on the portlet
        //set object
        //Unfortunately, this would change the API too drastically for now...
        set.setPortletConfig(getPortletConfig(portlets));

        // Add all sub portlet sets in the main set
        //        Portlets[] subsets = portlets.getPortlets();
        //        for (int i=0; i < subsets.length; i++ )

        for (Iterator it = portlets.getPortletsIterator(); it.hasNext();)
        {
            Portlets subset = (Portlets) it.next();
            // Set this subset's parent Portlets collection.         
            subset.setParentPortlets(portlets);

            Map constraints = getParameters(subset.getLayout());
            int position = getPosition(subset.getLayout());
            set.addPortlet(
                getSet(subset, theCount),
                controller.getConstraints(constraints),
                position);
        }

        // Populate the PortletSet with Portlets
        //        Entry[] entries = portlets.getEntry();
        //        for( int i = 0; i < entries.length; ++i )

        for (Iterator eit = portlets.getEntriesIterator(); eit.hasNext();)
        {
            try
            {

                Entry psmlEntry = (Entry) eit.next();
                PortletEntry entry =
                    (PortletEntry) Registry.getEntry(Registry.PORTLET, psmlEntry.getParent());

                if (entry != null)
                {
                    Portlet p = PortletFactory.getPortlet(psmlEntry);

                    if (p != null)
                    {
                        Map constraints = getParameters(psmlEntry.getLayout());
                        int position = getPosition(psmlEntry.getLayout());

                        PortletControl control = getControl(psmlEntry.getControl(), entry);

                        set.addPortlet(
                            initControl(control, p),
                            controller.getConstraints(constraints),
                            position);
                    }
                }
                else
                {
                    Log.error(
                        " The portlet "
                            + psmlEntry.getParent()
                            + " does not exist in the Registry ");
                    continue;
                }
            }
            catch (JetspeedException e)
            {
                Log.error(e);
                continue;
            }

        }

        // Decorate with a control if required and return
        if (portlets.getControl() != null)
        {
            PortletControl control = getControl(portlets.getControl());
            return initControl(control, set);
        }

        set.sortPortletSet();
        // Or return the set
        return set;
    }
View Full Code Here

     * @return a new instance of PortletSet
     */
    protected PortletSet getSet(Portlets portlets, VariableInteger theCount)
    {
        // Create a new BasePortletSet to handle the portlets
        BasePortletSet set = new BasePortletSet();
        PortletController controller = getController(portlets.getController());
        set.setController(controller);
        String name = portlets.getName();
        if (name != null)
        {
            set.setName(name);
        }
        else
            set.setName(String.valueOf(theCount.getValue()));

        set.setID(portlets.getId());

        theCount.setValue(theCount.getValue() + 1);

        //FIXME: this sucks ! we should either associate the portlet set
        //with its portlets peer or set the porpoerties directly on the portlet
        //set object
        //Unfortunately, this would change the API too drastically for now...
        set.setPortletConfig(getPortletConfig(portlets));

        // Add all sub portlet sets in the main set
        //        Portlets[] subsets = portlets.getPortlets();
        //        for (int i=0; i < subsets.length; i++ )

        for (Iterator it = portlets.getPortletsIterator(); it.hasNext();)
        {
            Portlets subset = (Portlets) it.next();
            // Set this subset's parent Portlets collection.         
            subset.setParentPortlets(portlets);

            Map constraints = getParameters(subset.getLayout());
            int position = getPosition(subset.getLayout());
            set.addPortlet(
                getSet(subset, theCount),
                controller.getConstraints(constraints),
                position);
        }

        // Populate the PortletSet with Portlets
        //        Entry[] entries = portlets.getEntry();
        //        for( int i = 0; i < entries.length; ++i )

        for (Iterator eit = portlets.getEntriesIterator(); eit.hasNext();)
        {
            try
            {

                Entry psmlEntry = (Entry) eit.next();
                PortletEntry entry =
                    (PortletEntry) Registry.getEntry(Registry.PORTLET, psmlEntry.getParent());

                if (entry != null)
                {
                    Portlet p = PortletFactory.getPortlet(psmlEntry);

                    if (p != null)
                    {
                        Map constraints = getParameters(psmlEntry.getLayout());
                        int position = getPosition(psmlEntry.getLayout());

                        PortletControl control = getControl(psmlEntry.getControl(), entry);

                        set.addPortlet(
                            initControl(control, p),
                            controller.getConstraints(constraints),
                            position);
                    }
                }
                else
                {
                    logger.error(
                        " The portlet "
                            + psmlEntry.getParent()
                            + " does not exist in the Registry ");
                    continue;
                }
            }
            catch (JetspeedException e)
            {
                logger.error("Exception", e);
                continue;
            }

        }

        // Decorate with a control if required and return
        if (portlets.getControl() != null)
        {
            PortletControl control = getControl(portlets.getControl());
            return initControl(control, set);
        }

        set.sortPortletSet();
        // Or return the set
        return set;
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.portal.BasePortletSet

Copyright © 2018 www.massapicom. 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.