public abstract class DefaultLinkTool extends DefaultDiagramTool implements ILinkTool
In a diagram, graphic links are graphic objects that display diagram links. For example an
ElementImport is a graphic link. ILinkCommand
is the
interface that drives the interaction of creating a link
The interaction is started when the user clicks on the button in the diagram palette. Once the interaction is started
the user can use the mouse to create a new graphic link in the diagram. The
acceptFirstElement
method is called to know if the
element flown over by the mouse is valid to be the origin of the link. If it is not valid the user cannot click. If
the element is valid the interaction moves on to the next step. The
acceptSecondElement
is called
until the user click on the destination of the link. When the user clicks on the destination the
actionPerformed
method is called.
The
actionPerformed
is in charge of creating the link in the model and of unmasking the element in the diagram.
Subclass the DefaultLinkCommand to provide a behavior to the
actionPerformed
method.
Constructor and Description |
---|
DefaultLinkTool() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
acceptFirstElement(IDiagramHandle diagramHandle,
IDiagramGraphic targetNode)
This method accept or refuse the interaction in the diagram for the origin of the link.
|
abstract boolean |
acceptSecondElement(IDiagramHandle diagramHandle,
IDiagramGraphic originNode,
IDiagramGraphic targetNode)
This method accept or refuse the interaction with the diagram for the destination element of the link.
|
abstract void |
actionPerformed(IDiagramHandle diagramHandle,
IDiagramGraphic originNode,
IDiagramGraphic targetNode,
IDiagramLink.LinkRouterKind touterType,
ILinkPath path)
This method is invoked when the command is launched.
|
decorate, findStereotypeFromSpec, getBitmap, getLabel, getModule, getParameter, getParameters, getSourceScopes, getTargetScopes, getTooltip, initialize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decorate, getBitmap, getLabel, getModule, getParameters, getSourceScopes, getTargetScopes, getTooltip, initialize
public abstract boolean acceptFirstElement(IDiagramHandle diagramHandle, IDiagramGraphic targetNode)
This method is called until the user clicks on an element.
This default implementation always accept the interaction.
acceptFirstElement
in interface ILinkTool
diagramHandle
- the representation of the diagram in which the interaction occurs.targetNode
- the graphic that is below the mouse pointer.public abstract boolean acceptSecondElement(IDiagramHandle diagramHandle, IDiagramGraphic originNode, IDiagramGraphic targetNode)
This method is called after the user has choosen the origin of the link.
This default implementation always accept the interaction.
acceptSecondElement
in interface ILinkTool
diagramHandle
- the representation of the diagram in which the interaction occurs.originNode
- the graphic that is the origin of the link.targetNode
- the graphic the is below the mouse pointer.public abstract void actionPerformed(IDiagramHandle diagramHandle, IDiagramGraphic originNode, IDiagramGraphic targetNode, IDiagramLink.LinkRouterKind touterType, ILinkPath path)
The actionPerformed is called after user has choosen the destination of the link.
This default implementation does nothing.
actionPerformed
in interface ILinkTool
diagramHandle
- the representation of the diagram where the command has been triggered.originNode
- the origin graphic of the link to create.targetNode
- the destination graphic of the link to create.path
- the link path deduced from the user interactions.touterType
- the router type that is currently defined to compute the path of the link.IDiagramHandle.unmask(MObject, int, int)