simple.template.layout
Interface Tile


public interface Tile

The Tile object is used to represent a value that has been acquired from a Source. The reason the source value cannot be entered directly into the template is because if there are ever extentions to this framework they need to be made in a way that will not break compatibility with existing implementations. Also, directly submitting the source value means that the full graph of documents needs to be made before anything is referenced within the template.

This object allows a lazy approach to be taken with regards to the graph building process. Only tiles that are referenced or used within the template will need their source value, and so, only those tiles will extract the source value. Another benifit to this is that it will reduce the problems caused with recursive references. If only nodes referenced within the template acquire the source value, then all documents can have references to themselves without initiating recursion.

Author:
Niall Gallagher

Method Summary
 java.lang.String getName()
          This provides the name of the tile which is the same name as the Source it wraps.
 java.lang.Object getValue()
          This method causes the Source.getValue method to be invoked.
 java.lang.String toString()
          This invokes the toString method of the source value.
 void write(java.io.PrintWriter out)
          This is used to write the contents of the tile to the provided writer.
 

Method Detail

getName

java.lang.String getName()
This provides the name of the tile which is the same name as the Source it wraps. This is useful if the tile needs to be inserted into a List as it will allow a template to determine the tile it represents.

Returns:
this provides the reference for this tile object

write

void write(java.io.PrintWriter out)
This is used to write the contents of the tile to the provided writer. The use of the print writer allows for a much more efficient means for displaying tiles. This is especially benificial when it is used with JSP templates.

Parameters:
out - this is the print writer to write the tile to

getValue

java.lang.Object getValue()
This method causes the Source.getValue method to be invoked. This will extract the value from the source when referenced from within a template. This initiates a further branch of the document graph to be created.

Returns:
this returns the value taken from the source

toString

java.lang.String toString()
This invokes the toString method of the source value. Typically objects inserted into the template by the document definition are viewable objects, such as headings or other templates. This makes it easy for those values to be presented within a template, a simple reference to the Tile will cause this method to be invoked.

Overrides:
toString in class java.lang.Object
Returns:
this returns the string value of this tile object