portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/page/psml PropertyImpl.java FragmentImpl.java
Date Thu, 05 Aug 2004 23:34:52 GMT
weaver      2004/08/05 16:34:52

  Modified:    components/page-manager/src/java/org/apache/jetspeed/om/page/psml
                        PropertyImpl.java FragmentImpl.java
  Log:
  Added easier access to property values of fragments
  
  Revision  Changes    Path
  1.3       +13 -1     jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java
  
  Index: PropertyImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertyImpl.java	28 May 2004 22:05:08 -0000	1.2
  +++ PropertyImpl.java	5 Aug 2004 23:34:52 -0000	1.3
  @@ -114,4 +114,16 @@
       {
           return super.clone();
       }
  +    /**
  +     * <p>
  +     * getIntValue
  +     * </p>
  +     *
  +     * @see org.apache.jetspeed.om.page.Property#getIntValue()
  +     * @return
  +     */
  +    public int getIntValue()
  +    {        
  +        return Integer.parseInt(value);
  +    }
   }
  
  
  
  1.3       +76 -1     jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
  
  Index: FragmentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FragmentImpl.java	28 May 2004 22:05:08 -0000	1.2
  +++ FragmentImpl.java	5 Aug 2004 23:34:52 -0000	1.3
  @@ -133,6 +133,41 @@
   
           return props;
       }
  +    
  +    public String getPropertyValue(String layout, String propName)
  +    {
  +        Iterator itr = getProperties(layout).iterator();
  +        while(itr.hasNext())
  +        {
  +            Property aProp = (Property) itr.next();
  +            if(aProp.getName().equals(propName))
  +            {
  +                return aProp.getValue();
  +            }
  +        }
  +        
  +        return null;
  +    }
  +    
  +    public void setPropertyValue(String layout, String propName, String value)
  +    {
  +        Iterator itr = getProperties(layout).iterator();
  +        while(itr.hasNext())
  +        {
  +            Property aProp = (Property) itr.next();
  +            if(aProp.getName().equals(propName))
  +            {
  +                aProp.setValue(value);
  +                return;
  +            }
  +        }
  +        
  +        PropertyImpl newProp = new PropertyImpl();
  +        newProp.setLayout(layout);
  +        newProp.setName(propName);
  +        newProp.setValue(value);
  +        addProperty(newProp);
  +    }
   
       public void addProperty(Property p)
       {
  @@ -201,4 +236,44 @@
   
       }   // clone
   
  +    /**
  +     * <p>
  +     * equals
  +     * </p>
  +     *
  +     * @see java.lang.Object#equals(java.lang.Object)
  +     * @param obj
  +     * @return
  +     */
  +    public boolean equals( Object obj )
  +    {
  +        if(obj != null && obj instanceof Fragment)
  +        {
  +            Fragment aFragment = (Fragment) obj;
  +            return getId().equals(aFragment.getId());
  +        }
  +        else
  +        {
  +            return false;
  +        }
  +    }
  +    /**
  +     * <p>
  +     * hashCode
  +     * </p>
  +     *
  +     * @see java.lang.Object#hashCode()
  +     * @return
  +     */
  +    public int hashCode()
  +    {    
  +        if(getId() != null)
  +        {
  +            return (Fragment.class.getName()+":"+getId()).hashCode();
  +        }
  +        else
  +        {
  +            return super.hashCode();
  +        }
  +    }
   }
  
  
  

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


Mime
View raw message