Package org.apache.jetspeed.services.statemanager

Examples of org.apache.jetspeed.services.statemanager.SessionState


    protected void buildNormalContext(VelocityPortlet portlet,
                                      Context context,
                                      RunData rundata) throws Exception
    {
        JetspeedRunData jdata = (JetspeedRunData) rundata;
        SessionState customizationState = jdata.getPageSessionState();
        Profile profile = jdata.getCustomizedProfile();
        String mediaType = profile.getMediaType ();

        // set velocity variable of mediatype (displayed in the customizer menu)
        context.put("mtype", profile.getMediaType());

        // make the list of already used panes/portlets available through the 'runs' reference
        context.put("runs", AutoProfile.getPortletList(rundata));
       
        // we should first retrieve the portlet to customize
        PortletSet set = (PortletSet) (jdata).getCustomized();

        //identify the portlet submode and build the appropriate subt-template path
        String mode = rundata.getParameters().getString("mode");
        if (mode == null)
        {
          mode = (String) customizationState.getAttribute("customize-mode");
          if ((mode == null) || (mode.equalsIgnoreCase("addset")) || (mode.equalsIgnoreCase("general")))
          {
            mode = "layout";
          }
         
        }
        else
        {
          if ((mediaType.equalsIgnoreCase("wml")) && (!mode.equalsIgnoreCase("add")))
          {
            mode = "layout";
          }

          customizationState.setAttribute("customize-mode", mode);
        }

        String template = (String) context.get("template");

        if (template != null)
        {
            int idx = template.lastIndexOf(".");
            StringBuffer buffer = new StringBuffer(template);
            if (idx > 0)
            {
                template = template.substring(0, idx);
            }
            buffer.append("-").append(mode).append(".vm");
           
            template = TemplateLocator.locatePortletTemplate(rundata, buffer.toString());
            context.put("feature", template);

        }
   
        if (set == null)
        {
            return;
        }

        // get the customization state for this page
        String customizedPaneName = (String) customizationState.getAttribute("customize-paneName");
        if (customizedPaneName == null)
        {
            customizedPaneName = "*";
        }

View Full Code Here


    /** Clean up the customization state */
    public void doCancel(RunData rundata, Context context)
    {
        //((JetspeedRunData)rundata).setCustomized(null);
        //rundata.setScreenTemplate("Home");
        SessionState customizationState = ((JetspeedRunData) rundata).getPageSessionState();
        customizationState.setAttribute("customize-mode", "layout");
    }
View Full Code Here

                }
                portlets.addPortlets(p);
            }
        }

        SessionState customizationState = ((JetspeedRunData) rundata).getPageSessionState();
        customizationState.setAttribute("customize-mode", "layout");
    }
View Full Code Here

                }
            }
        }
        // --------------------------------------------------------------------------

        SessionState customizationState = ((JetspeedRunData) rundata).getPageSessionState();
        customizationState.setAttribute("customize-mode", "layout");

        /**
         * Save changed wml profile
         * --------------------------------------------------------------------------
         * last modified: 10/31/01
View Full Code Here

                        Log.warn(message);
                    }
                }
            }
        }
        SessionState customizationState = ((JetspeedRunData) rundata).getPageSessionState();
        customizationState.setAttribute("customize-mode", "layout");
    }
View Full Code Here

                }
            }
        }

        // get the customization state for this page
        SessionState customizationState = ((JetspeedRunData)rundata).getPageSessionState();
        customizationState.setAttribute("customize-parameters", params);

        // populate the customizer context
        context.put("parameters", params);
        context.put("portlet", p);
        context.put("customizer", portlet);
View Full Code Here

    /** Updates the customized portlet entry */
    public void doUpdate(RunData rundata, Context context)
    {
        // get the customization state for this page
        SessionState customizationState = ((JetspeedRunData)rundata).getPageSessionState();

        // we should first retrieve the portlet to customize and its parameters
        // definition
        Portlet p = ((JetspeedRunData)rundata).getCustomized();
        Vector params = (Vector) customizationState.getAttribute("customize-parameters");
        String newSecurityParent = rundata.getParameters().getString("_security_ref");
        String newSkinName = (String) rundata.getParameters().getString("_skin");
        String newTitle = (String) rundata.getParameters().getString("current_title");

        boolean changeRequested = ( (params == null) || (newSkinName == null) || (newSecurityParent == null) || (newTitle == null));
View Full Code Here

     * @return the portlet id being customized or null
     */
    public Portlet getCustomized()
    {
        // customization state info is in the page's session state
        SessionState customizationState = getPageSessionState();
        Stack stack = (Stack)customizationState.getAttribute("customize-stack");

        Portlet p = null;

        if ((stack!=null)&&(!stack.empty()))
        {
            p = (Portlet)stack.peek();
        }

        /**
         * Save the title of this currently selected portlet
         * --------------------------------------------------------------------------
         * last modified: 11/06/01
         * Andreas Kempf, Siemens ICM S CP PE, Munich
         */
        if ((p != null) && (stack.size() > 1))
          customizationState.setAttribute ("customize-paneName", (String)p.getTitle());
        else
          customizationState.setAttribute ("customize-paneName", "*");

        return (Portlet)p;
    }
View Full Code Here

     * @param id the portlet id to customize or null;
     */
    public void setCustomized(Portlet p)
    {
        // customization state info is in the page's session state
        SessionState customizationState = getPageSessionState();
        Stack stack = (Stack)customizationState.getAttribute("customize-stack");
        if (stack == null)
        {
            stack = new Stack();
            customizationState.setAttribute("customize-stack", stack);
        }

        if (p==null)
        {
            if (!stack.empty()) stack.pop();

            customizationState.setAttribute ("customize-paneName", "*");
        }
        else
        {
          if (stack.size () > 0)
          {
            Portlet last = (Portlet)stack.peek();


            if ((last!=null) && (p.getName().equals(last.getName())) && (p.getTitle().equals(last.getTitle())))
            {
                //System.out.println ("Portlet already used!!!");
            }
            else
              stack.push(p);
          }
          else
            stack.push(p);


          /**
           * Save the title of this currently selected portlet
           * --------------------------------------------------------------------------
           * last modified: 11/06/01
           * Andreas Kempf, Siemens ICM S CP PE, Munich
           */

           customizationState.setAttribute ("customize-paneName", (String)p.getTitle());
        }
    }
View Full Code Here

    * @return the Profile being customized.
    */
    public Profile getCustomizedProfile()
    {
        // customization state info is in the page's session state
        SessionState customizationState = getPageSessionState();

        return (Profile) customizationState.getAttribute("customize-profile");

    }   // getCustomizedProfile
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.services.statemanager.SessionState

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.