com.dlsc.flexgantt.swing.timeline
Class Dateline

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 com.dlsc.flexgantt.swing.timeline.Dateline
All Implemented Interfaces:
ICalendarModelListener, IDatelineModelListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
SimpleDateline

public class Dateline
extends javax.swing.JPanel
implements IDatelineModelListener, java.beans.PropertyChangeListener, java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.event.MouseMotionListener, ICalendarModelListener

The dateline is one part of the timeline (the Eventline is the other) and responsible for displaying dates. A date can be based on a standard time granularity such as hours, minutes, seconds. It can also just be time units such as one, two, three, etc...

To perform the actual rendering the dateline uses instances of type IDatelineRenderer that can be mapped to model classes. This way different renderers can be used for different dateline models.

The dateline is divided into an upper and a lower part. The upper part shows major time units, the lower part shows minor time units. An example for a major time unit is week. The matching minor time unit would be day.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
setDatelineRenderer(Class, IDatelineRenderer), Serialized Form

Nested Class Summary
static class Dateline.ZoomStrategy
          The zoom strategy defines how the zoom operation will be performed.
 
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
static java.lang.String PROPERTY_FOCUSED_TIME_SPAN
          A constant used for property change events that get fired when the focused time span changes.
static java.lang.String PROPERTY_MODEL
          A constant used for property change events that get fired when the dateline model changes.
static java.lang.String PROPERTY_POLICY_PROVIDER
          A constant used for property change events that get fired when the policy provider changes.
static java.lang.String PROPERTY_SELECTION_BACKGROUND_COLOR
          A constant used for property change events that get fired when the selection background color changes.
static java.lang.String PROPERTY_SELECTION_FOREGROUND_COLOR
          A constant used for property change events that get fired when the selection foreground color changes.
 
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
Dateline(Timeline timeline)
          Constructs a new dateline that uses the dateline model implementation TimeGranularityDatelineModel as its default model.
 
Method Summary
 void calendarChanged(CalendarModelEvent evt)
          Listener callback method that gets invoked whenever the calendar model changes.
 void datelineModelChanged(DatelineModelEvent e)
          The listener's callback method that gets invoked when the model's time span or time zone changes.
 void datelineModelWillChange(DatelineModelEvent evt)
          The listener's callback method that gets invoked when the model's time span or time zone will change.
 IDatelineRenderer getDatelineRenderer()
          Returns the currently used dateline renderer.
<T extends IDatelineModel>
IDatelineRenderer<T>
getDatelineRenderer(java.lang.Class<T> modelClass)
          Returns a dateline renderer for the given model type.
 ITimeSpan getFocusedTimeSpan()
          Returns the currently focused time span.
 IGranularity getGranularity()
          Returns the time granularity that the dateline model should use for calculating its minor grid.
 java.awt.Color getGridColor()
          Returns the color used by the dateline to draw its grid lines.
 java.awt.Color getManualZoomColor()
          Returns the color used to draw the manual zoom rectangle.
 IDatelineMenuProvider getMenuProvider()
          Returns the menu provider for the dateline.
 IDatelineModel getModel()
          Sets the model used by the dateline to convert time points to coordinates and coordinates to time points.
 IPolicyProvider getPolicyProvider()
          Returns the dateline's policy provider.
 java.awt.Dimension getPreferredSize()
           
 java.util.Map<java.lang.Class<? extends IDatelineModel>,IDatelineRenderer> getRendererMap()
          Returns the map used to store the mappings between dateline model classes and dateline renderers.
 ITimeSpan getSelectedTimeSpan()
          Returns the selected time span.
 java.awt.Color getSelectionBackground()
          Returns the selection background color.
 java.awt.Color getSelectionForegroundColor()
          Returns the selection foreground color.
 long getTimeAt(int x)
          Returns the time in millis at the given x-coordinate (location).
 Timeline getTimeline()
          Returns the parent timeline container of which the dateline is a member.
 int getTimeLocation(long time)
          Returns the location of the given time point.
 ITimeSpan getTimeSpan()
          Returns the time span represented by the dateline.
 ITimeSpan getTimeSpanAt(int x, boolean major)
          Returns the time span in which the given x-coordinate is located.
 java.util.TimeZone getTimeZone()
          Returns the time zone represented by the dateline.
 ITimeSpan getVisibleTimeSpan()
          Returns the currently visible time span.
 Dateline.ZoomStrategy getZoomStrategy()
          Returns the currently used zoom strategy.
 boolean isManualZoomEnabled()
          Determines if the manual zoom feature is enabled.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void mouseWheelMoved(java.awt.event.MouseWheelEvent evt)
           
 void openGotoSelection(javax.swing.JComponent parentComponent)
          Opens a selector that will allow the user to select a timepoint to which the dateline will scroll.
 void openHorizonSelector(javax.swing.JComponent parentComponent)
          Opens the UI component used to select a time span for display by the timeline.
