com.dlsc.flexgantt.swing.layer.system
Class DefaultEditModeController

java.lang.Object
  extended by com.dlsc.flexgantt.swing.layer.system.DefaultEditModeController
All Implemented Interfaces:
IEditModeController
Direct Known Subclasses:
ActivityObjectEditModeController, CapacityObjectEditModeController

public class DefaultEditModeController
extends java.lang.Object
implements IEditModeController

The default edit mode controller specifies the editing behaviour used for timeline objects of type DefaultTimelineObject. The editor lets the user change the start and end times when the mouse cursor hovers over the left or right edige of the timeline object. The user can drag and drop the timeline object when the cursor is placed in its center region.

The controller makes heavy use of the IDragAndDropPolicy and the IEditTimelineObjectPolicy. These policies define, which kind of editing behaviour is supported by the timeline object.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
IDragAndDropPolicy.getDragActions(Object, Object, IGanttChartModel), IEditTimelineObjectPolicy.isStartTimeChangeable(Object, Object, IGanttChartModel), IEditTimelineObjectPolicy.isDurationChangeable(Object, Object, IGanttChartModel)

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.dlsc.flexgantt.swing.layer.system.IEditModeController
IEditModeController.EditMode
 
Constructor Summary
DefaultEditModeController()
           
 
Method Summary
 IEditModeController.EditMode getEditMode(DragLayer layer, ObjectBounds bounds, java.awt.event.MouseEvent e)
          Returns an edit mode based on the given bounds and mouse event.
protected  boolean isChangeEndTimeLocation(ObjectBounds bounds, java.awt.event.MouseEvent evt, IEditTimelineObjectPolicy editPolicy)
          Returns TRUE if the given location is valid for changing the end time of the timeline object.
protected  boolean isChangeStartTimeLocation(ObjectBounds bounds, java.awt.event.MouseEvent evt, IEditTimelineObjectPolicy editPolicy)
          Returns TRUE if the given location is valid for changing the start time of the timeline object.
protected  boolean isDragLocation(ObjectBounds bounds, java.awt.event.MouseEvent evt, IEditTimelineObjectPolicy editPolicy)
          Returns TRUE if the given location is a valid location within the object's bounds for initiating a drag operation.
protected  boolean isUsingDragOverrideModifiers(java.awt.event.MouseEvent evt)
          Determines whether the modifiers of the mouse event override the standard editing behaviour so that the controller will return EditMode.CHANGE_TIME_SPAN even when the cursor is on the locations that usually trigger an EditMode.CHANGE_START_TIME or an EditMode.CHANGE_END_TIME.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEditModeController

public DefaultEditModeController()
Method Detail

getEditMode

public IEditModeController.EditMode getEditMode(DragLayer layer,
                                                ObjectBounds bounds,
                                                java.awt.event.MouseEvent e)
Description copied from interface: IEditModeController
Returns an edit mode based on the given bounds and mouse event. The method can evaluate the location and the modifiers of the event in order to determine what kind of editing operation will be supported.

Specified by:
getEditMode in interface IEditModeController
Parameters:
layer - the drag layer requesting the edit mode
bounds - the object bounds over which the mouse cursor currently hovers
e - the mouse event that triggered the request
Returns:
the edit mode that is appropriate for the given location and key modifiers

isDragLocation

protected boolean isDragLocation(ObjectBounds bounds,
                                 java.awt.event.MouseEvent evt,
                                 IEditTimelineObjectPolicy editPolicy)
Returns TRUE if the given location is a valid location within the object's bounds for initiating a drag operation. The default implementation of this method will return TRUE if the location of the given mouse event is contained within the object bounds and the location is not the location for changing the start or the end time of the timeline object.

Parameters:
bounds - the object bounds to check
evt - the mouse event causing the location check
editPolicy - the timeline object editing policy
Returns:
TRUE if the specified location is valid for dragging the timeline object
Since:
1.0

isChangeEndTimeLocation

protected boolean isChangeEndTimeLocation(ObjectBounds bounds,
                                          java.awt.event.MouseEvent evt,
                                          IEditTimelineObjectPolicy editPolicy)
Returns TRUE if the given location is valid for changing the end time of the timeline object.

Parameters:
bounds - the object bounds to check
evt - the mouse event causing the location check
editPolicy - the timeline object editing policy
Returns:
TRUE if the specified location is valid for changing the end time of the timeline object
Since:
1.0

isChangeStartTimeLocation

protected boolean isChangeStartTimeLocation(ObjectBounds bounds,
                                            java.awt.event.MouseEvent evt,
                                            IEditTimelineObjectPolicy editPolicy)
Returns TRUE if the given location is valid for changing the start time of the timeline object.

Parameters:
bounds - the object bounds to check
evt - the mouse event causing the location check
editPolicy - the timeline object editing policy
Returns:
TRUE if the specified location is valid for changing the start time of the timeline object
Since:
1.0

isUsingDragOverrideModifiers

protected boolean isUsingDragOverrideModifiers(java.awt.event.MouseEvent evt)
Determines whether the modifiers of the mouse event override the standard editing behaviour so that the controller will return EditMode.CHANGE_TIME_SPAN even when the cursor is on the locations that usually trigger an EditMode.CHANGE_START_TIME or an EditMode.CHANGE_END_TIME. An override can be useful when the timeline object is too small for all edit modes. The default implementation of this method returns TRUE when the user is pressing the ALT key.

Parameters:
evt - the mouse event to check for override modifiers
Returns:
TRUE if the mouse event overrides the standard editing behaviour
Since:
1.0