net.sourceforge.nite.tools.videolabeler
Class TimelineFactory

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

public class TimelineFactory
extends java.lang.Object
implements SelectionListener

A timeline factory is a global singleton object. Before it is used it should be created with ViewFrameFactory.createInstance(). From then on the same factory can be retrieved with TimelineFactory.getInstance().

A timeline factory displays selected annotation layers on a timeline. A timeline is an instance of NiteTimeline. This factory does not only create the timeline, but it also serves as a repository of the current timeline and it is responsible for laying out the timeline in a designated area of a desktop pane.

The factory implements the SelectionListener interface. The user should be able to select and deselect the layers to be shown on the timeline. Whenever the user selects or deselects an annotation layer, the method layerSelected() should be called, so that the timeline blobs for the selected/deselected layer is created/removed and the timeline is refreshed.


Method Summary
 void agentSelected(NAgent agent, boolean selected)
          This method does nothing, because view frames are only associated with a layer, not with an agent.
static TimelineFactory createInstance(javax.swing.JDesktopPane desktop, java.awt.Rectangle area, NOMWriteCorpus corpus)
          Initialises the singleton timeline factory.
 java.util.List doSearch(java.lang.String query)
           
 Clock getClock()
           
static TimelineFactory getInstance()
          Returns the singleton timeline factory.
 void layerSelected(AnnotationLayer layer, boolean selected)
          Selects or deselects a layer.
 void setArea(java.awt.Rectangle area)
          Sets the area of the desktop in which the view frames are layed out.
 void setClock(Clock c)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInstance

public static TimelineFactory createInstance(javax.swing.JDesktopPane desktop,
                                             java.awt.Rectangle area,
                                             NOMWriteCorpus corpus)

Initialises the singleton timeline factory. The factory will display the timline on the specified desktop. The timeline will be layed out in the specified area of the desktop.

If the singleton timeline factory has already been initialised, this method does not create a new factory, but simply returns the existing singleton factory.

Parameters:
desktop - the desktop where the view frames will be displayed
area - the area of the desktop in which the view frames will be layed out
Returns:
the singleton view frame factory

getClock

public Clock getClock()

setClock

public void setClock(Clock c)

getInstance

public static TimelineFactory getInstance()

Returns the singleton timeline factory. The factory should have been initialised first with createInstance. If the factory has not been initialised yet, this method returns null.

Returns:
the singleton timeline factory or null

setArea

public void setArea(java.awt.Rectangle area)

Sets the area of the desktop in which the view frames are layed out. This method will set the area and lay out the current view frames in the specified area.

Parameters:
area - an area of the desktop

agentSelected

public void agentSelected(NAgent agent,
                          boolean selected)

This method does nothing, because view frames are only associated with a layer, not with an 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

doSearch

public java.util.List doSearch(java.lang.String query)

layerSelected

public void layerSelected(AnnotationLayer layer,
                          boolean selected)

Selects or deselects a layer. If a layer is selected, the view frame for that layer is created on the desktop. If a layer is deselected, the view frame for that layer is removed from the desktop. In either case the new set of selected view frames are layed out in the designated desktop area.

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