Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletConfig


        if (PortletEntry.TYPE_ABSTRACT.equals(regEntry.getType()))
        {
            throw new PortletException("PortletFactory: can't instanciate abstract registry entry: "+name);
        }
           
        PortletConfig pc = getPortletConfig(regEntry, id);
       
        return getPortlet( getClassname(regEntry), pc, null );
    }
View Full Code Here


    protected PortletConfig getPortletConfig( PortletEntry portletEntry, String id)
    {
        Map map = new HashMap();
        map.putAll(portletEntry.getParameterMap());
       
        PortletConfig pc = new BasePortletConfig();
        pc.setName( portletEntry.getName() );
        addParentInitParameters(portletEntry, map);       
        pc.setInitParameters( map );
        pc.setMetainfo( getMetaData( portletEntry ) );
        pc.setURL( portletEntry.getURL() );
        pc.setCachedOnURL( portletEntry.isCachedOnURL() );
        //pc.setSecurityRef(portletEntry.getSecurityRef());
        pc.setSecurityRef(getSecurityReference(null, portletEntry));

        if (runDataService != null)
        {
            JetspeedRunData rundata = runDataService.getCurrentRunData();
            if (rundata != null)
            {
                Profile profile = rundata.getProfile();
                if (profile != null)
                {
                    pc.setPageId(profile.getId());
                }
            }
        }
        pc.setPortletId(id);

        return pc;
    }
View Full Code Here

    /** Initialize the content of the portlet
    */
    public void init() throws PortletException {

        PortletConfig config = this.getPortletConfig();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            // RL: disable the SAX filter due to a class path problem
            // with Tomcat 3.2
            /*
            String url = JetspeedDiskCache.getInstance().getEntry( config.getURL() ).getURL();

            WMLFilter myFilter = new WMLFilter(new PrintWriter(bos));
            myFilter.filter(url);
            content = new JetspeedClearElement( bos.toString() );
            */
            content = new JetspeedClearElement(
                JetspeedDiskCache.getInstance().getEntry( config.getURL() ).getData() );
        } catch (Exception e) {
            throw new PortletException( e.getMessage() );
        } finally {
            try {
                bos.close();
View Full Code Here

    */
    public int getPadding() {
        int padding = 0;

        try {
            PortletConfig conf = getPortlets().getPortletConfig();
            padding =  Integer.parseInt( conf.getSkin( "padding" , String.valueOf( DEFAULT_PADDING ) ) );
        } catch ( RuntimeException e ) {
            logger.error("Exception getting padding value", e);
            padding = DEFAULT_PADDING;
        }

View Full Code Here

    /**
    Sets the padding space to be put between portlets
    */
    public void setPadding(int padding) {
        try {
            PortletConfig conf = getPortlets().getPortletConfig();
            conf.setSkin( "padding" , String.valueOf( padding ) );
        } catch ( RuntimeException e ) {
            logger.error("Exception setting padding value", e);
            // FIXME: What should we do if there's no portlets, config or skin defined ?
        }

View Full Code Here

    /**
    Sets the padding space to be put between portlets
    */
    public void setPadding(String padding) {
        try {
            PortletConfig conf = getPortlets().getPortletConfig();
            conf.setSkin( "padding" , padding );
        } catch ( RuntimeException e ) {
            logger.error("Exception setting padding value", e);
            // FIXME: What should we do if there's no portlets, config or skin defined ?
        }
    }
View Full Code Here

            return;
        }               

          
        PortletConfig portletConf = portlet.getPortletConfig();
        Integer colObj = portletConf.getConstraints().getColumn();
        Integer rowObj = portletConf.getConstraints().getRow();

        int col = (colObj!=null)?colObj.intValue():0;
        int row = (rowObj!=null)?rowObj.intValue():0;
       
        if ( col + 1 > this.getColumn() ) {
View Full Code Here

        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();

            Integer colObj = pConf.getConstraints().getColumn();
            Integer rowObj = pConf.getConstraints().getRow();
            int colnum = (colObj!=null)?colObj.intValue():0;
            int rownum = (rowObj!=null)?rowObj.intValue():0;

            elements[rownum % rows][colnum % cols]
                .addElement( p.getContent( rundata ) );
View Full Code Here

     */
    public static Object getHandle(Object config)
    {
        //this implementation expects a PortletConfig object as its
        // configuration
        PortletConfig pc = null;

        if (!(config instanceof PortletConfig))
        {
            return null;

        }

        // By default, only take into account the init parameters
        pc = (PortletConfig)config;
        StringBuffer handle = new StringBuffer(256);

        if (pc.getURL()!=null && pc.isCachedOnURL())
        {
            handle.append(String.valueOf(pc.getURL().hashCode()));
        }

        Iterator i = pc.getInitParameterNames();
        while(i.hasNext())
        {
            String name = (String)i.next();
            String value = pc.getInitParameter(name);

            if (value!=null)
            {
                handle.append("|").append(name).append("-").append(value);
            }
View Full Code Here

    }

    /**
     */
    public void setDescription( String description ) {
        PortletConfig pc = getPortletConfig();
        if (pc==null) {
            pc = new BasePortletConfig();
            setPortletConfig(pc);
        }

        MetaData meta = pc.getMetainfo();
        if (meta==null) {
            meta = new MetaData();
            pc.setMetainfo(meta);
        }

        meta.setDescription(description);
    }
View Full Code Here

TOP

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

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.