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/org/apache/tapestry/parse BodyRule.java SpecificationDigester.java SpecificationParser.java
Date Sun, 23 Mar 2003 01:29:16 GMT
hlship      2003/03/22 17:29:16

  Modified:    framework/src/org/apache/tapestry/parse
                        SpecificationDigester.java SpecificationParser.java
  Added:       framework/src/org/apache/tapestry/parse BodyRule.java
  Log:
  Maintain all whitespace when parsing body of <listener-binding> element.
  
  Revision  Changes    Path
  1.3       +7 -3      jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationDigester.java
  
  Index: SpecificationDigester.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationDigester.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SpecificationDigester.java	21 Mar 2003 19:00:33 -0000	1.2
  +++ SpecificationDigester.java	23 Mar 2003 01:29:16 -0000	1.3
  @@ -60,14 +60,13 @@
   import java.util.Map;
   
   import org.apache.commons.digester.Digester;
  -import org.apache.tapestry.*;
   import org.apache.tapestry.IResourceLocation;
  +import org.apache.tapestry.Location;
   import org.apache.tapestry.Tapestry;
   import org.apache.tapestry.util.RegexpMatcher;
   import org.xml.sax.Attributes;
   import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
  -import org.xml.sax.XMLReader;
   
   /**
    *  Extension of {@link org.apache.commons.digester.Digester} with additional rules, hooks
  @@ -159,6 +158,11 @@
           String[] propertyNames)
       {
           addRule(pattern, new SetLimitedPropertiesRule(attributeNames, propertyNames));
  +    }
  +    
  +    public void addBody(String pattern, String propertyName)
  +    {
  +    	addRule(pattern, new BodyRule(propertyName));
       }
   
       /**
  
  
  
  1.3       +2 -2      jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationParser.java
  
  Index: SpecificationParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/SpecificationParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SpecificationParser.java	15 Mar 2003 21:22:19 -0000	1.2
  +++ SpecificationParser.java	23 Mar 2003 01:29:16 -0000	1.3
  @@ -1234,7 +1234,7 @@
   
           digester.addRule(pattern, new CreateListenerBindingSpecificationRule());
           digester.addSetLimitedProperties(pattern, "language", "language");
  -        digester.addBeanPropertySetter(pattern, "value");
  +        digester.addBody(pattern, "value");
           digester.addConnectChild(pattern, "setBinding", "name");
   
           // <external-asset>
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/parse/BodyRule.java
  
  Index: BodyRule.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation", "Tapestry" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache" 
   *    or "Tapestry", nor may "Apache" or "Tapestry" appear in their 
   *    name, without prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE TAPESTRY CONTRIBUTOR COMMUNITY
   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.tapestry.parse;
  
  /**
   *  Variation of {@link org.apache.commons.digester.BeanPropertySetterRule}
   *  that does <em>not</em> trim the body text of leading and trailing
   *  whitespace.  This is important for {@link org.apache.tapestry.spec.ListenerBindingSpecification}s,
   *  where the whitespace may be relevant!
   *
   *  @author Howard Lewis Ship
   *  @version $Id: BodyRule.java,v 1.1 2003/03/23 01:29:16 hlship Exp $
   *  @since 2.4
   *
   **/
  
  public class BodyRule extends AbstractSpecificationRule
  {
  	private String _propertyName;
  	
  	public BodyRule(String propertyName)
  	{
  		_propertyName = propertyName;
  	}	
  
      public void body(String namespace, String name, String text) throws Exception
      {
  		setProperty(_propertyName, text);
      }
  
  }
  
  
  

Mime
View raw message