public interface IMultiLinkTool extends IDiagramTool
acceptFirstElement
method is called to know if
the element flown over by the mouse is valid to be the first element of the interaction. If it is not valid as first
element, then the acceptLastElement
method is
called to know if the element flown over by the mouse is valid as last element of the interaction (in which case the
interaction is done with a single click, as is the case for IBoxCommand for example). acceptAdditionalElement
method is
called to know if the element flown over by the mouse can be added to the current interaction. If it is not valid to
be added to the current interaction, then the acceptLastElement
method is called to know if the element flown over by the mouse is valid as last element of the
interaction.acceptAdditionalElement
method doesn't
accept the element to be added to the interaction but the
acceptLastElement
method accepts the element
as last element of the interaction, the
actionPerformed
method is
called. actionPerformed
method
is in charge of creating the elements in the model and of unmasking them 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 |
acceptAdditionalElement(IDiagramHandle diagramHandle,
java.util.List<IDiagramGraphic> previousNodes,
IDiagramGraphic targetNode)
This method accept or refuse the interaction with the diagram for an additional element of the interaction.
|
boolean |
acceptFirstElement(IDiagramHandle diagramHandle,
IDiagramGraphic targetNode)
This method accept or refuse the interaction in the diagram for the first element.
|
boolean |
acceptLastElement(IDiagramHandle diagramHandle,
java.util.List<IDiagramGraphic> otherNodes,
IDiagramGraphic targetNode)
This method accept or refuse the interaction with the diagram for the "last" element of the interaction.
|
void |
actionPerformed(IDiagramHandle diagramHandle,
IDiagramGraphic lastNode,
java.util.List<IDiagramGraphic> otherNodes,
java.util.List<IDiagramLink.LinkRouterKind> routerKinds,
java.util.List<ILinkPath> paths,
Rectangle rectangle)
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 acceptLastElement method is called with the same arguments, to check if the pointed element
could be the last of the interaction.
diagramHandle
- the representation of the diagram in which the interaction occurs.targetNode
- the graphic that is below the mouse pointer.boolean acceptAdditionalElement(IDiagramHandle diagramHandle, java.util.List<IDiagramGraphic> previousNodes, IDiagramGraphic targetNode)
new InteractionStatus(true, "");
new InteractionStatus(false, "Tooltip message");
. In this case the acceptLastElement method is called with the same arguments, to check if the pointed element
could be the last of the interaction.diagramHandle
- the representation of the diagram in which the interaction occurs.previousNodes
- the graphics accepted until now (might be empty).targetNode
- the graphic that is below the mouse pointer.boolean acceptLastElement(IDiagramHandle diagramHandle, java.util.List<IDiagramGraphic> otherNodes, IDiagramGraphic targetNode)
new InteractionStatus(true, "");
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 pointerdiagramHandle
- the representation of the diagram in which the interaction occurs.otherNodes
- the graphics accepted until now (might be empty).targetNode
- the graphic that is below the mouse pointer (might be null if no graphic under the mouse pointer, in
which case the diagram itself or its composition owner might be considered).void actionPerformed(IDiagramHandle diagramHandle, IDiagramGraphic lastNode, java.util.List<IDiagramGraphic> otherNodes, java.util.List<IDiagramLink.LinkRouterKind> routerKinds, java.util.List<ILinkPath> paths, Rectangle rectangle)
lastNode
is the graphic accepted by the acceptLastElement method.
otherNodes
are all the graphics accepted by calls to acceptFirstNode and acceptAdditionalNode.diagramHandle
- the representation of the diagram where the command has been triggered.lastNode
- the last graphic accepted (might be null if no graphic under the mouse pointer, in which case the
diagram itself or its composition owner might be considered).otherNodes
- all previous accepted graphics.routerKinds
- the router types that are currently defined to compute the path of the links from the previously
accepted graphics to the element to create.paths
- the link paths deduced from the user interactions.rectangle
- the rectangle of the object to create.IDiagramHandle.unmask(MObject, int, int)