protected  void paintCell(java.awt.Graphics g, ITimeSpan span, int x, int y, int width, int height, boolean major, boolean focus)
          Draws the content of a single time span cell.
protected  void paintComponent(java.awt.Graphics g)
           
protected  void paintGrid(java.awt.Graphics g)
          Paints the major and minor grid lines.
protected  void paintGrid(java.awt.Graphics g, int y, int height, java.util.List<GridLine> grid, boolean major)
          Paints the given grid lines.
protected  void paintSelectedTimeSpan(java.awt.Graphics g)
          Paints the time span selection.
protected  void paintZoomRectangle(java.awt.Graphics g, java.awt.Rectangle rect)
          Draws the rectangle used to visualize an ongoing manual zoom operation, where the user drags a grid line in order to manipulate the dateline model's zoom variable.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void requestVisibleTimeSpan(ITimeSpan span)
          Requests that the given time span will be made visible.
<T extends IDatelineModel>
void
setDatelineRenderer(java.lang.Class<T> modelClass, IDatelineRenderer<T> renderer)
          Specifies a dateline renderer implementation that will be used to draw the dateline if the dateline's model is of the given model type.
 void setFocusedTimeSpan(ITimeSpan span)
          Sets a new time span as the 'focused' time span.
 void setGranularity(IGranularity granularity)
          Specifies the time granularity that the dateline model should use for calculating its minor grid.
 void setGridColor(java.awt.Color color)
          Sets the color used by the dateline to draw its grid lines.
 void setManualZoomColor(java.awt.Color color)
          Sets the color used to draw the manual zoom rectangle.
 void setManualZoomEnabled(boolean enabled)
          Specifies if the manual zoom feature is enabled.
 void setMenuProvider(IDatelineMenuProvider provider)
          Sets the menu provider for the dateline.
 void setModel(IDatelineModel model)
          Sets the model used by the dateline to convert time points to coordinates and coordinates to time points.
 void setPolicyProvider(IPolicyProvider provider)
          Changes the dateline's policy provider.
 void setRendererMap(java.util.Map<java.lang.Class<? extends IDatelineModel>,IDatelineRenderer> map)
          Sets the map used to store the mappings between dateline model classes and dateline renderers.
 void setSelectedTimeSpan(ITimeSpan span)
          Sets the selected time span.
 void setSelectionBackground(java.awt.Color color)
          Sets the selection background color.
 void setSelectionForegroundColor(java.awt.Color color)
          Sets the selection foreground color.
 void setTimeSpan(ITimeSpan span)
          Sets the time span represented by the dateline.
 void setTimeZone(java.util.TimeZone timeZone)
          Sets a new time zone shown by the dateline.
 void setZoomStrategy(Dateline.ZoomStrategy strategy)
          Sets the currently used zoom strategy.
 void zoomIn()
          Zooms into the dateline.
 void zoomOut()
          Zooms out of the dateline.
 
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, 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, 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

PROPERTY_MODEL

public static final java.lang.String PROPERTY_MODEL
A constant used for property change events that get fired when the dateline model changes.

Since:
1.0
See Also:
setModel(IDatelineModel), Constant Field Values

PROPERTY_SELECTION_FOREGROUND_COLOR

public static final java.lang.String PROPERTY_SELECTION_FOREGROUND_COLOR
A constant used for property change events that get fired when the selection foreground color changes.

