Author: jbq
Date: Mon May  7 09:56:31 2007
New Revision: 535925

URL: http://svn.apache.org/viewvc?view=rev&rev=535925
Log:
* Making VelocityPanel abstract: implement getTemplateResource() to return the 
template contents
* Adding an example with nested Wicket components

Added:
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.html
   (with props)
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
   (with props)
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Field.java
   (with props)
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.html
   (with props)
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.java
   (with props)
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.properties
   (with props)
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/fields.vm
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/persons.vm
Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java
    
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityPage.java
    
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityWithMarkupParsingPage.java
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.html
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.java
    
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java?view=diff&rev=535925&r1=535924&r2=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/main/java/org/apache/wicket/velocity/markup/html/VelocityPanel.java
 Mon May  7 09:56:31 2007
@@ -56,11 +56,8 @@
  * <code>VelocityPanel</code>.
  * </p>
  */
-public class VelocityPanel extends Panel
+public abstract class VelocityPanel extends Panel
 {
-       /** Velocity template resource */
-       private final IStringResourceStream templateResource;
-
        /**
         * Construct.
         * 
@@ -72,11 +69,9 @@
         *            Model with variables that can be substituted by Velocity. 
Must
         *            return a [EMAIL PROTECTED] Map}.
         */
-       public VelocityPanel(final String name, final IStringResourceStream 
templateResource,
-                       final IModel/* <Map> */model)
+       public VelocityPanel(final String name, final IModel/* <Map> */ model)
        {
                super(name, model);
-               this.templateResource = templateResource;
        }
 
        /**
@@ -86,7 +81,7 @@
         */
        private Reader getTemplateReader()
        {
-               final String template = templateResource.asString();
+               final String template = getTemplateResource().asString();
                if (template != null)
                {
                        return new StringReader(template);
@@ -95,6 +90,11 @@
        }
 
        /**
+        * Returns the template resource passed to the constructor
+        */
+       protected abstract IStringResourceStream getTemplateResource();
+
+       /**
         * Either print or rethrow the throwable.
         * 
         * @param exception
@@ -188,9 +188,9 @@
                                        catch (ResourceStreamNotFoundException 
e)
                                        {
                                                throw new RuntimeException(
-                                                               "Could not 
parse resulting markup from '"
-                                                                               
+ templateResource + "'", e);
+                                                               "Could not 
parse resulting markup", e);
                                        }
+                                       markupStream.skipRawMarkup();
                                        renderAll(new MarkupStream(markup));
                                }
                        }

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityPage.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityPage.java?view=diff&rev=535925&r1=535924&r2=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityPage.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityPage.java
 Mon May  7 09:56:31 2007
@@ -20,6 +20,7 @@
 
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.model.Model;
+import org.apache.wicket.util.resource.IStringResourceStream;
 import org.apache.wicket.util.resource.UrlResourceStream;
 import org.apache.wicket.velocity.markup.html.VelocityPanel;
 
@@ -39,6 +40,12 @@
        {
                HashMap values = new HashMap();
                values.put("message", TEST_STRING);
-               add(new VelocityPanel("velocityPanel", new 
UrlResourceStream(this.getClass().getResource("test.html")), new 
Model(values)));
+               add(new VelocityPanel("velocityPanel", new Model(values))
+               {
+                       protected IStringResourceStream getTemplateResource()
+                       {
+                               return new 
UrlResourceStream(this.getClass().getResource("test.html"));
+                       }
+               });
        }
 }

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityWithMarkupParsingPage.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityWithMarkupParsingPage.java?view=diff&rev=535925&r1=535924&r2=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityWithMarkupParsingPage.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket-velocity/src/test/java/wicket/contrib/markup/html/velocity/VelocityWithMarkupParsingPage.java
 Mon May  7 09:56:31 2007
@@ -21,6 +21,7 @@
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.model.Model;
+import org.apache.wicket.util.resource.IStringResourceStream;
 import org.apache.wicket.util.resource.UrlResourceStream;
 import org.apache.wicket.velocity.markup.html.VelocityPanel;
 
@@ -38,11 +39,15 @@
        {
                HashMap values = new HashMap();
                values.put("labelId", "message");
-               VelocityPanel velocityPanel = new VelocityPanel(
-                               "velocityPanel",
-                               new 
UrlResourceStream(this.getClass().getResource("testWithMarkup.html")),
+               VelocityPanel velocityPanel = new VelocityPanel("velocityPanel",
                                new Model(values))
                {
+                       protected IStringResourceStream getTemplateResource()
+                       {
+                               return new 
UrlResourceStream(this.getClass().getResource(
+                                               "testWithMarkup.html"));
+                       }
+
                        public boolean parseGeneratedMarkup()
                        {
                                return true;

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.html
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.html?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.html
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.html
 Mon May  7 09:56:31 2007
@@ -0,0 +1,22 @@
+<html>
+<head>
+    <title>Wicket Contrib Examples - Template Page</title>
+       <link rel="stylesheet" type="text/css" href="style.css"/>
+</head>
+<body>
+
+ <span wicket:id="mainNavigation"/>
+               <div style="border: 2px dotted #fc0; padding: 5px; 
margin-right: 25%;">
+                       The fields in this page are driven by your data model, 
creating a new field will automatically add it to the
+                       layout.  This allows to build generic editors 
<b>without writing the associated Wicket template</b>.
+               </div>
+
+
+ <div id="templateOutputBox">
+  <fieldset>
+    <legend>output</legend>
+       <span wicket:id="templatePanel">Template output will be put here</span>
+  </fieldset>
+ </div>
+</body>
+</html>

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
 Mon May  7 09:56:31 2007
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.velocity;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.examples.WicketExamplePage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.util.resource.IStringResourceStream;
+import org.apache.wicket.util.resource.PackageResourceStream;
+import org.apache.wicket.velocity.markup.html.VelocityPanel;
+
+/**
+ * Template example page.
+ * 
+ * @author Eelco Hillenius
+ */
+public class DynamicPage extends WicketExamplePage
+{
+       /** the current template contents. */
+       private PackageResourceStream template = new 
PackageResourceStream(DynamicPage.class, "fields.vm");
+       /** context to be used by the template. */
+       private final Model templateContext;
+
+       /**
+        * Constructor
+        * 
+        * @param parameters
+        *            Page parameters
+        */
+       public DynamicPage(final PageParameters parameters)
+       {
+               Map<String, List<Field>> map = new HashMap<String, 
List<Field>>();
+               List<Field> fields = VelocityTemplateApplication.getFields();
+               map.put("fields", fields);
+               templateContext = Model.valueOf(map);
+
+               VelocityPanel panel;
+               add(panel = new VelocityPanel("templatePanel", templateContext) 
{
+                       @Override
+                       protected IStringResourceStream getTemplateResource()
+                       {
+                               return template;
+                       }
+                       @Override
+                       protected boolean parseGeneratedMarkup()
+                       {
+                               return true;
+                       }
+               });
+               for (Field field : fields) {
+                       panel.add(new TextField(field.getFieldName()));
+                       panel.add(new Label("label_"+field.getFieldName(), new 
ResourceModel(field.getFieldName())));
+               }
+       }
+}
\ No newline at end of file

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/DynamicPage.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Field.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Field.java?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Field.java
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Field.java
 Mon May  7 09:56:31 2007
@@ -0,0 +1,43 @@
+/*
+ * (c) 2007 Joost Technologies B.V. All rights reserved. This code contains
+ * trade secrets of Joost Technologies B.V. and any unauthorized use or
+ * disclosure is strictly prohibited.
+ *
+ * $Id$
+ */
+package org.apache.wicket.examples.velocity;
+
+import java.io.Serializable;
+
+/**
+ * // TODO Describe the class or the interface here.
+ */
+public class Field implements Serializable
+{
+       private String fieldName;
+       private int fieldSize;
+       /**
+        * 
+        */
+       public Field(String fieldName, int fieldSize)
+       {
+               this.fieldName = fieldName;
+               this.fieldSize = fieldSize;
+       }
+       public String getFieldName()
+       {
+               return fieldName;
+       }
+       public void setFieldName(String fieldName)
+       {
+               this.fieldName = fieldName;
+       }
+       public int getFieldSize()
+       {
+               return fieldSize;
+       }
+       public void setFieldSize(int fieldSize)
+       {
+               this.fieldSize = fieldSize;
+       }
+}

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Field.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Field.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.html
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.html?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.html
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.html
 Mon May  7 09:56:31 2007
@@ -0,0 +1,31 @@
+<html xmlns:wicket="http://wicket.apache.org/";>
+<head>
+    <title>Wicket Examples - Velocity</title>
+    <link rel="stylesheet" type="text/css" href="style.css"/>
+</head>
+<body>
+    <span wicket:id="mainNavigation"/>
+
+       <h3>Velocity Template Component</h3>
+               <div style="border: 2px dotted #fc0; padding: 5px; 
margin-right: 25%;">
+                       <p>
+               The VelocityPanel is useful for CMS-like functionality, where 
you want
+               to enable users to do basic scripting in predefined areas of 
your web
+               application. Read more about the
+               <a href="http://jakarta.apache.org/velocity/";>velocity</a> 
language
+               <a 
href="http://jakarta.apache.org/velocity/user-guide.html";>here</a>.
+       </p>
+ </div>
+
+<wicket:link>
+<ul>
+       <li>
+       <a href="TemplatePage.html">People directory example: type in your own 
Velocity template</a>
+       </li>
+       <li>
+       <a href="DynamicPage.html">Generic editor example: nesting Wicket 
components</a><br/>
+       </li>
+</ul>
+</wicket:link>
+</body>
+</html>

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.java?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.java
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.java
 Mon May  7 09:56:31 2007
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.velocity;
+
+import org.apache.wicket.examples.WicketExamplePage;
+
+public class Home extends WicketExamplePage
+{
+}

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/Home.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.html
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.html?view=diff&rev=535925&r1=535924&r2=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.html
 (original)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.html
 Mon May  7 09:56:31 2007
@@ -7,17 +7,6 @@
 
  <span wicket:id="mainNavigation"/>
 
- <div id="explain">
-       <h3>Velocity Template Component</h3>
-       <p>
-               The VelocityPanel is usefull for CMS like functionality, where 
you want
-               to enable users to do basic scripting in predefined areas of 
your web
-               application. Read more about the
-               <a href="http://jakarta.apache.org/velocity/";>velocity</a> 
language
-               <a 
href="http://jakarta.apache.org/velocity/user-guide.html";>here</a>.
-       </p>
- </div>
-
 <table cellpadding="5px">
  <tr>
   <td valign="top" height="100%">

Modified: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.java?view=diff&rev=535925&r1=535924&r2=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/TemplatePage.java
 Mon May  7 09:56:31 2007
@@ -27,7 +27,10 @@
 import org.apache.wicket.markup.html.panel.FeedbackPanel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.util.resource.StringBufferResourceStream;
+import org.apache.wicket.util.resource.IResourceStream;
+import org.apache.wicket.util.resource.IStringResourceStream;
+import org.apache.wicket.util.resource.PackageResourceStream;
+import org.apache.wicket.util.resource.StringResourceStream;
 import org.apache.wicket.velocity.markup.html.VelocityPanel;
 
 /**
@@ -66,24 +69,11 @@
        }
 
        /** the current template contents. */
-       private StringBufferResourceStream template = new 
StringBufferResourceStream();
+       private IStringResourceStream template = new 
PackageResourceStream(DynamicPage.class, "persons.vm");
+
        /** context to be used by the template. */
        private final Model templateContext;
 
-       {
-               template.append("<fieldset>\n");
-               template.append(" <legend>persons</legend>\n");
-               template.append("  <ul>\n");
-               template.append("   #foreach( $person in $persons )\n");
-               template.append("    <li>\n");
-               template.append("     ${person.lastName},\n");
-               template.append("     ${person.firstName}\n");
-               template.append("    </li>\n");
-               template.append("  #end\n");
-               template.append(" </ul>\n");
-               template.append("</fieldset>\n");
-       }
-
        /**
         * Constructor
         * 
@@ -97,7 +87,13 @@
                templateContext = Model.valueOf(map);
 
                add(new TemplateForm("templateForm"));
-               add(new VelocityPanel("templatePanel", template, 
templateContext));
+               add(new VelocityPanel("templatePanel", templateContext) {
+                       @Override
+                       protected IStringResourceStream getTemplateResource()
+                       {
+                               return template;
+                       }
+               });
                add(new FeedbackPanel("feedback"));
        }
 
@@ -119,7 +115,6 @@
         */
        public final void setTemplate(String template)
        {
-               this.template.clear();
-               this.template.append(template);
+               this.template = new StringResourceStream(template);
        }
 }

Modified: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.java?view=diff&rev=535925&r1=535924&r2=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.java
 Mon May  7 09:56:31 2007
@@ -43,6 +43,16 @@
                persons.add(new Person("Bush", "Gump"));
        }
 
