Package 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:
IAdaptable,ConnectionEditPart,EditPart,GraphicalEditPart,LayerConstants,RequestConstants
public abstract class AbstractConnectionEditPart
extends AbstractGraphicalEditPart
implements ConnectionEditPart, LayerConstants
The base implementation for
ConnectionEditPart.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected final classProvides accessibility support for when connections are also themselves nodes.Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
AbstractGraphicalEditPart.AccessibleGraphicalEditPartNested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPart
AbstractEditPart.EditPolicyIterator -
Field Summary
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, sourceConnections, targetConnectionsFields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAGFields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARYFields 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_LAYERFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidActivates the Figure representing this, by setting up the start and end connections, and adding the figure to the Connection Layer.voidCalled after the EditPart has been added to its parent.protected IFigureReturns a newly created Figure to represent these type of EditParts.protected voidDeactivates the Figure representing this, by removing it from the connection layer, and resetting the source and target connections tonull.<T> TgetAdapter(Class<T> adapter) AbstractConnectionEditPartextends getAdapter() to overrides theAccessibleAnchorProvideradapter returned by the superclass.Convenience method for casting this GraphicalEditPart's Figure to aConnectiongetDragTracker(Request req) Overridden to return a defaultDragTrackerfor GraphicalEditParts.protected ConnectionAnchorReturns theConnectionAnchorfor the source end of the connection.protected ConnectionAnchorReturns theConnectionAnchorfor the target end of the connection.voidrefresh()Extended here to also refresh the ConnectionAnchors.protected voidUpdates the source ConnectionAnchor.protected voidUpdates the target ConnectionAnchor.voidExtended here to remove the ConnectionEditPart's connection figure from the connection layer.voidExtended to implement automatic addNotify and removeNotify handling.voidSets the source EditPart of this connection.voidSets the target EditPart of this connection.Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
activate, addChildVisual, addNodeListener, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, deactivate, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getChildren, getContentPane, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, isSelectable, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeNodeListener, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisualsMethods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addChild, addEditPartListener, createChild, createEditPolicies, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getCommand, getEditPolicy, getEditPolicyIterable, getEditPolicyIterator, getEventListeners, getEventListenersIterable, getFlag, getModel, getModelChildren, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, refreshChildren, refreshVisuals, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregister, unregisterAccessibility, unregisterModelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.gef.EditPart
activate, addEditPartListener, deactivate, eraseSourceFeedback, eraseTargetFeedback, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, removeEditPartListener, removeEditPolicy, setFocus, setModel, setSelected, showSourceFeedback, showTargetFeedback, understandsRequestMethods inherited from interface org.eclipse.gef.GraphicalEditPart
addNodeListener, getChildren, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
-
Constructor Details
-
AbstractConnectionEditPart
public AbstractConnectionEditPart()
-
-
Method Details
-
activateFigure
protected 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:
-
addNotify
public void addNotify()Description copied from interface:EditPartCalled after the EditPart has been added to its parent. This is used to indicate to the EditPart that it should refresh itself for the first time.- Specified by:
addNotifyin interfaceEditPart- Overrides:
addNotifyin classAbstractGraphicalEditPart- See Also:
-
createFigure
Returns a newly created Figure to represent these type of EditParts.- Specified by:
createFigurein classAbstractGraphicalEditPart- Returns:
- The created Figure.
-
deactivateFigure
protected void deactivateFigure()Deactivates the Figure representing this, by removing it from the connection layer, and resetting the source and target connections tonull. -
getAdapter
AbstractConnectionEditPartextends getAdapter() to overrides theAccessibleAnchorProvideradapter returned by the superclass. When treating a connection as a node for other connections, it makes sense to target its midpoint, and not the edge of its bounds.- Specified by:
getAdapterin interfaceIAdaptable- Overrides:
getAdapterin classAbstractGraphicalEditPart- Parameters:
adapter- the adapter Class- Returns:
- the adapter
- See Also:
-
getConnectionFigure
Convenience method for casting this GraphicalEditPart's Figure to aConnection- Returns:
- the Figure as a Connection
-
getDragTracker
Description copied from class:AbstractGraphicalEditPartOverridden to return a defaultDragTrackerfor GraphicalEditParts.- Specified by:
getDragTrackerin interfaceEditPart- Overrides:
getDragTrackerin classAbstractGraphicalEditPart- Parameters:
req- aRequestindicating the context of the drag- Returns:
nullor a DragTracker- See Also:
-
getSource
- Specified by:
getSourcein interfaceConnectionEditPart- Returns:
- the EditPart at the source end of this connection.
- See Also:
-
getTarget
- Specified by:
getTargetin interfaceConnectionEditPart- Returns:
- the EditPart at the target end of this connection.
- See Also:
-
getSourceConnectionAnchor
Returns theConnectionAnchorfor the source end of the connection. If the source is an instance ofNodeEditPart, that interface will be used to determine the proper ConnectionAnchor. If the source is not an instance ofNodeEditPart, this method should be overridden to return the correct ConnectionAnchor. Failure to do this will cause a default anchor to be used so that the connection figure will be made visible to the developer.- Returns:
- ConnectionAnchor for the source end of the Connection
-
getTargetConnectionAnchor
Returns theConnectionAnchorfor the target end of the connection. If the target is an instance ofNodeEditPart, that interface will be used to determine the proper ConnectionAnchor. If the target is not an instance ofNodeEditPart, this method should be overridden to return the correct ConnectionAnchor. Failure to do this will cause a default anchor to be used so that the connection figure will be made visible to the developer.- Returns:
- ConnectionAnchor for the target end of the Connection
-
refresh
public void refresh()Extended here to also refresh the ConnectionAnchors.- Specified by:
refreshin interfaceEditPart- Overrides:
refreshin classAbstractGraphicalEditPart- See Also:
-
refreshSourceAnchor
protected void refreshSourceAnchor()Updates the source ConnectionAnchor. Subclasses should overridegetSourceConnectionAnchor()if necessary, and not this method. -
refreshTargetAnchor
protected void refreshTargetAnchor()Updates the target ConnectionAnchor. Subclasses should overridegetTargetConnectionAnchor()if necessary, and not this method. -
removeNotify
public void removeNotify()Extended here to remove the ConnectionEditPart's connection figure from the connection layer.- Specified by:
removeNotifyin interfaceEditPart- Overrides:
removeNotifyin classAbstractGraphicalEditPart- See Also:
-
setParent
Extended to implement automatic addNotify and removeNotify handling.- Specified by:
setParentin interfaceEditPart- Overrides:
setParentin classAbstractEditPart- Parameters:
parent- the parent EditPart- See Also:
-
setSource
Sets the source EditPart of this connection.- Specified by:
setSourcein interfaceConnectionEditPart- Parameters:
editPart- EditPart which is the source.
-
setTarget
Sets the target EditPart of this connection.- Specified by:
setTargetin interfaceConnectionEditPart- Parameters:
editPart- EditPart which is the target.
-