public class GenericMultiLinkTool extends DefaultMultiLinkTool
This implementation handles only n-ary Association, Link and Connector.
Constructor and Description |
---|
GenericMultiLinkTool() |
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.
|
protected void |
postConfigure(IDiagramHandle diagramHandle,
IDiagramGraphic lastNode,
java.util.List<IDiagramGraphic> otherNodes,
java.util.List<IDiagramLink.LinkRouterKind> routerKinds,
java.util.List<ILinkPath> paths,
Rectangle rectangle,
MObject newElement,
java.util.List<IDiagramGraphic> newGraphics)
Hook called once the element is created, configured, unmasked and before the transaction is committed.
|
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 boolean acceptFirstElement(IDiagramHandle diagramHandle, IDiagramGraphic targetNode)
DefaultMultiLinkTool
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.
acceptFirstElement
in interface IMultiLinkTool
acceptFirstElement
in class DefaultMultiLinkTool
diagramHandle
- the representation of the diagram in which the interaction occurs.targetNode
- the graphic that is below the mouse pointer.public void actionPerformed(IDiagramHandle diagramHandle, IDiagramGraphic lastNode, java.util.List<IDiagramGraphic> otherNodes, java.util.List<IDiagramLink.LinkRouterKind> routerKinds, java.util.List<ILinkPath> paths, Rectangle rectangle)
DefaultMultiLinkTool
lastNode
is the graphic accepted by the acceptLastElement method.
otherNodes
are all the graphics accepted by calls to acceptFirstNode and acceptAdditionalNode.actionPerformed
in interface IMultiLinkTool
actionPerformed
in class DefaultMultiLinkTool
diagramHandle
- the representation of the diagram where the command has been triggered.lastNode
- the last graphic accepted.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)
public boolean acceptAdditionalElement(IDiagramHandle diagramHandle, java.util.List<IDiagramGraphic> previousNodes, IDiagramGraphic targetNode)
DefaultMultiLinkTool
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.acceptAdditionalElement
in interface IMultiLinkTool
acceptAdditionalElement
in class DefaultMultiLinkTool
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.public boolean acceptLastElement(IDiagramHandle diagramHandle, java.util.List<IDiagramGraphic> otherNodes, IDiagramGraphic targetNode)
DefaultMultiLinkTool
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
pointeracceptLastElement
in interface IMultiLinkTool
acceptLastElement
in class DefaultMultiLinkTool
diagramHandle
- 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.protected void postConfigure(IDiagramHandle diagramHandle, IDiagramGraphic lastNode, java.util.List<IDiagramGraphic> otherNodes, java.util.List<IDiagramLink.LinkRouterKind> routerKinds, java.util.List<ILinkPath> paths, Rectangle rectangle, MObject newElement, java.util.List<IDiagramGraphic> newGraphics)
Does nothing by default. Sub classes may redefine this method to make additional modifications.
diagramHandle
- the diagram handlelastNode
- the last graphic nodeotherNodes
- the other graphic nodesrouterKinds
- the router types that are currently defined to compute the path of the links.paths
- the link paths deduced from the user interactions.rectangle
- the rectangle of the object to create.newElement
- the created link elementnewGraphics
- the graphics relating the new element that were unmasked.