+       private static List<Field> fields = new ArrayList<Field>();
+       static
+       {
+               fields.add(new Field("firstName", 50));
+               fields.add(new Field("lastName", 80));
+       }
+       public static List<Field> getFields() {
+               return fields;
+       }
+
        /**
         * Gets the dummy persons database.
         * 
@@ -65,7 +75,7 @@
         */
        public Class< ? extends Page> getHomePage()
        {
-               return TemplatePage.class;
+               return Home.class;
        }
 
        /**

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.properties
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.properties?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.properties
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.properties
 Mon May  7 09:56:31 2007
@@ -0,0 +1,2 @@
+lastName=Last Name
+firstName=First Name
\ No newline at end of file

Propchange: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/VelocityTemplateApplication.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/fields.vm
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/fields.vm?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/fields.vm
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/fields.vm
 Mon May  7 09:56:31 2007
@@ -0,0 +1,8 @@
+<ul>
+#foreach( $field in $fields )
+<!-- There must be a bug somewhere because wicket:message does not work when 
inserted here!
+  <wicket:message key="${field.fieldName}">value</wicket:message-->
+<span wicket:id="label_${field.fieldName}">Label</span>
+  <input wicket:id="${field.fieldName}" size="${field.fieldSize}"/><br/>
+#end
+</ul>

Added: 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/persons.vm
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/persons.vm?view=auto&rev=535925
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/persons.vm
 (added)
+++ 
incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/velocity/persons.vm
 Mon May  7 09:56:31 2007
@@ -0,0 +1,11 @@
+<fieldset>
+ <legend>persons</legend>
+  <ul>
+   #foreach( $person in $persons )
+    <li>
+     ${person.lastName},
+     ${person.firstName}
+    </li>
+  #end
+ </ul>
+</fieldset>


Reply via email to