net.sourceforge.nite.tools.videolabeler
Class AnnotationFrameFactory

java.lang.Object
  extended by net.sourceforge.nite.tools.videolabeler.AnnotationFrameFactory
All Implemented Interfaces:
SelectionListener

public class AnnotationFrameFactory
extends java.lang.Object
implements SelectionListener

This factory creates annotation frames and keeps track of the currently opened annotation frames. It is a selection listener, which means that it can be notified when the user selects or deselects a layer or an agent. For each selected layer that belongs to an agent coding, this factory makes sure that there is one annotation frame for each of the selected agents. For each selected layer that belongs to an interaction coding, this factory makes sure that there is one annotation frame exactly.

The factory is a singleton object, which is created with createInstance().


Method Summary
 void agentSelected(NAgent agent, boolean selected)
          Adds or removes annotation frames for the specified agent.
static AnnotationFrameFactory createInstance(javax.swing.JDesktopPane desktop, java.awt.Rectangle area)
          Creates and returns the singleton annotation frame factory.
static AnnotationFrameFactory getInstance()
          Returns the singleton annotation frame factory.
 void layerSelected(AnnotationLayer layer, boolean selected)
          Adds or removes annotation frames for the specified layer.
 void setArea(java.awt.Rectangle area)
          Sets the area of the desktop pane in which the annotation frames should be layed out.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInstance

public static AnnotationFrameFactory createInstance(javax.swing.JDesktopPane desktop,
                                                    java.awt.Rectangle area)

Creates and returns the singleton annotation frame factory. If this method has been called before, this method will return the existing factory. The annotation frames will be layed out in the specified area of the specified desktop pane.

Parameters:
desktop - the desktop pane to which the annotation frames will be added
area - the area in the desktop pane in which the frames will be layed out
Returns:
the annotation frame factory

getInstance

public static AnnotationFrameFactory getInstance()

Returns the singleton annotation frame factory. If createInstance() has not been called yet, this method returns null.

Returns:
the singleton annotation frame factory or null

setArea

public void setArea(java.awt.Rectangle area)

Sets the area of the desktop pane in which the annotation frames should be layed out. The current annotation frames are layed out in the new area.

Parameters:
area - the area in which the annotation frames are layed out

agentSelected

public void agentSelected(NAgent agent,
                          boolean selected)

Adds or removes annotation frames for the specified agent.

Specified by:
agentSelected in interface SelectionListener
Parameters:
agent - the agent that is selected or deselected
selected - true if the agent is selected, false if it is deselected

layerSelected

public void layerSelected(AnnotationLayer layer,
                          boolean selected)

Adds or removes annotation frames for the specified layer.

Specified by:
layerSelected in interface SelectionListener
Parameters:
layer - the layer that is selected or deselected
selected - true if the layer is selected, false if it is deselected