jvanzyl     00/10/19 19:19:59

  Modified:    build/lib log.jar
               src/java/org/apache/velocity Context.java Template.java
               src/java/org/apache/velocity/runtime/parser
                        ASTReference.java
               src/java/org/apache/velocity/test Test.java
                        TestProvider.java
               testbed  foreach-array.vm foreach-variable.vm p1.vm
  Log:
  - update.
  
  Revision  Changes    Path
  1.2       +17 -18    jakarta-velocity/build/lib/log.jar
  
        <<Binary file>>
  
  
  1.4       +3 -1      jakarta-velocity/src/java/org/apache/velocity/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Context.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Context.java      2000/10/15 03:20:06     1.3
  +++ Context.java      2000/10/20 02:19:50     1.4
  @@ -56,6 +56,8 @@
   
   import java.util.Hashtable;
   
  +import org.apache.velocity.util.ArrayIterator;
  +
   /**
    * This class provides the storage location for all dynamic
    * information that is used to create a document. A final
  @@ -64,7 +66,7 @@
    * an valid object derived from Object. These objects
    * are stored in a Hashtable. 
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: Context.java,v 1.3 2000/10/15 03:20:06 dlr Exp $
  + * @version $Id: Context.java,v 1.4 2000/10/20 02:19:50 jvanzyl Exp $
    */
   public class Context
   {
  
  
  
  1.7       +7 -20     jakarta-velocity/src/java/org/apache/velocity/Template.java
  
  Index: Template.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Template.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Template.java     2000/10/15 19:30:08     1.6
  +++ Template.java     2000/10/20 02:19:51     1.7
  @@ -83,7 +83,7 @@
    * </pre>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: Template.java,v 1.6 2000/10/15 19:30:08 dlr Exp $
  + * @version $Id: Template.java,v 1.7 2000/10/20 02:19:51 jvanzyl Exp $
    */
   public class Template
   {
  @@ -145,30 +145,17 @@
        * determine the objects being used by reflection.
        */
       public void merge(Context context, Writer writer)
  -        throws IOException
  +        throws IOException, Exception
       {
           synchronized(this)
           {
  -            if (!initialized) 
  -                init(context);
  +            if (!initialized)
  +            {
  +                document.init(context, null);
  +                initialized = true;
  +            }
           }                
           
           document.render(context, writer);
  -    }
  -
  -    /**
  -     * Initialize the AST node structure.
  -     */
  -    private void init(Context context)
  -    {
  -        try
  -        {
  -            document.init(context, null);
  -            initialized = true;
  -        }
  -        catch (Exception e)
  -        {
  -            Runtime.error(e);
  -        }
       }
   }
  
  
  
  1.7       +2 -2      
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/ASTReference.java
  
  Index: ASTReference.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/ASTReference.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ASTReference.java 2000/10/19 20:08:28     1.6
  +++ ASTReference.java 2000/10/20 02:19:53     1.7
  @@ -80,8 +80,8 @@
                       nullString);
           else
               writer.write(NodeUtils
  -                .specialText(getFirstToken()) + 
  -                    value(context).toString());
  +                .specialText(getFirstToken()) +
  +                    value.toString());
       }
   
       public boolean evaluate(Context context)
  
  
  
  1.2       +4 -2      jakarta-velocity/src/java/org/apache/velocity/test/Test.java
  
  Index: Test.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/test/Test.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Test.java 2000/09/30 17:04:21     1.1
  +++ Test.java 2000/10/20 02:19:54     1.2
  @@ -72,7 +72,7 @@
    * test all the directives support by Velocity.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: Test.java,v 1.1 2000/09/30 17:04:21 jvanzyl Exp $
  + * @version $Id: Test.java,v 1.2 2000/10/20 02:19:54 jvanzyl Exp $
    */
   public class Test
   {
  @@ -100,7 +100,8 @@
               context.put("search", provider.getSearch());
               context.put("relatedSearches", provider.getRelSearches());
               context.put("searchResults", provider.getRelSearches());
  -
  +            context.put("menu", provider.getMenu());
  +            context.put("stringarray", provider.getArray());
               
               FastWriter fw = new FastWriter(
                   System.out, Runtime.getString(
  @@ -116,6 +117,7 @@
           catch( Exception e )
           {
               e.printStackTrace();
  +            Runtime.error(e);
           }
       }
   
  
  
  
  1.3       +20 -2     
jakarta-velocity/src/java/org/apache/velocity/test/TestProvider.java
  
  Index: TestProvider.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/test/TestProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestProvider.java 2000/10/09 15:09:15     1.2
  +++ TestProvider.java 2000/10/20 02:19:54     1.3
  @@ -62,7 +62,7 @@
    * is traversed and dynamic content generated.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: TestProvider.java,v 1.2 2000/10/09 15:09:15 jvanzyl Exp $
  + * @version $Id: TestProvider.java,v 1.3 2000/10/20 02:19:54 jvanzyl Exp $
    */
   public class TestProvider
   {
  @@ -114,6 +114,24 @@
           this.title = title;
       }
   
  +    public Object[] getMenu()
  +    {
  +        //ArrayList al = new ArrayList();
  +        Object[] menu = new Object[3];
  +        for (int i = 0; i < 3; i++)
  +        {
  +            Hashtable item = new Hashtable();
  +            item.put("id", "item" + Integer.toString(i+1));
  +            item.put("name", "name" + Integer.toString(i+1));
  +            item.put("label", "label" + Integer.toString(i+1));
  +            //al.add(item);
  +            menu[i] = item;
  +        }            
  +            
  +        //return al;
  +        return menu;
  +    }
  +
       public ArrayList getCustomers()
       {
           ArrayList list = new ArrayList();
  @@ -158,7 +176,7 @@
           return list;
       }
   
  -    public Object getArray()
  +    public String[] getArray()
       {
           String[] strings = new String[2];
           strings[0] = "first element";
  
  
  
  1.4       +6 -2      jakarta-velocity/testbed/foreach-array.vm
  
  Index: foreach-array.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/testbed/foreach-array.vm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- foreach-array.vm  2000/10/09 15:11:07     1.3
  +++ foreach-array.vm  2000/10/20 02:19:56     1.4
  @@ -1,9 +1,13 @@
   Foreach with an array.
   
  +##foreach ($element in $provider.Array)
  +
  +$stringarray
  +
   <table>
  -#foreach ($element in $provider.Array)
  +#foreach ($element in $stringarray)
       <tr>
  -        <td>This is $element</td>
  +        <td>This is $element and it is the $velocityCount item</td>
       </tr>        
   #end
   </table>
  
  
  
  1.4       +1 -0      jakarta-velocity/testbed/foreach-variable.vm
  
  Index: foreach-variable.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/testbed/foreach-variable.vm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- foreach-variable.vm       2000/10/09 15:11:07     1.3
  +++ foreach-variable.vm       2000/10/20 02:19:56     1.4
  @@ -2,4 +2,5 @@
   
   #foreach ($element in $list)
       This is $element.
  +    $velocityCount
   #end
  
  
  
  1.2       +20 -6     jakarta-velocity/testbed/p1.vm
  
  Index: p1.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/testbed/p1.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- p1.vm     2000/09/30 17:04:30     1.1
  +++ p1.vm     2000/10/20 02:19:57     1.2
  @@ -1,10 +1,24 @@
  -
   #*
   
  -have a boolean in an object array is
  -giving me a InvocationTargetException.
  -Fix that.
  +Trying to debug a problem submitted to the
  +mailing list by killi.
   
  -*#
  +If $item is a hashtable and there are
  +entries for: id, name, and label everything
  +works fine.
   
  -$provider.concat(["I", "am", "a", true, $provider.Title])
  +*#
  +   
  +   
  +   $link.setPage("default.xml")
  +   <navigation>
  +      <menu>
  +      #foreach ($item in $menu)
  +         <item>
  +            <id>$item.id</id>
  +            <name>$item.name</name>
  +            <label>$item.label</label>
  +         </item>
  +      #end
  +      </menu>
  +   </navigation> 
  
  
  

Reply via email to