artisynth.core.gui.timeline
Class TimelineController

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by artisynth.core.gui.Timeline
                          extended by artisynth.core.gui.timeline.TimelineController
All Implemented Interfaces:
SchedulerListener, SelectionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class TimelineController
extends Timeline
implements SchedulerListener, SelectionListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TimelineController(java.lang.String title, MainFrame mainFrame, GLViewer glViewer)
          Creates the timeline
 
Method Summary
 void addContiguousTrack(Track src)
           
 void addProbe(Probe probe)
          Adds a probe to the timeline.
 void addProbeEditor(NumericProbeEditor editor)
           
 void addWayPoint(double wayTime, boolean isBreakPoint)
          Adds a waypoint to the timelime.
 void addWayPointFromUser(boolean isBreakPoint)
          Gets waypoint information from the current position of the timescale and adds the waypoint to the waypoint probe.
 void automaticProbesZoom()
          Automatically decide which zoom level is better for the probes and set this level based on the maximum probe time data.
 void closeProbeEditors()
           
 void deleteWaypoint(int idx, boolean isTimelineReset)
          Called when clearTimeline is requested on the timeline, or an action is performed requesting "Delete Waypoint".
 void deleteWayPoints()
           
 void disableAllBreakpoints()
           
 boolean executeDrop(int yCoor, ProbeInfo pInfo, Track origTrack)
           
 void expandTracks(boolean expanded, java.util.ArrayList<Track> list)
           
 void extendTimeline()
           
 java.awt.Cursor getCurrentCursor()
           
 Track getCurrentlyEnteredTrack()
           
 double getCurrentTime()
           
 double getLargestProbeTime()
           
 double getLargestWaypointTime()
           
 int getMultipleSelectionMask()
           
 int getNumberOfWayPoints()
           
 artisynth.core.gui.timeline.TimelineController.ProbeTrack getProbeTrack()
           
 Track getProbeTrack(Probe probe)
           
 int getProbeTrackHeight()
           
 java.util.ArrayList<ProbeInfo> getSelectedProbes()
           
 Timescale getTimescale()
           
 Track getTrack(int trackIdx, boolean isInput)
           
 Track getTrackAtYCoor(int yCoor, boolean isInputTrack)
           
 java.util.ArrayList<Track> getTrackGroup(Track firstTrack)
          Get the group of tracks that has the specified track as the first one in the group.
 int[] getVisibleBound()
          Returns the bounds for which the timeline is visible.
 WayPoint getWayPoint(double time)
           
 void getWayPointFromUser()
          Gets waypoint information from the user and adds the waypoint to the waypoint probe.
 int getYCoorUpToTrack(Track curTrack)
          compute Y coordinate to track
 int getZoomLevel()
           
 boolean groupTracks()
           
 void hideContiguousTracks(Track src)
          Hide the contiguous tracks that are grouped with the src track.
 boolean isActiveProbeExist()
           
 boolean isActiveWaypointExist()
           
 boolean isContiguousTrack(Track src)
          Determine if a track is part of the list of contiguous tracks or not.
 boolean isNextValidWayAvailable()
          Checks to see if there are any valid waypoints after the current time.
 boolean mouseReleased()
          When the left mouse button is released on a track this function is called to move the tracks around accordingly.
 void muteTracks(boolean muted, java.util.ArrayList<Track> list)
           
 void rebuildWayPointTrack()
           
 void refreshProbeTrackDisplay()
           
 void removeAllContiguousTracks()
           
 void removeContiguousTrack(Track src)
           
 void removeProbe(Probe probe)
           
 void removeWayPointFromRoot(WayPoint way)
          Removes a wayPoint at the request of the system.
 void repaintVisibleWindow()
          Get the current dimensions of the timeline window and repaint the timeline accordingly, and make a call to repaint the workspace.
 void requestResetAll()
           
 void requestUpdateDisplay()
           
 void requestUpdateWidgets()
           
 void resetAll()
          Resets the timeline.
 boolean rootModelExists()
           
 void saveAllProbes()
           
 void schedulerActionPerformed(Scheduler.Action action)
           
 void selectionChanged(SelectionEvent e)
           
 void setActiveProbeExist(boolean exist)
           
 void setActiveWaypointExist(boolean exist)
           
 void setAllInputProbes()
           
 void setAllMutable(boolean muted)
           
 void setAllTracksExpanded(boolean expanded)
           
 void setAllTracksMuted(boolean muted)
           
 void setCurrentCursor(java.awt.Cursor cur)
           
 Track setLastEntered(Track src, boolean group)
          Set the value of the track that was last entered by the mouse.
 void setMultipleSelectionMask(int mask)
           
 void setRestartTime(int dragMode)
          Responsible for setting up the model after the mouse has been used to drag the time to Tn.
 void setTrackExpanded(boolean expanded, boolean isInput, int modelIdx, int trackIdx)
           
 void setTrackMuted(boolean muted, boolean isInput, int modelIdx, int trackIdx)
           
 void setVisible(boolean visible)
           
 void setZoomLevel(int zoom)
           
 void showContiguousTracks(Track src)
           
 void ungroupTracks(Track src)
           
 void updateAllProbeDisplays()
           
 void updateComponentLocations()
          Computes the location where each component on the timeline should be as a function of the time with which the component spans over, and updates the location and size of these components accordingly.
 void updateComponentSizes()
          Computes the length that each component on the timeline should represent as a function of the time which the component spans over, and then updates the size of these components accordingly.
 void updateCurrentWaypointShadow(int x)
           
 void updateDisplay()
           
 void updateProbes()
          Updates probes when probes are added or removed from the RootModel.
 boolean updateProbesAndWaypoints()
          Checks to see if the currently loaded probes and waypoints are consistent with the root model, and updates them if necessary.
 void updateTimeDisplay(double t)
          Sets the current running time of the model
 void updateTimelineScroll()
           
 void updateWayPointListOrder(int modifiedWaypointIndex)
           
 void updateWidgets(boolean refreshCursor)
           
 void zoom(int mode)
           
 
