Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletSet


    }
   
    /** Add a new portlets element in the customized set */
    public void doAddset(RunData rundata, Context context)
    {
        PortletSet set = (PortletSet) ((JetspeedRunData) rundata).getCustomized();
        String title = rundata.getParameters().getString("title", "My Pane");
       
        if (set != null)
        {
            Portlets portlets = ((JetspeedRunData) rundata).getCustomizedProfile()
                                                           .getDocument()
                                                           .getPortletsById(set.getID());
           
            if (portlets != null)
            {
                Portlets p = new PsmlPortlets();
                p.setMetaInfo(new PsmlMetaInfo());
View Full Code Here


         * last modified: 10/31/01
         * Andreas Kempf, Siemens ICM S CP PE, Munich
         * mailto: A.Kempf@web.de
         */
        //boolean isWML = AutoProfile.doIt (rundata, true).getMediaType().equalsIgnoreCase("wml");
        PortletSet set = (PortletSet) ((JetspeedRunData) rundata).getCustomized();
       
        maintainUserSelections(rundata);
        Map userSelections = getUserSelections(rundata);
        String[] pnames = new String[userSelections.size()];
        userSelections.keySet().toArray(pnames);
        //String[] pnames = rundata.getParameters().getStrings("pname");

        // Create a ClearPortletControl
        Control ctrl = new PsmlControl();
        ctrl.setName ("ClearPortletControl");

       
        if ((pnames != null) && (set != null))
        {
            Portlets portlets = ((JetspeedRunData) rundata).getCustomizedProfile()
                                                           .getDocument()
                                                           .getPortletsById(set.getID());

            List usedPortlets = AutoProfile.getPortletList(rundata);
            boolean addIt;
            int cc;
            Entry usedEntry;
View Full Code Here

    }

    /** Add new Reference in the customized set */
    public void doAddref(RunData rundata, Context context) throws Exception
    {
        PortletSet set = (PortletSet) ((JetspeedRunData) rundata).getCustomized();
        String[] refNames = rundata.getParameters().getStrings("refname");
       
        // Create a ClearPortletControl
        Control ctrl = new PsmlControl();
        ctrl.setName ("ClearPortletControl");

       
        if ((refNames != null) && (set != null))
        {
            Portlets portlets = ((JetspeedRunData) rundata).getCustomizedProfile()
                                                           .getDocument()
                                                           .getPortletsById(set.getID());

            for (int i = 0; i < refNames.length; i++)
            {
                SecurityReference sref = getSecurityReference(rundata, refNames[i]);
                if (sref != null)
View Full Code Here

    }
   
    /** Sets the metainfo for this entry */
    public void doMetainfo(RunData rundata, Context context)
    {
        PortletSet set = (PortletSet) ((JetspeedRunData) rundata).getCustomized();
        String title = rundata.getParameters().getString("title");
        String description = rundata.getParameters().getString("description");

        if (set != null)
        {
            Portlets portlets = ((JetspeedRunData) rundata).getCustomizedProfile()
                                                           .getDocument()
                                                           .getPortletsById(set.getID());
           
            if (portlets != null)
            {
                MetaInfo meta = portlets.getMetaInfo();
                if (meta == null)
                {
                    meta = new PsmlMetaInfo();
                    portlets.setMetaInfo(meta);
                }
           
                if (title != null)
                {
                    meta.setTitle(title);
                    set.setTitle(title);
                }

                if(description != null)
                {
                    meta.setDescription(description);
                    set.setDescription(description);
                }
            }
        }
    }
View Full Code Here

    /** Updates the customized portlet entry */
    public void doLayout(RunData rundata, Context context)
    {
        // we should first retrieve the portlet to customize and its parameters
        // definition
        PortletSet set = (PortletSet) ((JetspeedRunData) rundata).getCustomized();
       
        try
        {           
            String controller = rundata.getParameters().getString("controller");
           
            if (controller != null)
            {
                Profile profile = ((JetspeedRunData) rundata).getCustomizedProfile();
                PortletController pc = PortalToolkit.getController(controller);

                if (pc != null)
                {
                    set.setController(pc);

                    Portlets portlets = profile.getDocument().getPortletsById(set.getID());

                    Controller c = portlets.getController();
                    if (c == null)
                    {
                        c = new PsmlController();
View Full Code Here

     */
    public void doSkin(RunData rundata, Context context)
    {
        // we should first retrieve the portlet to customize and its parameters
        // definition
        PortletSet set = (PortletSet) ((JetspeedRunData) rundata).getCustomized();
       
        try
        {           
            String skin = rundata.getParameters().getString("skin");
            Profile profile = ((JetspeedRunData) rundata).getCustomizedProfile();
            Portlets portlets = profile.getDocument().getPortletsById(set.getID());
           
            // skin is neither null nor zero-length
            if ((skin != null) && (skin.trim().length() > 0))
            {
                PortletSkin s = PortalToolkit.getSkin(skin);

                if (s != null)
                {
                    set.getPortletConfig().setPortletSkin(s);

                    Skin psmlSkin = portlets.getSkin();
                    if (psmlSkin == null)
                    {
                        portlets.setSkin(new PsmlSkin());
                    }
                    portlets.getSkin().setName(skin);
                }
                else
                {
                    logger.warn("Unable to update skin for portlet set "
                             + set.getID() + " because skin " + skin
                             + " does not exist.");
                    return;
                }
            }
            else
            {
              // skin is either null or zero-length
              String custPortletSetID = portlets.getId();
              String rootPortletSetID = profile.getRootSet().getID();
             
              // set system default skin for root PSML element
              if (custPortletSetID != null && rootPortletSetID != null &&
                  custPortletSetID.equals(rootPortletSetID))
              {
                // get system default skin
                String defaultSkinName = JetspeedResources.getString("services.PortalToolkit.default.skin");
                PortletSkin defaultSkin = PortalToolkit.getSkin(defaultSkinName);
               
                if (defaultSkin != null)
                {
                  set.getPortletConfig().setPortletSkin((PortletSkin) defaultSkin);
                  Skin psmlSkin = portlets.getSkin();
                 
                  if (psmlSkin == null)
                  {
                    portlets.setSkin(new PsmlSkin());
                  }
               
                  portlets.getSkin().setName(defaultSkin.getName());
                }
                else
                {
                    logger.warn("Unable to set default skin for root portlet set "
                             + set.getID() + " because skin " + skin
                             + " does not exist.");
                    return;
                }
              }
              else
              {
                // By setting the skin to null, the parent's skin will be used.
                set.getPortletConfig().setPortletSkin((PortletSkin) null);
                portlets.setSkin(null);
              }
            }
        }
        catch (Exception e)
View Full Code Here

     */
    public void doSecurity(RunData rundata, Context context)
    {
        // we should first retrieve the portlet to customize and its parameters
        // definition
        PortletSet set = (PortletSet) ((JetspeedRunData) rundata).getCustomized();
       
        try
        {           
            String securityRefName = rundata.getParameters().getString("securityRef");
            SecurityReference securityRef = null;
            Profile profile = ((JetspeedRunData) rundata).getCustomizedProfile();
            Portlets portlets = profile.getDocument().getPortletsById(set.getID());

            if ((securityRefName != null) && (securityRefName.trim().length() > 0))
            {
                securityRef = new BaseSecurityReference();
                securityRef.setParent(securityRefName);
            }
            set.getPortletConfig().setSecurityRef(securityRef);
            portlets.setSecurityRef(securityRef);
        }
        catch (Exception e)
        {
            logger.error("Exception", e);
View Full Code Here

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

        PortletSet set = controller.getPortlets();
        // normalize the constraints and calculate max num of rows needed
        Enumeration en = set.getPortlets();
        int row = 0;
        int col = 0;
        while (en.hasMoreElements())
        {
            Portlet p = (Portlet) en.nextElement();

            PortletSet.Constraints
                constraints = p.getPortletConfig().getConstraints();

            if ((constraints != null)
                 && (constraints.getColumn() != null)
                 && (constraints.getRow() != null))
            {
                col = constraints.getColumn().intValue();
                if (col > colNum)
                {
                    constraints.setColumn(new Integer(col % colNum));
                }

                row = constraints.getRow().intValue();
                if (row > rowNum)
                {
                    rowNum = row;
                }
            }
        }
        row = (int) Math.ceil(set.size() / colNum);
        if (row > rowNum)
        {
            rowNum = row;
        }

        if ( logger.isDebugEnabled() ) {
            logger.debug("Controller calculated setSize " + set.size() + " row " + row + " colNum: " + colNum +  " rowNum: " + rowNum);
        }
        // initialize the result position table and the work list
        List[] table = new List[colNum];
        List filler = Collections.nCopies(rowNum + 1, null);
        for (int i = 0; i < colNum; i++)
        {
            table[i] = new ArrayList();
            table[i].addAll(filler);
        }

        List work = new ArrayList();

        //position the constrained elements and keep a reference to the
        //others
        for (int i = 0; i < set.size(); i++)
        {
            Portlet p = set.getPortletAt(i);

            PortletSet.Constraints
                constraints = p.getPortletConfig().getConstraints();

            if ((constraints != null)
View Full Code Here

        //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);
        }
View Full Code Here

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

TOP

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

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.