velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r484712 [2/2] - in /velocity/tools/trunk: ./ examples/layout/ examples/showcase/ examples/showcase/WEB-INF/ examples/showcase/WEB-INF/src/ examples/showcase/layout/
Date Fri, 08 Dec 2006 19:47:28 GMT
Added: velocity/tools/trunk/examples/showcase/math.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/math.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/math.vm (added)
+++ velocity/tools/trunk/examples/showcase/math.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,82 @@
+## 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( 'MathTool' )
+<p>
+This page demonstrates functions of the #doclink( 'MathTool' true ).
+</p>
+
+#demoTableStart()
+
+#set( $desc = 'Returns the sum of the numbers or <code>null</code> if they are
invalid.' )
+#demo2( 'math' 'add' 3 $desc)
+
+#set( $desc = 'Returns the difference of the numbers or <code>null</code> if
they are invalid.' )
+#demo2( 'math' 'sub' 3 $desc)
+
+#set( $desc = 'Returns the product of the numbers or <code>null</code> if they
are invalid.' )
+#demo2( 'math' 'mul' 3 $desc)
+
+#set( $desc = 'Returns the quotient of the numbers or <code>null</code> if they
are invalid.' )
+#demo2( 'math' 'div' 3 $desc)
+
+#set( $desc = 'Returns the first number raised to the power of the second or <code>null</code>
if they are invalid.' )
+#demo2( 'math' 'pow' 3 $desc)
+
+#set( $desc = 'Returns the result of performing integer division on the operands or <code>null</code>
if they are invalid.' )
+#demo2( 'math' 'idiv' 3 $desc)
+
+#set( $desc = 'Returns the result of performing integer modulus on the operands or <code>null</code>
if they are invalid.' )
+#demo2( 'math' 'mod' 3 $desc)
+
+#set( $desc = 'Returns the largest of the numbers or <code>null</code> if they
are invalid.' )
+#demo2( 'math' 'max' 3 $desc)
+
+#set( $desc = 'Returns the smallest of the numbers or <code>null</code> if they
are invalid.' )
+#demo2( 'math' 'min' 3 $desc)
+
+#set( $desc = 'Returns the absolute value of the number or <code>null</code>
if it is invalid.' )
+#demo2( 'math' 'abs' 3 $desc)
+
+#set( $desc = 'Returns the smallest integer that is not less than the given number or <code>null</code>
if it is invalid.' )
+#demo1( 'math' 'ceil' 3 $desc)
+
+#set( $desc = 'Returns the integer portion of the given number or <code>null</code>
if it is invalid.' )
+#demo1( 'math' 'floor' 3 $desc)
+
+#set( $desc = 'Returns the given number rounded to the nearest whole Integer or <code>null</code>
if it is invalid.' )
+#demo1( 'math' 'found' 3 $desc)
+
+#set( $desc = "Rounds a number to the specified number of decimal places. This is particulary
useful for simple display formatting. If you want to round an number to the nearest integer,
it is better to use ${esc.d}math.round(), as that will return an Integer rather than a Double."
)
+#demo2( 'math' 'roundTo' 2 $desc )
+
+#set( $desc = 'Returns a pseudo-random Double greater than or equal to 0.0 and less than
1.0' )
+#demo( 'math' 'random' $desc )
+
+#set( $desc = 'This returns a random Number within the specified range.  The returned value
will be greater than or equal to the first number and less than the second number.  If both
arguments are whole numbers then the returned number will also be, otherwise a Double will
be returned.' )
+#demo2( 'math' 'random' 3 $desc )
+
+#set( $desc = 'Converts an object with a numeric value into an Integer. Valid formats are
Number or a string representation of a number.' )
+#demo1( 'math' 'toInteger' 3 $desc )
+
+#set( $desc = 'Converts an object with a numeric value into a Double. Valid formats are Number
or a string representation of a number.' )
+#demo1( 'math' 'toDouble' 3 $desc )
+
+#set( $desc = 'Converts an object with a numeric value into a Number. Valid formats are Number
or a string representation of a number.' )
+#demo1( 'math' 'toNumber' 3 $desc )
+
+#demoCustom( 'math' )
+</table>