Methods inherited from class artisynth.core.gui.Timeline
isMultipleProbeSelecting, setMultipleProbeSelecting
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

TimelineController

public TimelineController(java.lang.String title,
                          MainFrame mainFrame,
                          GLViewer glViewer)
Creates the timeline

Method Detail

updateComponentSizes

public void updateComponentSizes()
Computes the length that each component on the timeline should represent as a function of the time which the component spans over, and then updates the size of these components accordingly.

Specified by:
updateComponentSizes in class Timeline

getProbeTrackHeight

public int getProbeTrackHeight()

updateWidgets

public void updateWidgets(boolean refreshCursor)

updateDisplay

public void updateDisplay()

requestUpdateDisplay

public void requestUpdateDisplay()
Specified by:
requestUpdateDisplay in class Timeline

requestUpdateWidgets

public void requestUpdateWidgets()
Specified by:
requestUpdateWidgets in class Timeline

requestResetAll

public void requestResetAll()
Specified by:
requestResetAll in class Timeline

repaintVisibleWindow

public void repaintVisibleWindow()
Get the current dimensions of the timeline window and repaint the timeline accordingly, and make a call to repaint the workspace.

Specified by:
repaintVisibleWindow in class Timeline

setRestartTime

public void setRestartTime(int dragMode)
Responsible for setting up the model after the mouse has been used to drag the time to Tn.


setAllMutable

public void setAllMutable(boolean muted)

setAllTracksMuted

public void setAllTracksMuted(boolean muted)

muteTracks

public void muteTracks(boolean muted,
                       java.util.ArrayList<Track> list)

expandTracks

public void expandTracks(boolean expanded,
                         java.util.ArrayList<Track> list)

updateAllProbeDisplays

public void updateAllProbeDisplays()

updateComponentLocations

