|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jsky.timeline.TimeLine
public class TimeLine
A time line which can contain nodes that can be adjusted by time and duration.
This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected java.awt.geom.Line2D.Float |
_centerLine
|
protected java.util.Comparator |
_comparator
|
protected Time |
_displayEnd
|
protected Time |
_displayStart
|
protected float |
_handleHeight
|
protected int |
_intervalCount
|
protected Time |
_intervalInTime
|
protected java.awt.event.KeyAdapter |
_keyListener
|
protected boolean |
_labelsAtTop
|
protected java.lang.String |
_mode
|
protected TimeLineModel |
_model
|
protected java.awt.event.MouseMotionAdapter |
_mouseDragListener
an adapter used to handle mouse drag events |
protected java.awt.event.MouseAdapter |
_mouseListener
a listener for mouse events. |
protected java.beans.VetoableChangeListener |
_myChildListener
|
protected java.beans.PropertyChangeListener |
_myModelListener
|
protected java.util.TreeSet |
_nodes
|
protected java.lang.String |
_unitType
|
protected float |
_verticalSpacer
|
protected java.util.List |
_vetoableListeners
|
static java.lang.String |
DATE_VIEW
|
static java.awt.Cursor |
DEFAULT_CURSOR
|
static java.lang.String |
DISPLAY_WINDOW_CHANGE
|
protected static double |
MIN_DISPLAY_WINDOW
|
static java.lang.String |
NODE_ADDED
|
static java.lang.String |
NODE_REMOVED
|
static java.lang.String |
SELECTION_MODE
|
static java.lang.String |
TIME_VIEW
|
static java.lang.String |
ZOOM_MODE
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TimeLine()
constructor |
|
TimeLine(int interval)
constructor |
|
TimeLine(int start,
int end,
int intervals)
constructor |
|
TimeLine(TimeLineModel model)
constructor |
|
TimeLine(Time start,
Time end,
int intervals)
constructor |
Method Summary | |
---|---|
protected void |
addSilentTimeLineNode(TimeLineNode node)
add a time line node to the time line without checking its legality |
void |
addTimeLineNode(TimeLineNode node)
add a time line node to the time line |
void |
addTimeLineNodeNoEvents(TimeLineNode node)
Add a time line node to the time line and save time by not checking or firing events. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
add a vetoable property change listener to the time line. |
protected void |
fireVetoableChange(java.beans.PropertyChangeEvent evt)
fires a vetoable change event to all listeners of the timeline |
java.util.Date |
getDateForTime(Time time)
takes a time and converts it into a date where the new date is equal to the start date + the time |
Time |
getDisplayEnd()
get the displayed end of the timeline |
Time |
getDisplayStart()
get the displayed start of the timeline |
Time |
getEndTime()
get the ending value of the timeline |
float |
getHandleHeight()
|
int |
getIntervalCount()
get the number of intervals in the time line |
Time |
getIntervalTime()
get the time value of a single interval in the timeline |
java.lang.String |
getMode()
get the time line's mode |
TimeLineModel |
getModel()
|
float |
getPointForTime(Time time)
get the x coordinate for specified time |
java.util.List |
getSelectedNodes()
get the list of nodes in the timeline which are currently selected |
java.util.Date |
getStartDate()
get the start date |
Time |
getStartTime()
get the starting value in the timeline |
Time |
getTimeForDate(java.util.Date date)
takes a date and convert it to a time where the new time is equal to the date - start date |
Time |
getTimeForPoint(float xValue)
get the time value of an X coordinate in the TimeLine |
java.util.Iterator |
getTimeLineNodesIterator()
get an iterator for the time line nodes |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
|
java.lang.String |
getUnitsType()
get the unit types to display in the timeline |
float |
getVerticalSpacer()
|
void |
handleKeyEvent(java.awt.event.KeyEvent evt)
this method handles any key events received by the panel. |
protected void |
handleMouseClicked(java.awt.event.MouseEvent evt)
this method handles any mouse clicked events |
protected void |
handleMousePressed(java.awt.event.MouseEvent evt)
this method handles any mouse pressed or mouse released events |
boolean |
isLabelsAtTop()
|
static void |
main(java.lang.String[] args)
test main (allan) |
void |
moveDisplayAreaBy(Time time)
move the display window of the timeline by the specified amount |
protected void |
paintCenterLine(java.awt.Graphics2D g2)
paint the component |
protected void |
paintComponent(java.awt.Graphics grph)
paint the component |
protected void |
paintEndLabel(java.awt.Graphics2D g2)
paint the timeline end label in the current units. |
protected void |
paintNodes(java.awt.Graphics2D g2)
paint the timeline nodes. |
protected void |
paintStartLabel(java.awt.Graphics2D g2)
paint the timeline start label in the current units. |
void |
removeAllTimeLineNodes()
remove all time line nodes from time line |
void |
removeTimeLineNode(TimeLineNode node)
remove a time line node from the time line |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
remove a vetoable property change listener from the time line |
void |
resetDisplayArea()
reset the display window to show all data |
void |
setDisplayArea(Time start,
Time end)
sets the diplay window of the timeline |
void |
setHandleHeight(float f)
|
void |
setLabelsAtTop(boolean b)
|
void |
setMode(java.lang.String mode)
set the mode of the time line |
void |
setModel(TimeLineModel model)
Set the model (allan: added this method) |
void |
setStartDate(java.util.Date date)
set the date from which the timeline should start Note: if the date is not null then all time values are considered offsets from it |
void |
setUnitsType(java.lang.String unitType)
Set the unit types to display in the timeline. |
void |
setVerticalSpacer(float f)
|
protected void |
validatePropertyChange(java.beans.PropertyChangeEvent evt)
takes a PropertyChangeEvent and throws a PropertyVetoException if anything in the event would cause it to be rejected |
void |
zoomIn()
zoom the time line in |
void |
zoomIn(java.awt.Point centerPt)
zoom the time line in with center point centerPt being at the center |
void |
zoomOut()
zoom the time line out |
void |
zoomOut(java.awt.Point centerPt)
zoom the time line out with center point centerPt being at the center |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DATE_VIEW
public static final java.lang.String TIME_VIEW
public static final java.lang.String DISPLAY_WINDOW_CHANGE
public static final java.lang.String NODE_ADDED
public static final java.lang.String NODE_REMOVED
public static final java.lang.String SELECTION_MODE
public static final java.lang.String ZOOM_MODE
protected static final double MIN_DISPLAY_WINDOW
public static final java.awt.Cursor DEFAULT_CURSOR
protected java.util.Comparator _comparator
protected float _handleHeight
protected float _verticalSpacer
protected java.awt.geom.Line2D.Float _centerLine
protected java.util.TreeSet _nodes
protected java.util.List _vetoableListeners
protected int _intervalCount
protected java.lang.String _mode
protected java.lang.String _unitType
protected Time _displayStart
protected Time _displayEnd
protected Time _intervalInTime
protected TimeLineModel _model
protected boolean _labelsAtTop
protected java.awt.event.MouseAdapter _mouseListener
protected java.awt.event.MouseMotionAdapter _mouseDragListener
protected java.awt.event.KeyAdapter _keyListener
protected java.beans.VetoableChangeListener _myChildListener
protected java.beans.PropertyChangeListener _myModelListener
Constructor Detail |
---|
public TimeLine()
public TimeLine(int interval)
interval
- the number of intervals in a 50 minute time linepublic TimeLine(int start, int end, int intervals)
start
- the starting minute of the timelineend
- the ending minute of the timelineintervals
- the number of intervals on the timelinepublic TimeLine(Time start, Time end, int intervals)
start
- the starting time of the timelineend
- the ending time of the timelineintervals
- the number of intervals on the timelinepublic TimeLine(TimeLineModel model)
model
- the time line modelMethod Detail |
---|
public void addTimeLineNode(TimeLineNode node) throws IllegalNodePositionException
IllegalNodePositionException
public void addTimeLineNodeNoEvents(TimeLineNode node) throws IllegalNodePositionException
IllegalNodePositionException
public TimeLineModel getModel()
public void setModel(TimeLineModel model)
protected void addSilentTimeLineNode(TimeLineNode node)
public void setUnitsType(java.lang.String unitType)
public boolean isLabelsAtTop()
public void setLabelsAtTop(boolean b)
public float getHandleHeight()
public void setHandleHeight(float f)
public float getVerticalSpacer()
public void setVerticalSpacer(float f)
public java.lang.String getUnitsType()
public void setDisplayArea(Time start, Time end)
public void resetDisplayArea()
public void moveDisplayAreaBy(Time time)
public void removeTimeLineNode(TimeLineNode node)
public void removeAllTimeLineNodes()
public Time getIntervalTime()
public int getIntervalCount()
protected void paintComponent(java.awt.Graphics grph)
paintComponent
in class javax.swing.JComponent
protected void paintCenterLine(java.awt.Graphics2D g2)
protected void paintStartLabel(java.awt.Graphics2D g2)
protected void paintEndLabel(java.awt.Graphics2D g2)
protected void paintNodes(java.awt.Graphics2D g2)
public Time getDisplayStart()
public Time getDisplayEnd()
public java.util.Iterator getTimeLineNodesIterator()
public void handleKeyEvent(java.awt.event.KeyEvent evt)
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
addVetoableChangeListener
in class javax.swing.JComponent
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
removeVetoableChangeListener
in class javax.swing.JComponent
public void setMode(java.lang.String mode)
public Time getTimeForPoint(float xValue)
public float getPointForTime(Time time)
public java.util.Date getDateForTime(Time time)
public Time getTimeForDate(java.util.Date date)
public void setStartDate(java.util.Date date)
public java.util.Date getStartDate()
public Time getStartTime()
public Time getEndTime()
public java.util.List getSelectedNodes()
public java.lang.String getMode()
protected void validatePropertyChange(java.beans.PropertyChangeEvent evt) throws DetailedPropertyVetoException
DetailedPropertyVetoException
protected void fireVetoableChange(java.beans.PropertyChangeEvent evt) throws DetailedPropertyVetoException
DetailedPropertyVetoException
protected void handleMouseClicked(java.awt.event.MouseEvent evt)
protected void handleMousePressed(java.awt.event.MouseEvent evt)
public void zoomIn()
public void zoomOut()
public void zoomIn(java.awt.Point centerPt)
centerPt
- the point to center the zoom aroundpublic void zoomOut(java.awt.Point centerPt)
centerPt
- the point to center the zoom aroundpublic java.lang.String getToolTipText(java.awt.event.MouseEvent event)
getToolTipText
in class javax.swing.JComponent
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |