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 2005/06/22 14:57:44 UTC

cvs commit: jakarta-tapestry/annotations/src/java/org/apache/tapestry/annotations ComponentAnnotationWorker.java

hlship      2005/06/22 05:57:44

  Modified:    annotations/src/test/org/apache/tapestry/annotations
                        AnnotatedPage.java
                        TestComponentAnnotationWorker.java
               annotations/src/java/org/apache/tapestry/annotations
                        ComponentAnnotationWorker.java
  Log:
  Trim whitespace in bindings that are part of a Component annotation.
  
  Revision  Changes    Path
  1.7       +5 -1      jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java
  
  Index: AnnotatedPage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AnnotatedPage.java	22 Jun 2005 12:47:22 -0000	1.6
  +++ AnnotatedPage.java	22 Jun 2005 12:57:44 -0000	1.7
  @@ -104,7 +104,11 @@
       @Component(type = "Conditional", bindings =
       { "condition=message", "element=div" })
       public abstract IComponent getComponentWithBindings();
  -
  +    
  +    @Component(type = "TextField", bindings =
  +    { "value = email", "displayName = message:email-label" })
  +    public abstract IComponent getWhitespace();  
  +    
       @Message
       public abstract String noArgsMessage();
   
  
  
  
  1.5       +8 -21     jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java
  
  Index: TestComponentAnnotationWorker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestComponentAnnotationWorker.java	21 Jun 2005 22:31:37 -0000	1.4
  +++ TestComponentAnnotationWorker.java	22 Jun 2005 12:57:44 -0000	1.5
  @@ -89,29 +89,16 @@
           assertEquals("div", bs2.getValue());
       }
   
  -    public void testOddBindingCount()
  +    public void testBindingWhitespaceTrimmed()
       {
  -        Method method = findMethod(AnnotatedPage.class, "getOddBindingCount");
  +        IContainedComponent cc = run("whitespace", "getWhitespace");
   
  -        EnhancementOperation op = newOp();
  -
  -        replayControls();
  -
  -        IComponentSpecification spec = new ComponentSpecification();
  -
  -        try
  -        {
  -            new ComponentAnnotationWorker().performEnhancement(op, spec, method);
  -            unreachable();
  -        }
  -        catch (ApplicationRuntimeException ex)
  -        {
  -            assertEquals(
  -                    "The list of bindings was length 1.  It should be an even length, consisting of alternating parameter names and binding references.",
  -                    ex.getMessage());
  -        }
  -
  -        verifyControls();
  +        IBindingSpecification bs1 = cc.getBinding("value");
  +        assertNull(bs1.getLocation());
  +        assertEquals(BindingType.PREFIXED, bs1.getType());
  +        assertEquals("email", bs1.getValue());
   
  +        IBindingSpecification bs2 = cc.getBinding("displayName");
  +        assertEquals("message:email-label", bs2.getValue());
       }
   }
  
  
  
  1.6       +2 -4      jakarta-tapestry/annotations/src/java/org/apache/tapestry/annotations/ComponentAnnotationWorker.java
  
  Index: ComponentAnnotationWorker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/annotations/src/java/org/apache/tapestry/annotations/ComponentAnnotationWorker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ComponentAnnotationWorker.java	22 Jun 2005 12:47:21 -0000	1.5
  +++ ComponentAnnotationWorker.java	22 Jun 2005 12:57:44 -0000	1.6
  @@ -50,8 +50,6 @@
           cc.setType(component.type());
           cc.setPropertyName(propertyName);
   
  -        String[] bindings = component.bindings();
  -
           for (String binding : component.bindings())
           {
               addBinding(cc, binding);
  @@ -75,8 +73,8 @@
           if (equalsx + 1 >= binding.length())
               invalidBinding(binding);
   
  -        String name = binding.substring(0, equalsx);
  -        String value = binding.substring(equalsx);
  +        String name = binding.substring(0, equalsx).trim();
  +        String value = binding.substring(equalsx + 1).trim();
   
           IBindingSpecification bs = new BindingSpecification();
           bs.setType(BindingType.PREFIXED);
  
  
  

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