public void updateComponentLocations()
Computes the location where each component on the timeline should be as a function of the time with which the component spans over, and updates the location and size of these components accordingly.

Specified by:
updateComponentLocations in class Timeline

resetAll

public void resetAll()
Resets the timeline. Called when it is first created and when new models are loaded.

Specified by:
resetAll in class Timeline

deleteWaypoint

public void deleteWaypoint(int idx,
                           boolean isTimelineReset)
Called when clearTimeline is requested on the timeline, or an action is performed requesting "Delete Waypoint".


closeProbeEditors

public void closeProbeEditors()

removeWayPointFromRoot

public void removeWayPointFromRoot(WayPoint way)
Removes a wayPoint at the request of the system. This means that the system does not need to be informed about its removal.

Specified by:
removeWayPointFromRoot in class Timeline

setZoomLevel

public void setZoomLevel(int zoom)
Specified by:
setZoomLevel in class Timeline

automaticProbesZoom

public void automaticProbesZoom()
Automatically decide which zoom level is better for the probes and set this level based on the maximum probe time data.

Specified by:
automaticProbesZoom in class Timeline

updateTimeDisplay

public void updateTimeDisplay(double t)
Sets the current running time of the model

Specified by:
updateTimeDisplay in class Timeline
Parameters:
t - time is seconds

updateProbesAndWaypoints

public boolean updateProbesAndWaypoints()
Checks to see if the currently loaded probes and waypoints are consistent with the root model, and updates them if necessary. This method is not thread-safe.

Returns:
true if probes needed updating, false otherwise.

updateProbes

public void updateProbes()
Updates probes when probes are added or removed from the RootModel.

Specified by:
updateProbes in class Timeline

addProbe

public void addProbe(Probe probe)
Adds a probe to the timeline.


removeProbe

public void removeProbe(Probe probe)

addProbeEditor

public void addProbeEditor(NumericProbeEditor editor)
Specified by:
addProbeEditor in class Timeline

setActiveWaypointExist

public void setActiveWaypointExist(boolean exist)

setActiveProbeExist

public void setActiveProbeExist(boolean exist)

updateWayPointListOrder

public void updateWayPointListOrder(int modifiedWaypointIndex)

setCurrentCursor

public void setCurrentCursor(java.awt.Cursor cur)

addWayPointFromUser

public void addWayPointFromUser(boolean isBreakPoint)
Gets waypoint information from the current position of the timescale and adds the waypoint to the waypoint probe.


addWayPoint

public void addWayPoint(double wayTime,
                        boolean isBreakPoint)
Adds a waypoint to the timelime.


deleteWayPoints

public void deleteWayPoints()

getWayPointFromUser

public void getWayPointFromUser()
Gets waypoint information from the user and adds the waypoint to the waypoint probe.


disableAllBreakpoints

public void disableAllBreakpoints()

setAllTracksExpanded

public void setAllTracksExpanded(boolean expanded)
Specified by:
setAllTracksExpanded in class Timeline

getCurrentCursor

public java.awt.Cursor getCurrentCursor()

getZoomLevel

public int getZoomLevel()

getWayPoint

public WayPoint getWayPoint(double time)

getCurrentTime

public double getCurrentTime()

getTimescale

public Timescale getTimescale()

getVisibleBound

public int[] getVisibleBound()
Returns the bounds for which the timeline is visible.


isNextValidWayAvailable

public boolean isNextValidWayAvailable()
Checks to see if there are any valid waypoints after the current time.


rootModelExists

public boolean rootModelExists()

isActiveWaypointExist

public boolean isActiveWaypointExist()

isActiveProbeExist

public boolean isActiveProbeExist()

setTrackExpanded

public void setTrackExpanded(boolean expanded,
                             boolean isInput,
                             int modelIdx,
                             int trackIdx)
Specified by:
setTrackExpanded in class Timeline

setTrackMuted

public void setTrackMuted(boolean muted,
                          boolean isInput,
                          int modelIdx,
                          int trackIdx)
