This util class allows you to control the media-interface on the basis of predefined segments, with
actions such as 'goto next segment', 'loop', 'go to previous segment', 'play', 'pause', etc

To use this class, create a SegmentReplayer, then add all segments to it that you want to have
available. Usually you would initialize it with data from a layer of non-overlapping selections,
in order to annotate something else along that _selection_ of the timeline.

When you create NEW segments, you can add them directly to this replayer.

Next, you should get the Actions from the segmentreplayer and add them to your GUI somewhere.
In general, a segmentreplayer needs not have its own physical GUI. For convenience purposes
however you can request a panel of the replayer that contains buttons for the actions.
The Action objects that you get on request are pointers to the 'real' actions, i.e. if you want
to change icons or keyboard shortcuts or mnemonics you can do that, and they will change in
the convenience panel as well.

It is possible to automatically open a SegmentReplayer for all elements in a certain layer for the ContinuousVideoLabeler.
To do this, add the attributes segmentreplayer="true" and replaysegmentname="" to the corpussettingsnode
in the config XML file. THIS OPTINO WILL MOST PROBABLY DISAPPEAR IN THE FUTURE. USE IT FOR TESTING, BUT DON"T DEPEND ON IT TOO MUCH!

addAvailableSegment

Arg: a new NOMElement (at the given index, -1 means at end. It will be checked for proper timing. If it's
OK for timing, it's added to this segmentreplayer. The state of the replayer is kept as it was.

setCurrentSegment

Sets the segment that is now going to be replayed.
Afterwards, currentSegment and currentIndex will be in agreement
If the segment is not properly timed, a message is logged and the element is null and index -1.
If the segment is not in the list of availablesegments, currentsegment will be null and index -1.

Further reaction depends on state:
LOOP: state stays in LOOP, clock jumps to start of new segment
INACTIVE: stay INACTIVE. Only jump to start if current time outside segment time
PLAYONCE: stay PLAYONCE, clock jumps to start of new segment.

getActionMap

public javax.swing.ActionMap getActionMap()

getGuiPanel

public javax.swing.JPanel getGuiPanel()

returns a trivially simple gui panel for controlling this replayer.

acceptTimeChange

public void acceptTimeChange(double systemTime)

The reaction to changes in the system time depends on the state.
LOOP: check if we reached end of segment; if so, jump to start.
PLAYONCE: check if we reached end of segment; if so: stop playing.
INACTIVE: nothing.

acceptTimeSpanChange

Accept a new time span from another registered time
handler. This may involve changing our on-screen appearance to
introduce some new time highlights, or playing a stretch of
video, depending on the type of handler.