Package org.apache.wicket.util.template
Class TextTemplateDecorator
- java.lang.Object
-
- org.apache.wicket.util.resource.AbstractResourceStream
-
- org.apache.wicket.util.resource.AbstractStringResourceStream
-
- org.apache.wicket.util.template.TextTemplate
-
- org.apache.wicket.util.template.TextTemplateDecorator
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Serializable,java.lang.AutoCloseable,org.apache.wicket.util.io.IClusterable,org.apache.wicket.util.resource.IResourceStream,org.apache.wicket.util.resource.IStringResourceStream,org.apache.wicket.util.watch.IModifiable
- 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. For example, to embed it inside a JavaScript tag pair.- Since:
- 1.2.6
- Author:
- Eelco Hillenius
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected TextTemplatedecoratedThe decoratedTextTemplate.
-
Constructor Summary
Constructors Constructor Description TextTemplateDecorator(TextTemplate textTemplate)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringasString()Returns the decorated contents as aString.java.lang.StringasString(java.util.Map<java.lang.String,?> variables)Returns the decorated contents as aString.voidclose()booleanequals(java.lang.Object obj)abstract java.lang.StringgetAfterTemplateContents()Retrieves theStringto put after the actual template contents, for example:abstract java.lang.StringgetBeforeTemplateContents()Retrieves theStringto put before the actual template contents, for example:java.lang.StringgetContentType()java.io.InputStreamgetInputStream()java.util.LocalegetLocale()java.lang.StringgetString()Retrieves theStringresource.inthashCode()org.apache.wicket.util.time.TimelastModifiedTime()voidsetCharset(java.nio.charset.Charset charset)voidsetLastModified(org.apache.wicket.util.time.Time lastModified)voidsetLocale(java.util.Locale locale)java.lang.StringtoString()-
Methods inherited from class org.apache.wicket.util.template.TextTemplate
interpolate
-
Methods inherited from class org.apache.wicket.util.resource.AbstractStringResourceStream
getCharset, length
-
Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream
getStyle, getVariation, setStyle, setVariation
-
-
-
-
Field Detail
-
decorated
protected final TextTemplate decorated
The decoratedTextTemplate.
-
-
Constructor Detail
-
TextTemplateDecorator
public TextTemplateDecorator(TextTemplate textTemplate)
Constructor.- Parameters:
textTemplate- aTextTemplateto decorate
-
-
Method Detail
-
asString
public java.lang.String asString()
Returns the decorated contents as aString.- Specified by:
asStringin interfaceorg.apache.wicket.util.resource.IStringResourceStream- Overrides:
asStringin classTextTemplate- Returns:
- the contents decorated with
getBeforeTemplateContents()andgetAfterTemplateContents() - See Also:
TextTemplate.asString()
-
asString
public java.lang.String asString(java.util.Map<java.lang.String,?> variables)
Returns the decorated contents as aString.- Overrides:
asStringin classTextTemplate- Parameters:
variables- the variables to interpolate- Returns:
- the contents decorated with
getBeforeTemplateContents()andgetAfterTemplateContents(). - See Also:
TextTemplate.asString(java.util.Map)
-
getBeforeTemplateContents
public abstract java.lang.String getBeforeTemplateContents()
Retrieves theStringto put before the actual template contents, for example:<script type="text/javascript">- Returns:
- the
Stringto put before the actual template contents
-
getAfterTemplateContents
public abstract java.lang.String getAfterTemplateContents()
Retrieves theStringto put after the actual template contents, for example:</script>- Returns:
- the
Stringto put after the actual template contents
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceorg.apache.wicket.util.resource.IResourceStream- Overrides:
closein classorg.apache.wicket.util.resource.AbstractStringResourceStream- Throws:
java.io.IOException- See Also:
AbstractStringResourceStream.close()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfaceorg.apache.wicket.util.resource.IResourceStream- Overrides:
getContentTypein classorg.apache.wicket.util.resource.AbstractStringResourceStream- See Also:
AbstractStringResourceStream.getContentType()
-
getInputStream
public java.io.InputStream getInputStream() throws org.apache.wicket.util.resource.ResourceStreamNotFoundException- Specified by:
getInputStreamin interfaceorg.apache.wicket.util.resource.IResourceStream- Overrides:
getInputStreamin classorg.apache.wicket.util.resource.AbstractStringResourceStream- Throws:
org.apache.wicket.util.resource.ResourceStreamNotFoundException- See Also:
AbstractStringResourceStream.getInputStream()
-
getLocale
public java.util.Locale getLocale()
- Specified by:
getLocalein interfaceorg.apache.wicket.util.resource.IResourceStream- Overrides:
getLocalein classorg.apache.wicket.util.resource.AbstractResourceStream- See Also:
AbstractResourceStream.getLocale()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
lastModifiedTime
public org.apache.wicket.util.time.Time lastModifiedTime()
- Specified by:
lastModifiedTimein interfaceorg.apache.wicket.util.watch.IModifiable- Overrides:
lastModifiedTimein classorg.apache.wicket.util.resource.AbstractStringResourceStream- See Also:
AbstractStringResourceStream.lastModifiedTime()
-
setCharset
public void setCharset(java.nio.charset.Charset charset)
- Specified by:
setCharsetin interfaceorg.apache.wicket.util.resource.IStringResourceStream- Overrides:
setCharsetin classorg.apache.wicket.util.resource.AbstractStringResourceStream- See Also:
org.apache.wicket.util.resource.AbstractResourceStream#setCharset(java.nio.charset.Charset)
-
setLastModified
public void setLastModified(org.apache.wicket.util.time.Time lastModified)
- Overrides:
setLastModifiedin classorg.apache.wicket.util.resource.AbstractStringResourceStream- See Also:
AbstractStringResourceStream.setLastModified(org.apache.wicket.util.time.Time)
-
setLocale
public void setLocale(java.util.Locale locale)
- Specified by:
setLocalein interfaceorg.apache.wicket.util.resource.IResourceStream- Overrides:
setLocalein classorg.apache.wicket.util.resource.AbstractResourceStream- See Also:
AbstractResourceStream.setLocale(java.util.Locale)
-
getString
public java.lang.String getString()
Description copied from class:TextTemplateRetrieves theStringresource.- Specified by:
getStringin classTextTemplate- Returns:
- the
Stringresource - See Also:
TextTemplate.getString()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-