You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2006/12/08 20:47:28 UTC
svn commit: r484712 [1/2] - in /velocity/tools/trunk: ./ examples/layout/
examples/showcase/ examples/showcase/WEB-INF/
examples/showcase/WEB-INF/src/ examples/showcase/layout/
Author: nbubna
Date: Fri Dec 8 11:47:23 2006
New Revision: 484712
URL: http://svn.apache.org/viewvc?view=rev&rev=484712
Log:
replace layout example with new, layout-based, much more useful showcase example
Added:
velocity/tools/trunk/examples/showcase/
velocity/tools/trunk/examples/showcase/Error.vm (with props)
velocity/tools/trunk/examples/showcase/VM_global_library.vm (with props)
velocity/tools/trunk/examples/showcase/WEB-INF/
velocity/tools/trunk/examples/showcase/WEB-INF/.cvsignore
velocity/tools/trunk/examples/showcase/WEB-INF/src/
velocity/tools/trunk/examples/showcase/WEB-INF/src/LayoutLinkTool.java (with props)
velocity/tools/trunk/examples/showcase/WEB-INF/src/MyPagerTool.java (with props)
velocity/tools/trunk/examples/showcase/WEB-INF/src/MySearchTool.java (with props)
velocity/tools/trunk/examples/showcase/WEB-INF/toolbox.xml (with props)
velocity/tools/trunk/examples/showcase/WEB-INF/velocity.properties (with props)
velocity/tools/trunk/examples/showcase/WEB-INF/web.xml (with props)
velocity/tools/trunk/examples/showcase/alternator.vm (with props)
velocity/tools/trunk/examples/showcase/browser.vm (with props)
velocity/tools/trunk/examples/showcase/context.vm (with props)
velocity/tools/trunk/examples/showcase/cookies.vm (with props)
velocity/tools/trunk/examples/showcase/date.vm (with props)
velocity/tools/trunk/examples/showcase/esc.vm (with props)
velocity/tools/trunk/examples/showcase/footer.vm (with props)
velocity/tools/trunk/examples/showcase/header.vm (with props)
velocity/tools/trunk/examples/showcase/import.vm (with props)
velocity/tools/trunk/examples/showcase/index.vm (with props)
velocity/tools/trunk/examples/showcase/layout/
velocity/tools/trunk/examples/showcase/layout/CSS.vm (with props)
velocity/tools/trunk/examples/showcase/layout/Default.vm (with props)
velocity/tools/trunk/examples/showcase/layout/Print.vm (with props)
velocity/tools/trunk/examples/showcase/layout/Table.vm (with props)
velocity/tools/trunk/examples/showcase/layout/layout.css (with props)
velocity/tools/trunk/examples/showcase/layoutmenu.vm (with props)
velocity/tools/trunk/examples/showcase/link.vm (with props)
velocity/tools/trunk/examples/showcase/lists.vm (with props)
velocity/tools/trunk/examples/showcase/math.vm (with props)
velocity/tools/trunk/examples/showcase/mill.vm (with props)
velocity/tools/trunk/examples/showcase/number.vm (with props)
velocity/tools/trunk/examples/showcase/pager.vm (with props)
velocity/tools/trunk/examples/showcase/params.vm (with props)
velocity/tools/trunk/examples/showcase/render.vm (with props)
velocity/tools/trunk/examples/showcase/search.vm (with props)
velocity/tools/trunk/examples/showcase/sorter.vm (with props)
velocity/tools/trunk/examples/showcase/template.txt (with props)
velocity/tools/trunk/examples/showcase/toolmenu.vm (with props)
Removed:
velocity/tools/trunk/examples/layout/
Modified:
velocity/tools/trunk/build.xml
velocity/tools/trunk/examples.xml
Modified: velocity/tools/trunk/build.xml
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/build.xml?view=diff&rev=484712&r1=484711&r2=484712
==============================================================================
--- velocity/tools/trunk/build.xml (original)
+++ velocity/tools/trunk/build.xml Fri Dec 8 11:47:23 2006
@@ -378,11 +378,11 @@
<ant antfile="${basedir}/examples.xml" target="simple-example" />
</target>
- <!-- Build VelocityView - Layout application -->
- <target name="layout" depends="jar.view"
- description="Compiles and jars the VelocityView Layout example application.">
+ <!-- Build VelocityView - Showcase application -->
+ <target name="showcase" depends="jar.view"
+ description="Compiles and jars the VelocityView Showcase example application.">
<property name="target" value="war"/>
- <ant antfile="${basedir}/examples.xml" target="layout-example" />
+ <ant antfile="${basedir}/examples.xml" target="showcase-example" />
</target>
<!-- Build VelocityStruts example application -->
Modified: velocity/tools/trunk/examples.xml
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples.xml?view=diff&rev=484712&r1=484711&r2=484712
==============================================================================
--- velocity/tools/trunk/examples.xml (original)
+++ velocity/tools/trunk/examples.xml Fri Dec 8 11:47:23 2006
@@ -33,7 +33,7 @@
description="Build WAR files for all VelocityTools example applications">
<property name="target" value="war"/>
<antcall target="simple-example" />
- <antcall target="layout-example" />
+ <antcall target="showcase-example" />
<antcall target="struts-example" />
</target>
@@ -41,7 +41,7 @@
description="Build WAR files for all VelocityTools example applications">
<property name="target" value="clean"/>
<antcall target="simple-example" />
- <antcall target="layout-example" />
+ <antcall target="showcase-example" />
<antcall target="struts-example" />
</target>
@@ -62,13 +62,15 @@
<copy todir="${lib}" file="${velocity.jar}"/>
</target>
- <target name="layout-example">
- <property name="name" value="layout" />
+ <target name="showcase-example">
+ <property name="name" value="showcase" />
<property name="base" value="${examples.home}/${name}" />
<property name="lib" value="${base}/WEB-INF/lib"/>
<antcall target="example-${target}"/>
</target>
- <target name="layout-dependencies" depends="simple-dependencies"/>
+ <target name="showcase-dependencies" depends="simple-dependencies">
+ <copy todir="${lib}" file="${servlet.jar}"/>
+ </target>
<target name="struts-example">
<property name="name" value="struts" />
Added: velocity/tools/trunk/examples/showcase/Error.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/Error.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/Error.vm (added)
+++ velocity/tools/trunk/examples/showcase/Error.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,48 @@
+## 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.
+
+## Force use of default layout (so req params don't override it)
+#set( $layout = "Default.vm" )
+#title( "Error - $!cause.class.name" )
+
+<div align="center">
+<h1>There has been an error!</h1>
+<br>
+<b style="color: #FF0000;">
+#if( $invocation_exception )
+ $!invocation_exception.message
+#else
+ $!cause.message
+#end
+</b>
+<br>
+<div style="font-size: 8pt">
+<pre>
+#if( $invocation_exception )
+oh joy! it's a MethodInvocationException!
+
+Reference name: $invocation_exception.referenceName
+Method name: $invocation_exception.methodName
+#end
+
+Alright, here's the stack. Good luck.
+
+$stack_trace
+</pre>
+</div>
+<h3>Sorry about that!</h3>
+</div>
Propchange: velocity/tools/trunk/examples/showcase/Error.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/VM_global_library.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/VM_global_library.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/VM_global_library.vm (added)
+++ velocity/tools/trunk/examples/showcase/VM_global_library.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,219 @@
+## 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.
+
+#**
+ * Sets the $page_title key, so if it ever changes,
+ * it need only be changed here.
+ *#
+#macro( title $string )
+#set( $page_title = $string )#end
+
+#**
+ * Creates a link to the javadoc for the specified tool.
+ *#
+#macro( doclink $toolname $generic )
+<a href="http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/##
+#if( $generic )generic/#else#**#view/tools/#end##
+${toolname}.html">$toolname</a>#end
+
+#**
+ * Creates a list item for the toolmenu.
+ *#
+#macro( toolMenuItem $menulink $page $name )
+ <li><a href="$menulink.relative("${page}.vm")">$name</a></li>
+#end
+
+
+
+#**
+ * Creates the start tag and header row for a function demonstration table.
+ *#
+#macro( demoTableStart )
+<table border="1" cellspacing="0" cellpadding="3">
+<tr>
+ <th>Function</th>
+ <form method="get" action="$link.self">
+ <th nowrap="1">
+ Demo Result
+ <input style="font-size: 8pt" type="submit" value="Clear All">
+ </th>
+ #if( $params.layout )
+ <input type="hidden" name="layout" value="$params.layout">
+ #end
+ </form>
+ <th>Description</th>
+</tr>
+#end
+
+#**
+ * Creates a demonstration row of a tool method that takes no parameters.
+ *#
+#macro( demo $toolname $method $description )
+<tr>
+ <td valign="top">${esc.d}${toolname}.${method}</td>
+ <td valign="top">$render.eval("${esc.d}${toolname}.${method}")</td>
+ <td valign="top">$description</td>
+</tr>
+#end
+
+#**
+ * Creates a faux demonstration row of a tool method that takes no parameters.
+ *#
+#macro( demoAlt $toolname $method $result $description )
+<tr>
+ <td valign="top">${esc.d}${toolname}.${method}</td>
+ <td valign="top">$!result</td>
+ <td valign="top">$description</td>
+</tr>
+#end
+
+#**
+ * Creates an interactive demonstration row for a tool method that takes one parameter.
+ *#
+#macro( demo1 $toolname $method $size $description )
+#if( !$quote )
+ #set( $quote = $esc.q )
+#end
+<tr>
+ <form method="get" action="$link.anchor($method)">
+ <td valign="top">
+ <a name="$method"><nobr>
+ ${esc.d}${toolname}.$method(${quote}<input type="text" size="$size" name="$method" value="$!params.get($method)">${quote})
+ </nobr></a>
+ </td>
+ <td valign="top">
+ #if( $params.get($method) )
+ ${esc.d}${toolname}.${method}(${quote}$params.get($method)${quote})
+ =
+ $render.eval("${esc.d}${toolname}.${method}(${quote}$params.get($method)${quote})")
+ <input type="submit" value="Try it!">
+ #else
+ <input type="submit" value="Try it!">
+ #end
+ #foreach( $param in $request.parameterMap.keySet() )
+ #foreach( $value in $params.getStrings($param) )
+ <input type="hidden" name="$param" value="$value">
+ #end
+ #end
+ </td>
+ <td valign="top">$description</td>
+ </form>
+</tr>
+#end
+
+#**
+ * Creates an interactive demonstration row for a tool method that takes two parameters.
+ *#
+#macro( demo2 $toolname $method $size $description )
+#if( !$quote )
+ #set( $quote = $esc.q )
+#end
+#set( $method1 = "${method}1" )
+#set( $method2 = "${method}2" )
+<tr>
+ <form method="get" action="$link.anchor($method2)">
+ <td valign="top">
+ <a name="$method2"><nobr>${esc.d}${toolname}.$method(${quote}<input type="text" size="$size" name="${method1}" value="$!params.get("${method1}")">${quote},
+ ${quote}<input type="text" size="$size" name="${method2}" value="$!params.get("${method2}")">${quote})</nobr></a>
+ </td>
+ <td valign="top">
+ #if( $params.get(${method1}) )
+ ${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote})
+ =
+ $render.eval("${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote})")
+ <input type="submit" value="Try again!">
+ #else
+ <input type="submit" value="Try it!">
+ #end
+ #foreach( $param in $request.parameterMap.keySet() )
+ #foreach( $value in $params.getStrings($param) )
+ <input type="hidden" name="$param" value="$value">
+ #end
+ #end
+ </td>
+ <td valign="top">$description</td>
+ </form>
+</tr>
+#end
+
+#**
+ * Creates an interactive demonstration row for a tool method that takes three parameters.
+ *#
+#macro( demo3 $toolname $method $size $description )
+#if( !$quote )
+ #set( $quote = $esc.q )
+#end
+#set( $method1 = "${method}A" )
+#set( $method2 = "${method}B" )
+#set( $method3 = "${method}C" )
+<tr>
+ <form method="get" action="$link.anchor($method3)">
+ <td valign="top">
+ <a name="$method3"><nobr>${esc.d}${toolname}.$method(${quote}<input type="text" size="$size" name="${method1}" value="$!params.get("${method1}")">${quote},
+ ${quote}<input type="text" size="$size" name="${method2}" value="$!params.get("${method2}")">${quote},
+ ${quote}<input type="text" size="$size" name="${method3}" value="$!params.get("${method3}")">${quote})</nobr></a>
+ </td>
+ <td valign="top">
+ #if( $params.get(${method1}) )
+ ${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote}, ${quote}$!params.get(${method3})${quote})
+ =
+ $render.eval("${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote}, ${quote}$!params.get(${method3})${quote})")
+ <input type="submit" value="Try again!">
+ #else
+ <input type="submit" value="Try it!">
+ #end
+ #foreach( $param in $request.parameterMap.keySet() )
+ #foreach( $value in $params.getStrings($param) )
+ <input type="hidden" name="$param" value="$value">
+ #end
+ #end
+ </td>
+ <td valign="top">$description</td>
+ </form>
+</tr>
+#end
+
+#**
+ * Creates a free-form interactive demonstration row.
+ *#
+#macro( demoCustom $toolname )
+<tr>
+ <form method="get" action="$link.anchor('custom')">
+ <td valign="top">
+ <a name="custom">
+ <input type="text" size="30" name="custom" value="#if( $params.custom )$params.custom#else$esc.d$toolname#end">
+ </a>
+ </td>
+ <td valign="top">
+ #if( $params.custom )
+ $params.custom
+ =
+ $render.eval($params.custom)
+ <input type="submit" value="Try again!">
+ #else
+ <input type="submit" value="Try it!">
+ #end
+ #foreach( $param in $request.parameterMap.keySet() )
+ #foreach( $value in $params.getStrings($param) )
+ <input type="hidden" name="$param" value="$value">
+ #end
+ #end
+ </td>
+ <td>Try any code out here.</td>
+ </form>
+</tr>
+#end
Propchange: velocity/tools/trunk/examples/showcase/VM_global_library.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/WEB-INF/.cvsignore
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/.cvsignore?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/.cvsignore (added)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/.cvsignore Fri Dec 8 11:47:23 2006
@@ -0,0 +1,2 @@
+lib
+classes
\ No newline at end of file
Added: velocity/tools/trunk/examples/showcase/WEB-INF/src/LayoutLinkTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/src/LayoutLinkTool.java?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/src/LayoutLinkTool.java (added)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/src/LayoutLinkTool.java Fri Dec 8 11:47:23 2006
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+import org.apache.velocity.tools.view.tools.LinkTool;
+import org.apache.velocity.tools.view.servlet.VelocityLayoutServlet;
+
+/**
+ * This is meant to demonstrate how to extend the LinkTool to
+ * avoid the manual use of "magic" or common query parameters.
+ *
+ * @author Nathan Bubna
+ * @version $Id: LayoutLinkTool.java 479724 2006-11-27 18:49:37Z nbubna $
+ */
+public class LayoutLinkTool extends LinkTool
+{
+
+ public LayoutLinkTool layout(String layout)
+ {
+ if (layout != null && !layout.endsWith(".vm"))
+ {
+ layout += ".vm";
+ }
+ return (LayoutLinkTool)param(VelocityLayoutServlet.KEY_LAYOUT, layout);
+ }
+
+}
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/src/LayoutLinkTool.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/src/LayoutLinkTool.java
------------------------------------------------------------------------------
svn:keywords = Revision
Added: velocity/tools/trunk/examples/showcase/WEB-INF/src/MyPagerTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/src/MyPagerTool.java?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/src/MyPagerTool.java (added)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/src/MyPagerTool.java Fri Dec 8 11:47:23 2006
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+import javax.servlet.http.HttpServletRequest;
+import org.apache.velocity.tools.view.context.ViewContext;
+import org.apache.velocity.tools.view.tools.AbstractPagerTool;
+import org.apache.velocity.tools.view.tools.ParameterParser;
+
+/**
+ * This is meant to demonstrate how to extend the AbstractPagerTool.
+ *
+ * @author Nathan Bubna
+ * @version $Id: MyPagerTool.java 479724 2006-11-27 18:49:37Z nbubna $
+ */
+public class MyPagerTool extends AbstractPagerTool
+{
+ /**
+ * Override to create a session in which to store an item list.
+ */
+ public void init(Object obj)
+ {
+ ViewContext context = (ViewContext)obj;
+ context.getRequest().getSession(true);
+
+ // then pass on to the super class
+ super.init(obj);
+ }
+
+ public void setup(HttpServletRequest req)
+ {
+ ParameterParser pp = new ParameterParser(req);
+ setIndex(pp.getInt("index", 0));
+ setItemsPerPage(pp.getInt("show", DEFAULT_ITEMS_PER_PAGE));
+ }
+
+}
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/src/MyPagerTool.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/src/MyPagerTool.java
------------------------------------------------------------------------------
svn:keywords = Revision
Added: velocity/tools/trunk/examples/showcase/WEB-INF/src/MySearchTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/src/MySearchTool.java?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/src/MySearchTool.java (added)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/src/MySearchTool.java Fri Dec 8 11:47:23 2006
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.velocity.tools.view.context.ViewContext;
+import org.apache.velocity.tools.view.tools.AbstractSearchTool;
+import org.apache.velocity.tools.view.tools.ParameterParser;
+
+/**
+ * This is meant to demonstrate how to extend the AbstractSearchTool.
+ * A typical implementation would have no static Set as a database,
+ * not override init(), not have store() methods, and have a real
+ * executeQuery(criteria) implementation. But this works for the
+ * purposes of this demo.
+ *
+ * @author Nathan Bubna
+ * @version $Id: MySearchTool.java 479724 2006-11-27 18:49:37Z nbubna $
+ */
+public class MySearchTool extends AbstractSearchTool
+{
+ private static Set DATABASE = new HashSet();
+ static
+ {
+ // some random data to get things started
+ DATABASE.add("foo");
+ DATABASE.add("bar");
+ DATABASE.add("baz");
+ DATABASE.add("woogie");
+ DATABASE.add("pizza");
+ DATABASE.add("cheese");
+ DATABASE.add("wine");
+ DATABASE.add("avocado");
+ DATABASE.add("peanut butter");
+ DATABASE.add("salami");
+ DATABASE.add("hobbits");
+ DATABASE.add("basketball");
+ DATABASE.add("four score and seven years");
+ DATABASE.add("whatever");
+ DATABASE.add("you");
+ DATABASE.add("want");
+ }
+
+ /**
+ * Adds the specified item to our static "database".
+ * You would not do this in a normal application!
+ */
+ public void store(Object item)
+ {
+ DATABASE.add(item);
+ }
+
+ /**
+ * Adds the entries of the specified map to our static "database".
+ * You would not do this in a normal application!
+ */
+ public void store(Map items)
+ {
+ DATABASE.addAll(items.entrySet());
+ }
+
+ /**
+ * Adds the specified items to our static "database".
+ * You would not do this in a normal application!
+ */
+ public void store(Collection items)
+ {
+ DATABASE.addAll(items);
+ }
+
+ /**
+ * Override to create a session in which to store search results.
+ * This is done to make the demo work well. In a normal app, it
+ * would probably not be the search tool's responsibility to ensure
+ * that there is a session.
+ */
+ public void init(Object obj)
+ {
+ ViewContext context = (ViewContext)obj;
+ context.getRequest().getSession(true);
+
+ // then pass on to the super class
+ super.init(obj);
+ }
+
+
+ public void setup(HttpServletRequest req)
+ {
+ ParameterParser pp = new ParameterParser(req);
+ setCriteria(pp.getString("find"));
+ setIndex(pp.getInt("index", 0));
+ setItemsPerPage(pp.getInt("show", DEFAULT_ITEMS_PER_PAGE));
+ }
+
+ /**
+ * This is a very simplistic implementation that looks for the
+ * string value of the criteria in the string value of every item
+ * in our stupid static database. If the criteria string is in
+ * the item string, it is added to the result list.
+ */
+ protected List executeQuery(Object crit)
+ {
+ try
+ {
+ String findme = String.valueOf(crit);
+ List results = new ArrayList();
+ synchronized (DATABASE)
+ {
+ for (Iterator i = DATABASE.iterator(); i.hasNext(); )
+ {
+ String item = String.valueOf(i.next());
+ if (item.indexOf(findme) >= 0)
+ {
+ results.add(item);
+ }
+ }
+ }
+ Collections.sort(results);
+ return results;
+ }
+ catch (Exception e)
+ {
+ // never return null!
+ System.out.println(e);
+ e.printStackTrace();
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+}
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/src/MySearchTool.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/src/MySearchTool.java
------------------------------------------------------------------------------
svn:keywords = Revision
Added: velocity/tools/trunk/examples/showcase/WEB-INF/toolbox.xml
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/toolbox.xml?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/toolbox.xml (added)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/toolbox.xml Fri Dec 8 11:47:23 2006
@@ -0,0 +1,118 @@
+<?xml version="1.0"?>
+
+<!--
+ 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.
+-->
+
+<toolbox>
+
+ <data type="string">
+ <key>author</key>
+ <value>Nathan Bubna</value>
+ </data>
+
+ <tool>
+ <key>link</key>
+ <scope>request</scope>
+ <class>LayoutLinkTool</class>
+ </tool>
+ <tool>
+ <key>pager</key>
+ <scope>request</scope>
+ <class>MyPagerTool</class>
+ </tool>
+ <tool>
+ <key>search</key>
+ <scope>request</scope>
+ <class>MySearchTool</class>
+ </tool>
+
+ <tool>
+ <key>browser</key>
+ <scope>request</scope>
+ <class>org.apache.velocity.tools.view.tools.BrowserSnifferTool</class>
+ </tool>
+ <tool>
+ <key>context</key>
+ <scope>request</scope>
+ <class>org.apache.velocity.tools.view.tools.ContextTool</class>
+ </tool>
+ <tool>
+ <key>cookies</key>
+ <scope>request</scope>
+ <class>org.apache.velocity.tools.view.tools.CookieTool</class>
+ </tool>
+ <tool>
+ <key>import</key>
+ <scope>request</scope>
+ <class>org.apache.velocity.tools.view.tools.ImportTool</class>
+ </tool>
+ <tool>
+ <key>params</key>
+ <scope>request</scope>
+ <class>org.apache.velocity.tools.view.tools.ParameterParser</class>
+ </tool>
+ <tool>
+ <key>render</key>
+ <scope>request</scope>
+ <class>org.apache.velocity.tools.view.tools.ViewRenderTool</class>
+ <parameter name="catch.exceptions" value="true"/>
+ </tool>
+
+ <tool>
+ <key>alternator</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.AlternatorTool</class>
+ </tool>
+ <tool>
+ <key>date</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.DateTool</class>
+ </tool>
+ <tool>
+ <key>esc</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.EscapeTool</class>
+ </tool>
+ <tool>
+ <key>mill</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.IteratorTool</class>
+ </tool>
+ <tool>
+ <key>lists</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.ListTool</class>
+ </tool>
+ <tool>
+ <key>math</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.MathTool</class>
+ </tool>
+ <tool>
+ <key>number</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.NumberTool</class>
+ </tool>
+ <tool>
+ <key>sorter</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.SortTool</class>
+ </tool>
+
+</toolbox>
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/toolbox.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/WEB-INF/velocity.properties
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/velocity.properties?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/velocity.properties (added)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/velocity.properties Fri Dec 8 11:47:23 2006
@@ -0,0 +1,33 @@
+# 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.
+
+#
+# These are the default properties. So, this file is essentially
+# unnecessary here, but is included just to demonstrate that these
+# can be changed.
+#
+
+# Filepath for error template, relative to web application root directory
+tools.view.servlet.error.template = Error.vm
+
+# Directory for layout templates, relative to web application root directory
+tools.view.servlet.layout.directory = layout/
+
+# Filepath of the default layout template
+# relative to the layout directory
+# NOT relative to the root directory of the webapp!
+tools.view.servlet.layout.default.template = Default.vm
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/velocity.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/web.xml?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/web.xml (added)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/web.xml Fri Dec 8 11:47:23 2006
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
+
+<!--
+ 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.
+-->
+
+<web-app>
+ <servlet>
+ <servlet-name>velocity</servlet-name>
+ <servlet-class>org.apache.velocity.tools.view.servlet.VelocityLayoutServlet</servlet-class>
+ <init-param>
+ <param-name>org.apache.velocity.toolbox</param-name>
+ <param-value>/WEB-INF/toolbox.xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>org.apache.velocity.properties</param-name>
+ <param-value>/WEB-INF/velocity.properties</param-value>
+ </init-param>
+ <load-on-startup>10</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>velocity</servlet-name>
+ <url-pattern>*.vm</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>index.vm</welcome-file>
+ </welcome-file-list>
+</web-app>
Propchange: velocity/tools/trunk/examples/showcase/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/alternator.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/alternator.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/alternator.vm (added)
+++ velocity/tools/trunk/examples/showcase/alternator.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,80 @@
+## 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.
+#title( 'AlternatorTool' )
+<p>
+This page demonstrates functions of the #doclink( 'AlternatorTool' true ).
+The <a href="#fullDemo">example</a> at the bottom is a good demonstration of the
+difference between an automatic #doclink( 'Alternator' true ) and a manual one.
+</p>
+
+#demoTableStart()
+
+#set( $quote = '' )
+
+#set( $desc = "Returns <code>true</code> if #doclink( 'Alternator' true )s created by this tool will auto-alternate by default." )
+#demo( 'alternator' 'autoAlternateDefault' $desc )
+
+#set( $desc = "Returns a new, default #doclink( 'Alternator' true ) that alternates over the specified List or Object array of values." )
+#demo1( 'alternator' 'make' 5 $desc)
+
+#set( $desc = "Return a new, default #doclink( 'Alternator' true ) that alternates between the two specified values." )
+#demo2( 'alternator' 'make' 5 $desc )
+
+#set( $desc = "Returns a new, automatically alternating #doclink( 'Alternator' true ) that alternates over the specified List or Object array of values." )
+#demo1( 'alternator' 'auto' 5 $desc)
+
+#set( $desc = "Return a new, automatically alternating #doclink( 'Alternator' true ) that alternates between the two specified values." )
+#demo2( 'alternator' 'auto' 5 $desc )
+
+#set( $desc = "Returns a new, manually alternating #doclink( 'Alternator' true ) that alternates over the specified List or Object array of values." )
+#demo1( 'alternator' 'manual' 5 $desc)
+
+#set( $desc = "Return a new, manually alternating #doclink( 'Alternator' true ) that alternates between the two specified values." )
+#demo2( 'alternator' 'manual' 5 $desc )
+
+#demoCustom( "alternator.make(['b','c','a'])" )
+</table>
+
+<div align="center">
+ <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self">
+<textarea name="demo" rows="6" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+${esc.h}set( ${esc.d}color = ${esc.d}alternator.auto('red', 'blue') )
+${esc.h}${esc.h} use manual alternation for this one
+${esc.h}set( ${esc.d}style = ${esc.d}alternator.manual(['hip','fly','groovy']) )
+${esc.h}foreach( ${esc.d}i in [1..5] )
+ Number ${esc.d}i is ${esc.d}color and ${esc.d}style. I dig $style.next numbers.
+${esc.h}end##
+#end##
+</textarea>
+ <br>
+ <input type="submit" value="Try it!">
+ #if( $params.layout )
+ <input type="hidden" name="layout" value="$params.layout">
+ #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+ $render.eval($params.demo)
+</pre>
+#end
+</div>
Propchange: velocity/tools/trunk/examples/showcase/alternator.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/browser.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/browser.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/browser.vm (added)
+++ velocity/tools/trunk/examples/showcase/browser.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,163 @@
+## 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.
+#title( 'BrowserSniffer' )
+<p>
+This page demonstrates functions of the #doclink( 'BrowserSnifferTool' false ).
+</p>
+
+#demoTableStart()
+
+#set( $desc = 'Returns true if the specified value is found in the user-agent string' )
+#demo1( 'browser' 'get' 6 $desc )
+
+#set( $desc = 'Finds and returns the specified version information' )
+#demo( 'browser' 'Version' $desc )
+#demo( 'browser' 'MajorVersion' $desc )
+#demo( 'browser' 'MinorVersion' $desc )
+#demo( 'browser' 'GeckoVersion' $desc )
+#demo( 'browser' 'GeckoMajorVersion' $desc )
+#demo( 'browser' 'GeckoMinorVersion' $desc )
+#set( $desc = 'Returns true if the user-agent string indicates this browser made the request' )
+#demo( 'browser' 'Gecko' $desc )
+#demo( 'browser' 'Firefox' $desc )
+#demo( 'browser' 'Safari' $desc )
+#demo( 'browser' 'Netscape' $desc )
+#demo( 'browser' 'Nav2' $desc )
+#demo( 'browser' 'Nav3' $desc )
+#demo( 'browser' 'Nav4' $desc )
+#demo( 'browser' 'Nav4up' $desc )
+#demo( 'browser' 'Nav45' $desc )
+#demo( 'browser' 'Nav45up' $desc )
+#demo( 'browser' 'Navgold' $desc )
+#demo( 'browser' 'Nav6' $desc )
+#demo( 'browser' 'Nav6up' $desc )
+#demo( 'browser' 'Mozilla' $desc )
+#demo( 'browser' 'Ie' $desc )
+#demo( 'browser' 'Ie3' $desc )
+#demo( 'browser' 'Ie4' $desc )
+#demo( 'browser' 'Ie4up' $desc )
+#demo( 'browser' 'Ie5' $desc )
+#demo( 'browser' 'Ie5up' $desc )
+#demo( 'browser' 'Ie55' $desc )
+#demo( 'browser' 'Ie55up' $desc )
+#demo( 'browser' 'Ie6' $desc )
+#demo( 'browser' 'Ie6up' $desc )
+#demo( 'browser' 'Neoplanet' $desc )
+#demo( 'browser' 'Neoplanet2' $desc )
+#demo( 'browser' 'Aol' $desc )
+#demo( 'browser' 'Aol3' $desc )
+#demo( 'browser' 'Aol4' $desc )
+#demo( 'browser' 'Aol5' $desc )
+#demo( 'browser' 'Aol6' $desc )
+#demo( 'browser' 'AolTV' $desc )
+#demo( 'browser' 'Opera' $desc )
+#demo( 'browser' 'Opera3' $desc )
+#demo( 'browser' 'Opera4' $desc )
+#demo( 'browser' 'Opera5' $desc )
+#demo( 'browser' 'Opera6' $desc )
+#demo( 'browser' 'Opera7' $desc )
+#demo( 'browser' 'Hotjava' $desc )
+#demo( 'browser' 'Hotjava3' $desc )
+#demo( 'browser' 'Hotjava3up' $desc )
+#demo( 'browser' 'Amaya' $desc )
+#demo( 'browser' 'Curl' $desc )
+#demo( 'browser' 'Staroffice' $desc )
+#demo( 'browser' 'Icab' $desc )
+#demo( 'browser' 'Lotusnotes' $desc )
+#demo( 'browser' 'Konqueror' $desc )
+#demo( 'browser' 'Lynx' $desc )
+#demo( 'browser' 'Links' $desc )
+#demo( 'browser' 'WebTV' $desc )
+#demo( 'browser' 'Mosaic' $desc )
+#demo( 'browser' 'Wget' $desc )
+#demo( 'browser' 'Getright' $desc )
+#demo( 'browser' 'Lwp' $desc )
+#demo( 'browser' 'Yahoo' $desc )
+#demo( 'browser' 'Google' $desc )
+#demo( 'browser' 'Java' $desc )
+#demo( 'browser' 'Altavista' $desc )
+#demo( 'browser' 'Scooter' $desc )
+#demo( 'browser' 'Lycos' $desc )
+#demo( 'browser' 'Infoseek' $desc )
+#demo( 'browser' 'Webcrawler' $desc )
+#demo( 'browser' 'Linkexchange' $desc )
+#demo( 'browser' 'Slurp' $desc )
+#demo( 'browser' 'Robot' $desc )
+#set( $desc = 'Returns true if the user-agent string indicates the request was made by this device' )
+#demo( 'browser' 'Blackberry' $desc )
+#demo( 'browser' 'Audrey' $desc )
+#demo( 'browser' 'Iopener' $desc )
+#demo( 'browser' 'Avantgo' $desc )
+#demo( 'browser' 'Palm' $desc )
+#demo( 'browser' 'Wap' $desc )
+#set( $desc = 'Returns true if the user-agent string indicates the request was made using this operating system' )
+#demo( 'browser' 'Win16' $desc )
+#demo( 'browser' 'Win3x' $desc )
+#demo( 'browser' 'Win31' $desc )
+#demo( 'browser' 'Win95' $desc )
+#demo( 'browser' 'Win98' $desc )
+#demo( 'browser' 'Winnt' $desc )
+#demo( 'browser' 'Win2k' $desc )
+#demo( 'browser' 'Winxp' $desc )
+#demo( 'browser' 'Dotnet' $desc )
+#demo( 'browser' 'Winme' $desc )
+#demo( 'browser' 'Win32' $desc )
+#demo( 'browser' 'Windows' $desc )
+#demo( 'browser' 'Mac' $desc )
+#demo( 'browser' 'Macosx' $desc )
+#demo( 'browser' 'Mac68k' $desc )
+#demo( 'browser' 'Macppc' $desc )
+#demo( 'browser' 'Amiga' $desc )
+#demo( 'browser' 'Emacs' $desc )
+#demo( 'browser' 'Os2' $desc )
+#demo( 'browser' 'Sun' $desc )
+#demo( 'browser' 'Sun4' $desc )
+#demo( 'browser' 'Sun5' $desc )
+#demo( 'browser' 'Suni86' $desc )
+#demo( 'browser' 'Irix' $desc )
+#demo( 'browser' 'Irix5' $desc )
+#demo( 'browser' 'Irix6' $desc )
+#demo( 'browser' 'Hpux' $desc )
+#demo( 'browser' 'Hpux9' $desc )
+#demo( 'browser' 'Hpux10' $desc )
+#demo( 'browser' 'Aix' $desc )
+#demo( 'browser' 'Aix1' $desc )
+#demo( 'browser' 'Aix2' $desc )
+#demo( 'browser' 'Aix3' $desc )
+#demo( 'browser' 'Aix4' $desc )
+#demo( 'browser' 'Linux' $desc )
+#demo( 'browser' 'Sco' $desc )
+#demo( 'browser' 'Unixware' $desc )
+#demo( 'browser' 'Mpras' $desc )
+#demo( 'browser' 'Reliant' $desc )
+#demo( 'browser' 'Dec' $desc )
+#demo( 'browser' 'Sinix' $desc )
+#demo( 'browser' 'Freebsd' $desc )
+#demo( 'browser' 'Bsd' $desc )
+#demo( 'browser' 'X11' $desc )
+#demo( 'browser' 'Unix' $desc )
+#demo( 'browser' 'VMS' $desc )
+#set( $desc = 'Returns true if this feature is supported. Since support of those features is often partial, the sniffer returns true when a consequent subset is supported. ' )
+#demo( 'browser' 'Css' $desc )
+#demo( 'browser' 'Css1' $desc )
+#demo( 'browser' 'Css2' $desc )
+#demo( 'browser' 'Dom0' $desc )
+#demo( 'browser' 'Dom1' $desc )
+#demo( 'browser' 'Dom2' $desc )
+#demo( 'browser' 'Javascript' $desc )
+#demoCustom( 'browser' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/browser.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/context.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/context.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/context.vm (added)
+++ velocity/tools/trunk/examples/showcase/context.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,43 @@
+## 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.
+#title( 'ContextTool' )
+<p>
+This page demonstrates functions of the #doclink( 'ContextTool' false ).
+</p>
+
+#demoTableStart()
+
+#set( $desc = 'Returns the ViewContext being analyzed by this tool' )
+#demo( 'context' 'this' $desc )
+
+#set( $desc = 'Returns <code>true</code> if there is a value available in the current request context for the specified key' )
+#demo1( 'context' 'contains' 6 $desc )
+
+#set( $desc = 'Returns the value for the specified key in the current request context' )
+#demo1( 'context' 'get' 6 $desc )
+
+#set( $desc = 'Returns a java.util.Set of the keys available in the current request context' )
+#demo( 'context' 'keys' $desc )
+
+#set( $desc = 'Returns a java.util.Map of the tools available in the current request context and their context keys' )
+#demo( 'context' 'toolbox' $desc )
+
+#set( $desc = 'Returns a java.util.Set of the values available in the current request context' )
+#demo( 'context' 'values' $desc )
+
+#demoCustom( 'context' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/context.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/cookies.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/cookies.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/cookies.vm (added)
+++ velocity/tools/trunk/examples/showcase/cookies.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,46 @@
+## 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.
+#title( 'CookieTool' )
+<p>
+This page demonstrates functions of the #doclink( 'CookieTool' false ). Remember,
+when adding a cookie, it is <b>not</b> added to the same request which does the
+adding. This means to see a cookie you've added, you must add it, and then refresh
+the page again.
+</p>
+
+#demoTableStart()
+
+#set( $desc = 'Expose array of Cookies for this request to the template. This is equivalent to <code>$request.cookies</code>.' )
+#demo( 'cookies' 'all' $desc )
+
+#set( $desc = 'Returns the Cookie with the specified name, if it exists.' )
+#demo1( 'cookies' 'get' 5 $desc )
+
+#set( $desc = 'Adds a new Cookie with the specified name and value to the HttpServletResponse. This does <b>not</b> add a Cookie to the current request.' )
+#demo2( 'cookies' 'add' 5 $desc )
+
+#set( $desc = 'Convenience method to add a new Cookie to the response and set an expiry time for it.' )
+#demo3( 'cookies' 'add' 5 $desc )
+
+#set( $desc = 'Creates a new Cookie with the specified name and value. This does <b>not</b> add the Cookie to the response, so the created Cookie will not be set unless you do <code>$response.addCookie($myCookie)</code>' )
+#demo2( 'cookies' 'create' 5 $desc )
+
+#set( $desc = 'Convenience method to create a new Cookie and set an expiry time for it. The created cookie must be manually added to the response.' )
+#demo3( 'cookies' 'create' 5 $desc )
+
+#demoCustom( 'cookies' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/cookies.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/date.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/date.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/date.vm (added)
+++ velocity/tools/trunk/examples/showcase/date.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,88 @@
+## 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.
+#title( 'DateTool' )
+<p>
+This page demonstrates functions of the #doclink( 'DateTool' true ). As the DateTool
+is quite full-featured and provides many similar functions with varying and
+strongly-typed options, not all functions are demonstrated below. See the javadoc
+for a full listing of available functions.
+</p>
+
+#demoTableStart()
+
+#set( $desc = 'Converts the specified object to a date and formats it according to the pattern or style returned by $date.format.' )
+#demo1( 'date' 'format' 4 $desc)
+
+#set( $desc = 'Converts the specified object to a date and formats it according to the specified date format.' )
+#demo2( 'date' 'format' 4 $desc )
+
+#set( $desc = 'Returns the value of $date.date as a string formatted according to the specified date format.' )
+#demo1( 'date' 'get' 4 $desc )
+
+#set( $desc = 'Returns a formatted string representing the date and/or time given by $date.date in the specified date and time styles.' )
+#demo2( 'date' 'get' 4 $desc )
+
+#set( $desc = 'Returns the day (of the month) value of the date returned by $date.calendar' )
+#demo( 'date' 'day' $desc )
+
+#set( $desc = 'Returns the day (of the month) value for the specified date.' )
+#demo1( 'date' 'getDay' 4 $desc )
+
+#set( $desc = 'Returns the month value of the date returned by $date.calendar.' )
+#demo( 'date' 'month' $desc )
+
+#set( $desc = 'Returns the month value of the specified date.' )
+#demo1( 'date' 'getMonth' 4 $desc )
+
+#set( $desc = 'Returns the year value of the date returned by $date.calendar.' )
+#demo( 'date' 'year' $desc )
+
+#set( $desc = 'Returns the year value of the specified date.' )
+#demo1( 'date' 'getYear' 4 $desc )
+
+#set( $desc = 'Return the specified value of the date returned by $date.calendar or null if the field is invalid.' )
+#demo1( 'date' 'getValue' 4 $desc )
+
+#set( $desc = 'Returns the specified value of the specified date, or null if the field or date is invalid.' )
+#demo2( 'date' 'getValue' 4 $desc )
+
+#set( $desc = 'Returns a Date derived from the result of $date.calendar' )
+#demo( 'date' 'date' $desc )
+
+#set( $desc = 'Return the pattern or style to be used for formatting dates when none is specified.' )
+#demo( 'date' 'format' $desc )
+
+#set( $desc = 'This returns the default Locale configured for this instance.' )
+#demo( 'date' 'locale' $desc )
+
+#set( $desc = 'This returns the id of the default TimeZone configured for this instance.' )
+#demo( 'date' 'timeZone.ID' $desc )
+
+#set( $desc = 'Gets the Date at the time this page was rendered for the system running this application.' )
+#demo( 'date' 'systemDate' $desc )
+
+#set( $desc = 'Converts an object to an instance of Calendar using the locale returned by $date.locale if necessary.' )
+#demo1( 'date' 'toCalendar' 4 $desc )
+
+#set( $desc = 'Converts an object to an instance of Date using the format returned by $date.format,the Locale returned by $date.locale, and the TimeZone returned by $date.timeZone if the object is not already an instance of Date, Calendar, or Long.' )
+#demo1( 'date' 'toDate' 4 $desc )
+
+#set( $desc = 'Converts an object to an instance of Date using the specified format,the Locale returned by $date.locale, and the TimeZone returned by $date.timeZone if the object is not already an instance of Date, Calendar, or Long.' )
+#demo2( 'date' 'toDate' 4 $desc )
+
+#demoCustom( 'date' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/date.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/esc.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/esc.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/esc.vm (added)
+++ velocity/tools/trunk/examples/showcase/esc.vm Fri Dec 8 11:47:23 2006
@@ -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.
+#title( 'EscapeTool' )
+<p>
+This page demonstrates functions of the #doclink( 'EscapeTool' true ).
+</p>
+
+#demoTableStart()
+
+#set( $desc = 'Renders a backslash (\)' )
+#demo( 'esc' 'b' $desc )
+
+#set( $desc = 'Renders a backslash (\)' )
+#demo( 'esc' 'backslash' $desc )
+
+#set( $desc = 'Renders a dollar sign ($)' )
+#demo( 'esc' 'd' $desc )
+
+#set( $desc = 'Renders a dollar sign ($)' )
+#demo( 'esc' 'dollar' $desc )
+
+#set( $desc = 'Renders an exclamation mark (!)' )
+#demo( 'esc' 'e' $desc )
+
+#set( $desc = 'Renders an exclamation mark (!)' )
+#demo( 'esc' 'exclamation' $desc )
+
+#set( $desc = 'Renders a hash (#)' )
+#demo( 'esc' 'h' $desc )
+
+#set( $desc = 'Renders a hash (#)' )
+#demo( 'esc' 'hash' $desc )
+
+#set( $desc = 'Renders a double quotation mark (")' )
+#demo( 'esc' 'q' $desc )
+
+#set( $desc = 'Renders a double quotation mark (")' )
+#demo( 'esc' 'quote' $desc )
+
+#set( $desc = "Renders a single quotation mark (')" )
+#demo( 'esc' 's' $desc )
+
+#set( $desc = "Renders a single quotation mark (')" )
+#demo( 'esc' 'singleQuote' $desc )
+
+#set( $desc = 'Escapes the characters in a String using HTML entities.' )
+#demo1( 'esc' 'html' 8 $desc )
+
+#set( $desc = 'Escapes the characters in a String using Java String rules.' )
+#demo1( 'esc' 'java' 8 $desc )
+
+#set( $desc = 'Escapes the characters in a String using JavaScript String rules.' )
+#demo1( 'esc' 'javascript' 8 $desc )
+
+#set( $desc = 'Escapes the characters in a String to be suitable to pass to an SQL query.' )
+#demo1( 'esc' 'sql' 8 $desc )
+
+#set( $desc = 'Escapes the characters in a String using XML entities.' )
+#demo1( 'esc' 'xml' 8 $desc )
+
+#demoCustom( 'esc' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/esc.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/footer.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/footer.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/footer.vm (added)
+++ velocity/tools/trunk/examples/showcase/footer.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,18 @@
+## 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.
+</body>
+</html>
Propchange: velocity/tools/trunk/examples/showcase/footer.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/header.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/header.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/header.vm (added)
+++ velocity/tools/trunk/examples/showcase/header.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,24 @@
+## 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.
+<html>
+<head>
+ <title>VelocityTools - Showcase#if( $page_title ) - $page_title#end</title>
+#if( $stylesheet )
+ <style type="text/css" media="screen">@import "$link.relative($stylesheet)";</style>
+#end
+</head>
+<body#if( $onload ) onload="$onload"#end>
Propchange: velocity/tools/trunk/examples/showcase/header.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/import.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/import.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/import.vm (added)
+++ velocity/tools/trunk/examples/showcase/import.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,45 @@
+## 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.
+#title( 'ImportTool' )
+<p>
+This page demonstrates the function of the #doclink( 'ImportTool' false ).
+</p>
+
+<table border="1" cellspacing="0" cellpadding="3">
+<tr>
+ <th>Function</th>
+ <th>Demo Result</th>
+ <th>Description</th>
+</tr>
+<tr>
+ <form method="post" action="$link">
+ <td>
+ <nobr>${esc.d}import.read('<input type="text" width="8" name="read" value="$!params.read">')</nobr>
+ </td>
+ <td>
+ #if( $params.read )
+ $esc.html($import.read($params.read))
+ #else
+ <input type="submit" value="Try it!">
+ <br>
+ Please note that the results will be html-escaped by the
+ <a href="$link.relative('esc.vm').params($params.all)">EscapeTool</a> for the purposes of this demo.
+ #end
+ </td>
+ <td>Returns the content read from the specified URL</td>
+ </form>
+</tr>
+
+#demoCustom( 'import' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/import.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/index.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/index.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/index.vm (added)
+++ velocity/tools/trunk/examples/showcase/index.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,26 @@
+## 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.
+<p>Hi!</p>
+
+<p>
+This is a demo application meant to showcase the abilities of
+the various tools provided by the VelocityTools library, as well
+as some best practices for using them with the VelocityView
+servlets.
+</p>
+
+<p>To begin, choose a tool from the menu.</p>
Propchange: velocity/tools/trunk/examples/showcase/index.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/layout/CSS.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/layout/CSS.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/layout/CSS.vm (added)
+++ velocity/tools/trunk/examples/showcase/layout/CSS.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,56 @@
+## 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.
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+
+#set( $stylesheet = '/layout/layout.css' )
+#parse( 'header.vm' )
+
+<div class="content">
+ <h1>CSS Layout</h1>
+ <p>$screen_content</p>
+</div>
+
+<div class="content">
+ <h2>Known Issues</h2>
+ <p>This layout fails in IE4.5/Mac. That browser has poor support for CSS absolute positioning, yet it recognizes and executes the CSS @import statement used to hide CSS from broken browsers. Currently, there is no known solution.</p>
+</div>
+
+
+<div id="navAlpha">
+ <p>
+ <div class="menu">
+ #parse( 'toolmenu.vm' )
+ </div>
+ </p>
+ <p>
+ </p>
+</div>
+
+<div id="navBeta">
+ <div class="menu">
+ #parse( 'layoutmenu.vm' )
+ </div>
+
+ <h2>Nifty Layout Techniques</h2>
+ <p>All sorts of nifty layout can be accomplished using cascading style sheets (CSS). Check out <a href="http://www.bluerobot.com" title="BlueRobot layout Resource">bluerobot.com</a> and the <a href="http://www.bluerobot.com/web/layouts/">Layout Reservoir</A> </p>
+</div>
+
+<!-- BlueRobot was here. -->
+
+#parse( 'footer.vm' )
Propchange: velocity/tools/trunk/examples/showcase/layout/CSS.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/layout/Default.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/layout/Default.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/layout/Default.vm (added)
+++ velocity/tools/trunk/examples/showcase/layout/Default.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,29 @@
+## 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.
+
+#parse( 'header.vm' )
+
+<div id="content">
+$screen_content
+</div>
+
+<div id="menu">
+#parse( 'toolmenu.vm' )
+#parse( 'layoutmenu.vm' )
+</div>
+
+#parse( 'footer.vm' )
Propchange: velocity/tools/trunk/examples/showcase/layout/Default.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/layout/Print.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/layout/Print.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/layout/Print.vm (added)
+++ velocity/tools/trunk/examples/showcase/layout/Print.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,22 @@
+## 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.
+
+#parse( 'header.vm' )
+<p>
+$screen_content
+</p>
+#parse( 'footer.vm' )
Propchange: velocity/tools/trunk/examples/showcase/layout/Print.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/layout/Table.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/layout/Table.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/layout/Table.vm (added)
+++ velocity/tools/trunk/examples/showcase/layout/Table.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,33 @@
+## 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.
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+
+#parse( 'header.vm' )
+
+<table cellpadding="10">
+<tr>
+ <!-- left nav -->
+ <td bgcolor="#99CCFF" valign="top" >
+ #parse( 'toolmenu.vm' )
+ #parse( 'layoutmenu.vm' )
+ </td>
+ <td>$screen_content</td>
+</tr>
+</table>
+#parse( 'footer.vm' )
Propchange: velocity/tools/trunk/examples/showcase/layout/Table.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/layout/layout.css
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/layout/layout.css?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/layout/layout.css (added)
+++ velocity/tools/trunk/examples/showcase/layout/layout.css Fri Dec 8 11:47:23 2006
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ */
+
+body {
+ color:#333;
+ background-color:white;
+ margin:10px;
+ padding:0px;
+ font:11px verdana, arial, helvetica, sans-serif;
+ }
+h1 {
+ margin:0px 0px 15px 0px;
+ padding:0px;
+ font-size:28px;
+ font-weight:900;
+ color:#ccc;
+ }
+h2 {
+ font:bold 12px/14px verdana, arial, helvetica, sans-serif;
+ margin:0px 0px 5px 0px;
+ padding:0px;
+ }
+p {
+ font:11px/20px verdana, arial, helvetica, sans-serif;
+ margin:0px 0px 10px 0px;
+ padding:0px;
+ }
+.Content>p {margin:0px;}
+.Content>p+p {text-indent:30px;}
+
+a {
+ color:#09c;
+ font-size:11px;
+ font-family:verdana, arial, helvetica, sans-serif;
+ font-weight:600;
+ text-decoration:none;
+ }
+a:link {color:#09c;}
+a:visited {color:#07a;}
+a:hover {background-color:#eee;}
+
+
+/* All the content boxes belong to the content class. */
+.content {
+ position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */
+ width:auto;
+ min-width:120px;
+ margin:0px 157px 10px 157px;
+ border:1px solid black;
+ background-color:white;
+ padding:5px;
+ z-index:3; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
+ }
+
+#navAlpha {
+ position:absolute;
+ width:150px;
+ top:10px;
+ left:10px;
+ border:1px dashed black;
+ background-color:#eee;
+ padding:5px;
+ z-index:2;
+
+/* Here is the ugly brilliant hack that protects IE5/Win from its own stupidity.
+Thanks to Tantek Celik for the hack and to Eric Costello for publicizing it.
+IE5/Win incorrectly parses the "\"}"" value, prematurely closing the style
+declaration. The incorrect IE5/Win value is above, while the correct value is
+below. See http://glish.com/css/hacks.asp for details. */
+ voice-family: "\"}\"";
+ voice-family:inherit;
+ width:135px;
+ }
+/* I've heard this called the "be nice to Opera 5" rule. Basically, it feeds correct
+length values to user agents that exhibit the parsing error exploited above yet get
+the CSS box model right and understand the CSS2 parent-child selector. ALWAYS include
+a "be nice to Opera 5" rule every time you use the Tantek Celik hack (above). */
+body>#navAlpha {width:135px;}
+
+#navBeta {
+ position:absolute;
+ width:190px;
+ top:10px;
+ right:10px;
+ border:1px dashed black;
+ background-color:#eee;
+ padding:5px;
+ z-index:1;
+/* Again, the ugly brilliant hack. */
+ voice-family: "\"}\"";
+ voice-family:inherit;
+ width:135px;
+ }
+/* Again, "be nice to Opera 5". */
+body>#navBeta {width:135px;}
+
+
+/* Rollover Menu CSS from http://www.alistapart.com/stories/taminglists/ */
+
+.menu {
+ width: 12.3em;
+ border-right: 0px solid #000;
+ padding: 0 0 0 0;
+ margin-bottom: 1em;
+ font-family: 'Trebuchet MS', 'Lucida Grande',
+ Verdana, Lucida, Geneva, Helvetica,
+ Arial, sans-serif;
+ background-color: #90bade;
+ color: #333;
+ }
+
+ .menu ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ border: none;
+ }
+
+ .menu li {
+ border-bottom: 1px solid #90bade;
+ margin: 0;
+ }
+
+ .menu li a {
+ display: block;
+ padding: 4px 4px 4px 0.2em;
+ border-left: 4px solid #1958b7;
+ border-right: 4px solid #508fc4;
+ background-color: #2175bc;
+ color: #fff;
+ text-decoration: none;
+ width: 100%;
+ }
+
+ html>body .menu li a {
+ width: auto;
+ }
+
+ .menu li a:hover {
+ border-left: 4px solid #1c64d1;
+ border-right: 4px solid #5ba3e0;
+ background-color: #2586d7;
+ color: #fff;
+ }
+
Propchange: velocity/tools/trunk/examples/showcase/layout/layout.css
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/layoutmenu.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/layoutmenu.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/layoutmenu.vm (added)
+++ velocity/tools/trunk/examples/showcase/layoutmenu.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,24 @@
+## 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.
+#set( $slink = $link.self )
+<h3>Choose a layout:</h3>
+<ul>
+ <li><a href="$slink">Default Layout</a></li>
+ <li><a href="$slink.layout('CSS')">CSS Layout</a></li>
+ <li><a href="$slink.layout('Table')">Table Layout</a></li>
+ <li><a href="$slink.layout('Print')">Print Layout</a></li>
+</ul>
Propchange: velocity/tools/trunk/examples/showcase/layoutmenu.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/link.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/link.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/link.vm (added)
+++ velocity/tools/trunk/examples/showcase/link.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,91 @@
+## 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.
+#title( 'LinkTool' )
+<p>
+This page demonstrates functions of the #doclink( 'LinkTool' false ). This tool
+is somewhat unusual in that every method that takes parameters will return a new
+instance of the tool that is a copy of the one the method was called upon, with
+the additional change specified by the method call.
+</p>
+
+#demoTableStart()
+
+#set( $desc = "Returns a new ${esc.d}link with the addition of the specified anchor value." )
+#demo1( 'link' 'anchor' 6 $desc )
+
+#set( $desc = "Returns the anchor set for the ${esc.d}link" )
+#if( $params.anchor )
+ #set( $result = $link.anchor($params.anchor) )
+#else
+ #set( $result = $!link.anchor )
+#end
+#demoAlt( 'link' 'anchor' $result $desc )
+
+#set( $desc = "Returns a new ${esc.d}link with the addition of the specified URI value." )
+#demo1( 'link' 'uri' 6 $desc )
+
+#set( $desc = "Returns a new ${esc.d}link with the addition of the specified relative value." )
+#demo1( 'link' 'relative' 6 $desc )
+
+#set( $desc = "Returns a new ${esc.d}link with the addition of the specified absolute value." )
+#demo1( 'link' 'absolute' 6 $desc )
+
+#set( $desc = "Returns the URI set for this ${esc.d}link via one of the absolute(), relative(), or uri() methods." )
+#if( $params.uri )
+ #set( $result = $link.uri($params.uri).uri )
+#elseif( $params.relative )
+ #set( $result = $link.relative($params.relative).uri )
+#elseif( $params.absolute )
+ #set( $result = $link.absolute($params.absolute).uri )
+#else
+ #set( $result = $!link.uri )
+#end
+#demoAlt( 'link' 'uri' $result $desc )
+
+#set( $desc = "Returns a new ${esc.d}link with the addition of the specified parameter." )
+#demo1( 'link' 'param' 6 $desc )
+
+
+#set( $desc = "Returns the query data set for this ${esc.d}link" )
+#if( $params.param )
+ #set( $result = $link.param($params.param).params )
+#else
+ #set( $result = $link.params )
+#end
+#demoAlt( 'link' 'params' $desc )
+
+
+#set( $desc = "Returns the URI that addresses this web application. E.g. <code>http://myserver.net/myapp</code>. This string does not end with a "/"." )
+#demo( 'link' 'contextURL' $desc )
+
+#set( $desc = "Returns the context path that addresses this web application, e.g. <code>/myapp</code>. This string starts with a "/" but does not end with a "/"." )
+#demo( 'link' 'contextPath' $desc )
+
+#set( $desc = "Retrieves the path for the current request regardless of whether this is a direct request or an include by the RequestDispatcher." )
+#demo( 'link' 'requestPath' $desc )
+
+#set( $desc = "Returns the full URI of this template without any query data. e.g. <code>http://myserver.net/myapp/stuff/View.vm</code>" )
+#demo( 'link' 'baseRef' $desc )
+
+#set( $desc = "This method returns a new self-referencing ${esc.d}link for the current request (e.g. <code>/myapp/stuff/View.vm</code>). However, the behavior can be changed via toolbox configuration to use absolute URIs and/or add the current request parameters." )
+#demo( 'link' 'self' $desc )
+
+#set( $desc = "Performs URL encoding on the specified text." )
+#demo1( 'link' 'encodeURL' 6 $desc )
+
+#demoCustom( 'link' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/link.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: velocity/tools/trunk/examples/showcase/lists.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/lists.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/lists.vm (added)
+++ velocity/tools/trunk/examples/showcase/lists.vm Fri Dec 8 11:47:23 2006
@@ -0,0 +1,49 @@
+## 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.
+#title( 'ListTool' )
+<p>
+This page demonstrates functions of the #doclink( 'ListTool' true ).
+</p>
+
+#demoTableStart()
+
+## set quote character to empty string so values are not treated as strings
+#set( $quote = '' )
+
+#set( $desc = 'Checks if a List/array contains a certain element.' )
+#demo2( 'lists' 'contains' 5 $desc )
+
+#set( $desc = 'Gets the specified element of a List/array.' )
+#demo2( 'lists' 'get' 5 $desc )
+
+#set( $desc = 'Checks if an object is an array.' )
+#demo1( 'lists' 'isArray' 3 $desc)
+
+#set( $desc = 'Checks if a List/array is empty.' )
+#demo1( 'lists' 'isEmpty' 3 $desc)
+
+#set( $desc = 'Checks if an object is a List.' )
+#demo1( 'lists' 'isList' 3 $desc)
+
+#set( $desc = 'Sets the specified element of a List/array.' )
+#demo3( 'lists' 'set' 5 $desc )
+
+#set( $desc = 'Gets the size of a List/array.' )
+#demo1( 'lists' 'size' 3 $desc)
+
+#demoCustom( 'lists' )
+</table>
Propchange: velocity/tools/trunk/examples/showcase/lists.vm
------------------------------------------------------------------------------
svn:eol-style = native