ucar.unidata.ui
Class Timeline

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ucar.unidata.ui.Timeline
All Implemented Interfaces:
MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
IdvTimeline

public class Timeline
extends JPanel
implements MouseListener, MouseMotionListener

Widget for selecting dates and times

Version:
$Revision: 1.36 $
Author:
IDV Development Team
See Also:
Serialized Form

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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String CMD_APPLY
          Action command used for the Apply button
static String CMD_CANCEL
          Action command used for the Cancel button
static String CMD_OK
          Action command used for the Cancel button
static Cursor CURSOR_LEFT
          The normal cursor_
static Cursor CURSOR_MOVE
          The normal cursor_
static Cursor CURSOR_NORMAL
          The normal cursor_
static Cursor CURSOR_RIGHT
          The normal cursor_
static int DIM_TIME_HEIGHT
          drawing size
static int DRAGMODE_CENTER
          when dragging the date selection box what are we dragging
static int DRAGMODE_LEFT
          when dragging the date selection box what are we dragging
static int DRAGMODE_RIGHT
          when dragging the date selection box what are we dragging
protected  List sunriseDates
          _more_
 
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()
          Default ctor
Timeline(Date start, Date end)
          Create a Timeline with the initial date range
Timeline(Date start, Date end, int initDimension)
          ctor
Timeline(List times, int initDimension)
          ctor.
Timeline(List times, int width, int height)
          ctor.
 
Method Summary
protected  boolean dateSelectionActive()
          are we using the date selection
protected  void dateSelectionChanged()
          handle changed date selection
protected  void doMakeContents(boolean withButtons)
          make gui
protected  void doMakeContents(boolean withButtons, boolean withBorder)
           
 void expandByPercent(double percent, boolean doDateSelection)
          zoom
protected  DatedThing findClosest(Point p)
          find closest thing
protected  DatedThing findClosest(Point p, int minimumDistance)
          find closest thing
 String format(Date date)
          format date
 String format(long time)
          format time
 String format(long time, String pattern)
          format time
protected  int getBaseLine()
          get the axis line
protected  int getBottom()
          bottom of drawing area
 Color getColorTimeSelected()
          Get the ColorTimeSelected property.
 Color getColorTimeUnselected()
          Get the ColorTimeUnselected property.
 JComponent getContents(boolean withButtons)
          make gui
 JComponent getContents(boolean withButtons, boolean withBorder)
           
 List getDatedThings()
          Get the list of dated things we are displaying
 DateSelection getDateSelection()
          Get the DateSelection property.
 Date getEndDate()
          Get the EndDate property.
 String getFormat()
          get the format to use given the size of the visible range
 DatedThing getHighlightedDate()
           
 boolean getIsCapableOfSelection()
          Get the IsCapableOfSelection property.
protected  int getLeft()
          left of drawing area
protected  void getMenuItems(List items)
          make menu items
protected  int getRight()
          right of drawing area
 List getSelected()
          Get the list of selected DatedThing-s
 boolean getShortDisplay()
          Get the ShortDisplay property.
 boolean getShowIntervals()
          Get the ShowIntervals property.
 Date getStartDate()
          Get the StartDate property.
 boolean getSticky()
          Get the Sticky property.
static TimeZone getTimeZone()
          get default time zone
 Point getToolTipLocation(MouseEvent e)
          _more_
 String getToolTipText(MouseEvent event)
          get tooltip
 boolean getUseDateSelection()
          Get the UseDateSelection property.
protected  void init(Date start, Date end)
          initialize start/end time
protected  void initGui()
          make gui
static void main(String[] args)
          main
static JPanel makeButtons(ActionListener l, String[] labels)
           
static JPanel makeButtons(ActionListener listener, String[] labels, String[] cmds)
           
 void makeCurrentRangeOriginal()
          _more_
 void makeSunriseDates()
           
 void mouseClicked(MouseEvent e)
          handle mouse event
 void mouseDragged(MouseEvent e)
          handle mouse event
 void mouseEntered(MouseEvent e)
          handle mouse event
 void mouseExited(MouseEvent e)
          handle mouse event
 void mouseMoved(MouseEvent me)
          handle mouse event
 void mousePressed(MouseEvent e)
          handle mouse event
 void mouseReleased(MouseEvent e)
          handle mouse event
 void paint(Graphics g)
          paint
