myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject cvs commit: incubator-myfaces/src/components/org/apache/myfaces/component/html/util HtmlComponentUtils.java
Date Fri, 28 Jan 2005 17:19:10 GMT
matzew      2005/01/28 09:19:10

  Modified:    tlds/entities ext_forceId_attribute.xml
               src/share/org/apache/myfaces/renderkit JSFAttr.java
               src/share/org/apache/myfaces/taglib
                        UIComponentBodyTagBase.java UIComponentTagBase.java
               src/components/org/apache/myfaces/component/html/util
                        HtmlComponentUtils.java
  Log:
  Patch for MYFACES-91 form Sean Schofield
  
  Revision  Changes    Path
  1.2       +18 -1     incubator-myfaces/tlds/entities/ext_forceId_attribute.xml
  
  Index: ext_forceId_attribute.xml
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/tlds/entities/ext_forceId_attribute.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ext_forceId_attribute.xml	26 Jan 2005 12:50:15 -0000	1.1
  +++ ext_forceId_attribute.xml	28 Jan 2005 17:19:09 -0000	1.2
  @@ -1,7 +1,7 @@
           <!-- 
           This attribute indicates that the component should be forced to use the specified
id instead of 
           using the one that faces generates.  Components contained within a "list" will
include a '[n]'  
  -        suffix where 'n' is the row index.
  +        suffix where 'n' is the row index (unless the forceIdIndex attribute is set to
false).
           -->
           <attribute>
               <name>forceId</name>
  @@ -10,3 +10,20 @@
               <type>java.lang.String</type>
               <description>If true, this component will force the use of the specified
id when rendering.</description>
           </attribute>        
  +
  +        <!-- 
  +        If the component is contained within an "list" (such as dataTable), this attribute
indicates whether or not a 
  +        '[n]' suffix should be added where 'n' is the row index.  Default is true.  The
attribute is ignored if forceId 
  +        is false (or not specified)
  +        -->
  +        <attribute>
  +            <name>forceIdIndex</name>
  +            <required>false</required>
  +            <rtexprvalue>false</rtexprvalue>
  +            <type>java.lang.String</type>
  +            <description>
  +                If false, this component will not append a '[n]' suffix (where 'n' is the
row index) to components 
  +                that are contained within a "list."  This value will be true by default
