simple.template.layout
Class LayoutFactory

java.lang.Object
  extended by simple.template.layout.LayoutFactory

public final class LayoutFactory
extends java.lang.Object

The LayoutFactory retrieves a Layout implementation for the system. This is used so that an arbitrary layout can be imposed on the system using the command line. If an template is referenced then an instance is retrieved and the layout of that template is handled by the retrieved implementation. This has a number of advantages. For one it enables the layout to be configured without any changes to code, so only the layout configuration needs to be modified to change the layout used.

In order to define a system wide implementation a property is needed to define the object. This uses the System properties to define the class name for the default instance. The property is the simple.template.layout property that can be set using an argument to the VM.

 
 java -Dsimple.template.layout=demo.example.DemoLayout 
 
This will set the System property to the class name demo.example.DemoLayout. When the factory method getInstance is invoked it will return an implementation of this object or if the implementation cannot be loaded by this classes class loader a default implementation, TileLayout, is returned instead.

Author:
Niall Gallagher

Constructor Summary
LayoutFactory()
           
 
Method Summary
static Layout getInstance(simple.template.layout.PanelFactory factory, Context context)
          This is used to produce the system wide Layout implementation so that a layout can be imposed on templates.
static Layout getInstance(ViewerFactory factory, Context context)
          This is used to produce the system wide Layout implementation so that a layout can be imposed on templates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutFactory

public LayoutFactory()
Method Detail

getInstance

public static Layout getInstance(ViewerFactory factory,
                                 Context context)
This is used to produce the system wide Layout implementation so that a layout can be imposed on templates. This will use the simple.template.layout system property to define the class of the implementation that will be used for the system wide Layout. The property should contain the fully qualified class name of the object and should be loadable by this classes class loader. If the specified class cannot be loaded then the TileLayout implementation is used.

Parameters:
factory - this is used to produce the document object
context - this is the context used for configuration
Returns:
the systems Layout implementation

getInstance

public static Layout getInstance(simple.template.layout.PanelFactory factory,
                                 Context context)
This is used to produce the system wide Layout implementation so that a layout can be imposed on templates. This will use the simple.template.layout system property to define the class of the implementation that will be used for the system wide Layout. The property should contain the fully qualified class name of the object and should be loadable by this classes class loader. If the specified class cannot be loaded then the TileLayout implementation is used.

Parameters:
factory - this is used to produce the document object
context - this is the context used for configuration
Returns:
the systems Layout implementation