public class GenericAttachedBoxTool extends DefaultAttachedBoxTool
This class provides hook methods to allow sub classes to configure created elements.
#postConfigure(IDiagramHandle, IDiagramGraphic, LinkRouterKind, ILinkPath, Point, MObject, MObject, List)
is called by #actionPerformed(IDiagramHandle, IDiagramGraphic, LinkRouterKind, ILinkPath, Point)
.
postInDiagramConfigure(IDiagramHandle, Rectangle, ModelElement, MObject, List)
is called by actionPerformedInDiagram(IDiagramHandle, Rectangle)
Constructor and Description |
---|
GenericAttachedBoxTool() |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptElement(IDiagramHandle diagramHandle,
IDiagramGraphic targetNode)
This method accept or refuse the interaction in the diagram.
|
void |
actionPerformed(IDiagramHandle diagramHandle,
IDiagramGraphic graphic,
IDiagramLink.LinkRouterKind routerType,
ILinkPath path,
Point point)
This method is called when the user click on an existing diagram element.
|
void |
actionPerformedInDiagram(IDiagramHandle diagramHandle,
Rectangle rect)
This method is called when the user click in the diagram background.
|
protected void |
postConfigure(IDiagramHandle diagramHandle,
IDiagramGraphic parentGraphic,
IDiagramLink.LinkRouterKind routerType,
ILinkPath path,
Point point,
MObject parentElement,
MObject newElement,
java.util.List<IDiagramGraphic> newGraphics)
Hook called by
#actionPerformed(IDiagramHandle, IDiagramGraphic, LinkRouterKind, ILinkPath, Point) once the element is created, configured, unmasked and before the transaction is committed. |
protected void |
postInDiagramConfigure(IDiagramHandle diagramHandle,
Rectangle rect,
ModelElement parentElement,
MObject newElement,
java.util.List<IDiagramGraphic> newGraphics)
Hook called by
actionPerformedInDiagram(IDiagramHandle, Rectangle) 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 acceptElement(IDiagramHandle diagramHandle, IDiagramGraphic targetNode)
DefaultAttachedBoxTool
This method is called until the interaction is validated by the user.
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 "forbiden" icon and the tooltip message is displayed in a
tooltip near the mouse pointer
acceptElement
in interface IAttachedBoxTool
acceptElement
in class DefaultAttachedBoxTool
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 graphic, IDiagramLink.LinkRouterKind routerType, ILinkPath path, Point point)
DefaultAttachedBoxTool
The method is in charge of creating the model element in the model and of unmasking the element in the diagram.
The originNode argument contains the diagram node container corresponding to the origin graphic box.
The rect argument is the rectangle that result from the user interaction with the diagram. This rect should be used to manage the unmasking of the model element in the diagram.
actionPerformed
in interface IAttachedBoxTool
actionPerformed
in class DefaultAttachedBoxTool
diagramHandle
- the representation of the diagram where the command has been triggered.graphic
- the graphic parent where the user has clicked.routerType
- the router type that is currently defined to compute the path of the link.path
- the link path deduced from the user interactions.point
- the point of the second user click.IDiagramHandle.unmask(MObject, int, int)
public void actionPerformedInDiagram(IDiagramHandle diagramHandle, Rectangle rect)
DefaultAttachedBoxTool
The method is in charge of creating the model element in the model and of unmasking the element in the diagram.
The rect argument is the rectangle that result from the user interaction with the diagram background. This rect should be used to manage the unmasking of the model element in the diagram.
actionPerformedInDiagram
in interface IAttachedBoxTool
actionPerformedInDiagram
in class DefaultAttachedBoxTool
diagramHandle
- the representation of the diagram where the command has been triggered.rect
- the rectangle of the object to create.IDiagramHandle.unmask(MObject,int, int)
protected void postConfigure(IDiagramHandle diagramHandle, IDiagramGraphic parentGraphic, IDiagramLink.LinkRouterKind routerType, ILinkPath path, Point point, MObject parentElement, MObject newElement, java.util.List<IDiagramGraphic> newGraphics)
#actionPerformed(IDiagramHandle, IDiagramGraphic, LinkRouterKind, ILinkPath, Point)
once the element is created, configured, unmasked and before the transaction is committed.
Does nothing by default. Sub classes may redefine this method to make additional modifications.
diagramHandle
- the diagram handleparentGraphic
- the graphic under which the element was unmaskedrouterType
- the router type that is currently defined to compute the path of the link.path
- the link path deduced from the user interactions.point
- the new graphic position.parentElement
- the model element owning the new element.newElement
- the created model element.newGraphics
- the graphics relating the new element that were unmasked.protected void postInDiagramConfigure(IDiagramHandle diagramHandle, Rectangle rect, ModelElement parentElement, MObject newElement, java.util.List<IDiagramGraphic> newGraphics)
actionPerformedInDiagram(IDiagramHandle, Rectangle)
once the element is created, configured, unmasked and before the transaction is committed.
Does nothing by default. Sub classes may redefine this method to make additional modifications.
diagramHandle
- the diagram handlerect
- the new graphic bounds.parentElement
- the model element owning the new element.newElement
- the created model element.newGraphics
- the graphics relating the new element that were unmasked.