Propchange: velocity/tools/trunk/examples/showcase/math.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/mill.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/mill.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/mill.vm (added)
+++ velocity/tools/trunk/examples/showcase/mill.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,51 @@
+## 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( 'IteratorTool' )
+<p>
+This page demonstrates functions of the #doclink( 'IteratorTool' true ).
+This tool is a convenience tool to use with ${esc.h}foreach loops. It wraps a
+list to let the designer specify a condition to terminate the loop,
+and reuse the same list in different loops.
+</p>
+
+<form method="post" action="$link.self">
+  <textarea name="demo" rows="10" cols="65">
+#if( $params.demo )##
+$params.demo
+#else##
+${esc.h}set( ${esc.d}list = [1, 2, 3, 5, 8, 13] )
+${esc.h}set( ${esc.d}numbers = ${esc.d}mill.wrap(${esc.d}list) )
+
+${esc.h}foreach( ${esc.d}item in ${esc.d}numbers )
+  ${esc.h}if( ${esc.d}item < 8 )${esc.d}numbers.more()${esc.h}end
+${esc.h}end
+
+${esc.d}numbers.more()
+#end
+  </textarea>
+  <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

Propchange: velocity/tools/trunk/examples/showcase/mill.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/number.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/number.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/number.vm (added)
+++ velocity/tools/trunk/examples/showcase/number.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,69 @@
+## 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( 'NumberTool' )
+<p>
+This page demonstrates functions of the #doclink( 'NumberTool' true ).
+</p>
+
+#demoTableStart()
+
+#set( $desc = 'Convenience method equivalent to $number.format("currency", $foo).' )
+#demo1( 'number' 'currency' 4 $desc )
+
+#set( $desc = 'Converts the specified object to a number and formats it according to the
pattern or style returned by $number.format.' )
+#demo1( 'number' 'format' 4 $desc )
+
+#set( $desc = 'Converts the specified object to a number and returns a formatted string representing
that number in the locale returned by $number.locale.' )
+#demo2( 'number' 'format' 4 $desc )
+
+#set( $quote = '' )
+#set( $desc = 'Converts the specified object to a number and returns a formatted string representing
that number in the specified Locale.' )
+#demo3( 'number' 'format' 4 $desc )
+
+#set( $quote = '"' )
+#set( $desc = 'Return the pattern or style to be used for formatting numbers when none is
specified.' )
+#demo( 'number' 'format' $desc )
+
+#set( $desc = 'This implementation returns the default locale.' )
+#demo( 'number' 'locale' $desc )
+
+#set( $quote = '' )
+#set( $desc = 'Returns a NumberFormat instance for the specified format and Locale.' )
+#demo2( 'number' 'getNumberFormat' 4 $desc )
+
+#set( $quote = '"' )
+#set( $desc = 'Convenience method equivalent to $number.format("integer", $foo).' )
+#demo1( 'number' 'integer' 4 $desc )
+
+#set( $desc = 'Convenience method equivalent to $number.format("number", $foo).' )
+#demo1( 'number' 'number' 4 $desc )
+
+#set( $desc = 'Convenience method equivalent to $number.format("percent", $foo).' )
+#demo1( 'number' 'percent' 4 $desc )
+
+#set( $desc = 'Converts an object to an instance of Number using the format returned by $number.format
and the Locale returned by $number.locale if the object is not already an instance of Number.'
)
+#demo1( 'number' 'toNumber' 4 $desc )
+
+#set( $desc = 'Converts an object to an instance of Number using the specified format and
the Locale returned by $number.locale if the object is not already an instance of Number.'
)
+#demo2( 'number' 'toNumber' 4 $desc )
+
+#set( $quote = '' )
+#set( $desc = 'Converts an object to an instance of Number using the specified format and
Localeif the object is not already an instance of Number.' )
+#demo3( 'number' 'toNumber' 4 $desc )
+
+#demoCustom( 'number' )
+</table>

