com.dlsc.flexgantt.policy.layer
Class DefaultDragInfoPolicy

java.lang.Object
  extended by com.dlsc.flexgantt.policy.AbstractPolicy
      extended by com.dlsc.flexgantt.policy.layer.DefaultDragInfoPolicy
All Implemented Interfaces:
IPolicy, IDragInfoPolicy
Direct Known Subclasses:
TimeGranularityDragInfoPolicy

public class DefaultDragInfoPolicy
extends AbstractPolicy
implements IDragInfoPolicy

The default implementation of the drag info policy will simply create a string that contains the time span passed to the policy. This implementation is sufficient if for example the SimpleGranularityDatelineModel is in use.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultDragInfoPolicy()
           
 
Method Summary
 java.text.NumberFormat getCapacityFormatter()
          Returns the formatter that is being used to format the capacity used value into a nice text.
 java.lang.Object getDragInfo(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model, int rowHeight, int y, double capacityUsed)
          Returns an object that can be used to show information while the user interactively changes the capacity used value.
 java.lang.Object getDragInfo(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model, long timePoint, double percentageComplete)
          Returns an object that can be used to show information while the user interactively changes the percentage complete value.
 java.lang.Object getDragInfo(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model, java.lang.Object dropNode, ITimeSpan dropSpan)
          Returns an object that can be used to show information during a drag operation (e.g. time span over which the dragged timeline object hovers).
 java.text.NumberFormat getPercentageFormatter()
          Returns the formatter that is being used to format the percentage complete value into a nice text.
 void setCapacityFormatter(java.text.NumberFormat formatter)
          Sets the formatter that is being used to format the percentage complete value into a nice text.
 void setPercentageFormatter(java.text.NumberFormat formatter)
          Sets the formatter that is being used to format the percentage complete value into a nice text.
 
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

DefaultDragInfoPolicy

public DefaultDragInfoPolicy()
Method Detail

getDragInfo

public java.lang.Object getDragInfo(java.lang.Object node,
                                    java.lang.Object timelineObject,
                                    IGanttChartModel model,
                                    java.lang.Object dropNode,
                                    ITimeSpan dropSpan)
Description copied from interface: IDragInfoPolicy
Returns an object that can be used to show information during a drag operation (e.g. time span over which the dragged timeline object hovers). The default implementation returns the timeline object itself.

Specified by:
getDragInfo in interface IDragInfoPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the dragged object
model - the model to which the dragged timeline object belongs
dropNode - the tree node over which the dragged object hovers
dropSpan - the span over which the dragged object hovers
Returns:
an arbitrary object that can contain information relevant for a drag info renderer

getDragInfo

public java.lang.Object getDragInfo(java.lang.Object node,
                                    java.lang.Object timelineObject,
                                    IGanttChartModel model,
                                    long timePoint,
                                    double percentageComplete)
Description copied from interface: IDragInfoPolicy
Returns an object that can be used to show information while the user interactively changes the percentage complete value.

Specified by:
getDragInfo in interface IDragInfoPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the dragged object
model - the model to which the dragged timeline object belongs
timePoint - the current (grid adjusted) time at the cursor location
percentageComplete - the percentage complete value of the activity object
Returns:
an arbitrary object that can contain information relevant for a drag info renderer

getDragInfo

public java.lang.Object getDragInfo(java.lang.Object node,
                                    java.lang.Object timelineObject,
                                    IGanttChartModel model,
                                    int rowHeight,
                                    int y,
                                    double capacityUsed)
Description copied from interface: IDragInfoPolicy
Returns an object that can be used to show information while the user interactively changes the capacity used value.

Specified by:
getDragInfo in interface IDragInfoPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the dragged object
model - the model to which the dragged timeline object belongs
rowHeight - the height of the row in which the drag operation takes place
y - the current y coordinate relative to the coordinate system of the row (0 = bottom of row)
capacityUsed - the capacity used value of the capacity object
Returns:
an arbitrary object that can contain information relevant for a drag info renderer

getPercentageFormatter

public java.text.NumberFormat getPercentageFormatter()
Returns the formatter that is being used to format the percentage complete value into a nice text.

Returns:
the formatter for the percentage complete text
Since:
1.0
See Also:
getDragInfo(Object, Object, IGanttChartModel, long, double)

setPercentageFormatter

public void setPercentageFormatter(java.text.NumberFormat formatter)
Sets the formatter that is being used to format the percentage complete value into a nice text.

Parameters:
formatter - the formatter for the percentage complete text
Since:
1.0
See Also:
getDragInfo(Object, Object, IGanttChartModel, long, double)

getCapacityFormatter

public java.text.NumberFormat getCapacityFormatter()
Returns the formatter that is being used to format the capacity used value into a nice text.

Returns:
the formatter for the percentage complete text
Since:
1.0
See Also:
getDragInfo(Object, Object, IGanttChartModel, int, int, double)

setCapacityFormatter

public void setCapacityFormatter(java.text.NumberFormat formatter)
Sets the formatter that is being used to format the percentage complete value into a nice text.

Parameters:
formatter - the formatter for the percentage complete text
Since:
1.0
See Also:
getDragInfo(Object, Object, IGanttChartModel, int, int, double)