portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets PortletWrapper.java
Date Wed, 24 Jul 2002 03:21:18 GMT
paulsp      2002/07/23 20:21:18

  Modified:    docs/site changes.html
               xdocs    changes.xml
               src/java/org/apache/jetspeed/portal BasePortletSet.java
                        JetspeedPortletInstance.java Portlet.java
               src/java/org/apache/jetspeed/portal/controls
                        VelocityPortletControl.java
               src/java/org/apache/jetspeed/portal/portlets
                        AbstractPortlet.java ContainerTestPortlet.java
               src/java/org/apache/jetspeed/portal/security/portlets
                        PortletWrapper.java
  Log:
  Title/Description/Image in PortletInstance now uses PSML MetaInfo
  
  Revision  Changes    Path
  1.33      +3 -0      jakarta-jetspeed/docs/site/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- changes.html	23 Jul 2002 21:18:32 -0000	1.32
  +++ changes.html	24 Jul 2002 03:21:17 -0000	1.33
  @@ -130,6 +130,9 @@
   -->
         </ul>
                                                   <li>
  +  Fix - 2002/07/23 - Title/Description/Image in PortletInstance now uses PSML MetaInfo
(PS)
  +</li>
  +                                                <li>
     Update - 2002/07/23 - Updated PsmlImporter to run from command line only. Run "ant import"
(DST)
                         - Importer now supports exporting both ways (file system to db, db
to file system) (DST)
   							 - Updated docs for new PSML import-export process (DST)
  
  
  
  1.53      +4 -1      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- changes.xml	23 Jul 2002 21:18:32 -0000	1.52
  +++ changes.xml	24 Jul 2002 03:21:17 -0000	1.53
  @@ -24,6 +24,9 @@
   -->
         </ul>
   <li>
  +  Fix - 2002/07/23 - Title/Description/Image in PortletInstance now uses PSML MetaInfo
(PS)
  +</li>
  +<li>
     Update - 2002/07/23 - Updated PsmlImporter to run from command line only. Run "ant import"
