GEF v2.0

org.eclipse.gef.editparts
Class AbstractConnectionEditPart

java.lang.Object
  |
  +--org.eclipse.gef.editparts.AbstractEditPart
        |
        +--org.eclipse.gef.editparts.AbstractGraphicalEditPart
              |
              +--org.eclipse.gef.editparts.AbstractConnectionEditPart
All Implemented Interfaces:
ConnectionEditPart, EditPart, GraphicalEditPart, IAdaptable, LayerConstants, RequestConstants

public abstract class AbstractConnectionEditPart
extends AbstractGraphicalEditPart
implements ConnectionEditPart, LayerConstants

Provides support for connections based EditParts.


Inner classes inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
AbstractGraphicalEditPart.AccessibleGraphicalEditPart, AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
 
Inner classes inherited from class org.eclipse.gef.editparts.AbstractEditPart
AbstractEditPart.EditPolicyIterator
 
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, handles, sourceConnections, targetConnections
 
Fields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, eventListeners, FLAG_ACTIVE, FLAG_FOCUS, FLAG_INITIALIZED, MAX_FLAG
 
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, HANDLE_LAYER, PRIMARY_LAYER
 
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILD, REQ_ALIGN_CHILDREN, REQ_ANCESTOR_DELETED, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_BENDPOINT, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILD, REQ_MOVE_CHILDREN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_END, REQ_RECONNECT_SOURCE, REQ_RECONNECT_START, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILD, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER, REQ_SOURCE_DELETED, REQ_TARGET_DELETED
 
Constructor Summary
AbstractConnectionEditPart()
           
 
Method Summary
 void activateFigure()
          Activates the Figure representing this, by setting up the start and end connections, and adding the figure to the Connection Layer.
protected  void createEditPolicies()
          Creates the initial EditPolicies and reserves slots for dynamic ones.
protected  IFigure createFigure()
          Returns a newly created Figure to represent these type of EditParts.
 void deactivateFigure()
          Deactivates the Figure representing this, by removing it from the connection layer, and resetting the source and target connections to null.
 void dispose()
          Called when the EditPart will no longer be used.
protected  void doInitialize()
          Initializes the entire state of the EditPart.
 Object getAdapter(Class adapter)
           Returns the adapter of the given type, for example: IPropertySource.
 Connection getConnectionFigure()
          Returns the Figure representing the connection.
 DragTracker getDragTracker(Request req)
          Return a drag tracker for dragging this EditPart.
 EditPart getSource()
          Returns the source EditPart
protected  ConnectionAnchor getSourceConnectionAnchor()
          If the source is an instance of GraphicalNodeEditPart, it returns the anchor associated with it, else it returns null
 EditPart getTarget()
          Returns the target EditPart
protected  ConnectionAnchor getTargetConnectionAnchor()
          If the target is an instance of NodeEditPart, it returns the anchor associated with it, else it returns null
 void refresh()
          Called to force a refresh of all properties displayed by this EditPart.
protected  void refreshSourceAnchor()
           
protected  void refreshTargetAnchor()
           
 void setParent(EditPart parent)
           Sets the parent.
 void setSource(EditPart editPart)
          Sets the source EditPart of this connection.
 void setTarget(EditPart editPart)
          Sets the target EditPart of this connection.
protected  boolean shouldInitialize()
          Updates this EditPart.
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
activate, addChildVisual, addSourceConnection, addTargetConnection, deactivate, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getContentPane, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getParentingFigure, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregister
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addChild, addEditPartListener, createChild, createConnection, createOrFindConnection, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getKeyHandler, getModel, getModelChildren, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, initialize, installEditPolicy, isActive, isSelectable, performRequest, refreshChildren, refreshVisuals, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregisterAccessibility, unregisterModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.GraphicalEditPart
getContentPane, getFigure, getSourceConnections, getTargetConnections, setLayoutConstraint
 
Methods inherited from interface org.eclipse.gef.EditPart
activate, addEditPartListener, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getKeyHandler, getModel, getParent, getRoot, getSelected, getTargetEditPart, hasFocus, installEditPolicy, performRequest, removeEditPartListener, removeEditPolicy, setFocus, setModel, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 

Constructor Detail

AbstractConnectionEditPart

public AbstractConnectionEditPart()
Method Detail

activateFigure

public void activateFigure()
Activates the Figure representing this, by setting up the start and end connections, and adding the figure to the Connection Layer.
See Also:
AbstractGraphicalEditPart.deactivate()

createEditPolicies

