Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.Portlet


     *
     * @param rundata the RunData object for the current request
     */
    public boolean allowPrintFriendly( RunData rundata )
    {
        Portlet p = getPortlet();

        if (p==null) return false;
       
        if ((p instanceof PortletSet)
            ||(JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser(),
View Full Code Here


    /**
     * Returns true if this portlet is currently minimized
     */
    public boolean isMinimized(RunData rundata)
    {
        Portlet p = getPortlet();
       
        if ( (p!=null) && (p instanceof PortletState) )
        {
            return ((PortletState)p).isMinimized(rundata);
        }
View Full Code Here

    @param minimize True if the portlet change to minimized
    @param rundata A RunData object
    */
    public void setMinimized( boolean minimize, RunData rundata )
    {
        Portlet p = getPortlet();
       
        if ( (p!=null) && (p instanceof PortletState) )
        {
            ((PortletState)p).setMinimized( minimize, rundata);
        }
View Full Code Here

    /**
    Returns the Portlet with the given id
    */
    public Portlet getPortletByID(String id)
    {
        Portlet p = getPortlet();
         if (null == p)
            return null;

        if (p instanceof PortletSet)
        {
            Enumeration e = ((PortletSet)p).getPortlets();
            Portlet portlet = null;
            while ( e.hasMoreElements() )
            {
                portlet = (Portlet)e.nextElement();
                if (portlet.getID().equals(id))
                    return portlet;
            }
            return portlet;
       }
       return null;
View Full Code Here

    /**
    Returns the Portlet with the given name
    */
    public Portlet getPortletByName(String name)
    {
        Portlet p = getPortlet();
         if (null == p)
            return null;

        if (p instanceof PortletSet)
        {
            Enumeration e = ((PortletSet)p).getPortlets();
            Portlet portlet = null;
            while ( e.hasMoreElements() )
            {
                portlet = (Portlet)e.nextElement();
                if (portlet.getName().equals(name))
                    return portlet;
            }
            return portlet;
       }
       return null;
View Full Code Here

            String templatePath = TemplateLocator.locatePortletTemplate(
                                          (RunData) context.get("data"),
                                          template);

            // need to add cache support
            Portlet portlet = (Portlet) context.get("portlet");
            RunData rundata = (RunData) context.get("data");
            long cachePeriod = -1;
            AbstractPortlet abstractPortlet = null;
            // STW: Safety net ;)
            if(portlet instanceof AbstractPortlet)
View Full Code Here

            String templatePath = TemplateLocator.locatePortletTemplate(
                                          (RunData) context.get("data"),
                                          template);

            // need to add cache support
            Portlet portlet = (Portlet) context.get("portlet");
            RunData rundata = (RunData) context.get("data");
            long cachePeriod = -1;
            AbstractPortlet abstractPortlet = null;
            // STW: Safety net ;)
            if(portlet instanceof AbstractPortlet)
View Full Code Here

       String id = null;

        if (controller instanceof PanedPortletController)
        {
            PortletSet set = controller.getPortlets();
            Portlet portlet = null;
            if (null != set)
            {
                portlet = set.getPortletByName(panel);
            }
            if (portlet != null)
                id = portlet.getID();
        }
        else
        {
           Portlets entry = data.getProfile().getDocument().getPortlets(panel);
           if (entry != null)
View Full Code Here

    }

    public Object processView(GenericMVCContext context)
    {

        Portlet portlet = (Portlet) context.get("portlet");
        RunData data = (RunData) context.get("data");
        HttpServletRequest request = data.getRequest();
        String template = (String) context.get("template");
        logger.info("JSPViewProcessor - processing template " + template);

        try
        {

            // Allow access to portlet from .jsp template
            request.setAttribute("portlet", portlet);

            // put context in attribute so you can get to it from .jsp template
            request.setAttribute("context", context);

            // Add js_peid out of convenience
            request.setAttribute("js_peid", portlet.getID());

            // Add rundata out of convenience (JspService.RUNDATA differs from GenericMVCPortlet.RUNDATA)
            request.setAttribute(JspService.RUNDATA, data);

            // Retrieve the URL. For backward compatibility, use the URL first
            // and then fallback to "template" parameter
            PortletEntry pe = (PortletEntry) Registry.getEntry(Registry.PORTLET, portlet.getName());

            // Files referenced from default templates folder will be processed
            // using JspService. Otherwise, they will be loaded using EcsServletElement
            // from where ever they came from.
            if (pe.getURL() == null || pe.getURL().trim().length() == 0)
            {

                if (template != null && -1 == template.indexOf(".jsp"))
                {
                    template = template + ".jsp";
                }

                logger.info("JSPViewProcessor - locating template - " + data.toString()
                         + " - " + template);

                //we use the template locator to translate the template
                String locatedTemplate = TemplateLocator.locatePortletTemplate(data, template);
                logger.info("JSPViewProcessor - located template: " + locatedTemplate);

                /*if (locatedTemplate == null)
                {
                    locatedTemplate = TemplateLocator.locateScreenTemplate(data, template);
                    if (locatedTemplate != null)
                    {
                        locatedTemplate = "/screens" + locatedTemplate;
                    }
                    logger.debug("JSPViewProcessor - located screen template: " + locatedTemplate);
                } */

                JspService service = (JspService) ServiceUtil.getServiceByName(JspService.SERVICE_NAME);

                // this is only necessary if we don't run in a JSP page environment
                // but better be safe than sorry...
                service.addDefaultObjects(data);

                // handle request
                service.handleRequest(data, locatedTemplate);

            }
            else
            {
                // Build parameter list to be passed with the jsp
                Iterator names = portlet.getPortletConfig().getInitParameterNames();
                while (names.hasNext())
                {
                    String name = (String) names.next();
                    String value = (String) portlet.getPortletConfig().getInitParameter(name);
                    data.getParameters().setString(name, value);
                }

                template = pe.getURL();

View Full Code Here

                rundata.setScreenTemplate("Home");
                return new JetspeedClearElement("");
            }
            //return new JetspeedClearElement("You must specify portlet to preview using [previewedPortletName] parameter");
        }
        Portlet portlet = null;

        try
        {
            portlet = PortletFactory.getPortlet(portletName, "PreviewPortlet");
            PortletControl control = controlName == null ? PortalToolkit.getControl((String)null) :
                                     PortalToolkit.getControl(controlName);
            control = null;
            if ( control != null )
            {
                JetspeedRunData jdata = (JetspeedRunData)rundata;
                // Use the profile's skin
                //portlet.getPortletConfig().setSkin(PortalToolkit.getSkin(jdata.getProfile().getDocument().getPortlets().getSkin()));
                control.setPortlet(portlet);
                control.init();
                result = control.getContent(rundata);
            }
            else if ( portlet != null )
            {
                result = portlet.getContent(rundata);
            }

            if ( result != null && !result.toString().equals("") )
            {
                /*String html =  result.toString();
View Full Code Here

TOP

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

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.