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/controls AbstractPortletControl.java
Date Wed, 06 Mar 2002 18:32:34 GMT
taylor      02/03/06 10:32:34

  Modified:    src/java/org/apache/jetspeed/portal/controls
                        AbstractPortletControl.java
  Log:
  - added method to lookup portlet from portlet set by id
  
  Revision  Changes    Path
  1.13      +41 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java
  
  Index: AbstractPortletControl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AbstractPortletControl.java	4 Dec 2001 18:35:51 -0000	1.12
  +++ AbstractPortletControl.java	6 Mar 2002 18:32:34 -0000	1.13
  @@ -91,7 +91,7 @@
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
    * @author <a href="mailto:sgala@apache.org">Santiago Gala</a>
  - * @version $Id: AbstractPortletControl.java,v 1.12 2001/12/04 18:35:51 sgala Exp $
  + * @version $Id: AbstractPortletControl.java,v 1.13 2002/03/06 18:32:34 taylor Exp $
    */
   public abstract class AbstractPortletControl extends AbstractPortlet
       implements PortletControl
  @@ -105,6 +105,11 @@
       private Portlet                 portlet = null;
       private PortletControlConfig    conf = null;
   
  +    /**
  +    Provide a Unique Portlet ID
  +    */
  +    private String id = null;
  +
       // PortletControl specifc interface
       
       /**
  @@ -748,5 +753,40 @@
               ((PortletState)p).setMinimized( minimize, rundata);
           }
       }
  +
  +    public String getID()
  +    {
  +        return id;
  +    }
  +
  +    public void setID(String id)
  +    {
  +        this.id = id;
  +    }
  +
  +    /**
  +    Returns the Portlet with the given id
  +    */
  +    public Portlet getPortletByID(String id)
  +    {
  +        Portlet p = getPortlet();
  +         if (null == p) 
  +            return null;
  +
  +        if (p instanceof PortletSet)
  +        {
  +            Enumeration e = ((PortletSet)p).getPortlets();
  +            Portlet portlet = null;
  +            while ( e.hasMoreElements() )
  +            {
  +                portlet = (Portlet)e.nextElement();
  +                if (portlet.getID().equals(id))
  +                    return portlet;
  +            }
  +            return portlet;
  +       }
  +       return null;
  +    }
  +
   
   }
  
  
  

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