com.dlsc.flexgantt.swing.layer
Class DefaultLayerFactory

java.lang.Object
  extended by com.dlsc.flexgantt.swing.layer.DefaultLayerFactory
All Implemented Interfaces:
ILayerFactory

public class DefaultLayerFactory
extends java.lang.Object
implements ILayerFactory

A layer factory implementation. For more information read the comments inside the implemented ILayerFactory interface. The factory implements the singleton pattern.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
AbstractLayer, AbstractSystemLayer

Constructor Summary
protected DefaultLayerFactory()
          Constructs a new factory.
 
Method Summary
 AbstractCustomLayer createCustomLayer(LayerContainer lc, ILayer layer)
          The default layer factory implementation does not know about any custom layers and will always return a placeholder instance if a layer returned by the Gantt chart model indicates that it is a custom layer.
<T extends AbstractSystemLayer>
T
createSystemLayer(LayerContainer lc, java.lang.Class<T> layerType)
          Creates a new system layer.
 TimelineObjectLayer createTimelineLayer(LayerContainer lc, ILayer layer)
          Creates a new timeline object layer to be used for rendering timeline objects.
static ILayerFactory getInstance()
          Returns a factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLayerFactory

protected DefaultLayerFactory()
Constructs a new factory. The constructor is protected because the class implements the singleton pattern.

Since:
1.0
Method Detail

getInstance

public static ILayerFactory getInstance()
Returns a factory.

Returns:
a singleton layer factory
Since:
1.0

createSystemLayer

public <T extends AbstractSystemLayer> T createSystemLayer(LayerContainer lc,
                                                           java.lang.Class<T> layerType)
Description copied from interface: ILayerFactory
Creates a new system layer. The creation of all system layer types must be supported (all subclasses of AbstractSystemLayer).

Specified by:
createSystemLayer in interface ILayerFactory
Type Parameters:
T - the type of the system layer
Parameters:
lc - the layer container, which will manage the layer
layerType - the system layer class
Returns:
a system layer user interface component

createTimelineLayer

public TimelineObjectLayer createTimelineLayer(LayerContainer lc,
                                               ILayer layer)
Description copied from interface: ILayerFactory
Creates a new timeline object layer to be used for rendering timeline objects.

Specified by:
createTimelineLayer in interface ILayerFactory
Parameters:
lc - the layer container, which will manage the layer
layer - the layer model information
Returns:
either a timeline layer or a custom layer
See Also:
ILayerFactory.createCustomLayer(LayerContainer, ILayer)

createCustomLayer

public AbstractCustomLayer createCustomLayer(LayerContainer lc,
                                             ILayer layer)
The default layer factory implementation does not know about any custom layers and will always return a placeholder instance if a layer returned by the Gantt chart model indicates that it is a custom layer.

Specified by:
createCustomLayer in interface ILayerFactory
Parameters:
lc - the layer container, which will manage the layer
layer - the layer model information
Returns:
a custom layer
Since:
1.0
See Also:
ILayer.isCustomLayer()