You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2003/01/22 17:47:27 UTC

cvs commit: jakarta-tapestry/framework/src/net/sf/tapestry/parse Tapestry_1_4.dtd SpecificationParser.java

hlship      2003/01/22 08:47:27

  Modified:    framework/src/net/sf/tapestry/parse Tapestry_1_4.dtd
                        SpecificationParser.java
  Log:
  Allow <binding> to wrap around expression.
  
  Revision  Changes    Path
  1.3       +7 -3      jakarta-tapestry/framework/src/net/sf/tapestry/parse/Tapestry_1_4.dtd
  
  Index: Tapestry_1_4.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/net/sf/tapestry/parse/Tapestry_1_4.dtd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Tapestry_1_4.dtd	17 Jan 2003 17:40:19 -0000	1.2
  +++ Tapestry_1_4.dtd	22 Jan 2003 16:47:27 -0000	1.3
  @@ -108,16 +108,20 @@
   Element: binding
   Appears in: component
   
  -Binds a parameter of the component to a property of its container.
  +Binds a parameter of the component to a OGNL expression, relative
  +to its container.  The expression may be provided as an attribute, or 
  +as the body of the element.  The latter case is useful when the 
  +expression is long, or uses problematic characters (such as a 
  +mix of single and double quotes).
   
   Attributes:
     name: The name of the component parameter to bind.
     expression: The OGNL expression.
   -->
  -<!ELEMENT binding EMPTY>
  +<!ELEMENT binding (#PCDATA)>
   <!ATTLIST binding
     name CDATA #REQUIRED
  -  expression CDATA #REQUIRED
  +  expression CDATA #IMPLIED
   >
   
   <!-- =======================================================
  
  
  
  1.36      +9 -20     jakarta-tapestry/framework/src/net/sf/tapestry/parse/SpecificationParser.java
  
  Index: SpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/net/sf/tapestry/parse/SpecificationParser.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- SpecificationParser.java	17 Jan 2003 17:40:19 -0000	1.35
  +++ SpecificationParser.java	22 Jan 2003 16:47:27 -0000	1.36
  @@ -1015,7 +1015,7 @@
   
               if (isElement(child, "static-binding"))
               {
  -                convertStaticBinding(c, child);
  +                convertBinding(c, child, BindingType.STATIC, "value");
                   continue;
               }
   
  @@ -1045,6 +1045,13 @@
       {
           String name = getAttribute(node, "name");
           String value = getAttribute(node, attributeName);
  +        
  +        // In several cases, the 1.4 DTD makes the attribute optional and
  +        // allows the value to be to the body of the element.
  +        
  +        if (value == null)
  +        	value = getValue(node);
  +        	
           BindingSpecification binding = _factory.createBindingSpecification(type, value);
   
           component.setBinding(name, binding);
  @@ -1061,24 +1068,6 @@
   
           ListenerBindingSpecification binding =
               _factory.createListenerBindingSpecification(language, script);
  -
  -        component.setBinding(name, binding);
  -    }
  -
  -    private void convertStaticBinding(ContainedComponent component, Node node)
  -    {
  -        String name = getAttribute(node, "name");
  -
  -        // Starting in DTD 1.4, the value may be specified as an attribute
  -        // or as the PCDATA
  -
  -        String value = getAttribute(node, "value");
  -
  -        if (value == null)
  -            value = getValue(node);
  -
  -        BindingSpecification binding =
  -            _factory.createBindingSpecification(BindingType.STATIC, value);
   
           component.setBinding(name, binding);
       }