story.scheherazade.virgil
Class TimelineViewer

java.lang.Object
  extended by story.scheherazade.virgil.TimelineViewer
All Implemented Interfaces:
java.awt.event.ComponentListener, java.util.EventListener

public class TimelineViewer
extends java.lang.Object
implements java.awt.event.ComponentListener

A GUI component that shows a timeline as a list of states


Constructor Summary
TimelineViewer(Virgil virgil, VirgilConfiguration config, StateViewer stateViewer, TimelineArrowPanel arrowPanel, java.util.Hashtable<java.lang.String,TimelineColor> colors)
           
 
Method Summary
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 javax.swing.JComponent getPanel()
           
 TimelineTime getSelectedTimelineTime()
          Returns the StateTime of the state currently selected, or null if no such state.
 TimelineID getTimelineID()
          Returns the TimelineID that this TimelineViewer is set to, or null if none is set.
static double interpolate(double a, double b, double alpha, boolean scurve)
          Interpolate between two doubles.
 StateTime nextState(StateTime time)
          Returns the StateTime of the state following some state.
 StateTime previousState(StateTime time)
          Returns the StateTime of the state previous to some state.
 void reconstruct()
           
 void selectState(StateTime time)
          Focus the timeline viewport on a particular state.
 void selectState(StateTime time, boolean animate)
          Focus the timeline viewport on a particular state.
 void selectTime(TimelineTime time)
          Switchboard for calling selectState or selectTransition.
 void selectTime(TimelineTime time, boolean animate)
          Switchboard for calling selectState or selectTransition.
 void selectTransition(TransitionTime time)
          Focus the timeline viewport on a particular transition diamond.
 void selectTransition(TransitionTime time, boolean animate)
          Focus the timeline viewport on a particular transition diamond.
 void setControlPanel(TimelineControlPanel controlPanel)
           
 void setStory(StoryInterpreter story)
           
 void setTimeline(TimelineID timelineID, boolean overrideStateSelection)
           
 void setVisibleStates(VisibleStates visibleStates)
          Set the visible states for all timelines.
 void showError(Scheherexception s)
           
 boolean showingState(StateTime time)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimelineViewer

public TimelineViewer(Virgil virgil,
                      VirgilConfiguration config,
                      StateViewer stateViewer,
                      TimelineArrowPanel arrowPanel,
                      java.util.Hashtable<java.lang.String,TimelineColor> colors)
               throws Scheherexception
Throws:
Scheherexception
Method Detail

setControlPanel

public void setControlPanel(TimelineControlPanel controlPanel)

reconstruct

public void reconstruct()
                 throws Scheherexception
Throws:
Scheherexception

setVisibleStates

public void setVisibleStates(VisibleStates visibleStates)
                      throws Scheherexception
Set the visible states for all timelines. This is a shared data structure with Virgil.

Throws:
Scheherexception

selectTime

public void selectTime(TimelineTime time)
                throws Scheherexception
Switchboard for calling selectState or selectTransition. Animates transition.

Throws:
Scheherexception

selectTime

public void selectTime(TimelineTime time,
                       boolean animate)
                throws Scheherexception
Switchboard for calling selectState or selectTransition.

Throws:
Scheherexception

selectState

public void selectState(StateTime time)
                 throws Scheherexception
Focus the timeline viewport on a particular state. Animates transition.

Throws:
Scheherexception

selectState

public void selectState(StateTime time,
                        boolean animate)
                 throws Scheherexception
Focus the timeline viewport on a particular state.

Throws:
Scheherexception

selectTransition

public void selectTransition(TransitionTime time)
                      throws Scheherexception
Focus the timeline viewport on a particular transition diamond. Animates transition.

Throws:
Scheherexception

selectTransition

public void selectTransition(TransitionTime time,
                             boolean animate)
                      throws Scheherexception
Focus the timeline viewport on a particular transition diamond.

Throws:
Scheherexception

setStory

public void setStory(StoryInterpreter story)
              throws Scheherexception
Throws:
Scheherexception

setTimeline

public void setTimeline(TimelineID timelineID,
                        boolean overrideStateSelection)
                 throws Scheherexception
Throws:
Scheherexception

getPanel

public javax.swing.JComponent getPanel()

showError

public void showError(Scheherexception s)

getSelectedTimelineTime

public TimelineTime getSelectedTimelineTime()
Returns the StateTime of the state currently selected, or null if no such state.


getTimelineID

public TimelineID getTimelineID()
Returns the TimelineID that this TimelineViewer is set to, or null if none is set.


previousState

public StateTime previousState(StateTime time)
                        throws Scheherexception
Returns the StateTime of the state previous to some state. Returns null of given state is first state.

Throws:
Scheherexception

nextState

public StateTime nextState(StateTime time)
                    throws Scheherexception
Returns the StateTime of the state following some state. Returns null of given state is last state.

Throws:
Scheherexception

showingState

public boolean showingState(StateTime time)
                     throws Scheherexception
Throws:
Scheherexception

interpolate

public static double interpolate(double a,
                                 double b,
                                 double alpha,
                                 boolean scurve)
Interpolate between two doubles.

Parameters:
a - The first number
b - The second number
c - The faction of progress desired, between 0 and 1
scurve - True for an s-curve, false for linear interpolation.

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener


Copyright © 2011 David K. Elson. All Rights Reserved.