com.dlsc.flexgantt.swing.timeline

## Class Dateline

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - com.dlsc.flexgantt.swing.timeline.Dateline

- All Implemented Interfaces:
    ICalendarModelListener, IDatelineModelListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible
  Direct Known Subclasses:
    MacDateline, SimpleDateline

      public class Dateline
      extends JPanel
      implements IDatelineModelListener, PropertyChangeListener, MouseListener, MouseWheelListener, 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
  Version:
    $Revision: 1.33 $
  Author:
    Dirk Lemmermann
  See Also:
    `setDatelineRenderer(Class, IDatelineRenderer)`, Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Dateline.ZoomStrategy` The zoom strategy defines how the zoom operation will be performed.

    - ### 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PROPERTY_FOCUS_BACKGROUND_COLOR` A constant used for property change events that get fired when the focus background color changes.
    `static String` | `PROPERTY_FOCUSED_TIME_SPAN` A constant used for property change events that get fired when the focused time span changes.
    `static String` | `PROPERTY_MODEL` A constant used for property change events that get fired when the dateline model changes.
    `static String` | `PROPERTY_POLICY_PROVIDER` A constant used for property change events that get fired when the policy provider changes.
    `static String` | `PROPERTY_SELECTION_BACKGROUND_COLOR` A constant used for property change events that get fired when the selection background color changes.
    `static 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

      `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
    Constructor and Description
    `Dateline(Timeline timeline)` Constructs a new dateline that uses the dateline model implementation `TimeGranularityDatelineModel` as its default model.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `int` | `getAnimationDuration()` Returns the duration of the animation that gets used during zoom in and out operations.
    `IDatelineRenderer` | `getDatelineRenderer()` Returns the currently used dateline renderer.
    `<T extends IDatelineModel> IDatelineRenderer<T>` | `getDatelineRenderer(Class<T> modelClass)` Returns a dateline renderer for the given model type.
    `Color` | `getFocusBackground()` Returns the focus background color.
    `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.
    `Color` | `getGridColor()` Returns the color used by the dateline to draw its grid lines.
    `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.
    `Dimension` | `getPreferredSize()`
    `Map<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.
    `Color` | `getSelectionBackground()` Returns the selection background color.
    `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.
    `ITimeSpan` | `getTimeSpanAt(Point p)` Returns the time span in which the given point is located.
    `TimeZone` | `getTimeZone()` Returns the time zone represented by the dateline.
    `ITimeSpan` | `getVisibleTimeSpan()` Returns the currently visible time span.
    `int` | `getZoomClicks()` Returns the number of clicks that are needed to trigger a zoom operation.
    `Dateline.ZoomStrategy` | `getZoomStrategy()` Returns the currently used zoom strategy.
    `boolean` | `isAnimatingZoom()` Determines whether the zoom in and out operations will use an animation for user feedback.
    `boolean` | `isAnimationThreadRunning()` Determines whether the dateline is currently animating a zoom operation.
    `boolean` | `isClickZoomEnabled()` Returns whether the user is allowed to click on a day or an hour to make them the new visible time span (default is true).
    `boolean` | `isFocusTimeSpanEnabled()` Returns whether the currently focused time span will be highlighted with a different background color.
    `boolean` | `isManualZoomEnabled()` Determines if the manual zoom feature is enabled.
    `void` | `mouseClicked(MouseEvent e)`
    `void` | `mouseDragged(MouseEvent e)`
    `void` | `mouseEntered(MouseEvent e)`
    `void` | `mouseExited(MouseEvent e)`
    `void` | `mouseMoved(MouseEvent e)`
    `void` | `mousePressed(MouseEvent e)`
    `void` | `mouseReleased(MouseEvent e)`
    `void` | `mouseWheelMoved(MouseWheelEvent evt)`
    `protected void` | `paintCell(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(Graphics g)`
    `protected void` | `paintGrid(Graphics g)` Paints the major and minor grid lines.
    `protected void` | `paintGrid(Graphics g, int y, int height, List<GridLine> grid, boolean major)` Paints the given grid lines.
    `protected void` | `paintSelectedTimeSpan(Graphics g)` Paints the time span selection.
    `protected void` | `paintZoomRectangle(Graphics g, 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(PropertyChangeEvent evt)`
    `void` | `requestVisibleTimeSpan(ITimeSpan span)` Requests that the given time span will be made visible.
    `void` | `setAnimatingZoom(boolean animate)` Specifies whether the zoom in and out operations will use an animation for user feedback.
    `void` | `setAnimationDuration(int duration)` Sets the duration of the animation that gets used during zoom in and out operations.
    `void` | `setClickZoomEnabled(boolean enabled)` Controls whether the user is allowed to click on a day or an hour to make them the new visible time span (default is true).
    `<T extends IDatelineModel> void` | `setDatelineRenderer(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` | `setFocusBackground(Color color)` Sets the focus background color.
    `void` | `setFocusedTimeSpan(ITimeSpan span)` Sets a new time span as the 'focused' time span.
    `void` | `setFocusTimeSpanEnabled(boolean enabled)` Controls whether the currently focused time span will be highlighted with a different background color.
    `void` | `setGranularity(IGranularity granularity)` Specifies the time granularity that the dateline model should use for calculating its minor grid.
    `void` | `setGridColor(Color color)` Sets the color used by the dateline to draw its grid lines.
    `void` | `setManualZoomColor(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(Map<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(Color color)` Sets the selection background color.
    `void` | `setSelectionForegroundColor(Color color)` Sets the selection foreground color.
    `void` | `setTimeSpan(ITimeSpan span)` Sets the time span represented by the dateline.
    `void` | `setTimeZone(TimeZone timeZone)` Sets a new time zone shown by the dateline.
    `void` | `setZoomClicks(int zoomClicks)` Specifies how many clicks are needed to trigger a zoom operation.
    `void` | `setZoomStrategy(Dateline.ZoomStrategy strategy)` Sets the currently used zoom strategy.
    `void` | `showTime(long time, boolean center)` Requests that the given time will be shown by the Gantt chart.
    `void` | `showTimeNow(boolean center)` Requests that the time now will be shown by the Gantt chart.
    `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, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### PROPERTY_MODEL

          public static final 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 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 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_FOCUS_BACKGROUND_COLOR

          public static final String PROPERTY_FOCUS_BACKGROUND_COLOR

      A constant used for property change events that get fired when the focus background color changes.
      Since:
        2.0
      See Also:
        `setFocusBackground(Color)`, Constant Field Values

    - #### PROPERTY_POLICY_PROVIDER

          public static final 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 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(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(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 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(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(Point p)

      Returns the time span in which the given point is located. The y coordinate of the point will be used whether to return a major or a minor time span.
      Parameters:
        `p` - the coordinate to check
      Returns:
        the time span defined by the major or minor grid and the given coordinate
      Since:
        1.1

    - #### 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

    - #### showTimeNow

          public void showTimeNow(boolean center)

      Requests that the time now will be shown by the Gantt chart. This is a convenience method, which delegates to `AbstractGanttChart.showTimeNow(boolean)`.
      Parameters:
        `center` - if TRUE the time now will be shown in the center / middle of the layer container, otherwise it will be on the left edge of the layer container
      Since:
        1.1
      See Also:
        `showTime(long, boolean)`

    - #### showTime

          public void showTime(long time,
                               boolean center)

      Requests that the given time will be shown by the Gantt chart. This is a convenience method, which delegates to `AbstractGanttChart.showTime(long, boolean)`.
      Parameters:
        `time` - the time to make visible
        `center` - if TRUE the time now will be shown in the center / middle of the layer container, otherwise it will be on the left edge of the layer container
      Since:
        1.1
      See Also:
        `showTimeNow(boolean)`

    - #### 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)`

    - #### isAnimationThreadRunning

          public boolean isAnimationThreadRunning()

      Determines whether the dateline is currently animating a zoom operation.
      Returns:
        TRUE if the dateline is animating a zoom operation
      Since:
        1.1

    - #### getPreferredSize

          public Dimension getPreferredSize()

      Overrides:
        `getPreferredSize` in class `JComponent`

    - #### paintComponent

          protected void paintComponent(Graphics g)

      Overrides:
        `paintComponent` in class `JComponent`

    - #### paintGrid

          protected void paintGrid(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(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(Graphics g,
                                   int y,
                                   int height,
                                   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(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` - if TRUE the cell is the current focus owner
      Since:
        1.0

    - #### paintZoomRectangle

          protected void paintZoomRectangle(Graphics g,
                                            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 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(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 Color getSelectionBackground()

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

    - #### setSelectionBackground

          public void setSelectionBackground(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()`

    - #### getFocusBackground

          public Color getFocusBackground()

      Returns the focus background color.
      Returns:
        the focus background color
      Since:
        2.0
      See Also:
        `setFocusBackground(Color)`

    - #### setFocusBackground

          public void setFocusBackground(Color color)

      Sets the focus background color.
      Parameters:
        `color` - the color to use for the background of the currently focused time span
      Since:
        2.0
      See Also:
        `getFocusBackground()`

    - #### propertyChange

          public void propertyChange(PropertyChangeEvent evt)

      Specified by:
        `propertyChange` in interface `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

    - #### setClickZoomEnabled

          public void setClickZoomEnabled(boolean enabled)

      Controls whether the user is allowed to click on a day or an hour to make them the new visible time span (default is true).
      Parameters:
        `enabled` - if TRUE the user can zoom into time spans by clicking on them
      Since:
        2.0

    - #### isClickZoomEnabled

          public boolean isClickZoomEnabled()

      Returns whether the user is allowed to click on a day or an hour to make them the new visible time span (default is true).
      Returns:
        TRUE if the user can zoom into time spans by clicking on them
      Since:
        2.0

    - #### mouseClicked

          public void mouseClicked(MouseEvent e)

      Specified by:
        `mouseClicked` in interface `MouseListener`

    - #### mousePressed

          public void mousePressed(MouseEvent e)

      Specified by:
        `mousePressed` in interface `MouseListener`

    - #### mouseReleased

          public void mouseReleased(MouseEvent e)

      Specified by:
        `mouseReleased` in interface `MouseListener`

    - #### setFocusTimeSpanEnabled

          public void setFocusTimeSpanEnabled(boolean enabled)

      Controls whether the currently focused time span will be highlighted with a different background color.
      Parameters:
        `enabled` - TRUE if the background color of the focused time span will change (default is TRUE)
      Since:
        2.0
      See Also:
        `setFocusBackground(Color)`

    - #### isFocusTimeSpanEnabled

          public boolean isFocusTimeSpanEnabled()

      Returns whether the currently focused time span will be highlighted with a different background color.
      Returns:
        TRUE if the background will be changed
      Since:
        2.0
      See Also:
        `setFocusBackground(Color)`

    - #### mouseMoved

          public void mouseMoved(MouseEvent e)

      Specified by:
        `mouseMoved` in interface `MouseMotionListener`

    - #### mouseEntered

          public void mouseEntered(MouseEvent e)

      Specified by:
        `mouseEntered` in interface `MouseListener`

    - #### mouseExited

          public void mouseExited(MouseEvent e)

      Specified by:
        `mouseExited` in interface `MouseListener`

    - #### mouseDragged

          public void mouseDragged(MouseEvent e)

      Specified by:
        `mouseDragged` in interface `MouseMotionListener`

    - #### mouseWheelMoved

          public void mouseWheelMoved(MouseWheelEvent evt)

      Specified by:
        `mouseWheelMoved` in interface `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 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(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 Map<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(Map<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

    - #### setZoomClicks

          public void setZoomClicks(int zoomClicks)

      Specifies how many clicks are needed to trigger a zoom operation. Possible zoom operations are: a click inside a time span (make time span use the entire viewport), a click on the border of a time span (reset zoom factor to 1).
      Parameters:
        `zoomClicks` - number of mouse clicks needed to trigger a zoom operation
      Since:
        2.1

    - #### getZoomClicks

          public int getZoomClicks()

      Returns the number of clicks that are needed to trigger a zoom operation. Possible zoom operations are: a click inside a time span (make time span use the entire viewport), a click on the border of a time span (reset zoom factor to 1).
      Returns:
        number of mouse clicks needed to trigger a zoom operation
      Since:
        2.1

    - #### getManualZoomColor

          public 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(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)`

    - #### isAnimatingZoom

          public boolean isAnimatingZoom()

      Determines whether the zoom in and out operations will use an animation for user feedback.
      Returns:
        TRUE if the dateline animates zooming operations
      Since:
        1.0
      See Also:
        `setAnimationDuration(int)`

    - #### setAnimatingZoom

          public void setAnimatingZoom(boolean animate)

      Specifies whether the zoom in and out operations will use an animation for user feedback.
      Parameters:
        `animate` - if TRUE the dateline will animate zooming operations
      Since:
        1.0
      See Also:
        `setAnimationDuration(int)`

    - #### getAnimationDuration

          public int getAnimationDuration()

      Returns the duration of the animation that gets used during zoom in and out operations.
      Returns:
        the duration of the zoom animation
      Since:
        1.1

    - #### setAnimationDuration

          public void setAnimationDuration(int duration)

      Sets the duration of the animation that gets used during zoom in and out operations.
      Parameters:
        `duration` - the duration of the zoom animation
      Since:
        1.1

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.