Specified by:
setTrackMuted in class Timeline

updateTimelineScroll

public void updateTimelineScroll()

rebuildWayPointTrack

public void rebuildWayPointTrack()

getProbeTrack

public Track getProbeTrack(Probe probe)

refreshProbeTrackDisplay

public void refreshProbeTrackDisplay()

getTrackAtYCoor

public Track getTrackAtYCoor(int yCoor,
                             boolean isInputTrack)

getYCoorUpToTrack

public int getYCoorUpToTrack(Track curTrack)
compute Y coordinate to track

Parameters:
curTrack -
Returns:
Y coordinate to track

getTrack

public Track getTrack(int trackIdx,
                      boolean isInput)

getProbeTrack

public artisynth.core.gui.timeline.TimelineController.ProbeTrack getProbeTrack()

addContiguousTrack

public void addContiguousTrack(Track src)

removeContiguousTrack

public void removeContiguousTrack(Track src)

isContiguousTrack

public boolean isContiguousTrack(Track src)
Determine if a track is part of the list of contiguous tracks or not.

Parameters:
src - The track to test if it is part of the contiguous list.
Returns:
True if the track is in the list of contiguous tracks, false otherwise.

removeAllContiguousTracks

public void removeAllContiguousTracks()

setLastEntered

public Track setLastEntered(Track src,
                            boolean group)
Set the value of the track that was last entered by the mouse. The src track is the track to be set as the currentTrack. If the src track is part of a group of tracks and the currentTrack is also part of the group then the currentTrack does not change. If the src track is in a new group of tracks then the last track in that group is set as the currentTrack. If the src track is a single track then it is set as the currentTrack.

Parameters:
src - The track that was entered.
group - If true then treat groups of tracks as one single track, if false then treate all tracks as single.

getTrackGroup

public java.util.ArrayList<Track> getTrackGroup(Track firstTrack)
Get the group of tracks that has the specified track as the first one in the group.

Parameters:
firstTrack - This must be the first track in the group of tracks that is being searched for.
Returns:
associated track group

getCurrentlyEnteredTrack

public Track getCurrentlyEnteredTrack()

groupTracks

public boolean groupTracks()

ungroupTracks

public void ungroupTracks(Track src)

showContiguousTracks

public void showContiguousTracks(Track src)

hideContiguousTracks

public void hideContiguousTracks(Track src)
Hide the contiguous tracks that are grouped with the src track.

Parameters:
src - The first track in the block of contiguous tracks to be hidden.

mouseReleased

public boolean mouseReleased()
When the left mouse button is released on a track this function is called to move the tracks around accordingly.

Returns:
True if tracks were moved around, false if tracks could not be moved becuase input and output tracks were being mixed.

updateCurrentWaypointShadow

public void updateCurrentWaypointShadow(int x)

executeDrop

public boolean executeDrop(int yCoor,
                           ProbeInfo pInfo,
                           Track origTrack)

schedulerActionPerformed

public void schedulerActionPerformed(Scheduler.Action action)
Specified by:
schedulerActionPerformed in interface SchedulerListener

getLargestProbeTime

public double getLargestProbeTime()

getNumberOfWayPoints

public int getNumberOfWayPoints()

getLargestWaypointTime

public double getLargestWaypointTime()

extendTimeline

public void extendTimeline()

setAllInputProbes

public void setAllInputProbes()

saveAllProbes

public void saveAllProbes()
Specified by:
saveAllProbes in class Timeline

zoom

public void zoom(int mode)

setVisible

public void setVisible(boolean visible)
Overrides:
setVisible in class java.awt.Window

selectionChanged

public void selectionChanged(SelectionEvent e)
Specified by:
selectionChanged in interface SelectionListener

getSelectedProbes

public java.util.ArrayList<ProbeInfo> getSelectedProbes()

getMultipleSelectionMask

public int getMultipleSelectionMask()

setMultipleSelectionMask

public void setMultipleSelectionMask(int mask)