Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletSet


        ElementContainer base = new ElementContainer();

        try
        {
        PortletSet portlets = getPortlets();
        PortletConfig pc = portlets.getPortletConfig();

        // first get the number of columns and rows to display
        Enumeration en = portlets.getPortlets();
     
        //see if any or the Portlets you want to add have a larger column or
        //row number than that defined in PSML
        while ( en.hasMoreElements() ) {

            Portlet portlet = (Portlet)en.nextElement();

            calculateControllerLayout( portlet );
           
        }

        setWidth( pc.getLayout( "width", getWidth() ) );

        int rows = getRow();
        int cols = getColumn();

        if (0 == rows || 0 == cols)
            return base; // empty container

        Table t = new Table()
                       .setWidth( this.getWidth() )
                       .setCellPadding( this.getPadding() )
                       .setAlign("center");

        base.addElement( t );

        ElementContainer[][] elements = new ElementContainer[rows][cols];

        for( int i = 0; i < rows; i++ )  {
            for ( int j = 0 ; j < cols; j++ ) {
                elements[i][j]=new ElementContainer();
            }
        }

        // populate the elements array
        en = portlets.getPortlets();
        while (en.hasMoreElements() ) {

            Portlet p = (Portlet)en.nextElement();
            PortletConfig pConf = p.getPortletConfig();
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
View Full Code Here

            if (doc == null)
            {
                return null;
            }
            Portlets portlets = doc.getPortlets();
            PortletSet ps = PortalToolkit.getSet(portlets);
            return ps.getContent(rundata);
        }
        catch (Exception e)
        {
            logger.error("Exception",  e);
            return new JetspeedClearElement("Error in aggregation portlet: " + e.toString());
View Full Code Here

        {
            registryEntry = (RegistryEntry) Registry.getEntry(Registry.PORTLET, portletName);
        }           
        //portlet is not a portlet - probably a controller or control
        if (registryEntry==null) {
            PortletSet ps  = portlet.getPortletConfig().getPortletSet();
            if (ps != null) {
                PortletController pc = ps.getController();
                if (pc != null) {
                    portletName = pc.getConfig().getName();
                    registryEntry = (RegistryEntry)Registry.getEntry(Registry.PORTLET_CONTROLLER, portletName);
                }
            }
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

                                       RunData rundata )
    {
        super.buildCustomizeContext(controller, context, rundata);

        JetspeedRunData jdata = (JetspeedRunData)rundata;
        PortletSet set = (PortletSet)jdata.getCustomized();

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

        List plist = new ArrayList();
        List work = new ArrayList();
        List filler = Collections.nCopies(portlets.getPortletsCount()+portlets.getEntryCount(),null);
        plist.addAll(filler);
View Full Code Here

     * - position: the position of the component to delete
     */
    public void doDelete(RunData data, Context context) throws Exception
    {
      JetspeedRunData jdata = (JetspeedRunData)data;
      PortletSet customizedSet = (PortletSet)jdata.getCustomized();
      int position = data.getParameters().getInt("position",-1);
      Profile profile = jdata.getCustomizedProfile();

      // ADDED for WML
      //boolean isWML = (profile.getMediaType().equalsIgnoreCase("wml"));


        if (customizedSet == null) return;

        if (position > -1)
        {
            Portlets set = profile.getDocument()
                                  .getPortletsById(customizedSet.getID());
            if (set != null)
            {
                // first try explicit portlets position
                for(int i=0; i < set.getPortletsCount(); i++)
                {
View Full Code Here

     * The moveUp boolean determines the direction of the move
     */
    public void doMove(RunData data, Context context, boolean moveUp) throws Exception
    {
        JetspeedRunData jdata = (JetspeedRunData)data;
        PortletSet customizedSet = (PortletSet)jdata.getCustomized();
        int position = data.getParameters().getInt("position",-1);
        Profile profile = jdata.getCustomizedProfile();

        // ADDED for WML
        //boolean isWML = (profile.getMediaType().equalsIgnoreCase("wml"));


        if (customizedSet == null) return;

        if (position > -1)
        {
            int target = -1;

            Portlets set = profile.getDocument()
                                  .getPortletsById(customizedSet.getID());
            Layout targetLayout = null;
            Layout baseLayout = null;

            if (set != null)
            {
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.