Package org.apache.jetspeed.services.statemanager

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


    * @param profile The Profile being customized.
    */
    public void setCustomizedProfile(Profile profile)
    {
        // customization state info is in the page's session state
        SessionState customizationState = getPageSessionState();

        customizationState.setAttribute("customize-profile", profile);

    }   // setCustomizedProfile
View Full Code Here


    * Clean up from customization
    */
    public void cleanupFromCustomization()
    {
        // get the customization state for this page
        SessionState customizationState = getPageSessionState();

        customizationState.removeAttribute("customize-stack");
        customizationState.removeAttribute("customize-paneName");
        customizationState.removeAttribute("customize-profile");
        //customizationState.removeAttribute("customize-type");
        customizationState.removeAttribute("customize-columns");
        customizationState.removeAttribute("customize-mode");
        customizationState.removeAttribute("customize-parameters");

       setMode("default");

    }   // cleanupFromCustomization
View Full Code Here

        return new JetspeedClearElement(url);       
    }
   
    private void clearState(RunData rundata, PortletSet set)
    {
        SessionState state = ((JetspeedRunData)rundata).getPortletSessionState(set.getID());
        state.setAttribute(JetspeedResources.PATH_PANEID_KEY, null);
    }
View Full Code Here

            {
              // change the currently selected pane in the user session
              // If this is not done, the tab selection works, but the
              // content is picked up from the pane in the session!!
              if(!p.getAttribute("_menustate", "open", rundata).equals("closed")) {
                  SessionState state = ((JetspeedRunData)rundata).getPortletSessionState(getPortlets().getID());
                  state.setAttribute(JetspeedResources.PATH_PANEID_KEY, subPane);  
              }

              return true;
            }

      // is the peid for this tab set?
            if (getPortlets().getPortletByID(peid) != null)
            {
                // its for another tab in this set
                return false;
            }
            if (subPane == null)
            {
                if (last == null)
                {
                    return (getPortlets().getPortletAt( 0 ) == p);
                }
                else
                {
                    return (p.getID().equals(last));
                }
            }
            else
            {
                if (p.getID().equals( subPane ))
                {
                    // change the currently selected pane in the user session
                    // If this is not done, the tab selection works, but the
                    // content is picked up from the pane in the session!!
                    if(!p.getAttribute("_menustate", "open", rundata).equals("closed"))
                    {
                        SessionState state =
                            ((JetspeedRunData)rundata).getPortletSessionState(getPortlets().getID());
                        state.setAttribute(JetspeedResources.PATH_PANEID_KEY, subPane);
                    }
                    return true;
                }
            }
        }
