public class Timeline
extends javax.swing.JPanel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CMD_APPLY
Action command used for the Apply button
|
static java.lang.String |
CMD_CANCEL
Action command used for the Cancel button
|
static java.lang.String |
CMD_OK
Action command used for the Cancel button
|
static java.awt.Cursor |
CURSOR_LEFT
The normal cursor_
|
static java.awt.Cursor |
CURSOR_MOVE
The normal cursor_
|
static java.awt.Cursor |
CURSOR_NORMAL
The normal cursor_
|
static java.awt.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 java.util.List |
sunriseDates
_more_
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
Timeline()
Default ctor
|
Timeline(java.util.Date start,
java.util.Date end)
Create a Timeline with the initial date range
|
Timeline(java.util.Date start,
java.util.Date end,
int initDimension)
ctor
|
Timeline(java.util.List times,
int initDimension)
ctor.
|
Timeline(java.util.List times,
int width,
int height)
ctor.
|
| Modifier and Type | Method and Description |
|---|---|
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(java.awt.Point p)
find closest thing
|
protected DatedThing |
findClosest(java.awt.Point p,
int minimumDistance)
find closest thing
|
java.lang.String |
format(java.util.Date date)
format date
|
java.lang.String |
format(long time)
format time
|
java.lang.String |
format(long time,
java.lang.String pattern)
format time
|
protected int |
getBaseLine()
get the axis line
|
protected int |
getBottom()
bottom of drawing area
|
java.awt.Color |
getColorTimeSelected()
Get the ColorTimeSelected property.
|
java.awt.Color |
getColorTimeUnselected()
Get the ColorTimeUnselected property.
|
javax.swing.JComponent |
getContents(boolean withButtons)
make gui
|
javax.swing.JComponent |
getContents(boolean withButtons,
boolean withBorder) |
java.util.List |
getDatedThings()
Get the list of dated things we are displaying
|
DateSelection |
getDateSelection()
Get the DateSelection property.
|
java.util.Date |
getEndDate()
Get the EndDate property.
|
java.lang.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(java.util.List items)
make menu items
|
protected int |
getRight()
right of drawing area
|
java.util.List |
getSelected()
Get the list of selected DatedThing-s
|
boolean |
getShortDisplay()
Get the ShortDisplay property.
|
boolean |
getShowIntervals()
Get the ShowIntervals property.
|
java.util.Date |
getStartDate()
Get the StartDate property.
|
boolean |
getSticky()
Get the Sticky property.
|
static java.util.TimeZone |
getTimeZone()
get default time zone
|
java.awt.Point |
getToolTipLocation(java.awt.event.MouseEvent e)
_more_
|
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
get tooltip
|
boolean |
getUseDateSelection()
Get the UseDateSelection property.
|
protected void |
init(java.util.Date start,
java.util.Date end)
initialize start/end time
|
protected void |
initGui()
make gui
|
static void |
main(java.lang.String[] args)
main
|
static javax.swing.JPanel |
makeButtons(java.awt.event.ActionListener l,
java.lang.String[] labels) |
static javax.swing.JPanel |
makeButtons(java.awt.event.ActionListener listener,
java.lang.String[] labels,
java.lang.String[] cmds) |
void |
makeCurrentRangeOriginal()
_more_
|
void |
makeSunriseDates() |
void |
mouseClicked(java.awt.event.MouseEvent e)
handle mouse event
|
void |
mouseDragged(java.awt.event.MouseEvent e)
handle mouse event
|
void |
mouseEntered(java.awt.event.MouseEvent e)
handle mouse event
|
void |
mouseExited(java.awt.event.MouseEvent e)
handle mouse event
|
void |
mouseMoved(java.awt.event.MouseEvent me)
handle mouse event
|
void |
mousePressed(java.awt.event.MouseEvent e)
handle mouse event
|
void |
mouseReleased(java.awt.event.MouseEvent e)
handle mouse event
|
void |
paint(java.awt.Graphics g)
paint
|
protected void |
paintAxis(java.awt.Graphics2D g)
paint axis
|
void |
paintBackgroundDecoration(java.awt.Graphics2D g)
paint after we filled the background but before we do anything else
|
protected void |
paintDateSelection(java.awt.Graphics2D g,
DateSelection dateSelection)
paint
|
protected void |
paintIntervals(java.awt.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(java.awt.Color value)
Set the ColorTimeSelected property.
|
void |
setColorTimeUnselected(java.awt.Color value)
Set the ColorTimeUnselected property.
|
void |
setCount(java.lang.Integer i)
set count
|
void |
setDatedThings(java.util.List l)
set list of things
|
void |
setDatedThings(java.util.List l,
boolean andSetRange)
set list of things
|
static void |
setDateFormat(java.lang.String format)
set the format
|
void |
setDateSelection(java.util.Date[] r)
set the range of the date selection
|
void |
setDateSelection(DateSelection dateSelection)
Set the date selection
|
void |
setEndDate(java.util.Date value)
Set the EndDate property.
|
void |
setGroup(java.util.List group)
set the group we're linked to
|
void |
setHighlightedDate(DatedThing d) |
void |
setInterval(java.lang.Double i)
set interval
|
void |
setIsCapableOfSelection(boolean value)
Set the IsCapableOfSelection property.
|
void |
setPostRange(java.lang.Double i)
set post range
|
void |
setPreRange(java.lang.Double i)
set pre range
|
void |
setRange(java.util.Date start,
java.util.Date end)
Set the StartDate property.
|
void |
setRange(java.util.Date start,
java.util.Date end,
boolean makeTheseTheOriginal)
_more_
|
void |
setSelected(java.util.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(java.lang.Integer i)
set skip
|
void |
setStartDate(java.util.Date value)
Set the StartDate property.
|
void |
setSticky(boolean sticky)
Set the Sticky property.
|
static void |
setTimeZone(java.util.TimeZone tz)
set timezone
|
void |
setUseDateSelection(boolean value)
Set the UseDateSelection property.
|
void |
setVisibleRange(java.util.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.
|
java.util.Date |
toDate(int location)
map x location to date
|
int |
toLocation(java.util.Date date)
map date to x location
|
int |
toLocation(long date)
map date to x
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, updateadd, 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, validateTreeaction, 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, transferFocusUpCyclepublic static java.lang.String CMD_APPLY
public static java.lang.String CMD_CANCEL
public static java.lang.String CMD_OK
public static final java.awt.Cursor CURSOR_NORMAL
public static final java.awt.Cursor CURSOR_MOVE
public static final java.awt.Cursor CURSOR_LEFT
public static final java.awt.Cursor CURSOR_RIGHT
public static final int DIM_TIME_HEIGHT
public static final int DRAGMODE_LEFT
public static final int DRAGMODE_RIGHT
public static final int DRAGMODE_CENTER
protected java.util.List sunriseDates
public Timeline()
public Timeline(java.util.List times,
int initDimension)
times - List of DatedThingsinitDimension - initial widthpublic Timeline(java.util.List times,
int width,
int height)
times - List of DatedThingswidth - init widthheight - init heightpublic Timeline(java.util.Date start,
java.util.Date end)
start - startend - endpublic Timeline(java.util.Date start,
java.util.Date end,
int initDimension)
start - startend - endinitDimension - widthpublic static java.util.TimeZone getTimeZone()
public static void setDateFormat(java.lang.String format)
format - formatpublic static void setTimeZone(java.util.TimeZone tz)
tz - timezoneprotected void initGui()
public void mouseMoved(java.awt.event.MouseEvent me)
mouseMoved in interface java.awt.event.MouseMotionListenerme - mouse eventpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - mouse eventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenere - mouse eventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenere - mouse eventpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenere - mouse eventpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenere - mouse eventpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenere - mouse eventpublic void setDateSelection(DateSelection dateSelection)
dateSelection - The date selectionpublic DateSelection getDateSelection()
public java.util.List getDatedThings()
public void setSelected(java.util.List l)
l - List of selected itemspublic void selectedDatesChanged()
public java.util.List getSelected()
protected void init(java.util.Date start,
java.util.Date end)
start - startend - endprotected void showPopupMenu(int x,
int y)
x - xy - ypublic void resetDateRange()
public void resetDateSelection()
public void setDateSelection(java.util.Date[] r)
r - rangepublic void setVisibleRange(java.util.Date[] r)
r - The date rangeprotected void getMenuItems(java.util.List items)
items - itemspublic void removeIntervals()
public void setSkipFactor(java.lang.Integer i)
i - skippublic void setInterval(java.lang.Double i)
i - intervalpublic void setPreRange(java.lang.Double i)
i - rangepublic void setPostRange(java.lang.Double i)
i - range_public void setCount(java.lang.Integer i)
i - countpublic void showProperties()
public static javax.swing.JPanel makeButtons(java.awt.event.ActionListener l,
java.lang.String[] labels)
public static javax.swing.JPanel makeButtons(java.awt.event.ActionListener listener,
java.lang.String[] labels,
java.lang.String[] cmds)
public void setSticky(boolean sticky)
sticky - The new value for Stickypublic boolean getSticky()
protected boolean dateSelectionActive()
public void setUseDateSelection(boolean value)
value - The new value for UseDateSelectionpublic boolean getUseDateSelection()
public void setShowIntervals(boolean value)
value - The new value for ShowIntervalspublic boolean getShowIntervals()
protected void dateSelectionChanged()
public void timelineChanged()
public void makeSunriseDates()
public void selectDaytime()
protected DatedThing findClosest(java.awt.Point p)
p - locationprotected DatedThing findClosest(java.awt.Point p, int minimumDistance)
p - locationminimumDistance - withinpublic java.awt.Point getToolTipLocation(java.awt.event.MouseEvent e)
getToolTipLocation in class javax.swing.JComponente - _more_public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
getToolTipText in class javax.swing.JComponentevent - eventpublic javax.swing.JComponent getContents(boolean withButtons)
withButtons - add dialog buttonspublic javax.swing.JComponent getContents(boolean withButtons,
boolean withBorder)
protected void doMakeContents(boolean withButtons)
withButtons - with dialog buttonsprotected void doMakeContents(boolean withButtons,
boolean withBorder)
protected void paintDateSelection(java.awt.Graphics2D g,
DateSelection dateSelection)
g - graphicsdateSelection - the date selectionprotected void paintIntervals(java.awt.Graphics2D g)
g - graphicsprotected int getBaseLine()
protected int getBottom()
protected int getLeft()
protected int getRight()
protected void paintAxis(java.awt.Graphics2D g)
g - graphicspublic void paintBackgroundDecoration(java.awt.Graphics2D g)
g - graphicspublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentg - graphicspublic void setHighlightedDate(DatedThing d)
public DatedThing getHighlightedDate()
public void setDatedThings(java.util.List l)
l - list of DatedThingspublic void setGroup(java.util.List group)
group - group of Timelinespublic void setDatedThings(java.util.List l,
boolean andSetRange)
l - list of DatedThingsandSetRange - also set the start/end visible rangepublic java.lang.String format(java.util.Date date)
date - datepublic java.lang.String getFormat()
public java.lang.String format(long time)
time - timepublic java.lang.String format(long time,
java.lang.String pattern)
time - timepattern - date formatprotected void reset(boolean doDateSelection)
doDateSelection - determines whether we reset the date selection range or the visible rangeprotected void shiftByPercent(double percent,
boolean doDateSelection)
percent - how muchdoDateSelection - visible or date selectionpublic void expandByPercent(double percent,
boolean doDateSelection)
percent - how muchdoDateSelection - visible or date selectionpublic java.util.Date toDate(int location)
location - xpublic int toLocation(java.util.Date date)
date - locationpublic int toLocation(long date)
date - datepublic void setRange(java.util.Date start,
java.util.Date end)
start - startend - endpublic void makeCurrentRangeOriginal()
public void setRange(java.util.Date start,
java.util.Date end,
boolean makeTheseTheOriginal)
start - _more_end - _more_makeTheseTheOriginal - _more_public void setStartDate(java.util.Date value)
value - The new value for StartDatepublic java.util.Date getStartDate()
public void setEndDate(java.util.Date value)
value - The new value for EndDatepublic java.util.Date getEndDate()
public boolean popup()
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - argsjava.lang.Exception - _more_public void setIsCapableOfSelection(boolean value)
value - The new value for IsCapableOfSelectionpublic boolean getIsCapableOfSelection()
public void setShortDisplay(boolean value)
value - The new value for ShortDisplaypublic boolean getShortDisplay()
public void setColorTimeSelected(java.awt.Color value)
value - The new value for ColorTimeSelectedpublic java.awt.Color getColorTimeSelected()
public void setColorTimeUnselected(java.awt.Color value)
value - The new value for ColorTimeUnselectedpublic java.awt.Color getColorTimeUnselected()