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:
Closeable
,Serializable
,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 TextTemplate
decorated
The 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 String
asString()
Returns the decorated contents as aString
.String
asString(Map<String,?> variables)
Returns the decorated contents as aString
.void
close()
boolean
equals(Object obj)
abstract String
getAfterTemplateContents()
Retrieves theString
to put after the actual template contents, for example:abstract String
getBeforeTemplateContents()
Retrieves theString
to put before the actual template contents, for example:String
getContentType()
InputStream
getInputStream()
Locale
getLocale()
String
getString()
Retrieves theString
resource.int
hashCode()
Instant
lastModifiedTime()
void
setCharset(Charset charset)
void
setLastModified(Instant lastModified)
void
setLocale(Locale locale)
String
toString()
-
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
- aTextTemplate
to decorate
-
-
Method Detail
-
asString
public String asString()
Returns the decorated contents as aString
.- Specified by:
asString
in interfaceorg.apache.wicket.util.resource.IStringResourceStream
- Overrides:
asString
in classTextTemplate
- Returns:
- the contents decorated with
getBeforeTemplateContents()
andgetAfterTemplateContents()
- See Also:
TextTemplate.asString()
-
asString
public String asString(Map<String,?> variables)
Returns the decorated contents as aString
.- Overrides:
asString
in classTextTemplate
- Parameters:
variables
- the variables to interpolate- Returns:
- the contents decorated with
getBeforeTemplateContents()
andgetAfterTemplateContents()
. - See Also:
TextTemplate.asString(java.util.Map)
-
getBeforeTemplateContents
public abstract String getBeforeTemplateContents()
Retrieves theString
to put before the actual template contents, for example:<script type="text/javascript">
- Returns:
- the
String
to put before the actual template contents
-
getAfterTemplateContents
public abstract String getAfterTemplateContents()
Retrieves theString
to put after the actual template contents, for example:</script>
- Returns:
- the
String
to put after the actual template contents
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Overrides:
close
in classorg.apache.wicket.util.resource.AbstractStringResourceStream
- Throws:
IOException
- See Also:
AbstractStringResourceStream.close()
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classObject
- See Also:
Object.equals(java.lang.Object)
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Overrides:
getContentType
in classorg.apache.wicket.util.resource.AbstractStringResourceStream
- See Also:
AbstractStringResourceStream.getContentType()
-
getInputStream
public InputStream getInputStream() throws org.apache.wicket.util.resource.ResourceStreamNotFoundException
- Specified by:
getInputStream
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Overrides:
getInputStream
in classorg.apache.wicket.util.resource.AbstractStringResourceStream
- Throws:
org.apache.wicket.util.resource.ResourceStreamNotFoundException
- See Also:
AbstractStringResourceStream.getInputStream()
-
getLocale
public Locale getLocale()
- Specified by:
getLocale
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Overrides:
getLocale
in classorg.apache.wicket.util.resource.AbstractResourceStream
- See Also:
AbstractResourceStream.getLocale()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classObject
- See Also:
Object.hashCode()
-
lastModifiedTime
public Instant lastModifiedTime()
- Specified by:
lastModifiedTime
in interfaceorg.apache.wicket.util.watch.IModifiable
- Overrides:
lastModifiedTime
in classorg.apache.wicket.util.resource.AbstractStringResourceStream
- See Also:
AbstractStringResourceStream.lastModifiedTime()
-
setCharset
public void setCharset(Charset charset)
- Specified by:
setCharset
in interfaceorg.apache.wicket.util.resource.IStringResourceStream
- Overrides:
setCharset
in classorg.apache.wicket.util.resource.AbstractStringResourceStream
- See Also:
org.apache.wicket.util.resource.AbstractResourceStream#setCharset(java.nio.charset.Charset)
-
setLastModified
public void setLastModified(Instant lastModified)
- Overrides:
setLastModified
in classorg.apache.wicket.util.resource.AbstractStringResourceStream
- See Also:
org.apache.wicket.util.resource.AbstractStringResourceStream#setLastModified(org.apache.wicket.util.time.Time)
-
setLocale
public void setLocale(Locale locale)
- Specified by:
setLocale
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Overrides:
setLocale
in classorg.apache.wicket.util.resource.AbstractResourceStream
- See Also:
AbstractResourceStream.setLocale(java.util.Locale)
-
getString
public String getString()
Description copied from class:TextTemplate
Retrieves theString
resource.- Specified by:
getString
in classTextTemplate
- Returns:
- the
String
resource - See Also:
TextTemplate.getString()
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
-