Since:
1.0
See Also:
setSelectionForegroundColor(Color), Constant Field Values

PROPERTY_SELECTION_BACKGROUND_COLOR

public static final java.lang.String PROPERTY_SELECTION_BACKGROUND_COLOR
A constant used for property change events that get fired when the selection background color changes.

Since:
1.0
See Also:
setSelectionBackground(Color), Constant Field Values

PROPERTY_POLICY_PROVIDER

public static final java.lang.String PROPERTY_POLICY_PROVIDER
A constant used for property change events that get fired when the policy provider changes.

Since:
1.0
See Also:
setSelectionBackground(Color), Constant Field Values

PROPERTY_FOCUSED_TIME_SPAN

public static final java.lang.String PROPERTY_FOCUSED_TIME_SPAN
A constant used for property change events that get fired when the focused time span changes.

Since:
1.0
See Also:
setFocusedTimeSpan(ITimeSpan), Constant Field Values
Constructor Detail

Dateline

public Dateline(Timeline timeline)
Constructs a new dateline that uses the dateline model implementation TimeGranularityDatelineModel as its default model. The dateline registers renderers for the TimeGranularityDatelineModel and the SimpleGranularityDatelineModel (TimeGranularityDatelineRenderer, SimpleGranularityDatelineRenderer).

Parameters:
timeline - the timeline that contains the dateline
Since:
1.0
Method Detail

getPolicyProvider

public IPolicyProvider getPolicyProvider()
Returns the dateline's policy provider.

Returns:
the container's policy provider
Since:
1.0

setPolicyProvider

public void setPolicyProvider(IPolicyProvider provider)
Changes the dateline's policy provider. Calling this method will cause a property change event to be fired where the property name is equal to PROPERTY_POLICY_PROVIDER.

Parameters:
provider - the new policy provider
Since:
1.0
See Also:
getPolicyProvider()

setModel

public void setModel(IDatelineModel model)
Sets the model used by the dateline to convert time points to coordinates and coordinates to time points. The dateline attaches itself to the given model as a dateline model listener. Calling this method will cause a property change event to be fired where the ID given to the event object is equal to PROPERTY_MODEL.

Parameters:
model -
Since:
1.0
See Also:
getModel(), SimpleGranularityDatelineModel, TimeGranularityDatelineModel

getModel

public IDatelineModel getModel()
Sets the model used by the dateline to convert time points to coordinates and coordinates to time points.

Returns:
the dateline model
Since:
1.0
See Also:
setModel(IDatelineModel)

setDatelineRenderer

public <T extends IDatelineModel> void setDatelineRenderer(java.lang.Class<T> modelClass,
                                                           IDatelineRenderer<T> renderer)
Specifies a dateline renderer implementation that will be used to draw the dateline if the dateline's model is of the given model type.

Type Parameters:
T - the type of the dateline model
Parameters:
modelClass - the model class to which the renderer gets mapped
renderer - the renderer to use for the given model
Since:
1.0
See Also:
getDatelineRenderer(), TimeGranularityDatelineModel, TimeGranularityDatelineRenderer, SimpleGranularityDatelineModel, SimpleGranularityDatelineRenderer

getDatelineRenderer

public <T extends IDatelineModel> IDatelineRenderer<T> getDatelineRenderer(java.lang.Class<T> modelClass)
Returns a dateline renderer for the given model type.

Type Parameters:
T - the type of the model
Parameters:
modelClass - the model class
Returns:
a renderer that fits to the given dateline model
Since:
1.0

getTimeline

public Timeline getTimeline()
Returns the parent timeline container of which the dateline is a member.

Returns:
the parent timeline
Since:
1.0

getTimeZone

public java.util.TimeZone getTimeZone()
Returns the time zone represented by the dateline. This is a convenience method which will delegate to IDatelineModel.getTimeZone().

Returns:
the time zone shown by the dateline
Since:
1.0
See Also:
setTimeZone(TimeZone)

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)
Sets a new time zone shown by the dateline. This is a convenience method which will delegate to IDatelineModel.setTimeZone(TimeZone).

