net.sourceforge.nite.tools.videolabeler
Class AnnotationLayerFactory

java.lang.Object
  extended by net.sourceforge.nite.tools.videolabeler.AnnotationLayerFactory

public class AnnotationLayerFactory
extends java.lang.Object

An annotation layer factory is a singleton object that can create annotation layers, which are wrappers around NXT layers (see AnnotationLayer). The factory is obtained with the static method getInstance(). An annotation layer is created with createAnnotationLayer().


Method Summary
 AnnotationLayer createAnnotationLayer(NLayer layer, java.lang.String layerType, java.lang.String codeName, java.lang.String panelType, org.w3c.dom.Node layerInfo)
          Creates a new annotation layer.
static AnnotationLayerFactory getInstance()
          Returns the singleton annotation layer factory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AnnotationLayerFactory getInstance()

Returns the singleton annotation layer factory. The first time this method is called, the factory is created.

Returns:
the singleton annotation layer factory

createAnnotationLayer

public AnnotationLayer createAnnotationLayer(NLayer layer,
                                             java.lang.String layerType,
                                             java.lang.String codeName,
                                             java.lang.String panelType,
                                             org.w3c.dom.Node layerInfo)

Creates a new annotation layer. It is wrapped around the specified NXT layer. This method takes three further arguments: the type of the annotation layer (layerType), the type of the target control panel (panelType) and the layer info element from the configuration file (layerInfo), which may contain further layer-dependent settings. The arguments layerType and panelType should be specified as qualified class names. This method uses Java Reflection to create an instance of the annotation layer.

An annotation layer should be a subclass of AnnotationLayer and have a constructor of the same type as the constructor of AnnotationLayer. The target control panel should be a subclass of TargetControlPanel and have a constructor of the same type as the constructor of TargetControlPanel.

If an exception occurs, an error message is printed to standard output and this method returns null.

NOTE: not every combination of annotation layer type and target control panel type may work together.