Propchange: velocity/tools/trunk/examples/showcase/number.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/pager.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/pager.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/pager.vm (added)
+++ velocity/tools/trunk/examples/showcase/pager.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,133 @@
+## 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( 'AbstractPagerTool' )
+<p>
+This page demonstrates functions of the #doclink( 'AbstractPagerTool' false ).  In this
+case, we are working with a simple implementation called "MyPagerTool".
+</p>
+
+<p>
+If you set a list of items using the "Try it!" form at the top of the table below,
+then that will activate a full demonstration of this tool's abilities 
+<a href="#fullDemo">below the function list</a>.  An easy list to begin is a
list
+of numbers by entering something like <code>[111..2222]</code> in the 
+"${esc.d}pager.setItems" field.
+</p>
+
+#demoTableStart()
+
+## set quote character to empty string so values are not treated as strings
+#set( $quote = '' )
+
+#set( $desc = 'Sets the List to page through.' )
+#demo1( 'pager' 'setItems' 10 $desc )
+
+#set( $desc = 'Sets the index of the first result in the current page' )
+#demo1( 'pager' 'setIndex' 4 $desc )
+
+#set( $desc = 'Sets the number of items returned in a page of items' )
+#demo1( 'pager' 'setItemsPerPage' 4 $desc )
+
+#set( $desc = 'Sets the number of result page indices for $pager.slip to list.' )
+#demo1( 'pager' 'setSlipSize' 4 $desc )
+
+#set( $desc = 'Checks whether or not the result list is empty.' )
+#demo( 'pager' 'hasItems()' $desc )
+
+#set( $desc = 'Returns the current search result index.' )
+#demo( 'pager' 'index' $desc )
+
+#set( $desc = 'Returns the index of the first item on the current page of results (as determined
by the current index, items per page, and the number of items).' )
+#demo( 'pager' 'firstIndex' $desc )
+
+#set( $desc = 'Returns the index of the last item on the current page of results (as determined
by the current index, items per page, and the number of items).' )
+#demo( 'pager' 'lastIndex' $desc )
+
+#set( $desc = 'Return the index for the previous page of items (as determined by the current
index, items per page, and the number of items).' )
+#demo( 'pager' 'prevIndex' $desc )
+
+#set( $desc = 'Returns the index for the next page of items (as determined by the current
index, items per page, and the number of items).' )
+#demo( 'pager' 'nextIndex' $desc )
+
+#set( $desc = 'Returns the item list.' )
+#demo( 'pager' 'items' $desc )
+
+#set( $desc = 'Returns the current "page" of search items.' )
+#demo( 'pager' 'page' $desc )
+
+#set( $desc = 'Returns a description of the current page.' )
+#demo( 'pager' 'pageDescription' $desc )
+
+#set( $desc = 'Returns the "page number" for the current index.' )
+#demo( 'pager' 'pageNumber' $desc )
+
+#set( $desc = 'Returns the "page number" for the specified index.' )
+#demo1( 'pager' 'getPageNumber' 4 $desc )
+
+#set( $desc = 'Returns the set number of items to be displayed per page of items' )
+#demo( 'pager' 'itemsPerPage' $desc )
+
+#set( $desc = 'Returns the number of pages that can be made from this list given the set
number of items per page.' )
+#demo( 'pager' 'pagesAvailable' $desc )
+
+#set( $desc = 'Returns the total number of items available.' )
+#demo( 'pager' 'total' $desc )
+
+#set( $desc = 'Returns a Sliding List of Indices for Pages of items.' )
+#demo( 'pager' 'slip' $desc )
+
+#set( $desc = 'Returns the number of result page indices $pager.slip will return per request
(if available).' )
+#demo( 'pager' 'slipSize' $desc )
+
+#demoCustom( 'pager' )
+</table>
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+  #if( $pager.hasItems() )
+    <div align="left">
+      Showing $!pager.pageDescription<br>
+      #set( $i = $pager.index + 1 )
+      #foreach( $item in $pager.page )
+        ${i}. $!item <br>
+        #set( $i = $i + 1 )
+      #end
+      <br>
+      #if ( $pager.pagesAvailable > 1 )
+        #set( $pagelink = $link.self.anchor('fullDemo').param("layout",$!params.layout).param("show",$!pager.itemsPerPage)
)
+        #if( $pager.prevIndex )
+          <a href="$pagelink.param('index',$!pager.prevIndex)">Prev</a>
+        #end
+        #foreach( $index in $pager.slip )
+          #if( $index == $pager.index )
+            <b>$pager.pageNumber</b>
+          #else
+            <a href="$pagelink.param('index',$!index)">$!pager.getPageNumber($index)</a>
+          #end
+        #end
+        #if( $pager.nextIndex )
+          <a href="$pagelink.param('index',$!pager.nextIndex)">Next</a>
+        #end
+      #end
+    </div>
+  #else
+    <p>
+      There are no items to display.
+      To activate this example, follow the directions at the top of this page.
+    </p>
+  #end
+</div>

