portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/service JetspeedPersistenceService.java PersistenceService.java
Date Wed, 06 Mar 2002 17:03:35 GMT
taylor      02/03/06 09:03:35

  Modified:    src/java/org/apache/jetspeed/portal BasePortletSet.java
                        Portlet.java PortletSet.java
               src/java/org/apache/jetspeed/portal/controllers
                        CardPortletController.java
               src/java/org/apache/jetspeed/portal/controls
                        VelocityPortletSetControl.java
               src/java/org/apache/jetspeed/portal/portlets
                        AbstractPortlet.java
               src/java/org/apache/jetspeed/portal/security/portlets
                        PortletWrapper.java
               src/java/org/apache/jetspeed/portal/service
                        JetspeedPersistenceService.java
                        PersistenceService.java
  Log:
    - Start of support for portlet id. Set PSML id into portlet on portlet-set generation
  
  Revision  Changes    Path
  1.15      +36 -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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BasePortletSet.java	4 Dec 2001 18:35:51 -0000	1.14
  +++ BasePortletSet.java	6 Mar 2002 17:03:33 -0000	1.15
  @@ -64,6 +64,8 @@
   import org.apache.jetspeed.util.*;
   import org.apache.jetspeed.portal.expire.*;
   import org.apache.jetspeed.services.JetspeedSecurity;
  +import org.apache.jetspeed.portal.service.PersistenceService;
  +import org.apache.jetspeed.portal.service.ServiceFactory;
   
   //turbine stuff
   import org.apache.turbine.util.Log;
  @@ -81,7 +83,7 @@
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
    * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  - * @version $Id: BasePortletSet.java,v 1.14 2001/12/04 18:35:51 sgala Exp $
  + * @version $Id: BasePortletSet.java,v 1.15 2002/03/06 17:03:33 taylor Exp $
    */
   public class BasePortletSet implements PortletSet, Portlet, PortletState
   {
  @@ -121,6 +123,11 @@
       */
       private String info;
   
  +    /** 
  +    The portletset id
  +    */
  +    private String id = null;
  +
       /**
       Builds a new empty set for storing portlets
       */
  @@ -187,6 +194,24 @@
       }
   
       /**
  +    Returns the Portlet with the given id
  +    */
  +    public Portlet getPortletByID(String id)
  +    {
  +        if (portlets == null)
  +            return null;
  +
  +        Portlet portlet = null;
  +        for (int ix=0; ix < portlets.size(); ix++)
  +        {
  +            portlet = (Portlet)portlets.elementAt(ix);
  +            if (portlet.getID().equals(id))
  +                return portlet;
  +        }
  +        return portlet;
  +    }
  +
  +    /**
       Returns the portlet set as an Enumeration
       */
       public Enumeration getPortlets()
  @@ -588,6 +613,16 @@
       {
           // TODO: figure out if we can get an attribute for a portlet set...
           return attrDefValue;
  +    }
  +
  +    public String getID()
  +    {
  +        return id;
  +    }
  +
  +    public void setID(String id)
  +    {
  +        this.id = id;
       }
   
   }
  
  
  
  1.42      +7 -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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- Portlet.java	4 Dec 2001 18:35:51 -0000	1.41
  +++ Portlet.java	6 Mar 2002 17:03:33 -0000	1.42
  @@ -64,7 +64,7 @@
   extensible so that 3rd parties implement their own Portlets.
   
   @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  -@version $Id: Portlet.java,v 1.41 2001/12/04 18:35:51 sgala Exp $
  +@version $Id: Portlet.java,v 1.42 2002/03/06 17:03:33 taylor Exp $
   */
   public interface Portlet
   {
  @@ -201,5 +201,11 @@
       */
       public String getAttribute( String attrName, String attrDefValue, RunData rundata );
   
  +    /**
  +    Retrieve a unique portlet id 
  +    */
  +    public String getID();
  +
  +    public void setID(String id);
   }
   
  
  
  
  1.24      +6 -1      jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletSet.java
  
  Index: PortletSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletSet.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- PortletSet.java	4 Jun 2001 17:36:36 -0000	1.23
  +++ PortletSet.java	6 Mar 2002 17:03:34 -0000	1.24
  @@ -65,7 +65,7 @@
    * 
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
    * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  - * @version $Id: PortletSet.java,v 1.23 2001/06/04 17:36:36 raphael Exp $
  + * @version $Id: PortletSet.java,v 1.24 2002/03/06 17:03:34 taylor Exp $
    */
   public interface PortletSet extends Portlet
   {
  @@ -93,6 +93,11 @@
        * Returns the Portlet at position pos
        */
       public Portlet getPortletAt(int pos);
  +
  +    /**
  +     * Returns the Portlet with the given id
  +     */
  +    public Portlet getPortletByID(String id);
   
       /**
        * Returns the portlet set as an Enumeration
  
  
  
  1.20      +15 -3     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/CardPortletController.java
  
  Index: CardPortletController.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/CardPortletController.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CardPortletController.java	4 Dec 2001 18:35:51 -0000	1.19
  +++ CardPortletController.java	6 Mar 2002 17:03:34 -0000	1.20
  @@ -81,7 +81,7 @@
   or with an invalid value, use the first portlet (position 0)</li>
   </p>
   @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  -@version $Id: CardPortletController.java,v 1.19 2001/12/04 18:35:51 sgala Exp $
  +@version $Id: CardPortletController.java,v 1.20 2002/03/06 17:03:34 taylor Exp $
   */
   public class CardPortletController extends AbstractPortletController
       implements PanedPortletController
  @@ -99,6 +99,18 @@
           PortletSet myPortlets = this.getPortlets();
           PortletControllerConfig conf = getConfig();
   
  +      /*
  +        String id = rundata.getParameters().getString( "peid" );
  +        System.out.println("id = " + id);
  +
  +        if (id != null)
  +        {
  +            Portlet p = myPortlets.getPortletByID(id);
  +            System.out.println("p = " + p.getID());
  +            base.addElement( p.getContent( rundata ) );            
  +            return base;
  +        }
  +        */
           String pane = rundata.getParameters().getString( getParameterName() );
           
           if (pane == null)
  @@ -233,7 +245,7 @@
                   return true;
               }
           }
  -
  +                                                       
           // ...finally test implicit position  
           
           // sanity check: the position sought should be positive and lower than set size
  @@ -242,7 +254,7 @@
               return false;
           }
   
  -        return ( getPortlets().getPortletAt( paneNum ) == p );
  +       return ( getPortlets().getPortletAt( paneNum ) == p );
       }
   
       /**
  
  
  
  1.5       +24 -6     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletSetControl.java
  
  Index: VelocityPortletSetControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletSetControl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- VelocityPortletSetControl.java	30 Jul 2001 05:47:58 -0000	1.4
  +++ VelocityPortletSetControl.java	6 Mar 2002 17:03:34 -0000	1.5
  @@ -63,6 +63,7 @@
   import org.apache.jetspeed.portal.PortletSet;
   import org.apache.jetspeed.portal.PortletState;
   import org.apache.jetspeed.portal.PanedPortletController;
  +import org.apache.turbine.util.DynamicURI;
   
   // Velocity Stuff
   import org.apache.velocity.context.Context;
  @@ -90,7 +91,7 @@
       {
           if (getPortlet() instanceof PortletSet)
           {
  -            context.put("tabs", getTabs((PortletSet)getPortlet(), rundata) );
  +            context.put("tabs", getTabs((PortletSet)getPortlet(), rundata, context) );
           }
       }    
   
  @@ -104,9 +105,8 @@
        * @param portlet the base portlet to explore for children
        * @
        */
  -    private List getTabs( PortletSet portlets, RunData rundata )
  -    {
  -        
  +    private List getTabs( PortletSet portlets, RunData rundata, Context context )
  +    {       
           Vector tabs = new Vector();
           PanedPortletController controller = null;
   
  @@ -117,7 +117,8 @@
               controller = (PanedPortletController) portlets.getController();
           }
   
  -        for ( Enumeration en = portlets.getPortlets(); en.hasMoreElements(); )
  +        int count = 0;
  +        for ( Enumeration en = portlets.getPortlets(); en.hasMoreElements(); count++ )
           {
               Portlet p = (Portlet)en.nextElement();
               
  @@ -137,7 +138,24 @@
               if ( controller != null )
               {
                   tab.setSelected(controller.isSelected(p, rundata));
  -                tab.setLink(controller.getPortletURI( p, rundata ).toString());
  +                /*
  +                String pane = rundata.getParameters().getString( "peid" );
  +                if (null != pane)
  +                {
  +                    tab.setSelected(pane.equals(p.getID()));
  +                    context.put("portlet", portlets.getPortletByID(pane));
  +                }
  +                else
  +                {
  +                    tab.setSelected(count == 0);
  +                }
  +                */
  +                tab.setLink(controller.getPortletURI( p, rundata ).toString());       
        
  +/*
  +                DynamicURI duri = new DynamicURI( rundata );
  +                duri.addPathInfo("peid", p.getID());
  +                tab.setLink(duri.toString());
  +*/
               }
                   
               tab.setActions(buildActionList(rundata, p));
  
  
  
  1.53      +16 -1     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.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- AbstractPortlet.java	5 Feb 2002 03:08:05 -0000	1.52
  +++ AbstractPortlet.java	6 Mar 2002 17:03:34 -0000	1.53
  @@ -106,7 +106,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>
  -@version $Id: AbstractPortlet.java,v 1.52 2002/02/05 03:08:05 paulsp Exp $
  +@version $Id: AbstractPortlet.java,v 1.53 2002/03/06 17:03:34 taylor Exp $
   */
   public abstract class AbstractPortlet implements Portlet, PortletState, Cacheable, Refreshable
   {
  @@ -120,6 +120,11 @@
       private String        name            = null;
   
       /**
  +    Provide a Unique Portlet ID
  +    */
  +    private String id = null;
  +
  +    /**
       Cache handle for this object.
       */
       private String        handle          = "";
  @@ -794,6 +799,16 @@
           {
               Log.error("Exception while setting attribute "+attrName+" for portlet "+getName(),e);
           }
  +    }
  +
  +    public String getID()
  +    {
  +        return id;
  +    }
  +
  +    public void setID(String id)
  +    {
  +        this.id = id;
       }
   
   }
  
  
  
  1.3       +13 -2     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletWrapper.java	28 Jan 2002 11:20:19 -0000	1.2
  +++ PortletWrapper.java	6 Mar 2002 17:03:34 -0000	1.3
  @@ -80,7 +80,7 @@
   </p>
   
   @author <A HREF="mailto:sgala@apache.org">Santiago Gala</A>
  -@version $Id: PortletWrapper.java,v 1.2 2002/01/28 11:20:19 sgala Exp $
  +@version $Id: PortletWrapper.java,v 1.3 2002/03/06 17:03:34 taylor Exp $
   */
   public class PortletWrapper implements Portlet
   {
  @@ -340,5 +340,16 @@
           return new PortletWrapper( aPortlet );
           
       }
  -    
  + 
  +
  +    public String getID()
  +    {
  +        return wrappedPortlet.getID();
  +    }
  +
  +    public void setID(String id)
  +    {
  +        wrappedPortlet.setID(id);
  +    }
  +   
   }
  
  
  
  1.11      +12 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/service/JetspeedPersistenceService.java
  
  Index: JetspeedPersistenceService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/service/JetspeedPersistenceService.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JetspeedPersistenceService.java	6 Dec 2001 05:13:45 -0000	1.10
  +++ JetspeedPersistenceService.java	6 Mar 2002 17:03:34 -0000	1.11
  @@ -244,6 +244,8 @@
   
           private Entry iEntry;
   
  +        private String id;
  +
           private Hashtable iAttributes = new Hashtable ();
   
           private Page (PSMLDocument aDocument, Entry aEntry)
  @@ -255,11 +257,16 @@
               reset ();
           }
   
  +        public String getId()
  +        {
  +            return id;
  +        }
  +
           public String getName ()
           {
               return (iDocument.getName());
           }
  -
  +       
           public String getAttribute (String aName)
           {
               String value = null;
  @@ -309,6 +316,8 @@
           {
               iAttributes.clear ();
   
  +            id = iEntry.getId();
  +
               // take a clean copy of the parameters as there are in the
               // portlets tree (= PSML)
   
  @@ -366,5 +375,7 @@
               }
               
           }
  +
       }
  +
   }
  
  
  
  1.5       +7 -0      jakarta-jetspeed/src/java/org/apache/jetspeed/portal/service/PersistenceService.java
  
  Index: PersistenceService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/service/PersistenceService.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PersistenceService.java	10 Jan 2002 08:32:50 -0000	1.4
  +++ PersistenceService.java	6 Mar 2002 17:03:34 -0000	1.5
  @@ -271,5 +271,12 @@
            **/
   
           public void removeAttribute (String aName);
  +
  +        /**
  +         ** get the portlet id
  +         **
  +         **/
  +        public String getId();
  +
       }
   }
  
  
  

--
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