protected void createEditPolicies()
Description copied from class: AbstractEditPart
Creates the initial EditPolicies and reserves slots for dynamic ones. Should be overridden to install the inital edit policies based on the model's initial state. null can be used to reserve a "slot", should there be some desire to guarantee the ordering of EditPolcies.
Overrides:
createEditPolicies in class AbstractEditPart
Following copied from class: org.eclipse.gef.editparts.AbstractEditPart
See Also:
AbstractEditPart.doInitialize(), AbstractEditPart.installEditPolicy(Object, EditPolicy)

createFigure

protected IFigure createFigure()
Returns a newly created Figure to represent these type of EditParts.
Overrides:
createFigure in class AbstractGraphicalEditPart
Returns:
The created Figure.

deactivateFigure

public void deactivateFigure()
Deactivates the Figure representing this, by removing it from the connection layer, and resetting the source and target connections to null.

dispose

public void dispose()
Description copied from interface: EditPart
Called when the EditPart will no longer be used. The EditPart should perform cleanup that cannot be performed in EditPart.deactivate(), such as unregistering itself from the Viewer.
Specified by:
dispose in interface EditPart
Overrides:
dispose in class AbstractGraphicalEditPart

doInitialize

protected void doInitialize()
Description copied from class: AbstractEditPart
Initializes the entire state of the EditPart.
Overrides:
doInitialize in class AbstractEditPart

getAdapter

public Object getAdapter(Class adapter)
Description copied from class: AbstractEditPart
Returns the adapter of the given type, for example: IPropertySource. If your model implements IPropertySource, or if it is IAdaptable then there is no reason to override this method. Or, if you do not need propertysheet support. EditParts are the objects sent out as selection to other viewers. If you have viewers that require additional adapter types, return them here.
Specified by:
getAdapter in interface IAdaptable
Overrides:
getAdapter in class AbstractGraphicalEditPart
Following copied from class: org.eclipse.gef.editparts.AbstractEditPart
See Also:
IAdaptable

getConnectionFigure

public Connection getConnectionFigure()
Returns the Figure representing the connection.
Returns:
Figure as an IConnection.

getDragTracker

public DragTracker getDragTracker(Request req)
Description copied from interface: EditPart
Return a drag tracker for dragging this EditPart. The SelectionTool makes such requests, but other Tools may also do so.
Specified by:
getDragTracker in interface EditPart
Overrides:
getDragTracker in class AbstractGraphicalEditPart
Following copied from class: org.eclipse.gef.editparts.AbstractGraphicalEditPart
Parameters:
Request - A Request describing the type of drag.

getSource

public EditPart getSource()
Returns the source EditPart
Specified by:
getSource in interface ConnectionEditPart
Returns:
EditPart representing the source of this.

getTarget

public EditPart getTarget()
Returns the target EditPart
Specified by:
getTarget in interface ConnectionEditPart
Returns:
EditPart representing the target of this.

getSourceConnectionAnchor

protected ConnectionAnchor getSourceConnectionAnchor()
If the source is an instance of GraphicalNodeEditPart, it returns the anchor associated with it, else it returns null
Returns:
Connection anchor of the source.

getTargetConnectionAnchor

protected ConnectionAnchor getTargetConnectionAnchor()
If the target is an instance of NodeEditPart, it returns the anchor associated with it, else it returns null
Returns:
Connection anchor of the target.

refresh

public void refresh()
Description copied from interface: EditPart
Called to force a refresh of all properties displayed by this EditPart.
Specified by:
refresh in interface EditPart
Overrides:
refresh in class AbstractGraphicalEditPart

refreshSourceAnchor

protected void refreshSourceAnchor()

refreshTargetAnchor

protected void refreshTargetAnchor()

setParent

public void setParent(EditPart parent)
Description copied from interface: EditPart
Sets the parent. This should only be called by the managing EditPart.
Specified by:
setParent in interface EditPart
Overrides:
setParent in class AbstractEditPart

setSource

public void setSource(EditPart editPart)
Sets the source EditPart of this connection.
Specified by:
setSource in interface ConnectionEditPart
Parameters:
editPart - EditPart which is the source.

setTarget

public void setTarget(EditPart editPart)
Sets the target EditPart of this connection.
Specified by:
setTarget in interface ConnectionEditPart
Parameters:
editPart - EditPart which is the target.

shouldInitialize

protected boolean shouldInitialize()
Description copied from class: AbstractGraphicalEditPart
Updates this EditPart. Update is done only in the presence of a set Figure.
Overrides:
shouldInitialize in class AbstractGraphicalEditPart

GEF v2.0