Propchange: velocity/tools/trunk/examples/showcase/pager.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/params.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/params.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/params.vm (added)
+++ velocity/tools/trunk/examples/showcase/params.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,72 @@
+## 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( 'ParameterParser' )
+<p>
+This page demonstrates functions of the #doclink( 'ParameterParser' false ).
+</p>
+
+#demoTableStart()
+
+#set( $quote = '"' )
+#set( $desc = 'Convenience method for checking whether a certain parameter exists.' )
+#demo1( 'params' 'exists' 6 $desc )
+
+#set( $desc = 'Convenience method for use in Velocity templates. This is the same as $params.getString("foo"),
but simplifies the syntax to $params.foo' )
+#demo1( 'params' 'get' 6 $desc )
+
+#set( $desc = 'Returns the parameter with the specified key, if it exists; otherwise, returns
<code>null</code>.' )
+#demo1( 'params' 'getString' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang.Boolean, if it
exists and can be converted to that type; otherwise, returns <code>null</code>.'
)
+#demo1( 'params' 'getBoolean' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang.Number, if it
exists and can be converted to that type; otherwise, returns <code>null</code>.'
)
+#demo1( 'params' 'getNumber' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang.Double, if it
exists and can be converted to that type; otherwise, returns <code>null</code>.'
)
+#demo1( 'params' 'getDouble' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang.Integer, if it
exists and can be converted to that type; otherwise, returns <code>null</code>.'
)
+#demo1( 'params' 'getInteger' 6 $desc )
+           
+#set( $desc = 'Returns the parameter(s) with the specified key in an array of the type requested,
if any exist; otherwise, returns <code>null</code>..' )
+#demo1( 'params' 'getStrings' 6 $desc )
+#set( $desc = 'Returns the parameter(s) with the specified key in an array of java.lang.Boolean
objects, if any exist and can be converted to that type; otherwise, returns <code>null</code>..'
)
+#demo1( 'params' 'getBooleans' 6 $desc )
+#set( $desc = 'Returns the parameter(s) with the specified key in an array of java.lang.Number
objects, if any exist and can be converted to that type; otherwise, returns <code>null</code>..'
)
+#demo1( 'params' 'getNumbers' 6 $desc )
+#set( $desc = 'Returns the parameter(s) with the specified key in an array of java.lang.Double
objects, if any exist and can be converted to that type; otherwise, returns <code>null</code>..'
)
+#demo1( 'params' 'getDoubles' 6 $desc )
+#set( $desc = 'Returns the parameter(s) with the specified key in an array of int primitives,
if any exist and can be converted to that type; otherwise, returns <code>null</code>..'
)
+#demo1( 'params' 'getInts' 6 $desc )
+           
+#set( $quote = '' )
+#set( $desc = 'Returns the parameter with the specified key, if it exists; otherwise, returns
the specified alternate value.' )
+#demo2( 'params' 'getString' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang., if it exists;
otherwise, returns the specified alternate Boolean.' )
+#demo2( 'params' 'getBoolean' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang.Number, if it
exists; otherwise, returns the specified alternate Number.' )
+#demo2( 'params' 'getNumber' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang.Double, if it
exists; otherwise, returns the specified alternate Double.' )
+#demo2( 'params' 'getDouble' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as a java.lang.Integer, if it
exists; otherwise, returns the specified alternate Integer.' )
+#demo2( 'params' 'getInteger' 6 $desc )
+#set( $desc = 'Returns the parameter with the specified key as an int, if it exists; otherwise,
returns the specified alternate int.' )
+#demo2( 'params' 'getInt' 6 $desc )
+
+#set( $desc = 'Returns the map of all parameters available for the current request.' )
+#demo( 'params' 'all' $desc )
+           
+#set( $quote = '"' )
+#demoCustom( 'params.layout' )
+</table>

