org.loom.tags
Interface WriterWrapper<T extends java.io.Writer>

Type Parameters:
T - the Writer class being used, usually a JspWriter
All Known Implementing Classes:
AbstractWriterWrapper, JspWriterWrapper, PrintWriterWrapper, StringWriterWrapper

public interface WriterWrapper<T extends java.io.Writer>

Wrapper around the JspWriter class


Method Summary
 WriterWrapper<T> end(java.lang.String tag)
          Ends a HTML tag
 WriterWrapper<T> endJavascript()
          Write a javascript end tag
 void flush()
          Flush the written contents
 java.io.Writer getWriter()
           
 WriterWrapper<T> print(java.lang.CharSequence s)
          Print a String
 WriterWrapper<T> print(java.lang.Object o)
          Print ant Object, invoking its toString() method
 WriterWrapper<T> printAttribute(java.lang.String name, java.lang.Object value)
          Prints a tag attribute and value, if not null
 WriterWrapper<T> printHiddenField(java.lang.String name, java.lang.Object value)
          Prints a hidden form field if its value is not null
 WriterWrapper<T> start(java.lang.String tag, java.lang.Object... attributes)
          Start an HTML tag.
 WriterWrapper<T> startEnd(java.lang.String tag, java.lang.Object... attributes)
          Start and end a bodyless HTML tag.
 WriterWrapper<T> startJavascript()
          Write a javascript start tag
 

Method Detail

printAttribute

WriterWrapper<T> printAttribute(java.lang.String name,
                                java.lang.Object value)
                                                       throws java.io.IOException
Prints a tag attribute and value, if not null

Parameters:
name - name of the attribute
value - value of the attribute. If null, nothing will be written
Returns:
this same instance
Throws:
java.io.IOException

print

WriterWrapper<T> print(java.lang.CharSequence s)
                                              throws java.io.IOException
Print a String

Parameters:
s - the text to be written
Returns:
this same instance
Throws:
java.io.IOException

print

WriterWrapper<T> print(java.lang.Object o)
                                              throws java.io.IOException
Print ant Object, invoking its toString() method

Parameters:
o - the object to be written
Returns:
this same instance
Throws:
java.io.IOException

getWriter

java.io.Writer getWriter()
Returns:
the true writer instance

printHiddenField

WriterWrapper<T> printHiddenField(java.lang.String name,
                                  java.lang.Object value)
                                                         throws java.io.IOException
Prints a hidden form field if its value is not null

Parameters:
name - name of the field
value - value of the field. If null, nothing will be written
Throws:
java.io.IOException

startJavascript

WriterWrapper<T> startJavascript()
                                                        throws java.io.IOException
Write a javascript start tag

Throws:
java.io.IOException

endJavascript

WriterWrapper<T> endJavascript()
                                                      throws java.io.IOException
Write a javascript end tag

Throws:
java.io.IOException

flush

void flush()
           throws java.io.IOException
Flush the written contents

Throws:
java.io.IOException

start

WriterWrapper<T> start(java.lang.String tag,
                       java.lang.Object... attributes)
                                              throws java.io.IOException
Start an HTML tag. This method will write the starting tag complete with all the provided attributes. The attributes must be in pairs (name, value) Example of use: start("a", "href", "foo.html", "class", "bar") will write <a href="foo.html" class="bar"> If any of the provided attribute values is null, it will be ignored.

Throws:
java.lang.IllegalArgumentException - if the number of attribute names and values do not match.
java.io.IOException

startEnd

WriterWrapper<T> startEnd(java.lang.String tag,
                          java.lang.Object... attributes)
                                                 throws java.io.IOException
Start and end a bodyless HTML tag. This method will write the tag complete with all the provided attributes. The attributes must be in pairs (name, value) Example of use: startEnd("img", "href", "foo.html", "class", "bar") will write <img href="foo.html" class="bar"/> If any of the provided attribute values is null, it will be ignored.

Throws:
java.lang.IllegalArgumentException - if the number of attribute names and values do not match.
java.io.IOException

end

WriterWrapper<T> end(java.lang.String tag)
                                            throws java.io.IOException
Ends a HTML tag

Parameters:
tag -
Throws:
java.io.IOException