Class AbstractGraphicalEditPart
- All Implemented Interfaces:
- IAdaptable,- EditPart,- GraphicalEditPart,- RequestConstants
- Direct Known Subclasses:
- AbstractConnectionEditPart,- GraphicalRootEditPart,- SimpleRootEditPart
GraphicalEditPart.
 This is an implementation class, and the documentation here is targeted at subclassing this class. Callers of public API should refer to the interface's documentation.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classA default implementation ofAccessibleEditPart.protected classThe default implementation ofAccessibleAnchorProviderreturned ingetAdapter(Class).Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPartAbstractEditPart.EditPolicyIterator
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected IFigureThe Figureprotected List<ConnectionEditPart> List of source ConnectionEditPartsprotected List<ConnectionEditPart> List of source ConnectionEditPartsFields inherited from class org.eclipse.gef.editparts.AbstractEditPartchildren, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAGFields inherited from interface org.eclipse.gef.EditPartSELECTED, SELECTED_NONE, SELECTED_PRIMARYFields inherited from interface org.eclipse.gef.RequestConstantsREQ_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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidactivate()ExtendsAbstractEditPart.activate()to also activate all source ConnectionEditParts.protected voidaddChildVisual(EditPart childEditPart, int index) Adds the child's Figure to thecontentPane.voidaddNodeListener(NodeListener listener) Adds a NodeListener to the EditPart.voidCalled after the EditPart has been added to its parent.protected voidaddSourceConnection(ConnectionEditPart connection, int index) Adds a source ConnectionEditPart at the specified index.protected voidaddTargetConnection(ConnectionEditPart connection, int index) Adds a target ConnectionEditPart at the specified index.protected ConnectionEditPartcreateConnection(Object model) Creates aConnectionEditPartfor the given model.protected abstract IFigureCreates theFigureto be used as this part's visuals.protected ConnectionEditPartcreateOrFindConnection(Object model) Searches for an existingConnectionEditPartin the Viewer'sEditPart registryand returns it if one is found.voidExtendsAbstractEditPart.deactivate()to also deactivate the source ConnectionEditParts.protected voidfireRemovingSourceConnection(ConnectionEditPart connection, int index) Notifies listeners that a source connection has been removed.protected voidfireRemovingTargetConnection(ConnectionEditPart connection, int index) Notifies listeners that a target connection has been removed.protected voidfireSourceConnectionAdded(ConnectionEditPart connection, int index) Notifies listeners that a source connection has been added.protected voidfireTargetConnectionAdded(ConnectionEditPart connection, int index) Notifies listeners that a target connection has been added.<T> TgetAdapter(Class<T> key) ExtendsAbstractEditPart.getAdapter(Class)to handle additional adapter types.List<? extends GraphicalEditPart> Returns the List of childrenEditParts.Implemented to delegate togetFigure()by default.getDragTracker(Request request) Overridden to return a defaultDragTrackerfor GraphicalEditParts.The default implementation callscreateFigure()if the figure is currentlynull.protected IFigureA convenience method for obtaining the specified layer from theLayerManager.protected List<?> Returns theListof the connection model objects for which this EditPart's model is the source.protected List<?> Returns theListof the connection model objects for which this EditPart's model is the target.List<? extends ConnectionEditPart> Returns the source connections for this GraphicalEditPart.List<? extends ConnectionEditPart> Returns the target connections for this GraphicalEditPart.booleanA GraphicalEditPart is considered selectable, if it is active and its figure is showing.protected voidprimAddSourceConnection(ConnectionEditPart connection, int index) Adds the specified sourceConnectionEditPartat an index.protected voidprimAddTargetConnection(ConnectionEditPart connection, int index) Adds the specified targetConnectionEditPartat an index.protected voidprimRemoveSourceConnection(ConnectionEditPart connection) Removes the specified sourceConnectionEditPartfrom thesourceConnectionsList.protected voidprimRemoveTargetConnection(ConnectionEditPart connection) Removes the specified targetConnectionEditPartfrom thetargetConnectionsList.voidrefresh()ExtendsAbstractEditPart.refresh()to refresh two additional structural features: source and target connections.protected voidUpdates the set of source ConnectionEditParts so that it is in sync with the model source connections.protected voidUpdates the set of target ConnectionEditParts so that it is in sync with the model target connections.protected voidRegisters the EditPart's Figure in the Viewer.protected voidremoveChildVisual(EditPart childEditPart) Remove the child's Figure from thecontentPane.voidremoveNodeListener(NodeListener listener) Removes the first occurance of the specified listener from the list of listeners.voidExtendsAbstractEditPart.removeNotify()to cleanupConnectionEditParts.protected voidremoveSourceConnection(ConnectionEditPart connection) Removes the given connection for which this EditPart is the source.protected voidremoveTargetConnection(ConnectionEditPart connection) Removes the given connection for which this EditPart is the target.protected voidreorderChild(EditPart child, int index) This method is extended to preserve a LayoutManager constraint if one exists.protected voidreorderSourceConnection(ConnectionEditPart connection, int index) Moves a sourceConnectionEditPartinto a lower index than it currently occupies.protected voidreorderTargetConnection(ConnectionEditPart connection, int index) Moves a targetConnectionEditPartinto a lower index than it currently occupies.protected voidSets the FigurevoidsetLayoutConstraint(EditPart child, IFigure childFigure, Object constraint) Sets the specified constraint for a child's Figure on thecontent panefigure for this GraphicalEditPart.protected voidImplemented to remove the Figure from the Viewer's registry.Methods inherited from class org.eclipse.gef.editparts.AbstractEditPartactivateEditPolicies, 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, setParent, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregister, unregisterAccessibility, unregisterModelMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.gef.EditPartaddEditPartListener, eraseSourceFeedback, eraseTargetFeedback, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, removeEditPartListener, removeEditPolicy, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
- 
Field Details- 
figureThe Figure
- 
sourceConnectionsList of source ConnectionEditParts
- 
targetConnectionsList of source ConnectionEditParts
 
