public interface IDiagramHandle
extends java.lang.AutoCloseable
This class is used to manipulate a diagram's content. @since 2.0
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this diagram handle and release associated ressources.
This IDiagramHandle mustn't be used any longer after calling this method. |
IDiagramGraphicFactory |
getCreationFactory()
Get the diagram graphics creation factory.
|
AbstractDiagram |
getDiagram()
Get the element this
IDiagramHandle is related to. |
java.util.List<IDiagramGraphic> |
getDiagramGraphics(MObject element)
Returns the list of diagram graphic representing (ie: for which the getElement() method does return the element
of) the given reference in this diagram or an empty list if none is found.
|
IDiagramDG |
getDiagramNode()
Get the diagram graphic for the diagram itself.
|
IDiagramGraphic |
getDrawingGraphic(java.lang.String identifier)
Return the drawing graphics matching the given identifier.
|
boolean |
isLayoutAssistantEnabled()
Tells whether the layout assistant is enabled for this session.
|
void |
mask(IDiagramGraphic graphic)
Mask a graphical element in the diagram.
|
void |
refreshDynamicDecoration()
Make sure the dynamic decoration is applied.
|
void |
save()
Save the diagram in Modelio.
|
void |
saveInFile(java.lang.String format,
java.lang.String targetFile,
int margin)
Saves the diagram image in a file with the specified name.
|
void |
setBatchMode(boolean batchMode)
Sets the batch edition mode on/off.
|
void |
setLayoutAssistantEnabled(java.lang.Boolean enabled)
Set whether the layout assistant is enabled.
|
java.util.List<IDiagramGraphic> |
unmask(MObject element,
int x,
int y)
Unmask a model element in a diagram.
|
void close()
close
in interface java.lang.AutoCloseable
IDiagramGraphicFactory getCreationFactory()
To be used to unmask elements and create new diagram drawings.
AbstractDiagram getDiagram()
IDiagramHandle
is related to.java.util.List<IDiagramGraphic> getDiagramGraphics(MObject element)
element
- a model element for which we are searching graphics.IDiagramDG getDiagramNode()
IDiagramGraphic getDrawingGraphic(java.lang.String identifier)
Returns null if no drawing graphic matches the identifier.
identifier
- a drawing graphic identifierboolean isLayoutAssistantEnabled()
The layout assistant is disabled by default while the diagram is open with the diagram API.
The layout assistant may be enabled by calling
setLayoutAssistantEnabled(Boolean)
with true as parameter.
void mask(IDiagramGraphic graphic)
graphic
- The graphical element to remove from the diagram.void save()
void saveInFile(java.lang.String format, java.lang.String targetFile, int margin)
format
- the format to write the images in.targetFile
- the name of the file to write the image to.margin
- the margins to add around the content of the diagram.void setBatchMode(boolean batchMode)
Activating the batch edition mode should be used as a memory consumption optimization when applying lots of
modification to a single diagram in a single transaction (e.g. when using the API to layout a diagram) to avoid
potential saves of intermediary states of the diagram.
Callers should turn batch edition mode off once modifications are done and call save()
to actually save the
applied modifications.
Note: Batch edition mode is automatically turned off when close()
is called but it is
considered good practice to turn it off explicitly (particularly since close()
may be called silently by
a try
-with-resources statement managing this diagram handle).
batchMode
- true if batch mode should be engaged.void setLayoutAssistantEnabled(java.lang.Boolean enabled)
The layout assistant is disabled by default while the diagram is open with the diagram API.
The layout assistant may be disabled until the diagram is closed
by
calling this method with false.
enabled
- whether the layout assistant is enabled.java.util.List<IDiagramGraphic> unmask(MObject element, int x, int y)
The model element is unmasked at the given position.
element
- the model element to unmask.x
- the x coordinates of the unmasking position.y
- the y coordinates of the unmasking position.null
.void refreshDynamicDecoration()
Call this method to force the diagram to refresh its overwritten properties if no model changes were triggered.