Parameters:
timeZone - the new time zone to use
Since:
1.0
See Also:
getTimeZone()

getDatelineRenderer

public IDatelineRenderer getDatelineRenderer()
Returns the currently used dateline renderer. Which renderer gets used depends on the class of the currently used dateline model.

Returns:
the currently used dateline renderer
Since:
1.0
See Also:
setDatelineRenderer(Class, IDatelineRenderer), getDatelineRenderer(Class)

zoomIn

public void zoomIn()
Zooms into the dateline. This method will call IDatelineModel.requestVisibleTimeSpan(ITimeSpan).

Since:
1.0
See Also:
zoomOut()

zoomOut

public void zoomOut()
Zooms out of the dateline. This method will call IDatelineModel.requestVisibleTimeSpan(ITimeSpan).

Since:
1.0
See Also:
zoomOut()

setSelectedTimeSpan

public void setSelectedTimeSpan(ITimeSpan span)
Sets the selected time span.

Parameters:
span - the selected time span
Since:
1.0

getSelectedTimeSpan

public ITimeSpan getSelectedTimeSpan()
Returns the selected time span.

Returns:
the selected time span
Since:
1.0

getTimeLocation

public int getTimeLocation(long time)
Returns the location of the given time point. This method delegates its call to IDatelineModel.getTimeLocation(long).

Parameters:
time - the time for which to return an x-coordinate
Returns:
the location of the given time point
Since:
1.0
See Also:
getTimeAt(int)

getTimeSpan

public ITimeSpan getTimeSpan()
Returns the time span represented by the dateline. This is a convenience method that will delegate to IDatelineModel.getTimeSpan().

Returns:
the dateline's horizon
Since:
1.0
See Also:
setTimeSpan(ITimeSpan)

setGranularity

public void setGranularity(IGranularity granularity)
Specifies the time granularity that the dateline model should use for calculating its minor grid.

Parameters:
granularity - the granularity requested for the minor time grid
Since:
1.0

getGranularity

public IGranularity getGranularity()
Returns the time granularity that the dateline model should use for calculating its minor grid.

Returns:
the granularity requested for the minor time grid
Since:
1.0

setTimeSpan

public void setTimeSpan(ITimeSpan span)
Sets the time span represented by the dateline. This is a convenience method that delegates to IDatelineModel.setTimeSpan(ITimeSpan).

Parameters:
span - the dateline's horizon
Since:
1.0
See Also:
getTimeSpan()

getTimeAt

public long getTimeAt(int x)
Returns the time in millis at the given x-coordinate (location). This method will delegate to IDatelineModel.getTimeAt(int).

Parameters:
x - the location for which to return a time point
Returns:
the time (in milliseconds) at the given location
Since:
1.0

getTimeSpanAt

public ITimeSpan getTimeSpanAt(int x,
                               boolean major)
Returns the time span in which the given x-coordinate is located. This is a convenience method, which delegates to the dateline model method: IDatelineModel.getTimeSpanAt(int, boolean).

Parameters:
x - the x-coordinate to check
major - if TRUE the major grid will be checked (the minor grid if FALSE)
Returns:
the time span defined by the major or minor grid and the given x-coordinate
Since:
1.0

getVisibleTimeSpan

public ITimeSpan getVisibleTimeSpan()
Returns the currently visible time span.

Returns:
the visible time span
Since:
1.0

requestVisibleTimeSpan

public void requestVisibleTimeSpan(ITimeSpan span)
Requests that the given time span will be made visible. How this is done depends on the dateline model implementation. Ater the method has terminated it is not guaranteed that the requested time span will be equivalent to the visible time span. It might only be a part of the visible span. The underlying dateline model might also not be able at all to show the requested time span. In this case the model will throw an exception causing the dateline to emit a system beep.

Parameters:
span - the time span that is requested to be shown
Since:
1.0
See Also:
IDatelineModel.requestVisibleTimeSpan(ITimeSpan)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

paintGrid

protected void paintGrid(java.awt.Graphics g)
Paints the major and minor grid lines.

