net.sourceforge.nite.gui.timelineviewer
Class NiteTimeline

java.lang.Object
  extended by net.sourceforge.nite.gui.abstractviewer.NiteAbstractViewer
      extended by net.sourceforge.nite.gui.timelineviewer.NiteTimeline

public class NiteTimeline
extends NiteAbstractViewer

The NiteTimeline provides a scrolling window containing blobs arranged by time on one axis, and by layer on the other. When NOMElements are added to the viewer they are assigned to blobs, but blobs do not necessarily need to be assigned a NOMElement (if, for example, they represent a signal, although this is not yet implemented). A layer groups together a set of NOMElements, and each layer may contain a series of numbered sub-layers. The layers are defined by strings, and each NOMElement is assigned to a layer via the getElementToLayerDelegate() and setElementToLayerDelegate(ElementToTextDelegate) methods.

Author:
Craig Nicol

Constructor Summary
NiteTimeline()
          Create a NiteTimeline without a clock
NiteTimeline(Clock c)
          Create a NiteTimeline synchronised with the provided clock
NiteTimeline(java.lang.String title)
          Create a NiteTimeline with the given window title.
NiteTimeline(java.lang.String title, Clock c)
          Create a NiteTimeline with the given window title, synchronised with the provided clock.
 
Method Summary
 void addElement(NOMElement element)
          Add a new blob to the timeline based on an element
 Clock getClock()
           
 int getElementLayerDepth(NOMElement el)
          Returns the depth of the NOMElement within the current layer.
 ElementToTextDelegate getElementToLayerDelegate()
           
 ElementToLayerDepthDelegate getElementToLayerDepthDelegate()
           
 javax.swing.JInternalFrame getFrame()
          Return the frame for this timeline
 TimeGrid getGrid()
          Get the current TimeGrid
 void resetGrid()
           
 void setBlobTextAttribute(java.lang.String attr)
          Provide the String to be displayed on individual blobs on the timeline.
 void setBlobTextDelegate(TranscriptionToTextDelegate delegate)
          Provide the String to be displayed on individual blobs on the timeline.
 void setClock(Clock c)
          Add a clock to synchronise to
 void setDisplayedElements(java.util.Iterator elements)
          Add new blobs to the timeline based on NOMElements
 void setElementToLayerDelegate(ElementToTextDelegate eeld)
           
 void setElementToLayerDepthDelegate(ElementToLayerDepthDelegate eltodepth)
           
 void setLayerTextAttribute(java.lang.String attr)
          Divide elements into layers.
 void setLayerTextDelegate(TranscriptionToTextDelegate delegate)
          Divide elements into layers.
 
Methods inherited from class net.sourceforge.nite.gui.abstractviewer.NiteAbstractViewer
allowsMultipleSelection, getElementToTextDelegate, setDisplayedElements, setDisplayedElements, setElementToTextDelegate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NiteTimeline

public NiteTimeline()
Create a NiteTimeline without a clock


NiteTimeline

public NiteTimeline(Clock c)
Create a NiteTimeline synchronised with the provided clock

Parameters:
c - A Clock to synchronise with

NiteTimeline

public NiteTimeline(java.lang.String title,
                    Clock c)
Create a NiteTimeline with the given window title, synchronised with the provided clock.

Parameters:
title - The Window title
c - A Clock to synchronise with

NiteTimeline

public NiteTimeline(java.lang.String title)
Create a NiteTimeline with the given window title.

Parameters:
title - The Window title
Method Detail

getElementToLayerDepthDelegate

public ElementToLayerDepthDelegate getElementToLayerDepthDelegate()
Returns:
the current ElementToLayerDepthDelegate

setElementToLayerDepthDelegate

public void setElementToLayerDepthDelegate(ElementToLayerDepthDelegate eltodepth)
Parameters:
eltodepth - the ElementToLayerDepthDelegate to use on this timeline

getElementToLayerDelegate

public ElementToTextDelegate getElementToLayerDelegate()

setElementToLayerDelegate

public void setElementToLayerDelegate(ElementToTextDelegate eeld)

setLayerTextDelegate

public void setLayerTextDelegate(TranscriptionToTextDelegate delegate)

Divide elements into layers. Each element on the timeline is passed through this delegate class to make a String that names the layer; elements returning the same String will be placed in the same layer.

NOTE: This will override anything set by setLayerTextAttribute(String) unless delegate is null.

Parameters:
The - delegate to assign, or null
See Also:
getElementLayerDepth(NOMElement), ElementToTextDelegate

setLayerTextAttribute

public void setLayerTextAttribute(java.lang.String attr)

Divide elements into layers. Each element on the timeline is passed through this delegate class to make a String that names the layer; elements returning the same String will be placed in the same layer.

NOTE: This will be overridden by anything set by setLayerTextDelegate(TranscriptionToTextDelegate)

Parameters:
attr - The attribute to use, or null
See Also:
getElementLayerDepth(NOMElement), ElementToTextDelegate

setBlobTextDelegate

public void setBlobTextDelegate(TranscriptionToTextDelegate delegate)

Provide the String to be displayed on individual blobs on the timeline.

NOTE: This will override anything set by setBlobTextAttribute(String) unless delegate is null.

Parameters:
delegate - The delegate to use in this timeline.
See Also:
ElementToTextDelegate

setBlobTextAttribute

public void setBlobTextAttribute(java.lang.String attr)

Provide the String to be displayed on individual blobs on the timeline.

NOTE: This will be overridden by anything set by setBlobTextDelegate(TranscriptionToTextDelegate).

Parameters:
attr - The NOMElement attribute to use in this timeline.
See Also:
ElementToTextDelegate

getElementLayerDepth

public int getElementLayerDepth(NOMElement el)
Returns the depth of the NOMElement within the current layer.

Parameters:
el - the element to be displayed
Returns:
depth to display (or 0 if no display)
See Also:
to change what this method returns., ElementToLayerDepthDelegate, for more details on layers

resetGrid

public void resetGrid()

getFrame

public javax.swing.JInternalFrame getFrame()
Return the frame for this timeline


getGrid

public TimeGrid getGrid()
Get the current TimeGrid

Returns:
the TimeGrid associated with this timeline

setClock

public void setClock(Clock c)
Add a clock to synchronise to

Parameters:
c -

getClock

public Clock getClock()
Returns:
The Clock currently used for synchronisation

addElement

public void addElement(NOMElement element)
Add a new blob to the timeline based on an element

Parameters:
element -

setDisplayedElements

public void setDisplayedElements(java.util.Iterator elements)
Add new blobs to the timeline based on NOMElements

Specified by:
setDisplayedElements in class NiteAbstractViewer
Parameters:
elements - An Iterator over NOMElements