com.dlsc.flexgantt.policy.layer

## Class DefaultCrosshairPolicy

- java.lang.Object
- - com.dlsc.flexgantt.policy.AbstractPolicy
  - - com.dlsc.flexgantt.policy.layer.DefaultCrosshairPolicy

- All Implemented Interfaces:
    IPolicy, ICrosshairPolicy

      public class DefaultCrosshairPolicy
      extends AbstractPolicy
      implements ICrosshairPolicy

  The default implementation of the crosshair policy displays the following information in the four corners of the crosshair:
  - UPPER_LEFT: the time span of the timeline object on which the crosshair cursor is hovering (if there is one, blank otherwise)
  - UPPER_RIGHT: the time at the current crosshair cursor position
  - LOWER_LEFT: the name of the timeline object on which the crosshair cursor is hovering (if there is one, blank otherwise)
  - LOWER_RIGHT: the name of the hierarchy node that belongs to the row over which the crosshair cursor is hovering
  For a more general description of this policy please refer to the policy interface `ICrosshairPolicy`.
  Since:
    1.0
  Version:
    $Revision: 1.11 $
  Author:
    Dirk Lemmermann

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.dlsc.flexgantt.policy.layer.ICrosshairPolicy

      `ICrosshairPolicy.LabelPosition`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCrosshairPolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getLabel(Object node, TimelineObjectPath path, IGanttChartModel model, long time, ICrosshairPolicy.LabelPosition position)` Returns a label that will be shown to the left/right and top/bottom of the crosshair location.
    `DateFormat` | `getTimelineDateFormat()` Returns the date formatting object used for formatting the date at the current crosshair cursor location.
    `DateFormat` | `getTimelineObjectDateFormat()` Returns the date formatting object used for formatting the date information provided by the timeline object over which the crosshair cursor is hovering
    `boolean` | `isLabelVisible(ICrosshairPolicy.LabelPosition position)` Determines whether a label is visible at all.
    `void` | `setTimelineDateFormat(DateFormat format)` Sets the date formatting object used for formatting the date at the current crosshair cursor location.
    `void` | `setTimelineObjectDateFormat(DateFormat format)` Sets the date formatting object used for formatting the date information provided by the timeline object over which the crosshair cursor is hovering

    - ### Methods inherited from class com.dlsc.flexgantt.policy.AbstractPolicy

      `assertClass`

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

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

- - ### Constructor Detail

    - #### DefaultCrosshairPolicy

          public DefaultCrosshairPolicy()

  - ### Method Detail

    - #### getLabel

          public String getLabel(Object node,
                                 TimelineObjectPath path,
                                 IGanttChartModel model,
                                 long time,
                                 ICrosshairPolicy.LabelPosition position)

      Description copied from interface: `ICrosshairPolicy`
      Returns a label that will be shown to the left/right and top/bottom of the crosshair location. These labels could also be called label decorators of the crosshair.
      Specified by:
        `getLabel` in interface `ICrosshairPolicy`
      Parameters:
        `node` - the tree node to the left of the crosshair cursor (might be NULL if the crosshair is below the last row)
        `path` - the timeline object over which the crosshair is currently hovering (might be NULL if the crosshair is not on top of an object)
        `model` - the data source of the tree node and timeline object
        `time` - the time at the current location of the crosshair
        `position` - the position where the label will be placed
      Returns:
        a label to be shown next to the crosshair circle

    - #### isLabelVisible

          public boolean isLabelVisible(ICrosshairPolicy.LabelPosition position)

      Description copied from interface: `ICrosshairPolicy`
      Determines whether a label is visible at all.
      Specified by:
        `isLabelVisible` in interface `ICrosshairPolicy`
      Parameters:
        `position` - the positon to check for visibility
      Returns:
        TRUE if the label should be shown to the user

    - #### getTimelineDateFormat

          public DateFormat getTimelineDateFormat()

      Returns the date formatting object used for formatting the date at the current crosshair cursor location.
      Returns:
        the date formatter used for displaying the dateline time
      Since:
        1.0

    - #### setTimelineDateFormat

          public void setTimelineDateFormat(DateFormat format)

      Sets the date formatting object used for formatting the date at the current crosshair cursor location.
      Parameters:
        `format` - the date formatter used for displaying the dateline time
      Since:
        1.0

    - #### getTimelineObjectDateFormat

          public DateFormat getTimelineObjectDateFormat()

      Returns the date formatting object used for formatting the date information provided by the timeline object over which the crosshair cursor is hovering
      Returns:
        the date formatter used for displaying the timeline object time
      Since:
        1.0

    - #### setTimelineObjectDateFormat

          public void setTimelineObjectDateFormat(DateFormat format)

      Sets the date formatting object used for formatting the date information provided by the timeline object over which the crosshair cursor is hovering
      Parameters:
        `format` - the date formatter used for displaying the timeline object time
      Since:
        1.0

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