public class TimeLine extends JPanel
This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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 |
addVetoableChangeListener(VetoableChangeListener listener)
add a vetoable property change listener to the time line.
|
protected void |
fireVetoableChange(PropertyChangeEvent evt)
fires a vetoable change event to all listeners of the timeline
|
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
|
String |
getMode()
get the time line's mode
|
TimeLineModel |
getModel() |
float |
getPointForTime(Time time)
get the x coordinate for specified time
|
List |
getSelectedNodes()
get the list of nodes in the timeline which are currently selected
|
Date |
getStartDate()
get the start date
|
Time |
getStartTime()
get the starting value in the timeline
|
Time |
getTimeForDate(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
|
List |
getTimeLineNodes()
get the time line nodes in a uneditable list
|
Iterator |
getTimeLineNodesIterator()
get an iterator for the time line nodes
|
String |
getToolTipText(MouseEvent event) |
String |
getUnitsType()
get the unit types to display in the timeline
|
float |
getVerticalSpacer() |
void |
handleKeyEvent(KeyEvent evt)
this method handles any key events received by the panel.
|
protected void |
handleMouseClicked(MouseEvent evt)
this method handles any mouse clicked events
|
protected void |
handleMousePressed(MouseEvent evt)
this method handles any mouse pressed or mouse released events
|
boolean |
isLabelsAtTop() |
static void |
main(String[] args)
test main (allan)
|
void |
moveDisplayAreaBy(Time time)
move the display window of the timeline by the specified amount
|
protected void |
paintCenterLine(Graphics2D g2)
paint the component
|
protected void |
paintComponent(Graphics grph)
paint the component
|
protected void |
paintEndLabel(Graphics2D g2)
paint the timeline end label in the current units.
|
protected void |
paintNodes(Graphics2D g2)
paint the timeline nodes.
|
protected void |
paintStartLabel(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(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(String mode)
set the mode of the time line
|
void |
setModel(TimeLineModel model)
Set the model (allan: added this method)
|
void |
setStartDate(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(String unitType)
Set the unit types to display in the timeline.
|
void |
setVerticalSpacer(float f) |
protected void |
updateExternal() |
protected void |
validatePropertyChange(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(Point centerPt)
zoom the time line in with center point centerPt being at the center
|
void |
zoomOut()
zoom the time line out
|
void |
zoomOut(Point centerPt)
zoom the time line out with center point centerPt being at the center
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final String DATE_VIEW
public static final String TIME_VIEW
public static final String DISPLAY_WINDOW_CHANGE
public static final String NODE_ADDED
public static final String NODE_REMOVED
public static final String SELECTION_MODE
public static final String ZOOM_MODE
protected static final double MIN_DISPLAY_WINDOW
public static final Cursor DEFAULT_CURSOR
protected Comparator _comparator
protected float _handleHeight
protected float _verticalSpacer
protected Line2D.Float _centerLine
protected List _nodes
protected List _vetoableListeners
protected int _intervalCount
protected String _mode
protected String _unitType
protected Time _displayStart
protected Time _displayEnd
protected Time _intervalInTime
protected TimeLineModel _model
protected boolean _labelsAtTop
protected MouseAdapter _mouseListener
protected MouseMotionAdapter _mouseDragListener
protected KeyAdapter _keyListener
protected VetoableChangeListener _myChildListener
protected PropertyChangeListener _myModelListener
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 modelpublic void addTimeLineNode(TimeLineNode node) throws IllegalNodePositionException
IllegalNodePositionException
public TimeLineModel getModel()
public void setModel(TimeLineModel model)
protected void addSilentTimeLineNode(TimeLineNode node)
public void setUnitsType(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 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(Graphics grph)
paintComponent
in class JComponent
protected void paintCenterLine(Graphics2D g2)
protected void paintStartLabel(Graphics2D g2)
protected void paintEndLabel(Graphics2D g2)
protected void paintNodes(Graphics2D g2)
public Time getDisplayStart()
public Time getDisplayEnd()
public Iterator getTimeLineNodesIterator()
public List getTimeLineNodes()
public void handleKeyEvent(KeyEvent evt)
public void addVetoableChangeListener(VetoableChangeListener listener)
addVetoableChangeListener
in class JComponent
public void removeVetoableChangeListener(VetoableChangeListener listener)
removeVetoableChangeListener
in class JComponent
public void setMode(String mode)
public Time getTimeForPoint(float xValue)
public float getPointForTime(Time time)
public Date getDateForTime(Time time)
public Time getTimeForDate(Date date)
public void setStartDate(Date date)
public Date getStartDate()
public Time getStartTime()
public Time getEndTime()
public List getSelectedNodes()
public String getMode()
protected void validatePropertyChange(PropertyChangeEvent evt) throws DetailedPropertyVetoException
DetailedPropertyVetoException
protected void fireVetoableChange(PropertyChangeEvent evt) throws DetailedPropertyVetoException
DetailedPropertyVetoException
protected void handleMouseClicked(MouseEvent evt)
protected void handleMousePressed(MouseEvent evt)
public void zoomIn()
public void zoomOut()
public void zoomIn(Point centerPt)
centerPt
- the point to center the zoom aroundpublic void zoomOut(Point centerPt)
centerPt
- the point to center the zoom aroundpublic String getToolTipText(MouseEvent event)
getToolTipText
in class JComponent
protected void updateExternal()
public static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.