and the value will be ignored if 
  +                the value of forceId is false (or not specified.)
  +            </description>
  +        </attribute>        
  
  
  
  1.7       +3 -2      incubator-myfaces/src/share/org/apache/myfaces/renderkit/JSFAttr.java
  
  Index: JSFAttr.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/share/org/apache/myfaces/renderkit/JSFAttr.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JSFAttr.java	10 Jan 2005 08:08:11 -0000	1.6
  +++ JSFAttr.java	28 Jan 2005 17:19:09 -0000	1.7
  @@ -33,6 +33,7 @@
       public static final String   ESCAPE_ATTR                    = "escape";
       public static final String   TRANSIENT_ATTR                 = "transient";
       public static final String   FORCE_ID_ATTR                  = "forceId";
  +    public static final String   FORCE_ID_INDEX_ATTR            = "forceIdIndex";
       
       // Common Output Attributes
       public static final String   FOR_ATTR                       = "for";
  
  
  
  1.13      +17 -1     incubator-myfaces/src/share/org/apache/myfaces/taglib/UIComponentBodyTagBase.java
  
  Index: UIComponentBodyTagBase.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/share/org/apache/myfaces/taglib/UIComponentBodyTagBase.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- UIComponentBodyTagBase.java	25 Jan 2005 22:15:53 -0000	1.12
  +++ UIComponentBodyTagBase.java	28 Jan 2005 17:19:09 -0000	1.13
  @@ -31,6 +31,9 @@
    * @author Manfred Geiler (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.13  2005/01/28 17:19:09  matzew
  + * Patch for MYFACES-91 form Sean Schofield
  + *
    * Revision 1.12  2005/01/25 22:15:53  matzew
    * JavaDoc patch form Sean Schofield
    *
  @@ -123,6 +126,7 @@
       //UIComponent attributes
       private String _transient;
       private String _forceId;
  +    private String _forceIdIndex = "true";
   
       //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
       private String _value;
  @@ -135,6 +139,7 @@
   
           setBooleanProperty(component, JSFAttr.TRANSIENT_ATTR, _transient);
           setBooleanProperty(component, JSFAttr.FORCE_ID_ATTR, _forceId);
  +        setBooleanProperty(component, JSFAttr.FORCE_ID_INDEX_ATTR, _forceIdIndex);
   
           //rendererType already handled by UIComponentTag
   
  @@ -166,6 +171,17 @@
           _forceId = aForceId;
       }
   
  +    /**
  +     * Sets the forceIdIndex attribute of the tag.  NOTE: Not every tag that extends this
class will 
  +     * actually make use of this attribute.  Check the TLD to see which components actually
implement it.
  +     * 
  +     * @param aForceIdIndex The value of the forceIdIndex attribute.
  +     */
  +    public void setForceIdIndex(String aForceIdIndex)
  +    {
  +        _forceIdIndex = aForceIdIndex;
  +    }
  +
       public void setValue(String value)
       {
           _value = value;
  
  
  
  1.10      +17 -1     incubator-myfaces/src/share/org/apache/myfaces/taglib/UIComponentTagBase.java
  
  Index: UIComponentTagBase.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/share/org/apache/myfaces/taglib/UIComponentTagBase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- UIComponentTagBase.java	25 Jan 2005 22:15:53 -0000	1.9
  +++ UIComponentTagBase.java	28 Jan 2005 17:19:09 -0000	1.10
  @@ -24,6 +24,9 @@
    * @author Manfred Geiler (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.10  2005/01/28 17:19:09  matzew
  + * Patch for MYFACES-91 form Sean Schofield
  + *
    * Revision 1.9  2005/01/25 22:15:53  matzew
    * JavaDoc patch form Sean Schofield
    *
  @@ -57,6 +60,7 @@
       //UIComponent attributes
       private String _transient;
       private String _forceId;
  +    private String _forceIdIndex = "true";
       
       //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
       private String _value;
  @@ -69,6 +73,7 @@
   
           setBooleanProperty(component, JSFAttr.TRANSIENT_ATTR, _transient);
           setBooleanProperty(component, JSFAttr.FORCE_ID_ATTR, _forceId);
  +        setBooleanProperty(component, JSFAttr.FORCE_ID_INDEX_ATTR, _forceIdIndex);
   
           //rendererType already handled by UIComponentTag
   
  @@ -99,6 +104,17 @@
       {
           _forceId = aForceId;
       }
  +    
  +    /**
  +     * Sets the forceIdIndex attribute of the tag.  NOTE: Not every tag that extends this
class will 
  +     * actually make use of this attribute.  Check the TLD to see which components actually
implement it.
  +     * 
  +     * @param aForceIdIndex The value of the forceIdIndex attribute.
  +     */
  +    public void setForceIdIndex(String aForceIdIndex)
  +    {
  +        _forceIdIndex = aForceIdIndex;
  +    }    
   
       public void setValue(String value)
       {
  
  
  
  1.5       +16 -4     incubator-myfaces/src/components/org/apache/myfaces/component/html/util/HtmlComponentUtils.java
  
  Index: HtmlComponentUtils.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/component/html/util/HtmlComponentUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HtmlComponentUtils.java	16 Jan 2005 20:09:54 -0000	1.4
  +++ HtmlComponentUtils.java	28 Jan 2005 17:19:09 -0000	1.5
  @@ -77,10 +77,22 @@
               {
                   if (parentContainer instanceof UIData)
                   {
  -                    int rowIndex = ((UIData)parentContainer).getRowIndex();
  -                    if (rowIndex != -1)
  +                    // see if the originally supplied id should be used 
  +                    Boolean forceIdIndexValue = (Boolean)component.getAttributes().get(JSFAttr.FORCE_ID_INDEX_ATTR);
  +                    boolean forceIdIndex = true;
  +
  +                    if (forceIdIndexValue != null)
                       {
  -                        clientId = clientId + "[" + rowIndex + "]";
  +                        forceIdIndex = forceIdIndexValue.booleanValue();
  +                    }        
  +
  +                    // note: user may have specifically requested that we do not add the
special forceId [index] suffix
  +                    if (forceIdIndex)
  +                    {
  +                        int rowIndex = ( (UIData) parentContainer).getRowIndex();
  +                        if (rowIndex != -1) {
  +                            clientId = clientId + "[" + rowIndex + "]";
  +                        }
                       }
                   }
               }
  
  
  

Mime
View raw message