Parameters:
g - the graphics context into which to draw
Since:
1.0
See Also:
setGridColor(Color), paintGrid(Graphics, int, int, List, boolean), paintCell(Graphics, ITimeSpan, int, int, int, int, boolean, boolean)

paintSelectedTimeSpan

protected void paintSelectedTimeSpan(java.awt.Graphics g)
Paints the time span selection.

Parameters:
g - the graphics context into which to draw
Since:
1.0
See Also:
IDatelineModel.getSelectedTimeSpan()

paintGrid

protected void paintGrid(java.awt.Graphics g,
                         int y,
                         int height,
                         java.util.List<GridLine> grid,
                         boolean major)
Paints the given grid lines. This method gets called twice: once for the major grid on the upper half of the dateline and once for the minor grid on the lower half of the dateline.

Parameters:
g - the graphics context in which to draw
y - the y-coordinate (will be 0 when drawing the major time and getHeight() / 2 when drawing the minor time)
height - the height used for each half of the dateline (equals getHeight() / 2)
grid - a list of x-coordinates where two succeeding coordinates in combination with the given y-coordinate and the given height specify one cell that needs to be filled by the renderer
major - a flag indicating whether the given grid represents major or minor time
Since:
1.0

paintCell

protected void paintCell(java.awt.Graphics g,
                         ITimeSpan span,
                         int x,
                         int y,
                         int width,
                         int height,
                         boolean major,
                         boolean focus)
Draws the content of a single time span cell.

Parameters:
g - the graphics context in which to draw
span - the time span represented by the cell
x - the x-coordinate of the cell
y - the y-coordinate of the cell the y-coordinate (will be 0 when drawing the major time and getHeight() / 2 when drawing the minor time)
width - the width of the cell
height - the height used for each half of the dateline (equals getHeight() / 2)
major - a flag indicating whether the given grid represents major or minor time
focus -
Since:
1.0

paintZoomRectangle

protected void paintZoomRectangle(java.awt.Graphics g,
                                  java.awt.Rectangle rect)
Draws the rectangle used to visualize an ongoing manual zoom operation, where the user drags a grid line in order to manipulate the dateline model's zoom variable.

Parameters:
g - the graphics context into which to draw
rect - the zoom rectangle
Since:
1.0
See Also:
IDatelineModel.setZoom(double)

getSelectionForegroundColor

public java.awt.Color getSelectionForegroundColor()
Returns the selection foreground color.

Returns:
the color used for the foreground of selected time spans
Since:
1.0
See Also:
setSelectionForegroundColor(Color)

setSelectionForegroundColor

public void setSelectionForegroundColor(java.awt.Color color)
Sets the selection foreground color.

Parameters:
color - the color to use for the foreground of selected time spans
Since:
1.0
See Also:
getSelectionForegroundColor()

getSelectionBackground

public java.awt.Color getSelectionBackground()
Returns the selection background color.

Returns:
the selection background color
Since:
1.0
See Also:
setSelectionBackground(Color)

setSelectionBackground

public void setSelectionBackground(java.awt.Color color)
Sets the selection background color.

Parameters:
color - the color to use for the background of the currently selected time span
Since:
1.0
See Also:
getSelectionBackground()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

datelineModelWillChange

public void datelineModelWillChange(DatelineModelEvent evt)
Description copied from interface: IDatelineModelListener
The listener's callback method that gets invoked when the model's time span or time zone will change.

Specified by:
datelineModelWillChange in interface IDatelineModelListener
Parameters:
evt - the event that occured on the dateline

datelineModelChanged

public void datelineModelChanged(DatelineModelEvent e)
Description copied from interface: IDatelineModelListener
The listener's callback method that gets invoked when the model's time span or time zone changes.

Specified by:
datelineModelChanged in interface IDatelineModelListener
Parameters:
e - the event that occured on the dateline

getZoomStrategy

public Dateline.ZoomStrategy getZoomStrategy()
Returns the currently used zoom strategy. For information on the supported zoom operations, please refer to the documentation on Dateline.ZoomStrategy. The default value for the zoom strategy is Dateline.ZoomStrategy.CHANGE_VISIBLE_END_TIME.