- 
- 
Constructor Details- 
AbstractGraphicalEditPartpublic AbstractGraphicalEditPart()
 
- 
- 
Method Details- 
activatepublic void activate()ExtendsAbstractEditPart.activate()to also activate all source ConnectionEditParts.- Specified by:
- activatein interface- EditPart
- Overrides:
- activatein class- AbstractEditPart
- See Also:
 
- 
addChildVisualAdds the child's Figure to thecontentPane.- Specified by:
- addChildVisualin class- AbstractEditPart
- Parameters:
- childEditPart- The EditPart being added
- index- The child's position
- See Also:
 
- 
addNodeListenerDescription copied from interface:GraphicalEditPartAdds a NodeListener to the EditPart. Duplicate calls result in duplicate notification.- Specified by:
- addNodeListenerin interface- GraphicalEditPart
- Parameters:
- listener- the Listener
- See Also:
 
- 
addNotifypublic 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 interface- EditPart
- Overrides:
- addNotifyin class- AbstractEditPart
- See Also:
 
- 
addSourceConnectionAdds a source ConnectionEditPart at the specified index. This method is called fromrefreshSourceConnections(). There should be no reason to call or override this method. Source connection are created as a result of overridinggetModelSourceConnections().primAddSourceConnection(ConnectionEditPart, int)is called to perform the actual update of thesourceConnectionsList. The connection will have its source set tothis.If active, this EditPart will activate the ConnectionEditPart. Finally, all NodeListeners are notified of the new connection.- Parameters:
- connection- Connection being added
- index- Index where it is being added
 
