wicket.extensions.util.resource
Class TextTemplateDecorator

java.lang.Object
  extended bywicket.util.resource.AbstractResourceStream
      extended bywicket.util.resource.AbstractStringResourceStream
          extended bywicket.extensions.util.resource.TextTemplate
              extended bywicket.extensions.util.resource.TextTemplateDecorator
All Implemented Interfaces:
wicket.util.watch.IModifiable, wicket.util.resource.IResourceStream, wicket.util.resource.IStringResourceStream, java.io.Serializable
Direct Known Subclasses:
CssTemplate, JavaScriptTemplate

public abstract class TextTemplateDecorator
extends TextTemplate

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.

Author:
Eelco Hillenius
See Also:
Serialized Form

Field Summary
protected  TextTemplate decorated
          The decorated template.
 
Constructor Summary
TextTemplateDecorator(TextTemplate textTemplate)
          Construct.
 
Method Summary
 java.lang.String asString()
           
 java.lang.String asString(java.util.Map variables)
          Interpolate the map of variables with the content and return the resulting string without replacing the content.
 void close()
           
 boolean equals(java.lang.Object obj)
           
abstract  java.lang.String getAfterTemplateContents()
          Gets the string to put after the actual template contents, e.g.
abstract  java.lang.String getBeforeTemplateContents()
          Gets the string to put before the actual template contents, e.g.
 java.lang.String getContentType()
           
 java.io.InputStream getInputStream()
           
 java.util.Locale getLocale()
           
 java.lang.String getString()
          Gets the string resource.
 int hashCode()
           
 wicket.util.time.Time lastModifiedTime()
           
 long length()
           
 void setCharset(java.nio.charset.Charset charset)
           
 void setLastModified(wicket.util.time.Time lastModified)
           
 void setLocale(java.util.Locale locale)
           
 java.lang.String toString()
           
 
Methods inherited from class wicket.extensions.util.resource.TextTemplate
interpolate
 
Methods inherited from class wicket.util.resource.AbstractResourceStream
getCharset
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

decorated

protected final TextTemplate decorated
The decorated template.

Constructor Detail

TextTemplateDecorator

public TextTemplateDecorator(TextTemplate textTemplate)
Construct.

Parameters:
textTemplate - The text template to decorate
Method Detail

asString

public java.lang.String asString()
Specified by:
asString in interface wicket.util.resource.IStringResourceStream
Overrides:
asString in class TextTemplate
Returns:
the contents decorated with getBeforeTemplateContents() and getAfterTemplateContents().
See Also:
TextTemplate.asString()

asString

public java.lang.String asString(java.util.Map variables)
Description copied from class: TextTemplate
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").

Overrides:
asString in class TextTemplate
Parameters:
variables - The variables to interpolate
Returns:
the contents decorated with getBeforeTemplateContents() and getAfterTemplateContents().
See Also:
TextTemplate.asString(java.util.Map)

getBeforeTemplateContents

public abstract java.lang.String getBeforeTemplateContents()
Gets the string to put before the actual template contents, e.g.
    <script type="text/javascript">
 

Returns:
The string to put before the actual template contents

getAfterTemplateContents

public abstract java.lang.String getAfterTemplateContents()
Gets the string to put after the actual template contents, e.g.
    </script>
 

Returns:
The string to put after the actual template contents

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
AbstractStringResourceStream.close()

equals

public boolean equals(java.lang.Object obj)
See Also:
Object.equals(java.lang.Object)

getContentType

public java.lang.String getContentType()
See Also:
AbstractStringResourceStream.getContentType()

getInputStream

public java.io.InputStream getInputStream()
                                   throws wicket.util.resource.ResourceStreamNotFoundException
Throws:
wicket.util.resource.ResourceStreamNotFoundException
See Also:
AbstractStringResourceStream.getInputStream()

getLocale

public java.util.Locale getLocale()
See Also:
AbstractResourceStream.getLocale()

hashCode

public int hashCode()
See Also:
Object.hashCode()

lastModifiedTime

public wicket.util.time.Time lastModifiedTime()
See Also:
AbstractStringResourceStream.lastModifiedTime()

length

public long length()
See Also:
IResourceStream.length()

setCharset

public void setCharset(java.nio.charset.Charset charset)
See Also:
AbstractResourceStream.setCharset(java.nio.charset.Charset)

setLastModified

public void setLastModified(wicket.util.time.Time lastModified)
See Also:
AbstractStringResourceStream.setLastModified(wicket.util.time.Time)

setLocale

public void setLocale(java.util.Locale locale)
See Also:
AbstractResourceStream.setLocale(java.util.Locale)

getString

public java.lang.String getString()
Description copied from class: TextTemplate
Gets the string resource.

Specified by:
getString in class TextTemplate
Returns:
The string resource
See Also:
TextTemplate.getString()

toString

public java.lang.String toString()
See Also:
Object.toString()


Copyright © 2004-2008 Wicket developers. All Rights Reserved.