Propchange: velocity/tools/trunk/examples/showcase/params.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/render.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/render.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/render.vm (added)
+++ velocity/tools/trunk/examples/showcase/render.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,32 @@
+## 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( 'ViewRenderTool' )
+<p>
+This page demonstrates functions of the #doclink( 'ViewRenderTool' false ).
+</p>
+
+#demoTableStart()
+
+#set( $quote = "'" )
+#set( $desc = 'Evaluates a String containing VTL using the current context, and returns the
result as a String.' )
+#demo1( 'render' 'eval' 15 $desc)
+
+#set( $desc = 'Recursively evaluates a String containing VTL using the current context, and
returns the result as a String.' )
+#demo1( 'render' 'recurse' 15 $desc )
+
+#demoCustom( 'render' )
+</table>

Propchange: velocity/tools/trunk/examples/showcase/render.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/search.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/search.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/search.vm (added)
+++ velocity/tools/trunk/examples/showcase/search.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,151 @@
+## 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( 'AbstractSearchTool' )
+<p>
+This page demonstrates functions of the #doclink( 'AbstractSearchTool' false ).
+In this case, we are working with a simplistic, demonstration implementation
+called "MySearchTool".
+</p>
+
+<p>
+If you submit a list of items using the <a href="#store">store() function</a>
at the 
+bottom> of the table below, that will add those items to a static database of strings
+which we can use to search for the purposes of the function demonstrations and the
+<a href="#fullDemo">example</a> below the function list.
+Please note that, ${esc.d}search.store() is not a part of the AbstractSearchTool API
+and exists only for the implementation used in this demo.
+</p>
+
+#demoTableStart()
+
+#set( $quote = '"' )
+#set( $desc = 'Sets the criteria for finding results (i.e. the search terms).' )
+#demo1( 'search' 'setCriteria' 8 $desc )
+
+#set( $quote = '' )
+#set( $desc = 'Sets the index of the first result in the current page' )
+#demo1( 'search' 'setIndex' 4 $desc )
+
+#set( $desc = 'Sets the number of results returned in a page of results' )
+#demo1( 'search' 'setItemsPerPage' 4 $desc )
+
+#set( $desc = 'Sets the number of result page indices for $search.slip to list.' )
+#demo1( 'search' 'setSlipSize' 4 $desc )
+
+#set( $desc = 'Checks whether or not the result list is empty.' )
+#demo( 'search' 'hasItems()' $desc )
+
+#set( $desc = 'Returns the current search criteria.' )
+#demo( 'search' 'criteria' $desc )
+
+#set( $desc = 'Returns the current search result index.' )
+#demo( 'search' 'index' $desc )
+
+#set( $desc = 'Returns the index of the first result on the current page of results (as determined
by the current index, results per page, and the number of results).' )
+#demo( 'search' 'firstIndex' $desc )
+
+#set( $desc = 'Returns the index of the last result on the current page of results (as determined
by the current index, results per page, and the number of results).' )
+#demo( 'search' 'lastIndex' $desc )
+
+#set( $desc = 'Return the index for the previous page of results (as determined by the current
index, results per page, and the number of results).' )
+#demo( 'search' 'prevIndex' $desc )
+
+#set( $desc = 'Returns the index for the next page of results (as determined by the current
index, results per page, and the number of results).' )
+#demo( 'search' 'nextIndex' $desc )
+
+#set( $desc = 'Returns the search result list.' )
+#demo( 'search' 'items' $desc )
+
+#set( $desc = 'Returns the current "page" of search results.' )
+#demo( 'search' 'page' $desc )
+
+#set( $desc = 'Returns a description of the current page.' )
+#demo( 'search' 'pageDescription' $desc )
+
+#set( $desc = 'Returns the "page number" for the current index.' )
+#demo( 'search' 'pageNumber' $desc )
+
+#set( $desc = 'Returns the "page number" for the specified index.' )
+#demo1( 'search' 'getPageNumber' 4 $desc )
+
+#set( $desc = 'Returns the set number of results to be displayed per page of results' )
+#demo( 'search' 'itemsPerPage' $desc )
+
+#set( $desc = 'Returns the number of pages that can be made from this list given the set
number of results per page.' )
+#demo( 'search' 'pagesAvailable' $desc )
+
+#set( $desc = 'Returns the total number of results available.' )
+#demo( 'search' 'total' $desc )
+
+#set( $desc = 'Returns a Sliding List of Indices for Pages of results.' )
+#demo( 'search' 'slip' $desc )
+
+#set( $desc = 'Returns the number of result page indices $search.slip will return per request
(if available).' )
+#demo( 'search' 'slipSize' $desc )
+
+#demoCustom( 'search.store($context.toolbox)' )
+
+#set( $desc = 'Adds an item or list of items to the faux "database" that is being "searched"
by this example. This method is not part of the AbstractSearchTool API.' )
+#demo1( 'search' 'store' 12 $desc )
+</table>
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+   <form name="search" method="get" action="$link.self.anchor('fullDemo')">
+     <input type="text"name="find" value="$!search.criteria">
+     <input type="submit" value="Find">
+     #foreach( $param in $request.parameterMap.keySet() )
+       #if( !$param.equals('setCriteria') )
+         #foreach( $value in $params.getStrings($param) )
+           <input type="hidden" name="$param" value="$value">
+         #end
+       #end
+     #end
+   </form>
+   #if( $search.hasItems() )
+    <div align="left">
+      Showing $!search.pageDescription<br>
+      #set( $i = $search.index + 1 )
+      #foreach( $item in $search.page )
+        ${i}. $!item <br>
+        #set( $i = $i + 1 )
+      #end
+      <br>
+      #if ( $search.pagesAvailable > 1 )
+        #set( $pagelink = $link.self.anchor('fullDemo').param('find',$search.criteria).param('layout',$!params.layout).param('show',$!search.itemsPerPage)
)
+        #if( $search.prevIndex )
+          <a href="$pagelink.param('index',$!search.prevIndex)">Prev</a>
+        #end
+        #foreach( $index in $search.slip )
+          #if( $index == $search.index )
+            <b>$search.pageNumber</b>
+          #else
+            <a href="$pagelink.param('index',$!index)">$!search.getPageNumber($index)</a>
+          #end
+        #end
+        #if( $search.nextIndex )
+          <a href="$pagelink.param('index',$!search.nextIndex)">Next</a>
+        #end
+      #end
+    </div>
+  #else
+    <p>
+      There are no items to display.
+      To activate this example, follow the directions at the top of this page.
+    </p>
+  #end
+</div>

