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
,IClusterable
,IResourceStream
,IStringResourceStream
,IModifiable
- Direct Known Subclasses:
CssTemplate
,JavaScriptTemplate
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:
-
Field Summary
FieldsFields inherited from class org.apache.wicket.util.resource.AbstractStringResourceStream
DEFAULT_CONTENT_TYPE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasString()
Returns the decorated contents as aString
.Returns the decorated contents as aString
.void
close()
Closes the resource.boolean
abstract String
Retrieves theString
to put after the actual template contents, for example:abstract String
Retrieves theString
to put before the actual template contents, for example:Gets the mime type of this resourceGets the resource stream.Retrieves theString
resource.int
hashCode()
Gets the last time this modifiable thing changed.void
setCharset
(Charset charset) Sets the character set used for reading this resource.void
setLastModified
(Instant lastModified) void
This method shouldn't be used from the outside.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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.wicket.util.resource.IResourceStream
getStyle, getVariation, setStyle, setVariation
-
Field Details
-
decorated
The decoratedTextTemplate
.
-
-
Constructor Details
-
TextTemplateDecorator
Constructor.- Parameters:
textTemplate
- aTextTemplate
to decorate
-
-
Method Details
-
asString
Returns the decorated contents as aString
.- Specified by:
asString
in interfaceIStringResourceStream
- Overrides:
asString
in classTextTemplate
- Returns:
- the contents decorated with
getBeforeTemplateContents()
andgetAfterTemplateContents()
- See Also:
-
asString
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:
-
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
Retrieves theString
to put after the actual template contents, for example:</script>
- Returns:
- the
String
to put after the actual template contents
-
close
Description copied from interface:IResourceStream
Closes the resource. Normally, this includes closing any underlying input stream returned by getInputStream().- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceIResourceStream
- Overrides:
close
in classAbstractStringResourceStream
- Throws:
IOException
- See Also:
-
equals
-
getContentType
Description copied from interface:IResourceStream
Gets the mime type of this resource- Specified by:
getContentType
in interfaceIResourceStream
- Overrides:
getContentType
in classAbstractStringResourceStream
- Returns:
- The mime type of this resource, such as "image/jpeg" or "text/html". Return null to let ResourceStreamRequestHandler handle the Content-Type automatically
- See Also:
-
getInputStream
Description copied from interface:IResourceStream
Gets the resource stream. You should not directly close this stream. Instead call the close() method on IResourceStream.- Specified by:
getInputStream
in interfaceIResourceStream
- Overrides:
getInputStream
in classAbstractStringResourceStream
- Returns:
- Returns the inputStream.
- Throws:
ResourceStreamNotFoundException
- See Also:
-
getLocale
- Specified by:
getLocale
in interfaceIResourceStream
- Overrides:
getLocale
in classAbstractResourceStream
- Returns:
- The Locale where this stream did resolve to
-
hashCode
-
lastModifiedTime
Description copied from interface:IModifiable
Gets the last time this modifiable thing changed.- Specified by:
lastModifiedTime
in interfaceIModifiable
- Overrides:
lastModifiedTime
in classAbstractStringResourceStream
- Returns:
- the last modification
Time
ornull
if that information is not available - See Also:
-
setCharset
Description copied from class:AbstractStringResourceStream
Sets the character set used for reading this resource.- Specified by:
setCharset
in interfaceIStringResourceStream
- Overrides:
setCharset
in classAbstractStringResourceStream
- Parameters:
charset
- Charset for component
-
setLastModified
- Overrides:
setLastModified
in classAbstractStringResourceStream
- Parameters:
lastModified
- The lastModified to set.
-
setLocale
Description copied from interface:IResourceStream
This method shouldn't be used from the outside. It is used by the Loaders to set the resolved locale.- Specified by:
setLocale
in interfaceIResourceStream
- Overrides:
setLocale
in classAbstractResourceStream
- Parameters:
locale
- The Locale where this stream did resolve to.
-
getString
Description copied from class:TextTemplate
Retrieves theString
resource.- Specified by:
getString
in classTextTemplate
- Returns:
- the
String
resource
-
toString
-