Modelers

org.topcased.modeler.edit.policies
Class EdgeObjectUVEditPolicy

java.lang.Object
  extended by org.eclipse.gef.editpolicies.AbstractEditPolicy
      extended by org.eclipse.gef.editpolicies.GraphicalEditPolicy
          extended by org.eclipse.gef.editpolicies.SelectionEditPolicy
              extended by org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy
                  extended by org.topcased.modeler.edit.policies.EdgeObjectEditPolicy
                      extended by org.topcased.modeler.edit.policies.EdgeObjectUVEditPolicy
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.gef.EditPolicy, org.eclipse.gef.RequestConstants

public abstract class EdgeObjectUVEditPolicy
extends EdgeObjectEditPolicy

An abstract edit policy to select and move EdgeObjectUV relative to their owning edge. Must be used only with GraphEdgeEditPart.
Creation : 3 nov. 2005


Field Summary
 
Fields inherited from class org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy
handles
 
Fields inherited from interface org.eclipse.gef.EditPolicy
COMPONENT_ROLE, CONNECTION_BENDPOINTS_ROLE, CONNECTION_ENDPOINTS_ROLE, CONNECTION_ROLE, CONTAINER_ROLE, DIRECT_EDIT_ROLE, GRAPHICAL_NODE_ROLE, LAYOUT_ROLE, NODE_ROLE, PRIMARY_DRAG_ROLE, SELECTION_FEEDBACK_ROLE, TREE_CONTAINER_ROLE
 
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
 
Constructor Summary
EdgeObjectUVEditPolicy()
           
 
Method Summary
protected  int[] computeUVDistance(org.eclipse.draw2d.geometry.Dimension moveDelta, EdgeObjectUV edgeObject, org.eclipse.draw2d.geometry.Point mouseLocation)
          Compute a new uDistance and vDistance depending on the move delta and the edge object figure.
protected  org.eclipse.gef.Handle createSelectionHandle(EdgeObject edgeObject)
          Create a selection handle for the given edge object.
protected  void eraseSourceFeedBack(int oldUDistance, int oldVDistance, EdgeObjectUV edgeObject)
          Erases source feedback based on the given oldUDistance, oldVDistance and edge object.
 void eraseSourceFeedback(org.eclipse.gef.Request request)
           
 org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request)
           
protected  org.eclipse.gef.commands.Command getMoveEdgeObjectCommand(MoveEdgeObjectRequest request)
          Gets the command to move an edge object.
protected abstract  boolean isEnd(IEdgeObjectFigure figure)
          Returns true if the given edge ovject uv figure is located at the end of the connection or false if it is located at the start.
protected  void showSourceFeedBack(int newUDistance, int newVDistance, EdgeObjectUV edgeObject)
          Shows or updates source feedback for the specified new uDistance, vDistance and edge object.
 void showSourceFeedback(org.eclipse.gef.Request request)
           
 
Methods inherited from class org.topcased.modeler.edit.policies.EdgeObjectEditPolicy
activate, createSelectionHandles, deactivate, getFeedbackLayer, propertyChange
 
Methods inherited from class org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy
addSelectionHandles, getAdapter, hideSelection, removeSelectionHandles, showSelection
 
Methods inherited from class org.eclipse.gef.editpolicies.SelectionEditPolicy
addSelectionListener, getTargetEditPart, hideFocus, removeSelectionListener, setFocus, setSelectedState, showFocus, showPrimarySelection
 
Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy
addFeedback, getHostFigure, getLayer, removeFeedback
 
Methods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy
debugFeedback, eraseTargetFeedback, getHost, setHost, showTargetFeedback, toString, understandsRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EdgeObjectUVEditPolicy

public EdgeObjectUVEditPolicy()
Method Detail

createSelectionHandle

protected org.eclipse.gef.Handle createSelectionHandle(EdgeObject edgeObject)
Create a selection handle for the given edge object.

Overrides:
createSelectionHandle in class EdgeObjectEditPolicy
Parameters:
edgeObject - the edge object for the one the selection handle has to be created
Returns:
an handle or null if the given edge object must not have selection handle

showSourceFeedback

public void showSourceFeedback(org.eclipse.gef.Request request)
Specified by:
showSourceFeedback in interface org.eclipse.gef.EditPolicy
Overrides:
showSourceFeedback in class org.eclipse.gef.editpolicies.AbstractEditPolicy
See Also:
AbstractEditPolicy.showSourceFeedback(org.eclipse.gef.Request)

showSourceFeedBack

protected void showSourceFeedBack(int newUDistance,
                                  int newVDistance,
                                  EdgeObjectUV edgeObject)
Shows or updates source feedback for the specified new uDistance, vDistance and edge object.
Subclass must reimplement this method to customize the feedback.
Default implementation makes the edge object figure follow the mouse.

Parameters:
uDistance - a new uDistance
vDistance - a new vDistance
edgeObject - an edge object

eraseSourceFeedback

public void eraseSourceFeedback(org.eclipse.gef.Request request)
Specified by:
eraseSourceFeedback in interface org.eclipse.gef.EditPolicy
Overrides:
eraseSourceFeedback in class org.eclipse.gef.editpolicies.AbstractEditPolicy
See Also:
AbstractEditPolicy.eraseSourceFeedback(org.eclipse.gef.Request)

eraseSourceFeedBack

protected void eraseSourceFeedBack(int oldUDistance,
                                   int oldVDistance,
                                   EdgeObjectUV edgeObject)
Erases source feedback based on the given oldUDistance, oldVDistance and edge object.
Subclass must reimplement this method to customize the feedback.
Default implementation reinitialize the edge object figure with the initial edge object uDistance and vDistance.

Parameters:
uDistance - the old uDistance. It is the edge object uDistance here
edgeObject - an edge object

getCommand

public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request)
Specified by:
getCommand in interface org.eclipse.gef.EditPolicy
Overrides:
getCommand in class org.eclipse.gef.editpolicies.AbstractEditPolicy
See Also:
AbstractEditPolicy.getCommand(org.eclipse.gef.Request)

getMoveEdgeObjectCommand

protected org.eclipse.gef.commands.Command getMoveEdgeObjectCommand(MoveEdgeObjectRequest request)
Gets the command to move an edge object.

Parameters:
request - the move edge object request
Returns:
a comand to move an edge object

isEnd

protected abstract boolean isEnd(IEdgeObjectFigure figure)
Returns true if the given edge ovject uv figure is located at the end of the connection or false if it is located at the start.

Returns:

computeUVDistance

protected int[] computeUVDistance(org.eclipse.draw2d.geometry.Dimension moveDelta,
                                  EdgeObjectUV edgeObject,
                                  org.eclipse.draw2d.geometry.Point mouseLocation)
Compute a new uDistance and vDistance depending on the move delta and the edge object figure.

Parameters:
moveDelta - the current move delta
edgeObject - an edge object
mouseLocation - the mouse location
Returns:
an int array containing the uDistance and the vDistance

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.