- 
addTargetConnectionAdds a target ConnectionEditPart at the specified index. This method is called fromrefreshTargetConnections(). There should be no reason to call or override this method. Target connection are created as a result of overridinggetModelTargetConnections().primAddTargetConnection(ConnectionEditPart, int)is called to perform the actual update of thetargetConnectionsList. The connection will have its target set tothis.Finally, all NodeListeners are notified of the new connection.- Parameters:
- connection- Connection being added
- index- Index where it is being added
 
- 
createConnectionCreates aConnectionEditPartfor the given model. Similar toAbstractEditPart.createChild(Object). This method is called indirectly duringrefreshSourceConnections(), andrefreshTargetConnections().The default implementation goes to the EditPartViewer's EditPartFactoryto create the connection. This method should not be overridden unless factories are not being used.- Parameters:
- model- the connection model object
- Returns:
- the new ConnectionEditPart
 
- 
createFigureCreates theFigureto be used as this part's visuals. This is called fromgetFigure()if the figure has not been created.- Returns:
- a Figure
 
- 
createOrFindConnectionSearches for an existingConnectionEditPartin the Viewer'sEditPart registryand returns it if one is found. Otherwise,createConnection(Object)is called to create a new ConnectionEditPart. Override this method only if you need to find an existing connection some other way.- Parameters:
- model- the Connection's model
- Returns:
- the ConnectionEditPart
 
- 
deactivatepublic void deactivate()ExtendsAbstractEditPart.deactivate()to also deactivate the source ConnectionEditParts. Subclasses should extend this method to remove any listeners added inactivate().- Specified by:
- deactivatein interface- EditPart
- Overrides:
- deactivatein class- AbstractEditPart
- See Also:
 
- 
fireRemovingSourceConnectionNotifies listeners that a source connection has been removed. Called fromremoveSourceConnection(ConnectionEditPart). There is no reason for subclasses to call or override this method.- Parameters:
- connection-- ConnectionEditPartbeing added as child.
- index- Position child is being added into.
 
- 
fireRemovingTargetConnectionNotifies listeners that a target connection has been removed. Called fromremoveTargetConnection(ConnectionEditPart). There is no reason for subclasses to call or override this method.- Parameters:
- connection-- ConnectionEditPartbeing added as child.
- index- Position child is being added into.
 
- 
fireSourceConnectionAddedNotifies listeners that a source connection has been added. Called fromaddSourceConnection(ConnectionEditPart, int). There is no reason for subclasses to call or override this method.- Parameters:
- connection-- ConnectionEditPartbeing added as child.
- index- Position child is being added into.
 
- 
fireTargetConnectionAddedNotifies listeners that a target connection has been added. Called fromaddTargetConnection(ConnectionEditPart, int). There is no reason for subclasses to call or override this method.- Parameters:
- connection-- ConnectionEditPartbeing added as child.
- index- Position child is being added into.
 
- 
getAdapterExtendsAbstractEditPart.getAdapter(Class)to handle additional adapter types. Currently, these types includeAccessibleHandleProviderandAccessibleAnchorProvider. Subclasses should extend this method to support additional adapter types, or to replace the default provided adapters.- Specified by:
- getAdapterin interface- IAdaptable
- Overrides:
- getAdapterin class- AbstractEditPart
- See Also:
 
- 
getChildrenDescription copied from interface:EditPartReturns the List of childrenEditParts. This method should rarely be called, and is only made public so that helper objects of this EditPart, such as EditPolicies, can obtain the children. The returned List may be by reference, and should never be modified.- Specified by:
- getChildrenin interface- EditPart
- Specified by:
- getChildrenin interface- GraphicalEditPart
- Overrides:
- getChildrenin class- AbstractEditPart
- Returns:
- a Listof children
- See Also:
 
- 
getContentPaneImplemented to delegate togetFigure()by default. Subclasses may overwrite in case theIFigurereturned bygetFigure()is a composite figure and child figures should be added to one of its children instead of the figure itself.- Specified by:
- getContentPanein interface- GraphicalEditPart
- Returns:
- the content pane Figure
- See Also:
 