Propchange: velocity/tools/trunk/examples/showcase/search.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/sorter.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/sorter.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/sorter.vm (added)
+++ velocity/tools/trunk/examples/showcase/sorter.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.
+#title( 'SortTool' )
+<p>
+This page demonstrates functions of the #doclink( 'SortTool' true ).
+</p>
+
+#demoTableStart()
+
+#set( $quote = '' )
+
+#set( $desc = 'Sorts the values of the specified Collection, Map, or array of Objects according
to their natural ordering' )
+#demo1( 'sorter' 'sort' 3 $desc)
+
+#set( $desc = "Sorts the values of the specified Collection, Map, or array of Objects according
to the values returned by the specified property or list of properties" )
+#demo2( 'sorter' 'sort' 5 $desc )
+
+#demoCustom( "sorter.sort(['b','c','a'])" )
+</table>

Propchange: velocity/tools/trunk/examples/showcase/sorter.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/template.txt
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/template.txt?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/template.txt (added)
+++ velocity/tools/trunk/examples/showcase/template.txt Fri Dec  8 11:47:23 2006
@@ -0,0 +1,38 @@
+## 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>
+This page demonstrates functions of the #doclink( 'FooTool' true ).
+</p>
+
+<table border="1" cellspacing="0" cellpadding="3">
+<tr>
+  <th>Function</th>
+  <th>Demo Result</th>
+  <th>Description</th>
+</tr>
+#set( $desc = "" )
+#demo( 'foo' '' $desc )
+
+#set( $desc = '' )
+#demo1( 'foo' '' 3 $desc)
+
+#set( $desc = "" )
+#demo2( 'foo' '' 5 $desc )
+
+#demoCustom( 'foo' )
+</table>

