You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/10/24 11:03:46 UTC
svn commit: r587825 - in
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util:
string/interpolator/ template/
Author: jcompagner
Date: Wed Oct 24 02:03:44 2007
New Revision: 587825
URL: http://svn.apache.org/viewvc?rev=587825&view=rev
Log:
WICKET-1096
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/MapVariableInterpolator.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolator.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/SystemVariableInterpolator.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/VariableInterpolator.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/package.html
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/CssTemplate.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/JavaScriptTemplate.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/PackagedTextTemplate.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplate.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateHeaderContributor.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateLink.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/package.html
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/MapVariableInterpolator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/MapVariableInterpolator.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/MapVariableInterpolator.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/MapVariableInterpolator.java Wed Oct 24 02:03:44 2007
@@ -22,9 +22,10 @@
/**
- * Interpolates variables into a string from a Map.
+ * Interpolates variables into a <code>String</code> from a <code>Map</code>.
*
* @author Jonathan Locke
+ * @since 1.2.6
*/
public class MapVariableInterpolator extends VariableInterpolator
{
@@ -32,12 +33,12 @@
private Map variables;
/**
- * Constructor
+ * Constructor.
*
* @param string
- * The string to interpolate into
+ * a <code>String</code> to interpolate into
* @param variables
- * The variables to substitute
+ * the variables to substitute
*/
public MapVariableInterpolator(final String string, final Map variables)
{
@@ -46,16 +47,17 @@
}
/**
- * Constructor
+ * Constructor.
*
* @param string
- * The string to interpolate into
+ * a <code>String</code> to interpolate into
* @param variables
- * The variables to substitute
+ * the variables to substitute
* @param exceptionOnNullVarValue
- * if true an {@link IllegalStateException} will be thrown if a
- * {@link #getValue(String)} returns null, otherwise the ${varname} string will be
- * left in the <code>string</code> so multiple interpolators can be chained
+ * if <code>true</code> an {@link IllegalStateException} will be thrown if
+ * {@link #getValue(String)} returns <code>null</code>, otherwise the
+ * <code>${varname}</code> string will be left in the <code>String</code> so that
+ * multiple interpolators can be chained
*/
public MapVariableInterpolator(String string, final Map variables,
boolean exceptionOnNullVarValue)
@@ -65,10 +67,10 @@
}
/**
- * Accessor to set variables
+ * Sets the <code>Map</code> of variables.
*
* @param variables
- * New value
+ * the <code>Map</code> of variables
*/
public final void setVariables(final Map variables)
{
@@ -76,11 +78,11 @@
}
/**
- * Gets a value for a variable name during interpolation
+ * Retrieves a value for a variable name during interpolation.
*
* @param variableName
- * The variable
- * @return The value
+ * the variable name
+ * @return the value
*/
protected final String getValue(final String variableName)
{
@@ -88,11 +90,13 @@
}
/**
- * Interpolate the string with the arguments defined in a map
+ * Interpolates a <code>String</code> with the arguments defined in the given <code>Map</code>.
*
* @param string
+ * a <code>String</code> to interpolate into
* @param variables
- * @return interpolated string
+ * the variables to substitute
+ * @return the interpolated <code>String</code>
*/
public static String interpolate(String string, Map variables)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolator.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolator.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolator.java Wed Oct 24 02:03:44 2007
@@ -19,16 +19,19 @@
import org.apache.wicket.util.lang.PropertyResolver;
/**
- * Interpolates values into strings that are produced by interpreting property expressions against a
- * beans model.
+ * Interpolates values into <code>String</code>s that are produced by interpreting property
+ * expressions against a beans model.
* <p>
- * The interpolate(String string, Object model) method takes a string such as "My name is ${name}"
- * and a beans model such as a Person, and reflects on the object using any property expressions
- * found inside ${} markers in the string. In this case, if the Person model had a getName() method,
- * the results of calling that method would be substituted for ${name}. If getName() returned
- * Jonathan, interpolate() would then return "My name is Jonathan".
+ * The <code>interpolate(String string, Object model)</code> method takes a string such as "<code>My name is ${name}</code>"
+ * and a beans model such as a <code>Person</code>, and reflects on the object using any property
+ * expressions found inside <code>${}</code> markers in the <code>String</code>. In this case,
+ * if the <code>Person</code> model has a <code>getName()</code> method. The results of calling
+ * that method would be substituted for <code>${name}</code>. If <code>getName()</code>
+ * returned <code>"Jonathan"</code>, then <code>interpolate()</code> would return
+ * <code>"My name is Jonathan"</code>.
*
* @author Jonathan Locke
+ * @since 1.2.6
*/
public final class PropertyVariableInterpolator extends VariableInterpolator
{
@@ -36,12 +39,12 @@
private final Object model;
/**
- * Private constructor to force use of static interpolate method
+ * Private constructor to force use of static interpolate method.
*
* @param string
- * The string to interpolate into
+ * a <code>String</code> to interpolate into
* @param model
- * The model to apply property expressions to
+ * the model to apply property expressions to
*/
private PropertyVariableInterpolator(final String string, final Object model)
{
@@ -50,13 +53,13 @@
}
/**
- * Interpolates string, substituting values for property expressions
+ * Interpolates the given <code>String</code>, substituting values for property expressions.
*
* @param string
- * String containing property expressions like ${xyz}
+ * a <code>String</code> containing property expressions like <code>${xyz}</code>
* @param object
- * The object to reflect on
- * @return The interpolated string
+ * the <code>Object</code> to reflect on
+ * @return the interpolated <code>String</code>
*/
public static String interpolate(final String string, final Object object)
{
@@ -72,11 +75,11 @@
}
/**
- * Gets a value for a variable name during interpolation
+ * Retrieves a value for a variable name during interpolation.
*
* @param variableName
- * The variable
- * @return The value
+ * the variable name
+ * @return the value
*/
protected String getValue(final String variableName)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/SystemVariableInterpolator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/SystemVariableInterpolator.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/SystemVariableInterpolator.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/SystemVariableInterpolator.java Wed Oct 24 02:03:44 2007
@@ -20,14 +20,15 @@
* Convenient way of interpolating system properties.
*
* @author Jonathan Locke
+ * @since 1.2.6
*/
public final class SystemVariableInterpolator extends MapVariableInterpolator
{
/**
- * Constructor
+ * Constructor.
*
* @param string
- * The string to interpolate with system properties
+ * a <code>String</code> to interpolate with system properties
*/
public SystemVariableInterpolator(final String string)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/VariableInterpolator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/VariableInterpolator.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/VariableInterpolator.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/VariableInterpolator.java Wed Oct 24 02:03:44 2007
@@ -17,29 +17,32 @@
package org.apache.wicket.util.string.interpolator;
/**
- * Base class for variable interpolators. An interpolator substitutes values into a string. So a
- * variable interpolator substitutes the values of one or more variables into a string.
+ * Base class for variable interpolators. An interpolator substitutes values into a
+ * <code>String</code>. So, a variable interpolator substitutes the values of one or more
+ * variables into a <code>String</code>.
* <p>
- * The String to interpolate (substitute in) is passed to the VariableInterpolator constructor.
- * Variables are denoted in this string by the syntax ${variableName}. A subclass provides an
- * implementation for the abstract method getValue(String variableName). The toString() method then
- * performs an interpolation by replacing each variable of the form ${variableName} with the value
- * returned by getValue("variableName").
+ * The <code>String</code> to interpolate (substitute into) is passed to the
+ * <code>VariableInterpolator</code>'s constructor. Variables are denoted in this string by the
+ * syntax <code>${variableName}</code>. A subclass provides an implementation for the abstract
+ * method <code>getValue(String variableName)</code>. The <code>toString()</code> method then
+ * performs an interpolation by replacing each variable of the form <code>${variableName}</code>
+ * with the value returned by <code>getValue("variableName")</code>.
*
* @author Jonathan Locke
+ * @since 1.2.6
*/
public abstract class VariableInterpolator
{
- /** The string to interpolate within */
+ /** The <code>String</code> to interpolate into */
protected final String string;
private boolean exceptionOnNullVarValue = false;
/**
- * Constructor
+ * Constructor.
*
* @param string
- * String to interpolate with variable values
+ * a <code>String</code> to interpolate with variable values
*/
public VariableInterpolator(final String string)
{
@@ -47,14 +50,15 @@
}
/**
- * Constructor
+ * Constructor.
*
* @param string
- * String to interpolate with variable values
+ * a <code>String</code> to interpolate with variable values
* @param exceptionOnNullVarValue
- * if true an {@link IllegalStateException} will be thrown if a
- * {@link #getValue(String)} returns null, otherwise the ${varname} string will be
- * left in the <code>string</code> so multiple interpolators can be chained
+ * if <code>true</code> an {@link IllegalStateException} will be thrown if
+ * {@link #getValue(String)} returns <code>null</code>, otherwise the
+ * <code>${varname}</code> string will be left in the <code>String</code> so that
+ * multiple interpolators can be chained
*/
public VariableInterpolator(final String string, boolean exceptionOnNullVarValue)
{
@@ -63,11 +67,11 @@
}
/**
- * Gets a value for a variable name during interpolation
+ * Retrieves a value for a variable name during interpolation.
*
* @param variableName
- * The variable
- * @return The value
+ * a variable name
+ * @return the value
*/
protected abstract String getValue(String variableName);
@@ -82,9 +86,9 @@
}
/**
- * Interpolate using variables
+ * Interpolates using variables.
*
- * @return The interpolated string
+ * @return the interpolated <code>String</code>
*/
public String toString()
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/package.html
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/package.html?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/package.html (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/string/interpolator/package.html Wed Oct 24 02:03:44 2007
@@ -16,12 +16,14 @@
-->
<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 3.2 Final//NL">
<html>
-<head>
-<title>wicket.util.string.interpolator package</title>
-</head>
-<body>
-<p>
-Support for String-variable interpolation.
-</p>
-</body>
+ <head>
+ <title>
+ wicket.util.string.interpolator package
+ </title>
+ </head>
+ <body>
+ <p>
+ Support for String-variable interpolation.
+ </p>
+ </body>
</html>
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/CssTemplate.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/CssTemplate.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/CssTemplate.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/CssTemplate.java Wed Oct 24 02:03:44 2007
@@ -22,19 +22,20 @@
/**
- * Decorates the template with CSS tags.
+ * Decorates a <code>TextTemplate</code> with CSS tags.
*
* @author Eelco Hillenius
+ * @since 1.2.6
*/
public final class CssTemplate extends TextTemplateDecorator
{
private static final long serialVersionUID = 1L;
/**
- * Construct.
+ * Constructor.
*
* @param textTemplate
- * The template to decorate
+ * a <code>TextTemplate</code> to decorate
*/
public CssTemplate(TextTemplate textTemplate)
{
@@ -57,13 +58,13 @@
return CssUtils.INLINE_CLOSE_TAG;
}
-
/**
- * This class decorates another text template class and so does not allow interpolation.
+ * This class decorates another <code>TextTemplate</code> class and so does not allow
+ * interpolation.
*
* @param variables
- * Ignored
- * @return This for chaining
+ * ignored
+ * @return <code>this</code>, for chaining purposes
*/
public TextTemplate interpolate(final Map variables)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/JavaScriptTemplate.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/JavaScriptTemplate.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/JavaScriptTemplate.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/JavaScriptTemplate.java Wed Oct 24 02:03:44 2007
@@ -22,19 +22,20 @@
/**
- * Decorates the template with javascript tags.
+ * Decorates a <code>TextTemplate</code> with JavaScript tags.
*
* @author Eelco Hillenius
+ * @since 1.2.6
*/
public final class JavaScriptTemplate extends TextTemplateDecorator
{
private static final long serialVersionUID = 1L;
/**
- * Construct.
+ * Constructor.
*
* @param textTemplate
- * The template to decorate
+ * a <code>TextTemplate</code> to decorate
*/
public JavaScriptTemplate(TextTemplate textTemplate)
{
@@ -58,11 +59,12 @@
}
/**
- * This class decorates another text template class and so does not allow interpolation.
+ * This class decorates another <code>TextTemplate</code> class and so does not allow
+ * interpolation.
*
* @param variables
- * Ignored
- * @return This for chaining
+ * ignored
+ * @return <code>this</code>, for chaining purposes
*/
public TextTemplate interpolate(final Map variables)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/PackagedTextTemplate.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/PackagedTextTemplate.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/PackagedTextTemplate.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/PackagedTextTemplate.java Wed Oct 24 02:03:44 2007
@@ -36,9 +36,10 @@
/**
- * A string resource that can be appended to.
+ * A <code>String</code> resource that can be appended to.
*
* @author Eelco Hillenius
+ * @since 1.2.6
*/
// TODO cache templates application scoped with a watch
public class PackagedTextTemplate extends TextTemplate
@@ -60,7 +61,7 @@
CachedTextTemplateKey(Class clazz, String path)
{
- this.className = clazz.getName();
+ className = clazz.getName();
}
}
@@ -103,10 +104,10 @@
* Constructor.
*
* @param clazz
- * The class to be used for retrieving the classloader for loading the packaged
- * template.
+ * the <code>Class</code> to be used for retrieving the classloader for loading the
+ * <code>PackagedTextTemplate</code>
* @param fileName
- * The name of the file, relative to the clazz position
+ * the name of the file, relative to the <code>clazz</code> position
*/
public PackagedTextTemplate(final Class clazz, final String fileName)
{
@@ -117,12 +118,12 @@
* Constructor.
*
* @param clazz
- * The class to be used for retrieving the classloader for loading the packaged
- * template.
+ * the <code>Class</code> to be used for retrieving the classloader for loading the
+ * <code>PackagedTextTemplate</code>
* @param fileName
- * the name of the file, relative to the clazz position
+ * the name of the file, relative to the <code>clazz</code> position
* @param contentType
- * The mime type of this resource, such as "image/jpeg" or "text/html"
+ * the mime type of this resource, such as "<code>image/jpeg</code>" or "<code>text/html</code>"
*/
public PackagedTextTemplate(final Class clazz, final String fileName, final String contentType)
{
@@ -133,14 +134,14 @@
* Constructor.
*
* @param clazz
- * The class to be used for retrieving the classloader for loading the packaged
- * template.
+ * the <code>Class</code> to be used for retrieving the classloader for loading the
+ * <code>PackagedTextTemplate</code>
* @param fileName
- * the name of the file, relative to the clazz position
+ * the name of the file, relative to the <code>clazz</code> position
* @param contentType
- * The mime type of this resource, such as "image/jpeg" or "text/html"
+ * the mime type of this resource, such as "<code>image/jpeg</code>" or "<code>text/html</code>"
* @param encoding
- * The file's encoding, e.g. 'UTF-8'
+ * the file's encoding, for example, "<code>UTF-8</code>"
*/
public PackagedTextTemplate(final Class clazz, final String fileName, final String contentType,
final String encoding)
@@ -210,19 +211,20 @@
}
/**
- * Interpolate the map of variables with the content and replace the content with the result.
- * Variables are denoted in this string by the syntax ${variableName}. The contents will be
- * altered by replacing each variable of the form ${variableName} with the value returned by
- * variables.getValue("variableName").
+ * Interpolates a <code>Map</code> of variables with the content and replaces the content with
+ * the result. Variables are denoted in the <code>String</code> by the
+ * <code>syntax ${variableName}</code>. The contents will be altered by replacing each
+ * variable of the form <code>${variableName}</code> with the value returned by
+ * <code>variables.getValue("variableName")</code>.
* <p>
- * WARNING there is no going back to the original contents after the interpolation is done. if
- * you need to do different interpolations on the same original contents, use method
+ * WARNING: there is no going back to the original contents after the interpolation is done. If
+ * you need to do different interpolations on the same original contents, use the method
* {@link #asString(Map)} instead.
* </p>
*
* @param variables
- * The variables to interpolate
- * @return This for chaining
+ * a <code>Map</code> of variables to interpolate
+ * @return this for chaining
*/
public final TextTemplate interpolate(Map variables)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplate.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplate.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplate.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplate.java Wed Oct 24 02:03:44 2007
@@ -27,23 +27,24 @@
*
* @author Eelco Hillenius
* @author Jonathan Locke
+ * @since 1.2.6
*/
public abstract class TextTemplate extends AbstractStringResourceStream
{
private static final long serialVersionUID = 1L;
/**
- * Construct.
+ * Constructor.
*/
public TextTemplate()
{
}
/**
- * Construct.
+ * Constructor.
*
* @param contentType
- * The mime type of this resource, such as "image/jpeg" or "text/html".
+ * the mime type of this resource, such as "<code>image/jpeg</code>" or "<code>text/html</code>"
*/
public TextTemplate(String contentType)
{
@@ -51,13 +52,14 @@
}
/**
- * Interpolate the map of variables with the content and return the resulting string without
- * replacing the content. Variables are denoted in this string by the syntax ${variableName}.
- * The contents will be altered by replacing each variable of the form ${variableName} with the
- * value returned by variables.getValue("variableName").
+ * Interpolates the <code>Map</code> of variables with the content and returns the resulting
+ * <code>String</code> without replacing the content. Variables are denoted in this string by
+ * the syntax <code>${variableName}</code>. The contents will be altered by replacing each
+ * variable of the form <code>${variableName}</code> with the value returned by
+ * <code>variables.getValue("variableName")</code>.
*
* @param variables
- * The variables to interpolate
+ * the variables to interpolate
* @return the result of the interpolation
*/
public String asString(Map variables)
@@ -78,18 +80,18 @@
}
/**
- * Gets the string resource.
+ * Retrieves the <code>String</code> resource.
*
- * @return The string resource
+ * @return the <code>String</code> resource
*/
public abstract String getString();
/**
- * Interpolates values into this text template.
+ * Interpolates values into this <code>TextTemplate</code>.
*
* @param variables
- * Variables to interpolate into this text template
- * @return This for chaining
+ * variables to interpolate into this <code>TextTemplate</code>
+ * @return <code>this</code>, for chaining purposes
*/
public abstract TextTemplate interpolate(Map variables);
}
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java Wed Oct 24 02:03:44 2007
@@ -28,26 +28,25 @@
/**
* Provides the ability to 'decorate' the actual template contents before it is contributed to the
- * header. E.g. to embed in a javascript tag pair.
+ * header. For example, to embed it inside a JavaScript tag pair.
*
* @author Eelco Hillenius
+ * @since 1.2.6
*/
public abstract class TextTemplateDecorator extends TextTemplate
{
- /**
- *
- */
private static final long serialVersionUID = 1L;
+
/**
- * The decorated template.
+ * The decorated <code>TextTemplate</code>.
*/
protected final TextTemplate decorated;
/**
- * Construct.
+ * Constructor.
*
* @param textTemplate
- * The text template to decorate
+ * a <code>TextTemplate</code> to decorate
*/
public TextTemplateDecorator(TextTemplate textTemplate)
{
@@ -56,12 +55,14 @@
throw new IllegalArgumentException("argument textTemplate must be not null");
}
- this.decorated = textTemplate;
+ decorated = textTemplate;
}
/**
+ * Returns the decorated contents as a <code>String</code>.
+ *
* @return the contents decorated with {@link #getBeforeTemplateContents()} and
- * {@link #getAfterTemplateContents()}.
+ * {@link #getAfterTemplateContents()}
* @see org.apache.wicket.util.template.TextTemplate#asString()
*/
public String asString()
@@ -74,6 +75,8 @@
}
/**
+ * Returns the decorated contents as a <code>String</code>.
+ *
* @return the contents decorated with {@link #getBeforeTemplateContents()} and
* {@link #getAfterTemplateContents()}.
* @see org.apache.wicket.util.template.TextTemplate#asString(java.util.Map)
@@ -88,24 +91,24 @@
}
/**
- * Gets the string to put before the actual template contents, e.g.
+ * Retrieves the <code>String</code> to put before the actual template contents, for example:
*
* <pre>
* <script type="text/javascript">
* </pre>
*
- * @return The string to put before the actual template contents
+ * @return the <code>String</code> to put before the actual template contents
*/
public abstract String getBeforeTemplateContents();
/**
- * Gets the string to put after the actual template contents, e.g.
+ * Retrieves the <code>String</code> to put after the actual template contents, for example:
*
* <pre>
* </script>
* </pre>
*
- * @return The string to put after the actual template contents
+ * @return the <code>String</code> to put after the actual template contents
*/
public abstract String getAfterTemplateContents();
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateHeaderContributor.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateHeaderContributor.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateHeaderContributor.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateHeaderContributor.java Wed Oct 24 02:03:44 2007
@@ -25,17 +25,17 @@
/**
* A header contributor that will contribute the contents of the given template interpolated with
- * the provided map of variables.
+ * the provided <code>Map</code> of variables.
*
* @author Eelco Hillenius
+ * @since 1.2.6
*/
public class TextTemplateHeaderContributor extends StringHeaderContributor
{
private static final long serialVersionUID = 1L;
/**
- * This model holds the template and returns the interpolation of the template with of any of
- * the
+ * This model holds the template and returns the interpolation of the template.
*/
private static final class TemplateModel extends LoadableDetachableModel
{
@@ -47,19 +47,19 @@
private final TextTemplate template;
/**
- * The model that holds any variables for interpolation. It should return a {@link Map} or
- * null.
+ * The <code>IModel</code> that holds any variables for interpolation. It should return a
+ * {@link Map} or <code>null</code>.
*/
private final IModel variablesModel;
/**
- * Construct.
+ * Constructor.
*
* @param template
- * the template to work on
+ * the <code>TextTemplate</code> to work on
* @param variablesModel
- * The model that holds any variables for interpolation. It should return a
- * {@link Map} or null.
+ * the <code>IModel</code> that holds any variables for interpolation. It
+ * should return a {@link Map} or <code>null</code>.
*/
protected TemplateModel(TextTemplate template, IModel variablesModel)
{
@@ -99,15 +99,15 @@
}
/**
- * Gets a css header contributor based on the given text template. The template will be
- * interpolated with the given variables. The content will be written as the body of a script
- * tag pair.
+ * Retrieves a CSS header contributor based on the given <code>TextTemplate</code>. The
+ * template will be interpolated with the given variables. The content will be written as the
+ * body of a script/tag pair.
*
* @param template
- * The text template that is the base for the contribution
+ * the <code>TextTemplate</code> that is the base for the contribution
* @param variablesModel
- * The variables to interpolate
- * @return The header contributor instance
+ * the variables to interpolate
+ * @return the <code>TextTemplateHeaderContributor</code> instance
*/
public static TextTemplateHeaderContributor forCss(TextTemplate template, IModel variablesModel)
{
@@ -115,18 +115,19 @@
}
/**
- * Gets a css header contributor that will load the template from the given file name relative
- * to (/in the same package as) the provided clazz argument. The template will be interpolated
- * with the given variables. The content will be written as the body of a script tag pair.
+ * Retrieves a CSS header contributor that will load the template from the given file name
+ * relative to (or in the same package as) the provided <code>clazz</code> argument. The
+ * template will be interpolated with the given variables. The content will be written as the
+ * body of a script/tag pair.
*
* @param clazz
- * The class to be used for retrieving the classloader for loading the packaged
- * template.
+ * the <code>Class</code> to be used for retrieving the classloader for loading the
+ * packaged template.
* @param fileName
- * The name of the file, relative to the clazz position
+ * the name of the file, relative to the <code>clazz</code> position
* @param variablesModel
- * The variables to interpolate
- * @return The header contributor instance
+ * the variables to interpolate
+ * @return the <code>TextTemplateHeaderContributor</code> instance
*/
public static TextTemplateHeaderContributor forCss(final Class clazz, final String fileName,
IModel variablesModel)
@@ -135,15 +136,15 @@
}
/**
- * Gets a javascript header contributor based on the given text template. The template will be
- * interpolated with the given variables. The content will be written as the body of a script
- * tag pair.
+ * Retrieves a JavaScript header contributor based on the given <code>TextTemplate</code>.
+ * The template will be interpolated with the given variables. The content will be written as
+ * the body of a script/tag pair.
*
* @param template
- * The text template that is the base for the contribution
+ * the <code>TextTemplate</code> that is the base for the contribution
* @param variablesModel
- * The variables to interpolate
- * @return The header contributor instance
+ * the variables to interpolate
+ * @return the <code>TextTemplateHeaderContributor</code> instance
*/
public static TextTemplateHeaderContributor forJavaScript(TextTemplate template,
IModel variablesModel)
@@ -152,19 +153,19 @@
}
/**
- * Gets a javascript header contributor that will load the template from the given file name
- * relative to (/in the same package as) the provided clazz argument. The template will be
- * interpolated with the given variables. The content will be written as the body of a script
- * tag pair.
+ * Retrieves a JavaScript header contributor that will load the template from the given file
+ * name relative to (or in the same package as) the provided <code>clazz</code> argument. The
+ * template will be interpolated with the given variables. The content will be written as the
+ * body of a script/tag pair.
*
* @param clazz
- * The class to be used for retrieving the classloader for loading the packaged
- * template.
+ * the <code>Class</code> to be used for retrieving the classloader for loading the
+ * packaged template.
* @param fileName
- * The name of the file, relative to the clazz position
+ * the name of the file, relative to the <code>clazz</code> position
* @param variablesModel
- * The variables to interpolate
- * @return The header contributor instance
+ * the variables to interpolate
+ * @return the <code>TextTemplateHeaderContributor</code> instance
*/
public static TextTemplateHeaderContributor forJavaScript(final Class clazz,
final String fileName, IModel variablesModel)
@@ -173,12 +174,12 @@
}
/**
- * Construct.
+ * Constructor.
*
* @param template
- * The template with the contribution
+ * the <code>TextTemplate</code> with the contribution
* @param variablesModel
- * Optional model for variable substitution
+ * optional <code>IModel</code> for variable substitution
*/
protected TextTemplateHeaderContributor(TextTemplate template, IModel variablesModel)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateLink.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateLink.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateLink.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateLink.java Wed Oct 24 02:03:44 2007
@@ -22,24 +22,25 @@
/**
- * Links to shared, interpolated text template resources created by a factory. This is useful for
- * creating dynamic JNLP descriptors, among other things.
+ * Links to shared, interpolated <code>TextTemplate</code> resources created by a factory. This is
+ * useful for creating dynamic JNLP descriptors, among other things.
*
* @author Jonathan Locke
+ * @since 1.2.6
*/
public class TextTemplateLink extends ResourceLink
{
private static final long serialVersionUID = 1L;
/**
- * Construct.
+ * Constructor.
*
* @param id
- * Component id
+ * the <code>Component</code> id
* @param factory
- * The factory to create resources with
+ * the factory to create resources with
* @param variables
- * Variables to interpolate into the template held by the shared resource factory
+ * variables to interpolate into the template held by the shared resource factory
*/
public TextTemplateLink(final String id, final TextTemplateSharedResourceFactory factory,
final Map variables)
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/TextTemplateSharedResourceFactory.java Wed Oct 24 02:03:44 2007
@@ -29,24 +29,26 @@
/**
- * A resource (reference) factory that takes a TextTemplate and generates shared resources for
- * various interpolations of that template.
+ * A resource (reference) factory that takes a <code>TextTemplate</code> and generates shared
+ * resources for various interpolations of that template.
* <p>
* A scope for adding shared resources allows you to limit the namespace impact of the shared
- * resources created. If you omit the scope, the application-wide scope Application.class will be
- * used by default.
+ * resources created. If you omit the scope, the application-wide scope
+ * <code>Application.class</code> will be used by default.
* <p>
- * You may use resources created by this factory directly by calling resourceReference(Map) to get a
- * resource reference to the given shared resource interpolation represented by the variables in the
- * map. Or, for convenience, you can use TextTemplateLink to link to resources created by this
- * factory.
+ * You may use resources created by this factory directly by calling
+ * <code>resourceReference(Map)</code> to get a resource reference to the given shared resource
+ * interpolation represented by the variables in the <code>Map</code>. Or, for convenience, you
+ * can use <code>TextTemplateLink</code> to link to resources created by this factory.
* <p>
- * In many cases, it will be useful to extend this class and override sharedResourceName(Map) to
- * provide a unique name for resources created by the factory using map values. If you don't provide
- * an override, every value in the map will be used to produce the unique name, which may create
- * either longer names or more unique shared resources than you really wanted.
+ * In many cases, it will be useful to extend this class and override
+ * <code>sharedResourceName(Map)</code> in order to provide a unique name for resources created by
+ * the factory using map values. If you don't provide an override, every value in the map will be
+ * used to produce the unique name, which may create either longer names or more unique shared
+ * resources than you really wanted.
*
* @author Jonathan Locke
+ * @since 1.2.6
*/
// TODO Should weak-ref regenerable resources like this in SharedResources!
public class TextTemplateSharedResourceFactory
@@ -54,20 +56,20 @@
private static final long serialVersionUID = 1L;
/**
- * Shared resource scope
+ * Shared resource scope.
*/
private final WeakReference/* <Class> */scopeRef;
/**
- * Template to use to create resources
+ * <code>TextTemplate</code> to use to create resources.
*/
private final TextTemplate template;
/**
- * Creates shared text template resources.
+ * Creates shared <code>TextTemplate</code> resources.
*
* @param template
- * The template to interpolate into
+ * the <code>TextTemplate</code> to interpolate into
*/
public TextTemplateSharedResourceFactory(final TextTemplate template)
{
@@ -75,24 +77,27 @@
}
/**
- * Creates shared text template resources with the given scope.
+ * Creates shared <code>TextTemplate</code> resources with the given scope.
*
* @param template
- * The template to interpolate into
+ * the <code>TextTemplate</code> to interpolate into
* @param scope
- * The scope in shared resources to add resources at
+ * the scope in shared resources at which to add resources
*/
public TextTemplateSharedResourceFactory(final TextTemplate template, final Class scope)
{
this.template = template;
- this.scopeRef = new WeakReference(scope);
+ scopeRef = new WeakReference(scope);
}
/**
+ * Interpolates the given variables <code>Map</code> and returns a
+ * <code>ResourceReference</code>.
+ *
* @param variables
- * The variables to interpolate into the template
- * @return A resource reference to the template encoded as a resource with the given variables
- * interpolated.
+ * the variables to interpolate into the template
+ * @return a <code>ResourceReference</code> to the template encoded as a resource with the
+ * given variables interpolated
*/
public ResourceReference resourceReference(final Map variables)
{
@@ -133,9 +138,11 @@
}
/**
+ * Returns a unique name for the variables to use as a resource key.
+ *
* @param variables
- * Variables that parameterize the linked-to resource
- * @return A unique name for the variables to use as a resource key
+ * variables that parameterize the linked-to resource
+ * @return a unique name for the variables to use as a resource key
*/
protected String sharedResourceName(final Map variables)
{
@@ -156,8 +163,8 @@
* Simple encoder for key values. Letters and digits are unchanged. All others are encoded as %<hexcode>.
*
* @param value
- * The value
- * @return The encoded value
+ * a value
+ * @return the encoded value
*/
private String encodeValue(final String value)
{
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/package.html
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/package.html?rev=587825&r1=587824&r2=587825&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/package.html (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/template/package.html Wed Oct 24 02:03:44 2007
@@ -16,13 +16,15 @@
-->
<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 3.2 Final//NL">
<html>
-<head>
-<title>wicket.extensions.util.resource package</title>
-</head>
-<body>
-<p>
-Resource extensions that makes working with header contributions
-easier and better maintainable.
-</p>
-</body>
+ <head>
+ <title>
+ wicket.extensions.util.resource package
+ </title>
+ </head>
+ <body>
+ <p>
+ Resource extensions that make working with header contributions
+ easier and more maintainable.
+ </p>
+ </body>
</html>