Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletControl


            try
            {
                customizer = PortletFactory.getPortlet(name, p.getID()+"customize");
                customizer.getPortletConfig()
                          .setPortletSkin(p.getPortletConfig().getPortletSkin());
                PortletControl control = PortalToolkit.getControl((String)null);
                if (control!=null)
                {
                    control.setPortlet(customizer);
                    control.init();
                    return control;
                }
            }
            catch (Exception e)
            {
View Full Code Here


                 Portlet source = findPortlet(data);
                 if (source != null) {
                     jdata.setPortlet(source.getName());
                     info = PortletFactory.getPortlet(name, "PortletInfoPortlet");
                     info.getPortletConfig().setPortletSkin(source.getPortletConfig().getPortletSkin());
                     PortletControl control = PortalToolkit.getControl((String)null);
                     if (control != null)
                     {
                         control.setPortlet(info);
                         control.init();
                         return control;
                     }
                 }
             }
         } catch (Exception e) {
View Full Code Here

        try
        {
            // Always set portlet id to "preview" so each preview request gets it from the cache.
            // At least, I think that's how it works.
            p = PortletFactory.getPortlet(portletName, "preview");
            PortletControl control = controlName == null ? PortalToolkit.getControl((String) null)
                                                         : PortalToolkit.getControl(controlName);
            if (control != null)
            {
                JetspeedRunData jdata = (JetspeedRunData) rundata;
                // Use the profile's skin
                p.getPortletConfig().setPortletSkin(PortalToolkit.getSkin(jdata.getProfile().getDocument().getPortlets().getSkin()));
                control.setPortlet(p);
                control.init();
                result = control.getContent(rundata);
            }
            else if (p != null)
            {
                result = p.getContent(rundata);
            }
View Full Code Here

     * @param name a PortletControl name available in the registry or a classname
     * @return the created PortletControl
     */
    public PortletControl getControl(String name)
    {
        PortletControl pc = null;
        PortletControlEntry entry = null;

        if (name != null)
        {
            entry = (PortletControlEntry) Registry.getEntry(Registry.PORTLET_CONTROL, name);
        }

        Map params = null;

        try
        {
            if (entry == null)
            {
                if (name != null)
                {
                    pc = (PortletControl) Class.forName(name).newInstance();
                    params = new Hashtable();
                }
            }
            else
            {
                pc = (PortletControl) Class.forName(entry.getClassname()).newInstance();
                params = entry.getParameterMap();
            }
        }
        catch (Exception e)
        {
            Log.error("Unable to instanciate control " + name + ", using default", e);
        }

        if ((pc == null) && (defaultControl != null) && (!defaultControl.equals(name)))
        {
            return getControl(defaultControl);
        }

        PortletControlConfig pcConf = new BasePortletControlConfig();
        pcConf.setName(name);
        pcConf.setInitParameters(params);
        pc.setConfig(pcConf);

        return pc;
    }
View Full Code Here

     * @param control the PSML control object
     * @return the created PortletControl
     */
    public PortletControl getControl(Control control)
    {
        PortletControl pc = null;

        if (control != null)
        {
            pc = getControl(control.getName());
            pc.getConfig().getInitParameters().putAll(getParameters(control));
        }
        else
        {
            if (defaultControl != null)
            {
View Full Code Here

        return pc;
    }

    protected PortletControl getControl(Control control, PortletEntry entry)
    {
        PortletControl pc = null;

        if (control != null)
        {
            pc = getControl(control.getName());
            pc.getConfig().getInitParameters().putAll(getParameters(control));
        }
        else
        {
            org.apache.jetspeed.om.registry.Parameter dftPortletCtrl =
                entry.getParameter("_control");
View Full Code Here

                    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
View Full Code Here

     * @param name a PortletControl name available in the registry or a classname
     * @return the created PortletControl
     */
    public PortletControl getControl(String name)
    {
        PortletControl pc = null;
        PortletControlEntry entry = null;

        if (name != null)
        {
            entry = (PortletControlEntry) Registry.getEntry(Registry.PORTLET_CONTROL, name);
        }

        Map params = null;

        try
        {
            if (entry == null)
            {
                if (name != null)
                {
                    pc = (PortletControl) Class.forName(name).newInstance();
                    params = new Hashtable();
                }
            }
            else
            {
                pc = (PortletControl) Class.forName(entry.getClassname()).newInstance();
                params = entry.getParameterMap();
            }
        }
        catch (Exception e)
        {
            logger.error("Unable to instanciate control " + name + ", using default", e);
        }

        if ((pc == null) && (defaultControl != null) && (!defaultControl.equals(name)))
        {
            return getControl(defaultControl);
        }

        PortletControlConfig pcConf = new BasePortletControlConfig();
        pcConf.setName(name);
        pcConf.setInitParameters(params);
        pc.setConfig(pcConf);

        return pc;
    }
View Full Code Here

     * @param control the PSML control object
     * @return the created PortletControl
     */
    public PortletControl getControl(Control control)
    {
        PortletControl pc = null;

        if (control != null)
        {
            pc = getControl(control.getName());
            pc.getConfig().getInitParameters().putAll(getParameters(control));
        }
        else
        {
            if (defaultControl != null)
            {
View Full Code Here

        return pc;
    }

    protected PortletControl getControl(Control control, PortletEntry entry)
    {
        PortletControl pc = null;

        if (control != null)
        {
            pc = getControl(control.getName());
            pc.getConfig().getInitParameters().putAll(getParameters(control));
        }
        else
        {
            org.apache.jetspeed.om.registry.Parameter dftPortletCtrl =
                entry.getParameter("_control");
View Full Code Here

TOP

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

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.