- 
getDragTrackerOverridden to return a defaultDragTrackerfor GraphicalEditParts.- Specified by:
- getDragTrackerin interface- EditPart
- Parameters:
- request- a- Requestindicating the context of the drag
- Returns:
- nullor a DragTracker
- See Also:
 
- 
getFigureThe default implementation callscreateFigure()if the figure is currentlynull.- Specified by:
- getFigurein interface- GraphicalEditPart
- Returns:
- this EditPart's Figure
- See Also:
 
- 
getLayerA convenience method for obtaining the specified layer from theLayerManager.- Parameters:
- layer- ID of the Layer
- Returns:
- The requested layer or nullif it doesn't exist
 
- 
getModelSourceConnectionsReturns theListof the connection model objects for which this EditPart's model is the source.refreshSourceConnections()calls this method. For each connection model object,createConnection(Object)will be called automatically to obtain a correspondingConnectionEditPart.Callers must not modify the returned List. - Returns:
- the List of model source connections
 
- 
getModelTargetConnectionsReturns theListof the connection model objects for which this EditPart's model is the target.refreshTargetConnections()calls this method. For each connection model object,createConnection(Object)will be called automatically to obtain a correspondingConnectionEditPart.Callers must not modify the returned List. - Returns:
- the List of model target connections
 
- 
getSourceConnectionsDescription copied from interface:GraphicalEditPartReturns the source connections for this GraphicalEditPart. This method should only be called by the EditPart itself, and its helpers such as EditPolicies.- Specified by:
- getSourceConnectionsin interface- GraphicalEditPart
- Returns:
- the source connections
- See Also:
 
- 
getTargetConnectionsDescription copied from interface:GraphicalEditPartReturns the target connections for this GraphicalEditPart. This method should only be called by the EditPart itself, and its helpers such as EditPolicies.- Specified by:
- getTargetConnectionsin interface- GraphicalEditPart
- Returns:
- the target connections
- See Also:
 
- 
isSelectablepublic boolean isSelectable()A GraphicalEditPart is considered selectable, if it is active and its figure is showing.- Specified by:
- isSelectablein interface- EditPart
- Overrides:
- isSelectablein class- AbstractEditPart
- Returns:
- trueif the receiver can be selected
- See Also:
 
- 
primAddSourceConnectionAdds the specified sourceConnectionEditPartat an index. This method is used to update thesourceConnectionsList. This method is called fromaddSourceConnection(ConnectionEditPart, int). Subclasses should not call or override this method.- Parameters:
- connection- the ConnectionEditPart
- index- the index of the add
 
- 
primAddTargetConnectionAdds the specified targetConnectionEditPartat an index. This method is used to update thetargetConnectionsList. This method is called fromaddTargetConnection(ConnectionEditPart, int). Subclasses should not call or override this method.- Parameters:
- connection- the ConnectionEditPart
- index- the index of the add
 
- 
primRemoveSourceConnectionRemoves the specified sourceConnectionEditPartfrom thesourceConnectionsList. This method is called fromremoveSourceConnection(ConnectionEditPart). Subclasses should not call or override this method.- Parameters:
- connection- Connection to remove.
 
- 
primRemoveTargetConnectionRemoves the specified targetConnectionEditPartfrom thetargetConnectionsList. This method is called fromremoveTargetConnection(ConnectionEditPart). Subclasses should not call or override this method.- Parameters:
- connection- Connection to remove.
 
- 
refreshpublic void refresh()ExtendsAbstractEditPart.refresh()to refresh two additional structural features: source and target connections. Subclasses should probably overrideAbstractEditPart.refreshVisuals()instead of this method.- Specified by:
- refreshin interface- EditPart
- Overrides:
- refreshin class- AbstractEditPart
- See Also:
 