View Full Code Here

     *
     */
    protected String retrievePaneIDFromSession(RunData rundata)
    {
        // get the state for this portlet (portlet set) in this page in this session
        SessionState state = ((JetspeedRunData)rundata).getPortletSessionState(getPortlets().getID());

        // get the PANE_PARAMETER attribute
        String pane = (String) state.getAttribute(JetspeedResources.PATH_PANEID_KEY);
       
        // if not yet defined, select the first portlet set
        if (pane == null)
        {
            // use default
View Full Code Here

     @param id  The tab id to save for this controller
     */
    public void savePaneID( RunData data, String id )
    {
        // get the state for this portlet (portlet set) in this page in this session
        SessionState state = ((JetspeedRunData)data).getPortletSessionState(getPortlets().getID());
       
        // set the PANE_PARAMETER attribute
        state.setAttribute(JetspeedResources.PATH_PANEID_KEY, id);
    }
View Full Code Here

        String editMediaType = jdata.getParameters().getString ("mtype");
        String resetStack = jdata.getParameters().getString ("reset");
        String peid = jdata.getParameters().getString("js_peid");

        // get the customization state for this page
        SessionState customizationState = jdata.getPageSessionState();

        // this will be the profile we are editing
        Profile profile = null;

        // the "reset" parameter's presence signals the start of customization
View Full Code Here

                                         RunData rundata)
    {
        JetspeedRunData jdata = (JetspeedRunData) rundata;

        // get the customization state for this page
        SessionState customizationState = jdata.getPageSessionState();

        super.buildCustomizeContext(controller, context, rundata);

        List[] columns = null;

        // retrieve the number of columns
        String cols = controller.getConfig().getInitParameter("cols");
        int colNum = 0;
        try
        {
            colNum = Integer.parseInt(cols);
        }
        catch (Exception e)
        {
            // not an integer or null, default to standarrd value
            colNum = 3;
        }
        context.put("colNum", String.valueOf(colNum));

        //retrieve the size for each of the columns
        String sizes = controller.getConfig().getInitParameter("sizes");
        context.put("sizes", getCellSizes(sizes));

        //retrieve the class for each of the columns
        String columnClasses = controller.getConfig().getInitParameter("col_classes");
        context.put("col_classes", getCellClasses(columnClasses));

        columns = (List[]) customizationState.getAttribute("customize-columns");
        PortletSet customizedSet = (PortletSet) jdata.getCustomized();
        Portlets set = jdata.getCustomizedProfile()
                            .getDocument()
                            .getPortletsById(customizedSet.getID());

        if ( logger.isDebugEnabled() ) {
            logger.debug("MultiCol: columns " + columns + " set " + set);
        }

        if ((columns != null) && (columns.length == colNum))
        {
            int eCount = 0;
            for (int i = 0; i < columns.length; i++)
            {
                eCount += columns[i].size();
            }

            if ( logger.isDebugEnabled() ) {
                logger.debug("MultiCol: eCount " + eCount + " setCount" + set.getEntryCount() + set.getPortletsCount());
            }
            if (eCount != set.getEntryCount() + set.getPortletsCount())
            {
                if ( logger.isDebugEnabled() ) {
                    logger.debug("MultiCol: rebuilding columns ");
                }
                columns = buildColumns(set, colNum);
            }

        }
        else
        {
            if ( logger.isDebugEnabled() ) {
                logger.debug("MultiCol: rebuilding columns ");
            }
            columns = buildColumns(set, colNum);
        }

        customizationState.setAttribute("customize-columns", columns);
        context.put("portlets", columns);

        Map titles = new HashMap();
        for (int col = 0; col < columns.length; col++)
        {
View Full Code Here

    }

    public void doSave(RunData data, Context context)
    {
        // get the customization state for this page
        SessionState customizationState = ((JetspeedRunData) data).getPageSessionState();

        // update the changes made here to the profile being edited
        List[] columns = (List[]) customizationState.getAttribute("customize-columns");
        for (int col = 0; col < columns.length; col++)
        {
            for (int row = 0; row < columns[col].size(); row++)
            {
                setPosition((IdentityElement) columns[col].get(row), col, row);
            }
        }

        // move one level back in customization
        ((JetspeedRunData) data).setCustomized(null);

        // if we are all done customization
        if (((JetspeedRunData) data).getCustomized() == null)
        {
            // save the edit profile and make it current
            try
            {
                ((JetspeedRunData) data).getCustomizedProfile().store();

                // Because of the way references are stored in memory, we have to completely refresh
                // the profile after a references is removed (otherwise it will continue being displayed)
                String referencesRemoved = (String) customizationState.getAttribute(REFERENCES_REMOVED);
                if (referencesRemoved != null && referencesRemoved.equals("true"))
                {
                    PsmlManager.refresh(((JetspeedRunData) data).getCustomizedProfile());
                }               
            }
View Full Code Here

    public void doDelete(RunData data, Context context)
    {
        JetspeedRunData jdata = (JetspeedRunData) data;

        // get the customization state for this page
        SessionState customizationState = jdata.getPageSessionState();

        PortletSet customizedSet = (PortletSet) jdata.getCustomized();

        customizationState.setAttribute(REFERENCES_REMOVED, "false");

        int col = data.getParameters().getInt("col", -1);
        int row = data.getParameters().getInt("row", -1);
        List[] columns = (List[]) customizationState.getAttribute("customize-columns");
        if (columns == null)
        {
            return;
        }

        if ((col > -1) && (row > -1))
        {
            try
            {
                IdentityElement identityElement = (IdentityElement) columns[col].get(row);
                columns[col].remove(row);

                Portlets portlets = jdata.getCustomizedProfile()
                                          .getDocument()
                                          .getPortletsById(customizedSet.getID());

                if (portlets != null)
                {
                    if (identityElement instanceof Entry)
                    {
                        for (int i = 0; i < portlets.getEntryCount(); i++)
                        {
                            if (portlets.getEntry(i) == identityElement)
                            {
                                portlets.removeEntry(i);
                            }
                        }
                    }
                    else if (identityElement instanceof Reference)
                    {
                        for (int i = 0; i < portlets.getReferenceCount(); i++)
                        {
                            if (portlets.getReference(i) == identityElement)
                            {
                                customizationState.setAttribute(REFERENCES_REMOVED, "true");
                                portlets.removeReference(i);
                            }
                        }
                    }
                }
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.