protected  void paintAxis(Graphics2D g)
          paint axis
 void paintBackgroundDecoration(Graphics2D g)
          paint after we filled the background but before we do anything else
protected  void paintDateSelection(Graphics2D g, DateSelection dateSelection)
          paint
protected  void paintIntervals(Graphics2D g)
          paint intervals
 boolean popup()
          popup timeline in a dialog
 void removeIntervals()
          clear intervals
protected  void reset(boolean doDateSelection)
          reset range
 void resetDateRange()
          reset to original date range
 void resetDateSelection()
          reset to original date selection
 void selectDaytime()
          _more_
 void selectedDatesChanged()
          _more_
 void setColorTimeSelected(Color value)
          Set the ColorTimeSelected property.
 void setColorTimeUnselected(Color value)
          Set the ColorTimeUnselected property.
 void setCount(Integer i)
          set count
 void setDatedThings(List l)
          set list of things
 void setDatedThings(List l, boolean andSetRange)
          set list of things
static void setDateFormat(String format)
          set the format
 void setDateSelection(Date[] r)
          set the range of the date selection
 void setDateSelection(DateSelection dateSelection)
          Set the date selection
 void setEndDate(Date value)
          Set the EndDate property.
 void setGroup(List group)
          set the group we're linked to
 void setHighlightedDate(DatedThing d)
           
 void setInterval(Double i)
          set interval
 void setIsCapableOfSelection(boolean value)
          Set the IsCapableOfSelection property.
 void setPostRange(Double i)
          set post range
 void setPreRange(Double i)
          set pre range
 void setRange(Date start, Date end)
          Set the StartDate property.
 void setRange(Date start, Date end, boolean makeTheseTheOriginal)
          _more_
 void setSelected(List l)
          Set the list of selected items
 void setShortDisplay(boolean value)
          Set the ShortDisplay property.
 void setShowIntervals(boolean value)
          Set the ShowIntervals property.
 void setSkipFactor(Integer i)
          set skip
 void setStartDate(Date value)
          Set the StartDate property.
 void setSticky(boolean sticky)
          Set the Sticky property.
static void setTimeZone(TimeZone tz)
          set timezone
 void setUseDateSelection(boolean value)
          Set the UseDateSelection property.
 void setVisibleRange(Date[] r)
          set the visible range
protected  void shiftByPercent(double percent, boolean doDateSelection)
          shift left/right a percentage
protected  void showPopupMenu(int x, int y)
          popup menu at
 void showProperties()
          show properties dialog
 void timelineChanged()
          The timeline changed.
 Date toDate(int location)
          map x location to date
 int toLocation(Date date)
          map date to x location
 int toLocation(long date)
          map date to x
 
Methods 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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, 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

CMD_APPLY

public static String CMD_APPLY
Action command used for the Apply button


CMD_CANCEL

public static String CMD_CANCEL
Action command used for the Cancel button


CMD_OK

public static String CMD_OK
Action command used for the Cancel button


CURSOR_NORMAL

public static final Cursor CURSOR_NORMAL
The normal cursor_


CURSOR_MOVE

public static final Cursor CURSOR_MOVE
The normal cursor_


CURSOR_LEFT

public static final Cursor CURSOR_LEFT
The normal cursor_


CURSOR_RIGHT

public static final Cursor CURSOR_RIGHT
The normal cursor_


DIM_TIME_HEIGHT

public static final int DIM_TIME_HEIGHT
drawing size

See Also:
Constant Field Values

DRAGMODE_LEFT

public static final int DRAGMODE_LEFT
when dragging the date selection box what are we dragging

See Also:
Constant Field Values

DRAGMODE_RIGHT

public static final int DRAGMODE_RIGHT
when dragging the date selection box what are we dragging

See Also:
Constant Field Values

DRAGMODE_CENTER

public static final int DRAGMODE_CENTER
when dragging the date selection box what are we dragging