(DST)
                         - Importer now supports exporting both ways (file system to db, db
to file system) (DST)
   							 - Updated docs for new PSML import-export process (DST)
  
  
  
  1.24      +76 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java
  
  Index: BasePortletSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- BasePortletSet.java	23 Jul 2002 05:30:04 -0000	1.23
  +++ BasePortletSet.java	24 Jul 2002 03:21:17 -0000	1.24
  @@ -405,6 +405,17 @@
       }
   
       /**
  +     * Getter for property description.
  +     * @return Name of portlet description.
  +     */
  +    public String getDescription(String instanceDescription)
  +    {
  +      if (instanceDescription != null)
  +          return instanceDescription;
  +      return getDescription();
  +    }
  +
  +    /**
       */
       public void setDescription( String description )
       {
  @@ -426,6 +437,39 @@
       }
   
       /**
  +     * Setter for property image.
  +     */
  +    public void setImage(String instanceImage)
  +    {
  +    }    
  +     
  +    /**
  +    */
  +    public String getImage()
  +    {
  +        if (getPortletConfig()!=null)
  +        {
  +            if (getPortletConfig().getMetainfo()!=null)
  +            {
  +                return getPortletConfig().getMetainfo().getImage();
  +            }
  +        }
  +
  +        return null;
  +    }
  +    
  +    /**
  +     * Getter for property image.
  +     * @return Name of portlet image, icon.  The name is expected to be in the form of
a URL.
  +     */
  +    public String getImage(String instanceImage)
  +    {
  +      if (instanceImage != null)
  +          return instanceImage;
  +      return getImage();
  +    }
  +
  +    /**
       */
       public String getTitle()
       {
  @@ -439,6 +483,25 @@
   
           return null;
       }
  +    
  +
  +    /** Get a title for this instance of the portlet.  This method is called
  +     * from the context variable portlet_instance and from PortletInstance
  +     *
  +     * If you wish to append to the title, then you code should look like
  +     *    getTitle( String instanceTitle)
  +     *    {
  +     *      return super.getTitle( instanceTitle) + " - Appened title text";
  +     *    }
  +     *
  +     * @param instanceTitle Title from PSML
  +     */
  +    public String getTitle(String instanceTitle)
  +    {
  +        if (instanceTitle != null)
  +            return instanceTitle;
  +        return getTitle();
  +    }
   
       /**
       */
  @@ -704,4 +767,16 @@
       * @return true if the portlet does its own customization
       */
       public boolean providesCustomization() { return false; }
  +    
  +    /** Returns TRUE if the title bar in should be displayed. The title bar includes
  +     * the portlet title and action buttons.  This
  +     *
  +     * @param rundata The RunData object for the current request
  +     */
  +    public boolean isShowTitleBar(RunData rundata)
  +    {
  +        return true;
  +    }
  +    
  +    
   }
  
  
  
  1.3       +65 -3     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/JetspeedPortletInstance.java
  
  Index: JetspeedPortletInstance.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/JetspeedPortletInstance.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JetspeedPortletInstance.java	1 Jul 2002 06:15:52 -0000	1.2
  +++ JetspeedPortletInstance.java	24 Jul 2002 03:21:17 -0000	1.3
  @@ -53,17 +53,26 @@
    */
   package org.apache.jetspeed.portal;
   
  +// Java imports
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
   
  +// ECS imports
  +import org.apache.ecs.ClearElement;
  +import org.apache.ecs.ConcreteElement;
  +
  +// Jetspeed imports
   import org.apache.jetspeed.om.profile.Entry;
  +import org.apache.jetspeed.om.profile.MetaInfo;
   import org.apache.jetspeed.om.profile.PSMLDocument;
   import org.apache.jetspeed.om.profile.Parameter;
   import org.apache.jetspeed.om.profile.Profile;
   import org.apache.jetspeed.om.profile.psml.PsmlParameter;
   import org.apache.jetspeed.portal.Portlet;
   import org.apache.jetspeed.services.rundata.JetspeedRunData;
  +
  +//Turbine imports
   import org.apache.turbine.util.RunData;
   
   /**
  @@ -85,6 +94,7 @@
       private Profile profile;
       private PSMLDocument doc;
       private Entry entry;
  +    private JetspeedRunData rundata;
   
       /** 
        * keeping an instance of the actual Portlet around helps us with
  @@ -101,6 +111,7 @@
       public JetspeedPortletInstance(Portlet portlet, RunData data)
       {
           this(portlet, ((JetspeedRunData) data).getProfile());
  +        this.rundata = (JetspeedRunData)data;
       }
       
      /**
  @@ -285,7 +296,16 @@
        */
       public String getDescription()
       {
  -        return portlet.getDescription();
  +        String description = null;
  +        if (this.entry != null)
  +        {
  +            MetaInfo metaInfo = this.entry.getMetaInfo();
  +            if (metaInfo != null)
  +            {
  +                description = metaInfo.getDescription();
  +            }
  +        }
  +        return portlet.getDescription(description);
       }
   
       /**
  @@ -301,7 +321,33 @@
        */
       public String getTitle()
       {
  -        return portlet.getTitle();
  +        String title = null;
  +        if (this.entry != null)
  +        {
  +            MetaInfo metaInfo = this.entry.getMetaInfo();
  +            if (metaInfo != null)
  +            {
  +                title = metaInfo.getTitle();
  +            }
  +        }
  +        return portlet.getTitle(title);
  +    }
  +
  +    /**
  +     * @see PortletInstance#getImage()
  +     */
  +    public String getImage()
  +    {
  +        String image = null;
  +        if (entry != null)
  +        {
  +            MetaInfo metaInfo = this.entry.getMetaInfo();
  +            if (metaInfo != null)
  +            {
  +                return image = metaInfo.getImage();
  +            }
  +        }
  +        return portlet.getImage(image);
       }
   
       /**
  @@ -310,6 +356,22 @@
       public Portlet getPortlet()
       {
           return this.portlet;
  +    }
  +    
  +    /**
  +     * @see PortletInstance#getContent()
  +     */
  +    public ConcreteElement getContent()
  +    {
  +      return portlet.getContent(this.rundata);
  +    }
  +    
  +    /**
  +     * @see PortletInstance#isShowTitleBar()
  +     */
  +    public boolean isShowTitleBar()
  +    {
  +      return portlet.isShowTitleBar(this.rundata);
       }
   
   }
  
  
  
  1.45      +49 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/Portlet.java
  
  Index: Portlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/Portlet.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- Portlet.java	1 Jul 2002 05:54:09 -0000	1.44
  +++ Portlet.java	24 Jul 2002 03:21:17 -0000	1.45
  @@ -104,6 +104,20 @@
       public String getTitle();
   
       /**
  +     * Get a title for this instance of the portlet.  This method is called
  +     * from the context variable portlet_instance and from PortletInstance
  +     *
  +     * If you wish to append to the title, then you code should look like
  +     *    getTitle( String instanceTitle)
  +     *    {
  +     *      return super.getTitle( instanceTitle) + " - Appened title text";
  +     *    }
  +     *
  +     * @param instanceTitle Title from PSML
  +     */
  +    public String getTitle( String instanceTitle);
  +
  +    /**
       Set the title for this Portlet
       */
       public void setTitle( String title );
  @@ -127,11 +141,36 @@
       public String getDescription();
   
       /**
  +     * Get a Description for this instance of the portlet.  This method is called
  +     * from the context variable portlet_instance and from PortletInstance
  +     *
  +     * If you wish to append to the Description, then you code should look like
  +     *    getDescription( String instanceTitle)
  +     *    {
  +     *      return super.getDescription( instanceDescription) + " - Appened Description
text";
  +     *    }
  +     *
  +     * @param instanceDescription Description from PSML
  +     */
  +    public String getDescription( String instanceDescription);
  +
  +    /**
       Set the description for this Portlet
       */
       public void setDescription( String description );
   
       /**
  +     * Getter for property image. 
  +     * @return Name of portlet image, icon.  The name is expected to be in the form of
a URL.
  +     */
  +    public String getImage(String instanceImage);
  +    
  +    /**
  +     * Setter for property image. 
  +     */
  +    public void setImage(String instanceImage);
  +
  +    /**
       Returns an HTML representation of this portlet.  Usually a Portlet would
       initialized itself within init() and then when getContent is called it
       would return its presentation.
  @@ -182,6 +221,14 @@
       public long getCreationTime();
       
       /**
  +     * Returns TRUE if the title bar in should be displayed. The title bar includes
  +     * the portlet title and action buttons.  This
  +     * 
  +     * @param rundata The RunData object for the current request
  +     */
  +    public boolean isShowTitleBar(RunData rundata);
  +
  +    /**
       Set the creation time for this Portlet
       */
       public void setCreationTime( long creationTime );
  @@ -230,5 +277,6 @@
       * @return true if the portlet does its own customization
       */
       public boolean providesCustomization();
  +    
   }
   
  
  
  
  1.19      +11 -3     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java
  
  Index: VelocityPortletControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- VelocityPortletControl.java	23 Jul 2002 03:11:58 -0000	1.18
  +++ VelocityPortletControl.java	24 Jul 2002 03:21:18 -0000	1.19
  @@ -142,16 +142,24 @@
   
           // Put the request and session based contexts
           TurbinePull.populateContext(context, rundata);
  -
  +        
           if ( portlet.getName().equals(jdata.getCustomized())
                && (!portlet.providesCustomization()) )
           {            
               context.put("portlet",JetspeedTool.getCustomizer(portlet));
  +            context.put("portlet_instance",JetspeedTool.getCustomizer(portlet));
           }
           else
           {
               context.put("portlet", portlet );
  -            context.put("portlet_instance", PersistenceManager.getInstance(portlet, jdata)
);
  +            if (PersistenceManager.getInstance(portlet, jdata) == null)
  +            {
  +              context.put("portlet_instance", portlet );
  +            }
  +            else
  +            {
  +              context.put("portlet_instance", PersistenceManager.getInstance(portlet, jdata)
);
  +            }
           }
               
           // allow subclasses to add elements to the context
  
  
  
  1.57      +77 -7     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java
  
  Index: AbstractPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- AbstractPortlet.java	1 Jul 2002 05:54:09 -0000	1.56
  +++ AbstractPortlet.java	24 Jul 2002 03:21:18 -0000	1.57
  @@ -57,6 +57,7 @@
   //jetspeed
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.capability.CapabilityMapFactory;
  +import org.apache.jetspeed.om.profile.MetaInfo;
   import org.apache.jetspeed.om.registry.MediaTypeEntry;
   import org.apache.jetspeed.om.registry.PortletEntry;
   import org.apache.jetspeed.portal.BasePortletConfig;
  @@ -107,6 +108,7 @@
   @author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>
   @author <A HREF="mailto:raphael@apache.org">RaphaŽl Luta</A>
   @author <A HREF="mailto:sgala@apache.org">Santiago Gala</A>
  +@author <A HREF="mailto:paulsp@apache.org">Paul Spencer</A>
   @version $Id$
   */
   public abstract class AbstractPortlet implements Portlet, PortletState, Cacheable, Refreshable
  @@ -480,6 +482,18 @@
       }
   
       /**
  +     * Provide a Description within PML if the user has specified one.
  +     *
  +     * @return a null if entry AND portlet have not defined a description
  +     */
  +    public String getDescription(String instanceDescription)
  +    {
  +      if (instanceDescription != null)
  +          return instanceDescription;
  +      return getDescription();
  +    }
  +
  +    /**
        */
       public void setDescription( String description ) {
           PortletConfig pc = getPortletConfig();
  @@ -504,13 +518,26 @@
        *
        * @return a null entry if the user hasn't defined anything
        */
  -    public String getTitle() {
  +    public String getTitle()
  +    {
           if (getPortletConfig()!=null)
               if (getPortletConfig().getMetainfo()!=null)
                   return getPortletConfig().getMetainfo().getTitle();
   
           return null;
       }
  +    
  +    /**
  +     * Provide a title within PML if the user has specified one.
  +     *
  +     * @return a null if entry AND portlet have not defined a title
  +     */
  +    public String getTitle(String instanceTitle)
  +    {
  +      if (instanceTitle != null)
  +          return instanceTitle;
  +      return getTitle();
  +    }
   
       /**
        * Set the title for this Portlet.
  @@ -534,6 +561,47 @@
   
   
       /**
  +     * Getter for property image.
  +     * @return Name of portlet image, icon.  The name is expected to be in the form of
a URL.
  +     */
  +    public String getImage()
  +    {
  +        if (getPortletConfig()!=null)
  +            if (getPortletConfig().getMetainfo()!=null)
  +                return getPortletConfig().getMetainfo().getImage();
  +
  +        return null;
  +    }
  +
  +    /**
  +     * Getter for property image.
  +     * @return a null if entry AND portlet have not defined an icon.
  +     */
  +    public String getImage(String instanceImage)
  +    {
  +      if (instanceImage != null)
  +          return instanceImage;
  +      return getImage();
  +    }
  +    
  +    public void setImage( String image )
  +    {
  +        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.setImage(image);
  +    }
  +
  +    /**
        * Is the portled editable/customizeable.
        * @param rundata The RunData object for the current request
        * @return <CODE>true</CODE> Editing is allow
  @@ -720,9 +788,6 @@
       /**
        * Returns TRUE if the title bar in should be displayed. The title bar includes
        * the portlet title and action buttons.  This
  -     * 
  -     * FIXME: this is used in jetspeed.vm to drive the title display, but
  -     * it is *not* in any public interface as of 20020123.
        *
        * @param rundata The RunData object for the current request
        */
  @@ -772,13 +837,14 @@
           }
           catch (PortalPersistenceException e)
           {
  -            Log.error("Exception while setting attribute "+attrName+" for portlet "+getName(),e);
  +            Log.error("Exception while setting attribute "+attrName+" for portlet "+getName(),
e);
           }
       }
   
       /**
        * Gets the portlet instance associated with this portlet.
        *
  +     * @param rundata The RunData object for the current request
        * @return PortletInstance
        */
       public PortletInstance getInstance(RunData rundata)
  @@ -802,5 +868,9 @@
       /**
       * @return true if the portlet does its own customization
       */
  -    public boolean providesCustomization() { return false; }
  +    public boolean providesCustomization()
  +    {
  +        return false;
  +    }
  +    
   }
  
  
  
  1.3       +73 -3     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java
  
  Index: ContainerTestPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContainerTestPortlet.java	1 Jul 2002 05:54:09 -0000	1.2
  +++ ContainerTestPortlet.java	24 Jul 2002 03:21:18 -0000	1.3
  @@ -95,6 +95,8 @@
   
   public class ContainerTestPortlet implements Portlet /* , PortletState, Cacheable, Refreshable
*/
   {
  +    private String image = null;
  +
       private String name = "not set";
   
       private String title = "la title";
  @@ -158,6 +160,26 @@
       {
           return this.title;
       }
  +    
  +    /**
  +     * t a title for this instance of the portlet.  This method is called
  +     * from the context variable portlet_instance and from PortletInstance
  +     *
  +     * If you wish to append to the title, then you code should look like
  +     *    getTitle( String instanceTitle)
  +     *    {
  +     *      return super.getTitle( instanceTitle) + " - Appened title text";
  +     *    }
  +     *
  +     * @param instanceTitle Title from PSML
  +     */
  +    public String getTitle(String instanceTitle)
  +    {
  +        if (instanceTitle != null)
  +            return instanceTitle;
  +        return getTitle();
  +    }
  +
   
       /**
       Set the title for this Portlet
  @@ -189,6 +211,18 @@
       }
   
       /**
  +     * Provide a Description within PML if the user has specified one.
  +     *
  +     * @return a null entry if the user hasn't defined anything
  +     */
  +    public String getDescription(String instanceDescription)
  +    {
  +      if (instanceDescription != null)
  +          return instanceDescription;
  +      return getDescription();
  +    }
  +
  +    /**
       Set the description for this Portlet
       */
       public void setDescription( String description )
  @@ -196,7 +230,32 @@
           this.description = description;        
       }
   
  -     /**
  +    /**
  +     * Getter for property image.
  +     * @return Name of portlet image, icon.  The name is expected to be in the form of
a URL.
  +     */
  +    public String getImage()
  +    {
  +        return image;
  +    }
  +
  +    /**
  +     * Getter for property image.
  +     * @return Name of portlet image, icon.  The name is expected to be in the form of
a URL.
  +     */
  +    public String getImage(String instanceImage)
  +    {
  +      if (instanceImage != null)
  +          return instanceImage;
  +      return getImage();
  +    }
  +    
  +    public void setImage( String image )
  +    {
  +        this.image = image;
  +    }
  +
  +    /**
       Returns an HTML representation of this portlet.  Usually a Portlet would
       initialized itself within init() and then when getContent is called it
       would return its presentation.
  @@ -390,5 +449,16 @@
       {
           return false;
       }
  -
  +   
  +    /** Returns TRUE if the title bar in should be displayed. The title bar includes
  +     * the portlet title and action buttons.  This
  +     *
  +     * @param rundata The RunData object for the current request
  +     */
  +    public boolean isShowTitleBar(RunData rundata)
  +    {
  +        return true;
  +    }
  +    
  +     
   }
  
  
  
  1.8       +32 -6     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java
  
  Index: PortletWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PortletWrapper.java	1 Jul 2002 05:54:10 -0000	1.7
  +++ PortletWrapper.java	24 Jul 2002 03:21:18 -0000	1.8
  @@ -158,6 +158,11 @@
           return wrappedPortlet.getDescription();
       }
   
  +    public String getDescription( String instanceDescription)
  +    {
  +        return wrappedPortlet.getDescription(instanceDescription);
  +    }
  +
       /**
       */
       public void setDescription( String description )
  @@ -166,10 +171,23 @@
       }
   
       /**
  -    Provide a title within PML if the user has specified one.
  -
  -    @return a null entry if the user hasn't defined anything
  -    */
  +     * @see Portlet#getImage
  +     */
  +    public String getImage(String instanceImage)
  +    {
  +        return wrappedPortlet.getImage( instanceImage );
  +    }
  +    
  +    /**
  +     * @see Portlet#setImge
  +     */
  +    public void setImage(String image)
  +    {
  +        wrappedPortlet.setImage( image );
  +    }
  +    /**
  +     * @see Portlet#getTitle
  +     */
       public String getTitle()
       {
           /* FIXME, no rundata here if( !checkPermission(rundata, 
  @@ -181,6 +199,14 @@
       }
   
       /**
  +     * @see Portlet#getImage
  +     */
  +    public String getTitle(String instanceTitle)
  +    {
  +        return wrappedPortlet.getTitle(instanceTitle);
  +    }
  +    
  +    /**
       Set the title for this Portlet
       */
       public void setTitle( String title )
  @@ -395,5 +421,5 @@
       public boolean providesCustomization()
       {
           return wrappedPortlet.providesCustomization();
  -    }
  +    }       
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message