Propchange: velocity/tools/trunk/examples/showcase/template.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: velocity/tools/trunk/examples/showcase/toolmenu.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/toolmenu.vm?view=auto&rev=484712
==============================================================================
--- velocity/tools/trunk/examples/showcase/toolmenu.vm (added)
+++ velocity/tools/trunk/examples/showcase/toolmenu.vm Fri Dec  8 11:47:23 2006
@@ -0,0 +1,41 @@
+## 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.
+#if( $params.layout )
+  #set( $llink = $link.layout($params.layout) )
+#else
+  #set( $llink = $link)
+#end
+<h3>Choose a tool:</h3>
+<ul>
+#toolMenuItem( $llink 'alternator' 'AlternatorTool' )
+#toolMenuItem( $llink 'browser'    'BrowserSniffer' )
+#toolMenuItem( $llink 'context'    'ContextTool' )
+#toolMenuItem( $llink 'cookies'    'CookieTool' )
+#toolMenuItem( $llink 'date'       'DateTool' )
+#toolMenuItem( $llink 'esc'        'EscapeTool' )
+#toolMenuItem( $llink 'import'     'ImportTool' )
+#toolMenuItem( $llink 'link'       'LinkTool' )
+#toolMenuItem( $llink 'lists'      'ListTool' )
+#toolMenuItem( $llink 'math'       'MathTool' )
+#toolMenuItem( $llink 'mill'       'IteratorTool' )
+#toolMenuItem( $llink 'number'     'NumberTool' )
+#toolMenuItem( $llink 'pager'      'PagerTool' )
+#toolMenuItem( $llink 'params'     'ParameterParser' )
+#toolMenuItem( $llink 'render'     'RenderTool' )
+#toolMenuItem( $llink 'search'     'SearchTool' )
+#toolMenuItem( $llink 'sorter'     'SortTool' )
+</ul>

Propchange: velocity/tools/trunk/examples/showcase/toolmenu.vm
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message