tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/parse SpecificationParser.java Tapestry_3_1.dtd
Date Fri, 04 Feb 2005 02:28:06 GMT
hlship      2005/02/03 18:28:06

  Modified:    .        status.xml
               src/documentation/content/xdocs/UsersGuide spec.xml
               framework/src/java/org/apache/tapestry/parse
                        SpecificationParser.java Tapestry_3_1.dtd
  Log:
  TAPESTRY-262: Support more boolean values.
  
  Revision  Changes    Path
  1.62      +1 -0      jakarta-tapestry/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/status.xml,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- status.xml	31 Jan 2005 15:39:50 -0000	1.61
  +++ status.xml	4 Feb 2005 02:28:06 -0000	1.62
  @@ -137,6 +137,7 @@
         <action type="update" dev="HLS"> Add &lt;inject-state&gt; element to
specifications. </action>
         <action type="update" dev="HLS"> Add property attribute to &lt;component&gt;,
&lt;bean&gt; and &lt;asset&gt; and add enhancement workers to inject these
objects as properties. </action>
         <action type="update" dev="HLS"> Add hivemind: binding prefix. </action>
  +      <action type="update" dev="HLS" fixes-bug="TAPESTRY-262"> Support more boolean
values. </action>
       </release>
       <release version="3.0" date="Apr 18 2004">
         <action type="fix" dev="HLS" fixes-bug="28345"> Workbench/Upload exception
when no file specified </action>
  
  
  
  1.19      +35 -0     jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/spec.xml
  
  Index: spec.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/src/documentation/content/xdocs/UsersGuide/spec.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- spec.xml	2 Feb 2005 04:57:12 -0000	1.18
  +++ spec.xml	4 Feb 2005 02:28:06 -0000	1.19
  @@ -140,6 +140,7 @@
     <li>The &spec.inject-state; element has been added.</li>
     <li>Added the property attribute to the &spec.component; and &spec.bean;
elements.</li>
     <li>Removed the type attribute from the &spec.configure; element.</li>
  +  <li>Added many more options for <link href="#spec.boolean-types">boolean
attributes</link>.</li>
   </ul>
   
   <p>
  @@ -166,6 +167,40 @@
     
   </section>  <!-- spec.property-injection -->
   
  +<section id="spec.boolean-types">
  +  <title>Boolean type values</title>
  +  
  +<p>
  +Several attributes are type boolean. Tapestry supports a number of common (and one humorous)
values
  +for booleans.  Values considered true:  
  +</p>  
  +
  +<ul>
  +  <li>true</li>
  +  <li>yes</li>
  +  <li>on</li>
  +  <li>1</li>
  +  <li>t</li>
  +  <li>y</li>
  +  <li>aye</li>
  +</ul>
  +
  +<p>
  +Values considered false:
  +</p>
  +
  +<ul>
  +  <li>false</li>
  +  <li>no</li>
  +  <li>off</li>
  +  <li>0</li>
  +  <li>f</li>
  +  <li>n</li>
  +  <li>nay</li>
  +</ul>
  +
  +</section>
  +
   <section id="spec.application">
   	<title>&application; element</title>
   	
  
  
  
  1.20      +12 -6     jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java
  
  Index: SpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/SpecificationParser.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SpecificationParser.java	31 Jan 2005 05:36:22 -0000	1.19
  +++ SpecificationParser.java	4 Feb 2005 02:28:06 -0000	1.20
  @@ -292,9 +292,9 @@
        * application specification.
        */
       private Object _rootObject;
  -    
  +
       /** @since 3.1 */
  -    
  +
       private ValueConverter _valueConverter;
   
       // Identify all the different acceptible values.
  @@ -311,6 +311,7 @@
           CONVERSION_MAP.put("y", Boolean.TRUE);
           CONVERSION_MAP.put("yes", Boolean.TRUE);
           CONVERSION_MAP.put("on", Boolean.TRUE);
  +        CONVERSION_MAP.put("aye", Boolean.TRUE);
   
           CONVERSION_MAP.put("false", Boolean.FALSE);
           CONVERSION_MAP.put("f", Boolean.FALSE);
  @@ -318,6 +319,7 @@
           CONVERSION_MAP.put("off", Boolean.FALSE);
           CONVERSION_MAP.put("no", Boolean.FALSE);
           CONVERSION_MAP.put("n", Boolean.FALSE);
  +        CONVERSION_MAP.put("nay", Boolean.FALSE);
   
           CONVERSION_MAP.put("none", BeanLifecycle.NONE);
           CONVERSION_MAP.put("request", BeanLifecycle.REQUEST);
  @@ -975,7 +977,7 @@
   
           ia.setPath(prefix == null ? path : prefix + path);
           ia.setPropertyName(propertyName);
  -        
  +
           IComponentSpecification cs = (IComponentSpecification) peekObject();
   
           cs.addAsset(name, ia);
  @@ -1173,7 +1175,9 @@
           boolean immediate = getBooleanAttribute("immediate", false);
           String className = getAttribute("class");
   
  -        IExtensionSpecification es = _factory.createExtensionSpecification(_resolver, _valueConverter);
  +        IExtensionSpecification es = _factory.createExtensionSpecification(
  +                _resolver,
  +                _valueConverter);
   
           es.setClassName(className);
           es.setImmediate(immediate);
  @@ -1517,7 +1521,9 @@
           if (value == null)
               return defaultValue;
   
  -        return value.equals("yes");
  +        Boolean b = (Boolean) CONVERSION_MAP.get(value);
  +
  +        return b.booleanValue();
       }
   
       private Object getConvertedAttribute(String name, Object defaultValue)
  @@ -1736,7 +1742,7 @@
       {
           _bindingSource = bindingSource;
       }
  -    
  +
       /** @since 3.1 */
       public void setValueConverter(ValueConverter valueConverter)
       {
  
  
  
  1.12      +3 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/Tapestry_3_1.dtd
  
  Index: Tapestry_3_1.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/parse/Tapestry_3_1.dtd,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Tapestry_3_1.dtd	31 Jan 2005 05:36:22 -0000	1.11
  +++ Tapestry_3_1.dtd	4 Feb 2005 02:28:06 -0000	1.12
  @@ -41,14 +41,14 @@
   - Added <inject-state>
   - Added property attribute to <component>, <bean> and <asset>
   - Removed the type attribute from the <configure> element
  +- Add many alternatives to 'yes' and 'no' for boolean attributes.
   -->
   <!-- =======================================================
   Entity: attribute-flag
   
  -For entity attributes that take a boolean value, defines 'yes' and 'no'.
  -The default varies, so isn't included here.
  +For entity attributes that take a boolean value.
   -->
  -<!ENTITY % attribute-flag "(yes|no)">
  +<!ENTITY % attribute-flag "(yes|no|true|false|on|off|1|0|y|n|t|f|aye|nay)">
   <!ENTITY % library-content "(description?, (meta|page|component-type|service|library|extension)*)">
   <!-- =======================================================
   Element: application
  
  
  

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


Mime
View raw message