velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r608943 - in /velocity/tools/trunk/examples/showcase: WEB-INF/src/resources.properties display.vm
Date Fri, 04 Jan 2008 17:56:37 GMT
Author: nbubna
Date: Fri Jan  4 09:56:32 2008
New Revision: 608943

URL: http://svn.apache.org/viewvc?rev=608943&view=rev
Log:
update DisplayTool showcase

Modified:
    velocity/tools/trunk/examples/showcase/WEB-INF/src/resources.properties
    velocity/tools/trunk/examples/showcase/display.vm

Modified: velocity/tools/trunk/examples/showcase/WEB-INF/src/resources.properties
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/WEB-INF/src/resources.properties?rev=608943&r1=608942&r2=608943&view=diff
==============================================================================
--- velocity/tools/trunk/examples/showcase/WEB-INF/src/resources.properties (original)
+++ velocity/tools/trunk/examples/showcase/WEB-INF/src/resources.properties Fri Jan  4 09:56:32
2008
@@ -152,6 +152,39 @@
 context.getToolbox = Returns a java.util.Map of the tools available in the current request
context and their context keys.
 context.getValues = Returns a java.util.Set of the values available in the current request
context.
 
+# display.vm resources
+display.intro = This tool provides a variety of methods for controlling the output \
+    displayed by various references in your templates.
+display.list = Formats a collection or array into the form "A, B and C".
+display.list_Object.param1 = ['A','B','C']
+display.list_ObjectString = Formats a collection or array into a string delimited by the
second argument
+display.list_ObjectStringString = Formats a collection or array into a string delimited by
the second argument, except the last two arguments are delimited by the third argument
+display.truncate = Limits the string output of the specified value to the configured max
length in characters (default is 30 characters). If the string gets curtailed, the configured
suffix (default is "...") is used as the ending of the truncated string.
+display.truncate_Objectint = Limits the string output of the second argument to the specified
number of characters.  If the string gets curtailed, the configured suffix (default is "...")
is used as the ending of the truncated string.
+display.truncate_ObjectString = Limits the string output of the first argument to the configured
max length in characters (default is 30 characters). If the string gets curtailed, the specified
suffix is used as the ending of the truncated string.
+display.truncate_ObjectintString = Limits the string output of the second argument to the
specified number of characters. If the string gets curtailed, the specified suffix is used
as the ending of the truncated string.
+display.alt = Returns the configured default value ("null" by default) if the specified value
is null.
+display.alt_ObjectObject = Returns the second argument if first argument specified is null.
+display.cell = Truncates or pads the string value of the specified object as necessary to
ensure that the returned string's length equals the default cell size.
+display.cell_Objectint = Truncates or pads the string value of the specified object as necessary
to ensure that the returned string's length equals the specified cell size.
+display.cell_ObjectString = Truncates or pads the string value of the specified object as
necessary to ensure that the returned string's length equals the default cell size. If truncation
is necessary, the specified suffix will replace the end of the string value to indicate that.
+display.cell_ObjectintString = Truncates or pads the string value of the specified object
as necessary to ensure that the returned string's length equals the specified cell size. If
truncation is necessary, the specified suffix will replace the end of the string value to
indicate that.
+display.message = Uses <code>java.text.MessageFormat</code> to format the specified
String with the specified arguments. If there are no arguments, then the String is returned
directly.
+display.message_StringObjectVarArgs.param1 = 'foo {1} {0}'
+display.message_StringObjectVarArgs.param2 = ['bar', 2]
+display.space = Returns a string of spaces of the specified length.
+display.space_int.param1 = 4
+display.capitalize = Changes the first character of the string value of the specified object
to upper case and returns the resulting string.
+display.uncapitalize = Changes the first character of the string value of the specified object
to lower case and returns the resulting string.
+display.measure = Returns the measurements of the string value of the specified object.
+display.getCellLength = Returns the configured default cell size.
+display.getCellSuffix = Returns the configured default suffix used when cell contents need
truncating.
+display.getDefaultAlternate = Returns the configured default alternate used by alt(Object).
+display.getListDelimiter = Returns the configured default delimiter used between items by
the list formatting methods.
+display.getListFinalDelimiter = Returns the configured default delimiter used between the
last two items by the list formatting methods.
+display.getTruncateLength = Returns the configured default length used by truncate(Object).
+display.getTruncateSuffix = Returns the configured default suffix used by the truncate methods.
+
 # field.vm resources
 field.intro = This tool allows easy access to public static fields in classes,  such as string
