simple.template.layout
Class TileLayout
java.lang.Object
simple.template.layout.TileLayout
- All Implemented Interfaces:
- Layout
public class TileLayout
- extends java.lang.Object
- implements Layout
The TileLayout
provides a document layout that
can be used to build a graph of templates that can be used to
create a single view. This is used to generate a layout defined
within an XML configuration file that describes a list of
documents containing tiles that are to be included into a
generated Panel
object. The idea is that each
of the described documents, with its tiles, can be added to
another document, such that a graph of documents can be made.
Below is an example specification for two documents.
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<document target="example" source="/layout.vm">
<tile name="name" value="value" type="type"/>
</document>
<document target="demo" source="example"/>
</layout>
This graph of documents is basically a primary layout template
that contains several Panel
objects, which in
turn may contain several objects. This avoids a template using
hardcoded includes, which lead to an unmaintainable codebase.
Another advantage to using this layout is that it supports the
use of object oriented document definitions, that is, when a
specification for a particular document is created another one
can be created that extends it. So, using the above example, a
document will be created called "demo" that has its source as
"example". This document would have the tile "name" without
having to declare it within the definition for "demo".
- Author:
- Niall Gallagher
- See Also:
Tile
Constructor Summary |
TileLayout(simple.template.layout.PanelFactory system,
Context context)
Constructor for the TileLayout object. |
Method Summary |
Panel |
getPanel(java.lang.String name,
java.lang.Object data,
boolean share)
This method will retrieve a Panel object to
represent the specified target. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TileLayout
public TileLayout(simple.template.layout.PanelFactory system,
Context context)
- Constructor for the
TileLayout
object. A tile
layout is used to create a layout using a specification
acquired from an XML configuration file. The configuration
is acquired from the provided Context
object.
- Parameters:
system
- this is used to acquire the actual templatescontext
- this is used to load the XML configuration
getPanel
public Panel getPanel(java.lang.String name,
java.lang.Object data,
boolean share)
throws java.lang.Exception
- This method will retrieve a
Panel
object to
represent the specified target. The document returned may
be either an empty template document or a layout document
that contains various inserted tiles as specified by the
XML configuration file. This method will be used to insert
a collection of Tile
objects into a layout
template. The tiles inserted will communicate with a source
to acquire its value and present itself within the layout.
- Specified by:
getPanel
in interface Layout
- Parameters:
name
- this is the name for the document requesteddata
- this is the data source used by the documentshare
- should the data be inherited or unmodified
- Throws:
java.lang.Exception