public abstract class AbstractGraphicalEditPart extends AbstractEditPart implements GraphicalEditPart
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.
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractGraphicalEditPart.AccessibleGraphicalEditPart
A default implementation of
AccessibleEditPart. |
protected class |
AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
The default implementation of
AccessibleAnchorProvider returned
in getAdapter(Class). |
AbstractEditPart.EditPolicyIterator| Modifier and Type | Field and Description |
|---|---|
protected IFigure |
figure
The Figure
|
protected java.util.List |
sourceConnections
List of source ConnectionEditParts
|
protected java.util.List |
targetConnections
List of source ConnectionEditParts
|
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAGSELECTED, SELECTED_NONE, SELECTED_PRIMARYREQ_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 and Description |
|---|
AbstractGraphicalEditPart() |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Extends
AbstractEditPart.activate() to also activate all
source ConnectionEditParts. |
protected void |
addChildVisual(EditPart childEditPart,
int index)
Adds the child's Figure to the
contentPane. |
void |
addNodeListener(NodeListener listener)
Adds a NodeListener to the EditPart.
|
void |
addNotify()
Called after the EditPart has been added to its parent.
|
protected void |
addSourceConnection(ConnectionEditPart connection,
int index)
Adds a source ConnectionEditPart at the specified index.
|
protected void |
addTargetConnection(ConnectionEditPart connection,
int index)
Adds a target ConnectionEditPart at the specified index.
|
protected ConnectionEditPart |
createConnection(java.lang.Object model)
Creates a
ConnectionEditPart for the given model. |
protected abstract IFigure |
createFigure()
Creates the
Figure to be used as this part's visuals. |
protected ConnectionEditPart |
createOrFindConnection(java.lang.Object model)
Searches for an existing
ConnectionEditPart in the Viewer's
EditPart registry and
returns it if one is found. |
void |
deactivate()
Extends
AbstractEditPart.deactivate() to also deactivate the
source ConnectionEditParts. |
protected void |
fireRemovingSourceConnection(ConnectionEditPart connection,
int index)
Notifies listeners that a source connection has been removed.
|
protected void |
fireRemovingTargetConnection(ConnectionEditPart connection,
int index)
Notifies listeners that a target connection has been removed.
|
protected void |
fireSourceConnectionAdded(ConnectionEditPart connection,
int index)
Notifies listeners that a source connection has been added.
|
protected void |
fireTargetConnectionAdded(ConnectionEditPart connection,
int index)
Notifies listeners that a target connection has been added.
|
java.lang.Object |
getAdapter(java.lang.Class key)
Extends
AbstractEditPart.getAdapter(Class) to handle additional
adapter types. |
IFigure |
getContentPane()
Implemented to delegate to
getFigure() by default. |
DragTracker |
getDragTracker(Request request)
Overridden to return a default
DragTracker for
GraphicalEditParts. |
IFigure |
getFigure()
The default implementation calls
createFigure() if the figure is
currently null. |
protected IFigure |
getLayer(java.lang.Object layer)
A convenience method for obtaining the specified layer from the
LayerManager. |
protected java.util.List |
getModelSourceConnections()
Returns the
List of the connection model objects for which
this EditPart's model is the source. |
protected java.util.List |
getModelTargetConnections()
Returns the
List of the connection model objects for which
this EditPart's model is the target. |
java.util.List |
getSourceConnections()
Returns the source connections for this GraphicalEditPart.
|
java.util.List |
getTargetConnections()
Returns the target connections for this GraphicalEditPart.
|
boolean |
isSelectable()
A GraphicalEditPart is considered selectable, if it is active and its
figure is showing.
|
protected void |
primAddSourceConnection(ConnectionEditPart connection,
int index)
Adds the specified source
ConnectionEditPart at an index. |
protected void |
primAddTargetConnection(ConnectionEditPart connection,
int index)
Adds the specified target
ConnectionEditPart at an index. |
protected void |
primRemoveSourceConnection(ConnectionEditPart connection)
Removes the specified source
ConnectionEditPart from the
sourceConnections List. |
protected void |
primRemoveTargetConnection(ConnectionEditPart connection)
Removes the specified target
ConnectionEditPart from the
targetConnections List. |
void |
refresh()
Extends
AbstractEditPart.refresh() to refresh two additional
structural features: source and target connections. |
protected void |
refreshSourceConnections()
Updates the set of source ConnectionEditParts so that it is in
sync with the model source connections.
|
protected void |
refreshTargetConnections()
Updates the set of target ConnectionEditParts so that it is in
sync with the model target connections.
|
protected void |
registerVisuals()
Registers the EditPart's Figure in the Viewer.
|
protected void |
removeChildVisual(EditPart childEditPart)
Remove the child's Figure from the
contentPane. |
void |
removeNodeListener(NodeListener listener)
Removes the first occurance of the specified listener from the list of
listeners.
|
void |
removeNotify()
Extends
AbstractEditPart.removeNotify() to cleanup
ConnectionEditParts. |
protected void |
removeSourceConnection(ConnectionEditPart connection)
Removes the given connection for which this EditPart is the
source.
|
protected void |
removeTargetConnection(ConnectionEditPart connection)
Removes the given connection for which this EditPart is the
target.
|
protected void |
reorderChild(EditPart child,
int index)
This method is extended to preserve a LayoutManager constraint if one
exists.
|
protected void |
reorderSourceConnection(ConnectionEditPart connection,
int index)
Moves a source
ConnectionEditPart into a lower index than it
currently occupies. |
protected void |
reorderTargetConnection(ConnectionEditPart connection,
int index)
Moves a target
ConnectionEditPart into a lower index than it
currently occupies. |
protected void |
setFigure(IFigure figure)
Sets the Figure
|
void |
setLayoutConstraint(EditPart child,
IFigure childFigure,
java.lang.Object constraint)
Sets the specified constraint for a child's Figure on the
content pane figure for this GraphicalEditPart. |
protected void |
unregisterVisuals()
Implemented to remove the Figure from the Viewer's registry.
|
activateEditPolicies, addChild, addEditPartListener, createChild, createEditPolicies, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, 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, unregisterModelclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddEditPartListener, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, removeEditPartListener, removeEditPolicy, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequestprotected IFigure figure
protected java.util.List sourceConnections
protected java.util.List targetConnections
public void activate()
AbstractEditPart.activate() to also activate all
source ConnectionEditParts.activate in interface EditPartactivate in class AbstractEditPartEditPart.activate()protected void addChildVisual(EditPart childEditPart, int index)
contentPane.addChildVisual in class AbstractEditPartchildEditPart - The EditPart being addedindex - The child's positionAbstractEditPart.addChildVisual(EditPart,
int)public void addNodeListener(NodeListener listener)
GraphicalEditPartaddNodeListener in interface GraphicalEditPartlistener - the ListenerGraphicalEditPart.addNodeListener(org.eclipse.gef.NodeListener)public void addNotify()
EditPartaddNotify in interface EditPartaddNotify in class AbstractEditPartEditPart.addNotify()protected void addSourceConnection(ConnectionEditPart connection, int index)
refreshSourceConnections(). There should
be no reason to call or override this method. Source connection are
created as a result of overriding getModelSourceConnections().
primAddSourceConnection(ConnectionEditPart, int) is called to
perform the actual update of the sourceConnections
List. The connection will have its source set to
this.
If active, this EditPart will activate the ConnectionEditPart.
Finally, all NodeListeners are notified of the new connection.
connection - Connection being addedindex - Index where it is being addedprotected void addTargetConnection(ConnectionEditPart connection, int index)
refreshTargetConnections(). There should
be no reason to call or override this method. Target connection are
created as a result of overriding getModelTargetConnections().
primAddTargetConnection(ConnectionEditPart, int) is called to
perform the actual update of the targetConnections
List. The connection will have its target set to
this.
Finally, all NodeListeners are notified of the new connection.
connection - Connection being addedindex - Index where it is being addedprotected ConnectionEditPart createConnection(java.lang.Object model)
ConnectionEditPart for the given model. Similar to
AbstractEditPart.createChild(Object). This method is called
indirectly during refreshSourceConnections(), and
refreshTargetConnections().
The default implementation goes to the EditPartViewer's
EditPartFactory to create the connection. This method should not
be overridden unless factories are not being used.
model - the connection model objectprotected abstract IFigure createFigure()
Figure to be used as this part's visuals.
This is called from getFigure() if the figure has not been
created.protected ConnectionEditPart createOrFindConnection(java.lang.Object model)
ConnectionEditPart in the Viewer's
EditPart registry and
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.model - the Connection's modelpublic void deactivate()
AbstractEditPart.deactivate() to also deactivate the
source ConnectionEditParts. Subclasses should extend this method
to remove any listeners added in activate().deactivate in interface EditPartdeactivate in class AbstractEditPartEditPart.deactivate()protected void fireRemovingSourceConnection(ConnectionEditPart connection, int index)
removeSourceConnection(ConnectionEditPart). There is no reason
for subclasses to call or override this method.connection - ConnectionEditPart being added as child.index - Position child is being added into.protected void fireRemovingTargetConnection(ConnectionEditPart connection, int index)
removeTargetConnection(ConnectionEditPart). There is no reason
for subclasses to call or override this method.connection - ConnectionEditPart being added as child.index - Position child is being added into.protected void fireSourceConnectionAdded(ConnectionEditPart connection, int index)
addSourceConnection(ConnectionEditPart, int). There is no reason
for subclasses to call or override this method.connection - ConnectionEditPart being added as child.index - Position child is being added into.protected void fireTargetConnectionAdded(ConnectionEditPart connection, int index)
addTargetConnection(ConnectionEditPart, int). There is no reason
for subclasses to call or override this method.connection - ConnectionEditPart being added as child.index - Position child is being added into.public java.lang.Object getAdapter(java.lang.Class key)
AbstractEditPart.getAdapter(Class) to handle additional
adapter types. Currently, these types include
AccessibleHandleProvider and AccessibleAnchorProvider.
Subclasses should extend this method to support additional
adapter types, or to replace the default provided adapaters.getAdapter in interface IAdaptablegetAdapter in class AbstractEditPartIAdaptable.getAdapter(Class)public IFigure getContentPane()
getFigure() by default. Subclasses
may overwrite in case the IFigure returned by
getFigure() is a composite figure and child figures should be
added to one of its children instead of the figure itself.getContentPane in interface GraphicalEditPartGraphicalEditPart.getContentPane()public DragTracker getDragTracker(Request request)
DragTracker for
GraphicalEditParts.getDragTracker in interface EditPartrequest - a Request indicating the context of the dragnull or a DragTrackerEditPart.getDragTracker(Request)public IFigure getFigure()
createFigure() if the figure is
currently null.getFigure in interface GraphicalEditPartGraphicalEditPart.getFigure()protected IFigure getLayer(java.lang.Object layer)
LayerManager.layer - ID of the Layernull if it doesn't existprotected java.util.List getModelSourceConnections()
List of 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 corresponding ConnectionEditPart.
Callers must not modify the returned List.
protected java.util.List getModelTargetConnections()
List of 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 corresponding ConnectionEditPart.
Callers must not modify the returned List.
public java.util.List getSourceConnections()
GraphicalEditPartgetSourceConnections in interface GraphicalEditPartGraphicalEditPart.getSourceConnections()public java.util.List getTargetConnections()
GraphicalEditPartgetTargetConnections in interface GraphicalEditPartGraphicalEditPart.getTargetConnections()public boolean isSelectable()
isSelectable in interface EditPartisSelectable in class AbstractEditParttrue if the receiver can be selectedAbstractEditPart.isSelectable()protected void primAddSourceConnection(ConnectionEditPart connection, int index)
ConnectionEditPart at an index.
This method is used to update the sourceConnections List. This
method is called from
addSourceConnection(ConnectionEditPart, int). Subclasses should
not call or override this method.connection - the ConnectionEditPartindex - the index of the addprotected void primAddTargetConnection(ConnectionEditPart connection, int index)
ConnectionEditPart at an index.
This method is used to update the targetConnections List. This
method is called from
addTargetConnection(ConnectionEditPart, int). Subclasses should
not call or override this method.connection - the ConnectionEditPartindex - the index of the addprotected void primRemoveSourceConnection(ConnectionEditPart connection)
ConnectionEditPart from the
sourceConnections List. This method is called from
removeSourceConnection(ConnectionEditPart). Subclasses should
not call or override this method.connection - Connection to remove.protected void primRemoveTargetConnection(ConnectionEditPart connection)
ConnectionEditPart from the
targetConnections List. This method is called from
removeTargetConnection(ConnectionEditPart). Subclasses should
not call or override this method.connection - Connection to remove.public void refresh()
AbstractEditPart.refresh() to refresh two additional
structural features: source and target connections.
Subclasses should probably override
AbstractEditPart.refreshVisuals() instead of this method.refresh in interface EditPartrefresh in class AbstractEditPartEditPart.refresh()protected void refreshSourceConnections()
refresh(), 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 are removed. New models have their ConnectionEditParts
created. Subclasses should override
getModelSourceChildren().
This method should not be overridden.
protected void refreshTargetConnections()
refresh(), 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 are removed. New models have their ConnectionEditParts
created. Subclasses should override
getModelTargetChildren().
This method should not be overridden.
protected void registerVisuals()
registerVisuals in class AbstractEditPartAbstractEditPart.registerVisuals()protected void removeChildVisual(EditPart childEditPart)
contentPane.removeChildVisual in class AbstractEditPartchildEditPart - the child EditPartAbstractEditPart.removeChildVisual(EditPart)public void removeNodeListener(NodeListener listener)
GraphicalEditPartremoveNodeListener in interface GraphicalEditPartlistener - the listener being removedGraphicalEditPart.removeNodeListener(org.eclipse.gef.NodeListener)public void removeNotify()
AbstractEditPart.removeNotify() to cleanup
ConnectionEditParts.removeNotify in interface EditPartremoveNotify in class AbstractEditPartEditPart.removeNotify()protected void removeSourceConnection(ConnectionEditPart connection)
addSourceConnection(ConnectionEditPart, int)connection - Connection being removedprotected void removeTargetConnection(ConnectionEditPart connection)
addTargetConnection(ConnectionEditPart, int)connection - Connection being removedprotected void reorderChild(EditPart child, int index)
reorderChild in class AbstractEditPartchild - the child being reorderedindex - new index for the childAbstractEditPart.reorderChild(EditPart,
int)protected void reorderSourceConnection(ConnectionEditPart connection, int index)
ConnectionEditPart into a lower index than it
currently occupies. This method is called from
refreshSourceConnections().connection - the ConnectionEditPartindex - the new indexprotected void reorderTargetConnection(ConnectionEditPart connection, int index)
ConnectionEditPart into a lower index than it
currently occupies. This method is called from
refreshTargetConnections().connection - the ConnectionEditPartindex - the new indexprotected void setFigure(IFigure figure)
figure - the Figurepublic void setLayoutConstraint(EditPart child, IFigure childFigure, java.lang.Object constraint)
GraphicalEditPartcontent pane figure for this GraphicalEditPart.
The constraint will be applied to the content pane's
LayoutManager. revalidate() is
called on the content pane, which will cause it to layout during the next
update.setLayoutConstraint in interface GraphicalEditPartchild - the child GraphicalEditPart whose constraint is being
setchildFigure - the Figure whose constraint is being setconstraint - the constraint for the draw2d
LayoutManagerGraphicalEditPart.setLayoutConstraint(EditPart, IFigure, Object)protected void unregisterVisuals()
unregisterVisuals in class AbstractEditPartAbstractEditPart.unregisterVisuals()Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.