- 
refreshSourceConnectionsprotected void refreshSourceConnections()Updates the set of source ConnectionEditParts so that it is in sync with the model source connections. This method is called fromrefresh(), and may also be called in response to notification from the model.The update is performed by comparing the existing source ConnectionEditParts with the set of model source connections returned from getModelSourceConnections(). EditParts whose model no longer exists areremoved. New models have their ConnectionEditPartscreated. Subclasses should overridegetModelSourceChildren().This method should not be overridden. 
- 
refreshTargetConnectionsprotected void refreshTargetConnections()Updates the set of target ConnectionEditParts so that it is in sync with the model target connections. This method is called fromrefresh(), and may also be called in response to notification from the model.The update is performed by comparing the existing source ConnectionEditParts with the set of model source connections returned from getModelTargetConnections(). EditParts whose model no longer exists areremoved. New models have their ConnectionEditPartscreated. Subclasses should overridegetModelTargetChildren().This method should not be overridden. 
- 
registerVisualsprotected void registerVisuals()Registers the EditPart's Figure in the Viewer. This is what makes it possible for the Viewer to map a mouse location to an EditPart.- Overrides:
- registerVisualsin class- AbstractEditPart
- See Also:
 
- 
removeChildVisualRemove the child's Figure from thecontentPane.- Specified by:
- removeChildVisualin class- AbstractEditPart
- Parameters:
- childEditPart- the child EditPart
- See Also:
 
- 
removeNodeListenerDescription copied from interface:GraphicalEditPartRemoves the first occurance of the specified listener from the list of listeners. Does nothing if the listener was not present.- Specified by:
- removeNodeListenerin interface- GraphicalEditPart
- Parameters:
- listener- the listener being removed
- See Also:
 
- 
removeNotifypublic void removeNotify()ExtendsAbstractEditPart.removeNotify()to cleanupConnectionEditParts.- Specified by:
- removeNotifyin interface- EditPart
- Overrides:
- removeNotifyin class- AbstractEditPart
- See Also:
 
- 
removeSourceConnectionRemoves the given connection for which this EditPart is the source.
 Fires notification.
 Inverse ofaddSourceConnection(ConnectionEditPart, int)- Parameters:
- connection- Connection being removed
 
- 
removeTargetConnectionRemoves the given connection for which this EditPart is the target.
 Fires notification.
 Inverse ofaddTargetConnection(ConnectionEditPart, int)- Parameters:
- connection- Connection being removed
 
- 
reorderChildThis method is extended to preserve a LayoutManager constraint if one exists.- Overrides:
- reorderChildin class- AbstractEditPart
- Parameters:
- child- the child being reordered
- index- new index for the child
- See Also:
 
- 
reorderSourceConnectionMoves a sourceConnectionEditPartinto a lower index than it currently occupies. This method is called fromrefreshSourceConnections().- Parameters:
- connection- the ConnectionEditPart
- index- the new index
 
- 
reorderTargetConnectionMoves a targetConnectionEditPartinto a lower index than it currently occupies. This method is called fromrefreshTargetConnections().- Parameters:
- connection- the ConnectionEditPart
- index- the new index
 
- 
setFigureSets the Figure- Parameters:
- figure- the Figure
 
- 
setLayoutConstraintDescription copied from interface:GraphicalEditPartSets the specified constraint for a child's Figure on thecontent panefigure for this GraphicalEditPart. The constraint will be applied to the content pane'sLayoutManager.revalidate()is called on the content pane, which will cause it to layout during the next update.- Specified by:
- setLayoutConstraintin interface- GraphicalEditPart
- Parameters:
- child- the child GraphicalEditPart whose constraint is being set
- childFigure- the Figure whose constraint is being set
- constraint- the constraint for the draw2d- LayoutManager
- See Also:
 
- 
unregisterVisualsprotected void unregisterVisuals()Implemented to remove the Figure from the Viewer's registry.- Overrides:
- unregisterVisualsin class- AbstractEditPart
- See Also:
 
 
-