vocleditor.edit
Class VOCLAssociationRoleEditPart

java.lang.Object
  extended by org.eclipse.gef.editparts.AbstractEditPart
      extended by org.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended by org.eclipse.gef.editparts.AbstractConnectionEditPart
              extended by vocleditor.edit.VOCLAssociationRoleEditPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.gef.ConnectionEditPart, org.eclipse.gef.EditPart, org.eclipse.gef.GraphicalEditPart, org.eclipse.gef.LayerConstants, org.eclipse.gef.RequestConstants

public class VOCLAssociationRoleEditPart
extends org.eclipse.gef.editparts.AbstractConnectionEditPart

EditPart for an AssociationRole.


Field Summary
 boolean isMoving
           
 int lastAnchorAt
          This is variable is for a pretty much dirty hack.
 
Fields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
 
Fields inherited from interface org.eclipse.gef.LayerConstants
CONNECTION_LAYER, FEEDBACK_LAYER, GRID_LAYER, GUIDE_LAYER, HANDLE_LAYER, PRIMARY_LAYER, PRINTABLE_LAYERS, SCALABLE_LAYERS, SCALED_FEEDBACK_LAYER
 
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
VOCLAssociationRoleEditPart(VOCLModel.AssociationRole associationrole)
          Constructs a new VOCLAssociationRoleEditPart for the given AssociationRole
 
Method Summary
 void activate()
          starts listening for model changes
 void deactivate()
          stops listening for model changes
 java.lang.Object getAdapter(java.lang.Class key)
          returns a property source for thr model object
 VOCLBendpoint getBendpointAt(int index)
          Retrieves the bendpoint at index
 void insertBendpoint(int index, VOCLBendpoint point)
          Inserts a bendpoint
 void performRequest(org.eclipse.gef.Request request)
          Opens the properties dialog and creates and executes an EditAssociationRoleCommand if necessary
 void removeBendpointAt(int index)
          removes a bendpoint
 void setBendpoint(int index, VOCLBendpoint point)
          Moves a bendpoint to a new location
 void setLayerEditPart(NavExpEditPart part)
          Set the NavExpEditPart the knows the ConnectionLayer for our ConnectionFigure
 void setSelected(boolean selectmode)
          Set's selection mode of the Association for highlighting
 
Methods inherited from class org.eclipse.gef.editparts.AbstractConnectionEditPart
addNotify, getConnectionFigure, getDragTracker, getSource, getTarget, refresh, removeNotify, setParent, setSource, setTarget
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addNodeListener, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
addEditPartListener, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, removeEditPartListener, removeEditPolicy, setFocus, setModel, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.GraphicalEditPart
addNodeListener, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
 
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, removeEditPartListener, removeEditPolicy, setFocus, setModel, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 

Field Detail

lastAnchorAt

public int lastAnchorAt
This is variable is for a pretty much dirty hack. The setAnchorAt functions are fired before a ReconnectionCommand is constructed. So we remember the last anchor position here to get it reconstructed from the Command.


isMoving

public boolean isMoving
See Also:
this variable is reset by VOCLAssociationRoleEditPart.execute
Constructor Detail

VOCLAssociationRoleEditPart

public VOCLAssociationRoleEditPart(VOCLModel.AssociationRole associationrole)
Constructs a new VOCLAssociationRoleEditPart for the given AssociationRole

Parameters:
associationrole - an AssociationRole model element
Method Detail

activate

public void activate()
starts listening for model changes

Specified by:
activate in interface org.eclipse.gef.EditPart
Overrides:
activate in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
See Also:
EditPart.activate()

deactivate

public void deactivate()
stops listening for model changes

Specified by:
deactivate in interface org.eclipse.gef.EditPart
Overrides:
deactivate in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
See Also:
EditPart.deactivate()

getAdapter

public java.lang.Object getAdapter(java.lang.Class key)
returns a property source for thr model object

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class org.eclipse.gef.editparts.AbstractConnectionEditPart
See Also:
IAdaptable.getAdapter(java.lang.Class)

insertBendpoint

public void insertBendpoint(int index,
                            VOCLBendpoint point)
Inserts a bendpoint

Parameters:
index - Index of the new bendpoint
point - the bendpoint to insert

removeBendpointAt

public void removeBendpointAt(int index)
removes a bendpoint

Parameters:
index - the index of the bendpoint to remove

setBendpoint

public void setBendpoint(int index,
                         VOCLBendpoint point)
Moves a bendpoint to a new location

Parameters:
index - Index of the bendpoint to move
point - new value for the moved point

getBendpointAt

public VOCLBendpoint getBendpointAt(int index)
Retrieves the bendpoint at index

Parameters:
index - The index of the bendpoint to retrieve
Returns:
The bendpoint at index

setSelected

public void setSelected(boolean selectmode)
Set's selection mode of the Association for highlighting

Parameters:
selectmode - true == selected, false == not selected

setLayerEditPart

public void setLayerEditPart(NavExpEditPart part)
Set the NavExpEditPart the knows the ConnectionLayer for our ConnectionFigure

Parameters:
part - a NavExpEditPart that knows the ConnectionLayer for our ConnectionFigure

performRequest

public void performRequest(org.eclipse.gef.Request request)
Opens the properties dialog and creates and executes an EditAssociationRoleCommand if necessary

Specified by:
performRequest in interface org.eclipse.gef.EditPart
Overrides:
performRequest in class org.eclipse.gef.editparts.AbstractEditPart