Class 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 TextTemplate decorated
      The decorated TextTemplate.
      • Fields inherited from class org.apache.wicket.util.resource.AbstractStringResourceStream

        DEFAULT_CONTENT_TYPE
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String asString()
      Returns the decorated contents as a String.
      java.lang.String asString​(java.util.Map<java.lang.String,​?> variables)
      Returns the decorated contents as a String.
      void close()  
      boolean equals​(java.lang.Object obj)  
      abstract java.lang.String getAfterTemplateContents()
      Retrieves the String to put after the actual template contents, for example:
      abstract java.lang.String getBeforeTemplateContents()
      Retrieves the String to put before the actual template contents, for example:
      java.lang.String getContentType()  
      java.io.InputStream getInputStream()  
      java.util.Locale getLocale()  
      java.lang.String getString()
      Retrieves the String resource.
      int hashCode()  
      org.apache.wicket.util.time.Time lastModifiedTime()  
      void setCharset​(java.nio.charset.Charset charset)  
      void setLastModified​(org.apache.wicket.util.time.Time lastModified)  
      void setLocale​(java.util.Locale locale)  
      java.lang.String toString()  
      • 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 Detail

      • decorated

        protected final TextTemplate decorated
        The decorated TextTemplate.
    • Constructor Detail

      • TextTemplateDecorator

        public TextTemplateDecorator​(TextTemplate textTemplate)
        Constructor.
        Parameters:
        textTemplate - a TextTemplate to decorate
    • Method Detail

      • getBeforeTemplateContents

        public abstract java.lang.String getBeforeTemplateContents()
        Retrieves the String 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 java.lang.String getAfterTemplateContents()
        Retrieves the String 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 java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.apache.wicket.util.resource.IResourceStream
        Overrides:
        close in class org.apache.wicket.util.resource.AbstractStringResourceStream
        Throws:
        java.io.IOException
        See Also:
        AbstractStringResourceStream.close()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • getContentType

        public java.lang.String getContentType()
        Specified by:
        getContentType in interface org.apache.wicket.util.resource.IResourceStream
        Overrides:
        getContentType in class org.apache.wicket.util.resource.AbstractStringResourceStream
        See Also:
        AbstractStringResourceStream.getContentType()
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws org.apache.wicket.util.resource.ResourceStreamNotFoundException
        Specified by:
        getInputStream in interface org.apache.wicket.util.resource.IResourceStream
        Overrides:
        getInputStream in class org.apache.wicket.util.resource.AbstractStringResourceStream
        Throws:
        org.apache.wicket.util.resource.ResourceStreamNotFoundException
        See Also:
        AbstractStringResourceStream.getInputStream()
      • getLocale

        public java.util.Locale getLocale()
        Specified by:
        getLocale in interface org.apache.wicket.util.resource.IResourceStream
        Overrides:
        getLocale in class org.apache.wicket.util.resource.AbstractResourceStream
        See Also:
        AbstractResourceStream.getLocale()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • lastModifiedTime

        public org.apache.wicket.util.time.Time lastModifiedTime()
        Specified by:
        lastModifiedTime in interface org.apache.wicket.util.watch.IModifiable
        Overrides:
        lastModifiedTime in class org.apache.wicket.util.resource.AbstractStringResourceStream
        See Also:
        AbstractStringResourceStream.lastModifiedTime()
      • setCharset

        public void setCharset​(java.nio.charset.Charset charset)
        Specified by:
        setCharset in interface org.apache.wicket.util.resource.IStringResourceStream
        Overrides:
        setCharset in class org.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:
        setLastModified in class org.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:
        setLocale in interface org.apache.wicket.util.resource.IResourceStream
        Overrides:
        setLocale in class org.apache.wicket.util.resource.AbstractResourceStream
        See Also:
        AbstractResourceStream.setLocale(java.util.Locale)
      • toString

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