constants.
 field.get_String = Returns the value of the field with the specified name, if found.

Modified: velocity/tools/trunk/examples/showcase/display.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/display.vm?rev=608943&r1=608942&r2=608943&view=diff
==============================================================================
--- velocity/tools/trunk/examples/showcase/display.vm (original)
+++ velocity/tools/trunk/examples/showcase/display.vm Fri Jan  4 09:56:32 2008
@@ -16,72 +16,22 @@
 ## under the License.
 #title( 'DisplayTool' )
 <p>
-#set( $demo = $text.demo )
-$demo.thisPage.insert("#doclink( 'DisplayTool' true )").
+$text.demo.thisPage.insert("#doclink( 'DisplayTool' true )").
+$text.get('display.intro')
 </p>
 
-#demoTableStart()
-
-## set quote character to empty string so values are not treated as strings
-#set( $quote = '' )
-
-#set( $desc = 'Formats a collection or array into the form "A, B and C".' )
-#demo1( 'display' 'list' 5 $desc )
-
-#set( $desc = 'Formats a collection or array into a string delimited by the second argument'
)
-#demo2( 'display' 'list' 5 $desc )
-
-#set( $desc = 'Formats a collection or array into a string delimited by the second argument,
except the last two arguments are delimited by the third argument' )
-#demo3( 'display' 'list' 5 $desc )
-
-#set( $desc = 'Limits the string output of the specified value to the configured max length
in characters (default is 30 characters). If the string gets curtailed, the configured suffix
(default is "...") is used as the ending of the truncated string.' )
-#demo1( 'display' 'truncate' 8 $desc )
-
-#set( $desc = 'Limits the string output of the second argument to the specified number of
characters.  If the string gets curtailed, the configured suffix (default is "...") is used
as the ending of the truncated string.' )
-#demo2( 'display' 'truncate' 5 $desc )
-
-#set( $desc = 'Limits the string output of the first argument to the configured max length
in characters (default is 30 characters). If the string gets curtailed, the specified suffix
is used as the ending of the truncated string.' )
-#demo2( 'display' 'truncate' 5 $desc )
-
-#set( $desc = 'Limits the string output of the second argument to the specified number of
characters. If the string gets curtailed, the specified suffix is used as the ending of the
truncated string.' )
-#demo3( 'display' 'truncate' 4 $desc )
-
-#set( $desc = 'Returns the configured default value ("null" by default) if the specified
value is null.' )
-#demo1( 'display' 'alt' 8 $desc )
-
-#set( $desc = 'Returns the second argument if first argument specified is null.' )
-#demo2( 'display' 'alt' 5 $desc )
-
-#demoCustom( 'display' )
-</table>
-
-#set( $primes = [1, 2, 3, 5, 7, 11] )
-<div align="center">
-  <a name="fullDemo"><h3>$demo.mainExampleHeader</h3></a>
-<form method="post" action="$link.self.anchor('fullDemo')">
-<textarea name="demo" rows="7" cols="65">##
-#if( $params.demo )##
-$params.demo##
-#else##
-${esc.d}primes
+#set( $toolname = 'display' )
+#set( $toolclass = $display.class )
+#set( $toollink = $doclink )
+#set( $toolDemo = 
+"${esc.h}set( ${esc.d}primes = [1, 2, 3, 5, 7, 11] )
 ${esc.d}display.list(${esc.d}primes)
-${esc.d}display.truncate("This sentence should be truncated at 30 characters.")
-${esc.d}display.truncate("This will be cut at 15.", 15)
+${esc.d}display.truncate('This sentence should be truncated at 30 characters.')
+${esc.d}display.truncate('This will be cut at 15.', 15)
 ${esc.d}display.alt(${esc.d}primes)
-${esc.d}display.alt(${esc.d}null, "--")##
-#end##
-</textarea>
-  <br>
-  <input type="submit" value="$demo.try">
-  #if( $params.layout )
-  <input type="hidden" name="layout" value="$params.layout">
-  #end
-</form>
+${esc.d}display.alt(${esc.d}null, '--')
+${esc.h}set( ${esc.d}demoSize = ${esc.d}display.measure(${esc.d}toolDemo) )
+This demo is ${esc.d}demoSize.height lines with a max length of ${esc.d}demoSize.width chars."
+)
 
-#if( $params.demo )
-$demo.mainResultsIntro:
-<pre>
-  $render.eval($params.demo)
-</pre>
-#end
-</div>
+#parse( 'demo.vm' )



Mime
View raw message