Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PanedPortletController


     * @
     */
    private Collection getTabs(PortletSet portlets, RunData rundata, Context context)
    {      
        TreeSet tabs = new TreeSet(new PortletTabComparator());
        PanedPortletController controller = null;

        // if portlet is a PortletSet, try to retrieve the Controller
        // we need a PanedPortletController to work properly.
        if (portlets.getController() instanceof PanedPortletController)
        {   
            controller = (PanedPortletController) portlets.getController();
        }

        int count = 0;
        for (Enumeration en = portlets.getPortlets(); en.hasMoreElements(); count++)
        {
            Portlet p = (Portlet) en.nextElement();
            PortalResource portalResource = new PortalResource(p);

            // Secure the tabs
            try
            {
                JetspeedLink jsLink = JetspeedLinkFactory.getInstance(rundata);
                portalResource.setOwner(jsLink.getUserName());
                JetspeedLinkFactory.putInstance(jsLink);
            }
            catch (Exception e)
            {
                logger.warn(e.toString(), e);
                portalResource.setOwner(null);
            }
            JetspeedRunData jdata = (JetspeedRunData) rundata;
            boolean hasView = JetspeedSecurity.checkPermission((JetspeedUser) jdata.getUser(),
                                                                portalResource,
                                                                JetspeedSecurity.PERMISSION_VIEW);
            if (!hasView)
            {
                continue;
            }
            // skip any closed portlet
            if ((p instanceof PortletState) && (((PortletState) p).isClosed(rundata)))
            {
                continue;
            }           

            String mstate = p.getAttribute("_menustate", null, rundata);
            PortletConfig pc= p.getPortletConfig();
            if (mstate == null && pc != null)
            {
                mstate = pc.getInitParameter("_menustate", "open");
            }
           
            if (mstate.equals("closed"))
            {
                continue;
            }

            PortletTab tab = new PortletTab();
           
            // Handle the portlet title
            String title = null;           
            PortletInstance pi = PersistenceManager.getInstance(p, rundata);
            if (pi != null)
            {
                title = pi.getTitle();
                if (title == null)
                {
                    title = (p.getTitle() != null) ? p.getTitle() : p.getName();
                }
            }
            tab.setTitle(title);

            tab.setPosition(p.getPortletConfig().getPosition());
            if (tabs.contains(tab))
            {
                PortletTab lastTab = (PortletTab) tabs.last();
                int nextPos = lastTab.getPosition() + 1;
                tab.setPosition(nextPos);           
            }       
               
            if (controller != null)
            {
                tab.setSelected(controller.isSelected(p, rundata));
                tab.setLink(controller.getPortletURI(p, rundata).toString());               
            }
               
            tab.setActions(buildActionList(rundata, p));
            tabs.add(tab);
        }
View Full Code Here


     */
    protected void buildNormalContext( PortletController controller,
                                       Context context,
                                       RunData rundata )
    {
        PanedPortletController cont = (PanedPortletController)controller;
       
        PortletSet myPortlets = cont.getPortlets();
        PortletControllerConfig conf = cont.getConfig();

        Portlet portlet = null;
        String paneID = null;
        String paneName = rundata.getParameters().getString( JetspeedResources.PATH_PANENAME_KEY );

        if (null != paneName)       
        {
            portlet = myPortlets.getPortletByName(paneName);
            if (portlet != null)
            {
                paneID = portlet.getID();
                rundata.getParameters().setString(JetspeedResources.PATH_PANEID_KEY, paneID);
            }
        }

        if (null == portlet)
        {
            paneID = cont.retrievePaneID(rundata, true);
            portlet = myPortlets.getPortletByID(paneID);
            if (null == portlet)
            {
                paneID = cont.retrievePaneID(rundata, false);
                portlet = myPortlets.getPortletByID(paneID);
            }
        }

        if (portlet != null)
        {
            context.put("pane", portlet);       
            String state = portlet.getAttribute("_menustate", "open", rundata);
            //System.out.println("State = [" + state +"]");
            // if(state == null || !state.equals("closed"))
            {  
                cont.savePaneID(rundata, paneID);
            }
        }
    }   
View Full Code Here

     */
    protected void buildNormalContext( PortletController controller,
                                       Context context,
                                       RunData rundata )
    {
        PanedPortletController cont = (PanedPortletController)controller;
       
        PortletSet myPortlets = cont.getPortlets();
        PortletControllerConfig conf = cont.getConfig();

        Portlet portlet = null;
        String paneID = null;
        String paneName = rundata.getParameters().getString( JetspeedResources.PATH_PANENAME_KEY );

        if (null != paneName)       
        {
            portlet = myPortlets.getPortletByName(paneName);
            if (portlet != null)
            {
                paneID = portlet.getID();
                rundata.getParameters().setString(JetspeedResources.PATH_PANEID_KEY, paneID);
            }
        }

        if (null == portlet)
        {
            paneID = cont.retrievePaneID(rundata, true);
            portlet = myPortlets.getPortletByID(paneID);
            if (null == portlet)
            {
                paneID = cont.retrievePaneID(rundata, false);
                portlet = myPortlets.getPortletByID(paneID);
            }
        }

        if (portlet != null)
            context.put("pane", portlet);       
       
        if(!portlet.getAttribute("_menustate", "open", rundata).equals("closed"))
        {  
            cont.savePaneID(rundata, paneID);
        }
    }   
View Full Code Here

     * @
     */
    private Collection getTabs(PortletSet portlets, RunData rundata, Context context)
    {      
        TreeSet tabs = new TreeSet(new PortletTabComparator());
        PanedPortletController controller = null;

        // if portlet is a PortletSet, try to retrieve the Controller
        // we need a PanedPortletController to work properly.
        if (portlets.getController() instanceof PanedPortletController)
        {   
            controller = (PanedPortletController) portlets.getController();
        }

        int count = 0;
        for (Enumeration en = portlets.getPortlets(); en.hasMoreElements(); count++)
        {
            Portlet p = (Portlet) en.nextElement();
            PortalResource portalResource = new PortalResource(p);

            // Secure the tabs
            try
            {
                JetspeedLink jsLink = JetspeedLinkFactory.getInstance(rundata);
                portalResource.setOwner(jsLink.getUserName());
                JetspeedLinkFactory.putInstance(jsLink);
            }
            catch (Exception e)
            {
                logger.warn(e.toString(), e);
                portalResource.setOwner(null);
            }
            JetspeedRunData jdata = (JetspeedRunData) rundata;
            boolean hasView = JetspeedSecurity.checkPermission((JetspeedUser) jdata.getUser(),
                                                                portalResource,
                                                                JetspeedSecurity.PERMISSION_VIEW);
            if (!hasView)
            {
                continue;
            }
            // skip any closed portlet
            if ((p instanceof PortletState) && (((PortletState) p).isClosed(rundata)))
            {
                continue;
            }           

            String mstate = p.getAttribute("_menustate", "open", rundata);
            if (mstate.equals("closed"))
            {
                continue;
            }

            PortletTab tab = new PortletTab();
           
            // Handle the portlet title
            String title = null;           
            PortletInstance pi = PersistenceManager.getInstance(p, rundata);
            if (pi != null)
            {
                title = pi.getTitle();
                if (title == null)
                {
                    title = (p.getTitle() != null) ? p.getTitle() : p.getName();
                }
            }
            tab.setTitle(title);

            tab.setPosition(p.getPortletConfig().getPosition());
            if (tabs.contains(tab))
            {
                PortletTab lastTab = (PortletTab) tabs.last();
                int nextPos = lastTab.getPosition() + 1;
                tab.setPosition(nextPos);           
            }       
               
            if (controller != null)
            {
                tab.setSelected(controller.isSelected(p, rundata));
                tab.setLink(controller.getPortletURI(p, rundata).toString());               
            }
               
            tab.setActions(buildActionList(rundata, p));
            tabs.add(tab);
        }
View Full Code Here

     */
    protected void buildNormalContext( PortletController controller,
                                       Context context,
                                       RunData rundata )
    {
        PanedPortletController cont = (PanedPortletController)controller;
       
        PortletSet myPortlets = cont.getPortlets();
        PortletControllerConfig conf = cont.getConfig();

        Portlet portlet = null;
        String paneID = null;
        String paneName = rundata.getParameters().getString( JetspeedResources.PATH_PANENAME_KEY );

        if (null != paneName)       
        {
            portlet = myPortlets.getPortletByName(paneName);
            if (portlet != null)
            {
                paneID = portlet.getID();
                rundata.getParameters().setString(JetspeedResources.PATH_PANEID_KEY, paneID);
            }
        }

        if (null == portlet)
        {
            paneID = cont.retrievePaneID(rundata, true);
            portlet = myPortlets.getPortletByID(paneID);
            if (null == portlet)
            {
                paneID = cont.retrievePaneID(rundata, false);
                portlet = myPortlets.getPortletByID(paneID);
            }
        }

        if (portlet != null)
            context.put("pane", portlet);       
        cont.savePaneID(rundata, paneID);
    }   
View Full Code Here

     * @
     */
    private Collection getTabs(PortletSet portlets, RunData rundata, Context context)
    {      
        TreeSet tabs = new TreeSet(new PortletTabComparator());
        PanedPortletController controller = null;

        // if portlet is a PortletSet, try to retrieve the Controller
        // we need a PanedPortletController to work properly.
        if (portlets.getController() instanceof PanedPortletController)
        {   
            controller = (PanedPortletController) portlets.getController();
        }

        int count = 0;
        for (Enumeration en = portlets.getPortlets(); en.hasMoreElements(); count++)
        {
            Portlet p = (Portlet) en.nextElement();
            PortalResource portalResource = new PortalResource(p);

            // Secure the tabs
            try
            {
                JetspeedLink jsLink = JetspeedLinkFactory.getInstance(rundata);
                portalResource.setOwner(jsLink.getUserName());
                JetspeedLinkFactory.putInstance(jsLink);
            }
            catch (Exception e)
            {
                Log.warn(e.toString());
                portalResource.setOwner(null);
            }
            JetspeedRunData jdata = (JetspeedRunData) rundata;
            boolean hasView = JetspeedSecurity.checkPermission((JetspeedUser) jdata.getUser(),
                                                                portalResource,
                                                                JetspeedSecurity.PERMISSION_VIEW);
            if (!hasView)
            {
                continue;
            }
            // skip any closed portlet
            if ((p instanceof PortletState) && (((PortletState) p).isClosed(rundata)))
            {
                continue;
            }           

            String mstate = p.getAttribute("_menustate", "open", rundata);
            if (mstate.equals("closed"))
            {
                continue;
            }

            PortletTab tab = new PortletTab();
           
            // Handle the portlet title
            String title = null;           
            PortletInstance pi = PersistenceManager.getInstance(p, rundata);
            if (pi != null)
            {
                title = pi.getTitle();
                if (title == null)
                {
                    title = (p.getTitle() != null) ? p.getTitle() : p.getName();
                }
            }
            tab.setTitle(title);

            tab.setPosition(p.getPortletConfig().getPosition());
            if (tabs.contains(tab))
            {
                PortletTab lastTab = (PortletTab) tabs.last();
                int nextPos = lastTab.getPosition() + 1;
                tab.setPosition(nextPos);           
            }       
               
            if (controller != null)
            {
                tab.setSelected(controller.isSelected(p, rundata));
                tab.setLink(controller.getPortletURI(p, rundata).toString());               
            }
               
            tab.setActions(buildActionList(rundata, p));
            tabs.add(tab);
        }
View Full Code Here

     */
    protected void buildNormalContext( PortletController controller,
                                       Context context,
                                       RunData rundata )
    {
        PanedPortletController cont = (PanedPortletController)controller;
       
        PortletSet myPortlets = cont.getPortlets();
        PortletControllerConfig conf = cont.getConfig();

        Portlet portlet = null;
        String paneID = null;
        String paneName = rundata.getParameters().getString( JetspeedResources.PATH_PANENAME_KEY );

        if (null != paneName)       
        {
            portlet = myPortlets.getPortletByName(paneName);
            if (portlet != null)
            {
                paneID = portlet.getID();
                rundata.getParameters().setString(JetspeedResources.PATH_PANEID_KEY, paneID);
            }
        }

        if (null == portlet)
        {
            paneID = cont.retrievePaneID(rundata, true);
            portlet = myPortlets.getPortletByID(paneID);
            if (null == portlet)
            {
                paneID = cont.retrievePaneID(rundata, false);
                portlet = myPortlets.getPortletByID(paneID);
            }
        }

        if (portlet != null)
        {
            context.put("pane", portlet);       
            String state = portlet.getAttribute("_menustate", "open", rundata);
            //System.out.println("State = [" + state +"]");
            // if(state == null || !state.equals("closed"))
            {  
                cont.savePaneID(rundata, paneID);
            }
        }
    }   
View Full Code Here

     * @
     */
    private Collection getTabs(PortletSet portlets, RunData rundata, Context context)
    {      
        TreeSet tabs = new TreeSet(new PortletTabComparator());
        PanedPortletController controller = null;

        // if portlet is a PortletSet, try to retrieve the Controller
        // we need a PanedPortletController to work properly.
        if (portlets.getController() instanceof PanedPortletController)
        {   
            controller = (PanedPortletController) portlets.getController();
        }

        int count = 0;
        for (Enumeration en = portlets.getPortlets(); en.hasMoreElements(); count++)
        {
            Portlet p = (Portlet) en.nextElement();
            PortalResource portalResource = new PortalResource(p);

            // Secure the tabs
            try
            {
                JetspeedLink jsLink = JetspeedLinkFactory.getInstance(rundata);
                portalResource.setOwner(jsLink.getUserName());
                JetspeedLinkFactory.putInstance(jsLink);
            }
            catch (Exception e)
            {
                logger.warn(e.toString(), e);
                portalResource.setOwner(null);
            }
            JetspeedRunData jdata = (JetspeedRunData) rundata;
            boolean hasView = JetspeedSecurity.checkPermission((JetspeedUser) jdata.getUser(),
                                                                portalResource,
                                                                JetspeedSecurity.PERMISSION_VIEW);
            if (!hasView)
            {
                continue;
            }
            // skip any closed portlet
            if ((p instanceof PortletState) && (((PortletState) p).isClosed(rundata)))
            {
                continue;
            }           

            String mstate = p.getAttribute("_menustate", "open", rundata);
            if (mstate.equals("closed"))
            {
                continue;
            }

            PortletTab tab = new PortletTab();
           
            // Handle the portlet title
            String title = null;           
            PortletInstance pi = PersistenceManager.getInstance(p, rundata);
            if (pi != null)
            {
                title = pi.getTitle();
                if (title == null)
                {
                    title = (p.getTitle() != null) ? p.getTitle() : p.getName();
                }
            }
            tab.setTitle(title);

            tab.setPosition(p.getPortletConfig().getPosition());
            if (tabs.contains(tab))
            {
                PortletTab lastTab = (PortletTab) tabs.last();
                int nextPos = lastTab.getPosition() + 1;
                tab.setPosition(nextPos);           
            }       
               
            if (controller != null)
            {
                tab.setSelected(controller.isSelected(p, rundata));
                tab.setLink(controller.getPortletURI(p, rundata).toString());               
            }
               
            tab.setActions(buildActionList(rundata, p));
            tabs.add(tab);
        }
View Full Code Here

TOP

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

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.