Package ucar.unidata.ui
Class Timeline
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ucar.unidata.ui.Timeline
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
- Direct Known Subclasses:
IdvTimeline
Widget for selecting dates and times
- Version:
- $Revision: 1.36 $
- Author:
- IDV Development Team
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic String
Action command used for the Apply buttonstatic String
Action command used for the Cancel buttonstatic String
Action command used for the Cancel buttonstatic final Cursor
The normal cursor_static final Cursor
The normal cursor_static final Cursor
The normal cursor_static final Cursor
The normal cursor_static final int
drawing sizestatic final int
when dragging the date selection box what are we draggingstatic final int
when dragging the date selection box what are we draggingstatic final int
when dragging the date selection box what are we draggingprotected List
_more_Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
are we using the date selectionprotected void
handle changed date selectionprotected void
doMakeContents
(boolean withButtons) make guiprotected void
doMakeContents
(boolean withButtons, boolean withBorder) void
expandByPercent
(double percent, boolean doDateSelection) zoomprotected DatedThing
findClosest
(Point p) find closest thingprotected DatedThing
findClosest
(Point p, int minimumDistance) find closest thingformat
(long time) format timeformat timeformat dateprotected int
get the axis lineprotected int
bottom of drawing areaGet the ColorTimeSelected property.Get the ColorTimeUnselected property.getContents
(boolean withButtons) make guigetContents
(boolean withButtons, boolean withBorder) Get the list of dated things we are displayingGet the DateSelection property.Get the EndDate property.get the format to use given the size of the visible rangeboolean
Get the IsCapableOfSelection property.protected int
getLeft()
left of drawing areaprotected void
getMenuItems
(List items) make menu itemsprotected int
getRight()
right of drawing areaGet the list of selected DatedThing-sboolean
Get the ShortDisplay property.boolean
Get the ShowIntervals property.Get the StartDate property.boolean
Get the Sticky property.static TimeZone
get default time zone_more_getToolTipText
(MouseEvent event) get tooltipboolean
Get the UseDateSelection property.protected void
initialize start/end timeprotected void
initGui()
make guistatic void
mainstatic JPanel
makeButtons
(ActionListener l, String[] labels) static JPanel
makeButtons
(ActionListener listener, String[] labels, String[] cmds) void
_more_void
void
handle mouse eventvoid
handle mouse eventvoid
handle mouse eventvoid
handle mouse eventvoid
mouseMoved
(MouseEvent me) handle mouse eventvoid
handle mouse eventvoid
handle mouse eventvoid
paintprotected void
paint axisvoid
paint after we filled the background but before we do anything elseprotected void
paintDateSelection
(Graphics2D g, DateSelection dateSelection) paintprotected void
paint intervalsboolean
popup()
popup timeline in a dialogvoid
clear intervalsprotected void
reset
(boolean doDateSelection) reset rangevoid
reset to original date rangevoid
reset to original date selectionvoid
_more_void
_more_void
setColorTimeSelected
(Color value) Set the ColorTimeSelected property.void
setColorTimeUnselected
(Color value) Set the ColorTimeUnselected property.void
set countvoid
set list of thingsvoid
setDatedThings
(List l, boolean andSetRange) set list of thingsstatic void
setDateFormat
(String format) set the formatvoid
setDateSelection
(Date[] r) set the range of the date selectionvoid
setDateSelection
(DateSelection dateSelection) Set the date selectionvoid
setEndDate
(Date value) Set the EndDate property.void
set the group we're linked tovoid
void
set intervalvoid
setIsCapableOfSelection
(boolean value) Set the IsCapableOfSelection property.void
set post rangevoid
set pre rangevoid
Set the StartDate property.void
_more_void
setSelected
(List l) Set the list of selected itemsvoid
setShortDisplay
(boolean value) Set the ShortDisplay property.void
setShowIntervals
(boolean value) Set the ShowIntervals property.void
set skipvoid
setStartDate
(Date value) Set the StartDate property.void
setSticky
(boolean sticky) Set the Sticky property.static void
setTimeZone
(TimeZone tz) set timezonevoid
setUseDateSelection
(boolean value) Set the UseDateSelection property.void
setVisibleRange
(Date[] r) set the visible rangeprotected void
shiftByPercent
(double percent, boolean doDateSelection) shift left/right a percentageprotected void
showPopupMenu
(int x, int y) popup menu atvoid
show properties dialogvoid
The timeline changed.toDate
(int location) map x location to dateint
toLocation
(long date) map date to xint
toLocation
(Date date) map date to x locationMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
CMD_APPLY
Action command used for the Apply button -
CMD_CANCEL
Action command used for the Cancel button -
CMD_OK
Action command used for the Cancel button -
CURSOR_NORMAL
The normal cursor_ -
CURSOR_MOVE
The normal cursor_ -
CURSOR_LEFT
The normal cursor_ -
CURSOR_RIGHT
The normal cursor_ -
DIM_TIME_HEIGHT
public static final int DIM_TIME_HEIGHTdrawing size- See Also:
-
DRAGMODE_LEFT
public static final int DRAGMODE_LEFTwhen dragging the date selection box what are we dragging- See Also:
-
DRAGMODE_RIGHT
public static final int DRAGMODE_RIGHTwhen dragging the date selection box what are we dragging- See Also:
-
DRAGMODE_CENTER
public static final int DRAGMODE_CENTERwhen dragging the date selection box what are we dragging- See Also:
-
sunriseDates
_more_
-
-
Constructor Details
-
Timeline
public Timeline()Default ctor -
Timeline
ctor. start and end date is the min/max of the times- Parameters:
times
- List of DatedThingsinitDimension
- initial width
-
Timeline
ctor. start and end date is the min/max of the times- Parameters:
times
- List of DatedThingswidth
- init widthheight
- init height
-
Timeline
Create a Timeline with the initial date range- Parameters:
start
- startend
- end
-
Timeline
ctor- Parameters:
start
- startend
- endinitDimension
- width
-
-
Method Details
-
getTimeZone
get default time zone- Returns:
- time zone
-
setDateFormat
set the format- Parameters:
format
- format
-
setTimeZone
set timezone- Parameters:
tz
- timezone
-
initGui
protected void initGui()make gui -
mouseMoved
handle mouse event- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Parameters:
me
- mouse event
-
mouseDragged
handle mouse event- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Parameters:
e
- mouse event
-
mouseExited
handle mouse event- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
e
- mouse event
-
mouseEntered
handle mouse event- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
e
- mouse event
-
mouseClicked
handle mouse event- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
e
- mouse event
-
mousePressed
handle mouse event- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
e
- mouse event
-
mouseReleased
handle mouse event- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
e
- mouse event
-
setDateSelection
Set the date selection- Parameters:
dateSelection
- The date selection
-
getDateSelection
Get the DateSelection property.- Returns:
- The DateSelection
-
getDatedThings
Get the list of dated things we are displaying- Returns:
- List of dated things
-
setSelected
Set the list of selected items- Parameters:
l
- List of selected items
-
selectedDatesChanged
public void selectedDatesChanged()_more_ -
getSelected
Get the list of selected DatedThing-s- Returns:
- The Selected things
-
init
initialize start/end time- Parameters:
start
- startend
- end
-
showPopupMenu
protected void showPopupMenu(int x, int y) popup menu at- Parameters:
x
- xy
- y
-
resetDateRange
public void resetDateRange()reset to original date range -
resetDateSelection
public void resetDateSelection()reset to original date selection -
setDateSelection
set the range of the date selection- Parameters:
r
- range
-
setVisibleRange
set the visible range- Parameters:
r
- The date range
-
getMenuItems
make menu items- Parameters:
items
- items
-
removeIntervals
public void removeIntervals()clear intervals -
setSkipFactor
set skip- Parameters:
i
- skip
-
setInterval
set interval- Parameters:
i
- interval
-
setPreRange
set pre range- Parameters:
i
- range
-
setPostRange
set post range- Parameters:
i
- range_
-
setCount
set count- Parameters:
i
- count
-
showProperties
public void showProperties()show properties dialog -
makeButtons
-
makeButtons
-
setSticky
public void setSticky(boolean sticky) Set the Sticky property.- Parameters:
sticky
- The new value for Sticky
-
getSticky
public boolean getSticky()Get the Sticky property.- Returns:
- The Sticky
-
dateSelectionActive
protected boolean dateSelectionActive()are we using the date selection- Returns:
- using the date selection
-
setUseDateSelection
public void setUseDateSelection(boolean value) Set the UseDateSelection property.- Parameters:
value
- The new value for UseDateSelection
-
getUseDateSelection
public boolean getUseDateSelection()Get the UseDateSelection property.- Returns:
- The UseDateSelection
-
setShowIntervals
public void setShowIntervals(boolean value) Set the ShowIntervals property.- Parameters:
value
- The new value for ShowIntervals
-
getShowIntervals
public boolean getShowIntervals()Get the ShowIntervals property.- Returns:
- The ShowIntervals
-
dateSelectionChanged
protected void dateSelectionChanged()handle changed date selection -
timelineChanged
public void timelineChanged()The timeline changed. repaint, etc. -
makeSunriseDates
public void makeSunriseDates() -
selectDaytime
public void selectDaytime()_more_ -
findClosest
find closest thing- Parameters:
p
- location- Returns:
- closest thing
-
findClosest
find closest thing- Parameters:
p
- locationminimumDistance
- within- Returns:
- closest thing
-
getToolTipLocation
_more_- Overrides:
getToolTipLocation
in classJComponent
- Parameters:
e
- _more_- Returns:
- _more_
-
getToolTipText
get tooltip- Overrides:
getToolTipText
in classJComponent
- Parameters:
event
- event- Returns:
- tooltip
-
getContents
make gui- Parameters:
withButtons
- add dialog buttons- Returns:
- gui
-
getContents
-
doMakeContents
protected void doMakeContents(boolean withButtons) make gui- Parameters:
withButtons
- with dialog buttons
-
doMakeContents
protected void doMakeContents(boolean withButtons, boolean withBorder) -
paintDateSelection
paint- Parameters:
g
- graphicsdateSelection
- the date selection
-
paintIntervals
paint intervals- Parameters:
g
- graphics
-
getBaseLine
protected int getBaseLine()get the axis line- Returns:
- axis line location
-
getBottom
protected int getBottom()bottom of drawing area- Returns:
- bottom
-
getLeft
protected int getLeft()left of drawing area- Returns:
- left
-
getRight
protected int getRight()right of drawing area- Returns:
- right
-
paintAxis
paint axis- Parameters:
g
- graphics
-
paintBackgroundDecoration
paint after we filled the background but before we do anything else- Parameters:
g
- graphics
-
paint
paint- Overrides:
paint
in classJComponent
- Parameters:
g
- graphics
-
setHighlightedDate
-
getHighlightedDate
-
setDatedThings
set list of things- Parameters:
l
- list of DatedThings
-
setGroup
set the group we're linked to- Parameters:
group
- group of Timelines
-
setDatedThings
set list of things- Parameters:
l
- list of DatedThingsandSetRange
- also set the start/end visible range
-
format
format date- Parameters:
date
- date- Returns:
- date formatted
-
getFormat
get the format to use given the size of the visible range- Returns:
- format
-
format
format time- Parameters:
time
- time- Returns:
- formatted time
-
format
format time- Parameters:
time
- timepattern
- date format- Returns:
- formatted time
-
reset
protected void reset(boolean doDateSelection) reset range- Parameters:
doDateSelection
- determines whether we reset the date selection range or the visible range
-
shiftByPercent
protected void shiftByPercent(double percent, boolean doDateSelection) shift left/right a percentage- Parameters:
percent
- how muchdoDateSelection
- visible or date selection
-
expandByPercent
public void expandByPercent(double percent, boolean doDateSelection) zoom- Parameters:
percent
- how muchdoDateSelection
- visible or date selection
-
toDate
map x location to date- Parameters:
location
- x- Returns:
- date
-
toLocation
map date to x location- Parameters:
date
- location- Returns:
- x
-
toLocation
public int toLocation(long date) map date to x- Parameters:
date
- date- Returns:
- x
-
setRange
Set the StartDate property.- Parameters:
start
- startend
- end
-
makeCurrentRangeOriginal
public void makeCurrentRangeOriginal()_more_ -
setRange
_more_- Parameters:
start
- _more_end
- _more_makeTheseTheOriginal
- _more_
-
setStartDate
Set the StartDate property.- Parameters:
value
- The new value for StartDate
-
getStartDate
Get the StartDate property.- Returns:
- The StartDate
-
setEndDate
Set the EndDate property.- Parameters:
value
- The new value for EndDate
-
getEndDate
Get the EndDate property.- Returns:
- The EndDate
-
popup
public boolean popup()popup timeline in a dialog- Returns:
- ok
-
main
main- Parameters:
args
- args- Throws:
Exception
- _more_
-
setIsCapableOfSelection
public void setIsCapableOfSelection(boolean value) Set the IsCapableOfSelection property.- Parameters:
value
- The new value for IsCapableOfSelection
-
getIsCapableOfSelection
public boolean getIsCapableOfSelection()Get the IsCapableOfSelection property.- Returns:
- The IsCapableOfSelection
-
setShortDisplay
public void setShortDisplay(boolean value) Set the ShortDisplay property.- Parameters:
value
- The new value for ShortDisplay
-
getShortDisplay
public boolean getShortDisplay()Get the ShortDisplay property.- Returns:
- The ShortDisplay
-
setColorTimeSelected
Set the ColorTimeSelected property.- Parameters:
value
- The new value for ColorTimeSelected
-
getColorTimeSelected
Get the ColorTimeSelected property.- Returns:
- The ColorTimeSelected
-
setColorTimeUnselected
Set the ColorTimeUnselected property.- Parameters:
value
- The new value for ColorTimeUnselected
-
getColorTimeUnselected
Get the ColorTimeUnselected property.- Returns:
- The ColorTimeUnselected
-