public interface ILinkTool extends IDiagramTool
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.
This interface is intended to be implemented by MDA Components in order to add commands in a diagram palette.
Modifier and Type | Method and Description |
---|---|
boolean |
acceptFirstElement(IDiagramHandle diagramHandle,
IDiagramGraphic targetNode)
This method accept or refuse the interaction in the diagram for the origin of the link.
|
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.
|
void |
actionPerformed(IDiagramHandle diagramHandle,
IDiagramGraphic originNode,
IDiagramGraphic targetNode,
IDiagramLink.LinkRouterKind routerType,
ILinkPath path)
This method is invoked when the command is launched.
|
decorate, getBitmap, getLabel, getModule, getParameters, getSourceScopes, getTargetScopes, getTooltip, initialize
boolean acceptFirstElement(IDiagramHandle diagramHandle, IDiagramGraphic targetNode)
This method is called until the user clicks on an element.
If the interaction is allowed the method return new InteractionStatus(true, "");
If the interaction is not allowed the method return new InteractionStatus(false, "Tooltip message");
. In this case the mouse pointer is changed to a "forbidden" icon and the tooltip message is displayed in a
tooltip near the mouse pointer
diagramHandle
- the representation of the diagram in which the interaction occurs.targetNode
- the graphic that is below the mouse pointer.boolean acceptSecondElement(IDiagramHandle diagramHandle, IDiagramGraphic originNode, IDiagramGraphic targetNode)
This method is called after the user has choosen the origin of the link.
If the interaction is allowed the method return new InteractionStatus(true, "");
If the interaction is not allowed the method return new InteractionStatus(false, "Tooltip message");
. In this case the mouse pointer is changed to a "forbidden" icon and the tooltip message is displayed in a
tooltip near the mouse pointer
The acceptSecondElement method will be called until the user choose the destination of the link.
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.void actionPerformed(IDiagramHandle diagramHandle, IDiagramGraphic originNode, IDiagramGraphic targetNode, IDiagramLink.LinkRouterKind routerType, ILinkPath path)
The actionPerformed is called after user has choosen the destination of the link.
The method is in charge of creating the link in the model and of unmasking it in the diagram.
originNode
and targetNode
are the origin and the destination of the link.
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.routerType
- the router type that is currently defined to compute the path of the link.path
- the link path deduced from the user interactions.IDiagramHandle.unmask(MObject, int, int)