com.dlsc.flexgantt.policy.layer
Class DefaultCrosshairPolicy

java.lang.Object
  extended by com.dlsc.flexgantt.policy.AbstractPolicy
      extended by 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:

For a more general description of this policy please refer to the policy interface ICrosshairPolicy.

Since:
1.0
Author:
Dirk Lemmermann

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.dlsc.flexgantt.policy.layer.ICrosshairPolicy
ICrosshairPolicy.LabelPosition
 
Constructor Summary
DefaultCrosshairPolicy()
           
 
Method Summary
 java.lang.String getLabel(java.lang.Object node, java.lang.Object timelineObject, 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.
 java.text.DateFormat getTimelineDateFormat()
          Returns the date formatting object used for formatting the date at the current crosshair cursor location.
 java.text.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(java.text.DateFormat format)
          Sets the date formatting object used for formatting the date at the current crosshair cursor location.
 void setTimelineObjectDateFormat(java.text.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 java.lang.String getLabel(java.lang.Object node,
                                 java.lang.Object timelineObject,
                                 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)
timelineObject - 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 java.text.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(java.text.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 java.text.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(java.text.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