Returns:
the currently used zoom strategy
Since:
1.0

setZoomStrategy

public void setZoomStrategy(Dateline.ZoomStrategy strategy)
Sets the currently used zoom strategy. For information on the supported zoom operations, please refer to the documentation on Dateline.ZoomStrategy.

Parameters:
strategy - the strategy used for zooming into the dateline
Since:
1.0

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt)
Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener

getMenuProvider

public IDatelineMenuProvider getMenuProvider()
Returns the menu provider for the dateline. The provider is used to return a popup menu for the dateline that is based on the time point where the popup trigger was received.

Returns:
the dateline's menu provider
Since:
1.0

setMenuProvider

public void setMenuProvider(IDatelineMenuProvider provider)
Sets the menu provider for the dateline. The provider is used to return a popup menu for the dateline that is based on the time point where the popup trigger was received.

Parameters:
provider - the dateline's menu provider
Since:
1.0

getGridColor

public java.awt.Color getGridColor()
Returns the color used by the dateline to draw its grid lines.

Returns:
the grid line color
Since:
1.0

setGridColor

public void setGridColor(java.awt.Color color)
Sets the color used by the dateline to draw its grid lines.

Parameters:
color - the grid line color
Since:
1.0

setFocusedTimeSpan

public void setFocusedTimeSpan(ITimeSpan span)
Sets a new time span as the 'focused' time span. A time span is the focused time span if the mouse cursor hovers over it.

Parameters:
span - the new focused time span
Since:
1.0

getFocusedTimeSpan

public ITimeSpan getFocusedTimeSpan()
Returns the currently focused time span. A time span is the focused time span if the mouse cursor hovers over it.

Returns:
the currently focused time span
Since:
1.0

calendarChanged

public void calendarChanged(CalendarModelEvent evt)
Description copied from interface: ICalendarModelListener
Listener callback method that gets invoked whenever the calendar model changes.

Specified by:
calendarChanged in interface ICalendarModelListener
Parameters:
evt - the change event with more information on the source of the change

getRendererMap

public java.util.Map<java.lang.Class<? extends IDatelineModel>,IDatelineRenderer> getRendererMap()
Returns the map used to store the mappings between dateline model classes and dateline renderers.

Returns:
the renderer map
Since:
1.0

setRendererMap

public void setRendererMap(java.util.Map<java.lang.Class<? extends IDatelineModel>,IDatelineRenderer> map)
Sets the map used to store the mappings between dateline model classes and dateline renderers.

Parameters:
map - the renderer map
Since:
1.0

getManualZoomColor

public java.awt.Color getManualZoomColor()
Returns the color used to draw the manual zoom rectangle.

Returns:
the color of the zoom rectangle
Since:
1.0

setManualZoomColor

public void setManualZoomColor(java.awt.Color color)
Sets the color used to draw the manual zoom rectangle.

Parameters:
color - the color of the zoom rectangle
Since:
1.0

isManualZoomEnabled

public boolean isManualZoomEnabled()
Determines if the manual zoom feature is enabled. This feature allows the user to perform a zoom by dragging a grid line to the left or right. The minimum zoom factor is 1.

Returns:
TRUE if the user can manually change the zoom variable in the dateline model
Since:
1.0
See Also:
IDatelineModel.setZoom(double)

setManualZoomEnabled

public void setManualZoomEnabled(boolean enabled)
Specifies if the manual zoom feature is enabled. This feature allows the user to perform a zoom by dragging a grid line to the left or right. The minimum zoom factor is 1.

Parameters:
enabled - if TRUE the user can manually change the zoom variable in the dateline model
Since:
1.0
See Also:
IDatelineModel.setZoom(double)

openHorizonSelector

public void openHorizonSelector(javax.swing.JComponent parentComponent)
Opens the UI component used to select a time span for display by the timeline.

Parameters:
parentComponent - the parent component
Since:
1.0

openGotoSelection

public void openGotoSelection(javax.swing.JComponent parentComponent)
Opens a selector that will allow the user to select a timepoint to which the dateline will scroll.

Parameters:
parentComponent - the parent component
Since:
1.0