Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletConfig


        if ((p==null) || (changeRequested == false ))
        {
            doCancel(rundata, context);
            return;
        }
        PortletConfig pc = p.getPortletConfig();
        Profile profile = ((JetspeedRunData)rundata).getCustomizedProfile();
        Entry entry = profile.getDocument().getEntryById(p.getID());

        // Only update the security ref if the parent changed
        if ((newSecurityParent != null))
        {
            boolean securityChanged = false;
            SecurityReference currentSecurityRef = pc.getSecurityRef();
            if (currentSecurityRef != null)
            {
                securityChanged = (newSecurityParent.equals(currentSecurityRef.getParent()) == false);
            }
            else
            {
                securityChanged = (newSecurityParent.trim().length() > 0);
            }
            if (securityChanged == true)
            {
                SecurityReference securityRef = null;
                if ((newSecurityParent.trim().length() > 0))
                {
                    securityRef = new BaseSecurityReference();
                    securityRef.setParent( newSecurityParent);
                }
                // Note: setting the portlet's config may not be a good idea -
                // it might be used as the Portlet for other PSMLDocument Entries that
                // have a different idea of security - and the caching of Portlets does
                // NOT include security -ggolden.
                pc.setSecurityRef(securityRef);
                entry.setSecurityRef(securityRef);
                madePcChange = true;
            }
        }

        // Only update the skin if the name changed
        if (newSkinName != null)
        {
            boolean skinChanged = false;
            String currentSkinName = null;

            if  (pc.getSkin() != null)
                currentSkinName = pc.getPortletSkin().getName();

            if (currentSkinName != null)
            {
                skinChanged = (newSkinName.equals(currentSkinName) == false);
            }
            else
            {
                skinChanged = (newSkinName.trim().length() > 0);
            }

            if (skinChanged == true)
            {
                PortletSkin skin = null;
                if ((newSkinName.trim().length() > 0))
                {
                    skin = PortalToolkit.getSkin(newSkinName);
                    if (skin != null)
                    {
                        // Note: setting the portlet's config may not be a good idea -
                        // it might be used as the Portlet for other PSMLDocument Entries that
                        // have a different idea of skin - and the caching of Portlets does
                        // NOT include skin -ggolden.
                        pc.setPortletSkin(skin);

                        Skin psmlSkin = entry.getSkin();
                        if (psmlSkin == null)
                        {
                            entry.setSkin(new PsmlSkin());
                        }
                        entry.getSkin().setName(newSkinName);
                    }
                    else
                    {
                        logger.warn( "Unable to update skin for portlet entry " + entry.getId() + " because skin " + skin + " does not exist.");
                    }
                }
                else
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of skin - and the caching of Portlets does
                    // NOT include skin -ggolden.
                    pc.setPortletSkin( null);
                    entry.setSkin(null);
                }
                madePcChange = true;
            }
        }

        // Only update the title if the title changed
        if (newTitle != null)
        {
            boolean titleChanged = false;
            String currentTitle = entry.getTitle();

            MetaData md = pc.getMetainfo();
            if  (currentTitle == null && md != null && md.getTitle() != null)
                currentTitle = md.getTitle();

            if (currentTitle != null)
            {
                titleChanged = (newTitle.equals(currentTitle) == false);
            }
            else
            {
                titleChanged = (newTitle.trim().length() > 0);
            }

            if (titleChanged == true)
            {

                if ((newTitle.trim().length() > 0))
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of title - and the caching of Portlets does
                    // NOT include title -ggolden.
                    if (md == null) {
                        md = new MetaData();
                        pc.setMetainfo(md);
                    }
                    md.setTitle(newTitle);
                    entry.setTitle(newTitle);
                    madePcChange = true;
                }
View Full Code Here


  @param data the RunData object for the request
  @return the content to be displayed to the user-agent
  */
  public ConcreteElement getContent(RunData data)
  {
    PortletConfig config = this.getPortletConfig();

    if (contentStale == true)
      return getWebClippedContent(data, config);

    if (null == getExpirationMillis())
View Full Code Here

    @return the newly created PortletConfig object
    */
    protected PortletConfig getPortletConfig(Portlets portlets)
    {

        PortletConfig pc = new BasePortletConfig();

        pc.setName(portlets.getName());
        pc.setInitParameters(getParameters(portlets));

        //Invocation of new skin-locating algorithim
        pc.setPortletSkin(getSkin(findSkin(portlets)));

        pc.setSecurityRef(portlets.getSecurityRef());
        pc.setMetainfo(getMetaData(portlets));

        return pc;
    }
View Full Code Here

    {
 
        if (initDone) // Why is init called more than once per portlet?
            return;

        PortletConfig config = this.getPortletConfig();
       
        try
        {
            rewriter = new HTMLRewriter();

            // fetch username and password for HTTP Basic Autentication
            username = config.getInitParameter("username");
            password = config.getInitParameter("password");
           
            contentStale = true;
            initDone = true;
        }
        catch (Exception e)
View Full Code Here

    @param data the RunData object for the request
    @return the content to be displayed to the user-agent
    */
    public ConcreteElement getContent( RunData data )
    {
        PortletConfig config = this.getPortletConfig();
       
        if (contentStale == true)
            return getWebPageContent(data, config);
       
        if (null == getExpirationMillis())
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

    /** 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 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.