Package se.conciliate.extensions.store
Interface MTVertex
- All Superinterfaces:
Comparable<MTNamedObject>
,MTHistoryEnabled
,MTNamedObject
,MTVertexHeader
- All Known Subinterfaces:
MTCompleteVertex
Full interface for vertices. The vertex is the graphical representation of a symbol.
The vertex/symbol relationship is best explained with an example. A symbol could be for example
a role within the organization. This role will probably be involved in a number
of models within a repository, and we wish to use the same role everywhere to make
sure that changes to the roles data is reflected in all models. On the other hand,
the appearance of the role might differ between the models and this is where the
vertex comes in. The vertex defines the position, size, color (if overridden) and
so on of the role in a specific model.
- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the specific color settings for this vertex or null if this vertex has no specific color settings.getLayer()
Returns the layer that this vertex is in.getProperty
(String provider, String name) Returns a property value.getPropertyKeys
(String provider) Returns the property names of all properties stored by a provider.Returns all providers that have stored properties.Returns the symbol that this vertex represents.default String
getTitle()
default String
getTitle
(MTLanguageHeader lang) default MTEdit
prepareSave
(MTRemoteChangeHandler errorHandler) Prepares this vertex for saving.void
queueSave
(MTRemoteChangeHandler exceptionHandler) Puts this vertex on a save queue, making this call safe to do from the event dispatch thread.void
removeProperty
(String provider, String name) Removes a property.void
save()
Saves a new vertex or changes to an existing one.void
setBorderColor
(Color color) Sets the border color for the vertex.void
setBorderStroke
(BasicStroke stroke) Sets the border stroke for the vertex.void
Sets the bounds of the vertex.void
Sets the bounds of the vertex.void
setCenterLabel
(boolean centerLabel) Sets whether the vertex label should be centered in the vertex bounds.void
Sets the specific color settings for this vertex.void
Updates the label bounds to a default size and position.void
setDefaultLabelBounds
(MTLanguage language) Updates the label bounds to a default size and position.void
setDefaultLabelBounds
(MTLanguage language, Optional<Direction> forceSide) Updates the label bounds to a default size and position.void
setFrozen
(boolean frozen) Sets whether the vertex should be frozen.void
setHolder
(boolean holder) Sets whether the vertex should be a holder.void
setImageURL
(URL imageURL) Sets the image URL or null.void
setLabelBounds
(Rectangle bounds) Sets the label bounds in the current language.void
setLabelBounds
(MTLanguageHeader language, Rectangle bounds) Sets the label bounds in a given language.void
setLabelColor
(Color color) Sets the labels text color.void
setLabelFont
(Font font) Sets the labels font.void
setLockedProportions
(boolean lockedProportions) Sets whether the vertex should have locked proportions.default void
Sets this vertex as the owner of the symbol.void
setOwningSymbol
(boolean owning) Sets the symbol ownership.void
setProperty
(String provider, String name, String value) Sets a property value.void
setShowLabel
(boolean showLabel) Sets whether the vertex label should be shown.void
Sets the size of the vertex.void
Sets the size of the vertex.void
setSizeRatio
(float sizeRatio) Sets the size ratio (height/width) for a vertex with locked proportions.void
Sets the symbol that this vertex is showing.void
setZOrder
(int zOrder) Sets the z-order of the vertex.Methods inherited from interface se.conciliate.extensions.store.MTHistoryEnabled
getHistory, getID, getUUID
Methods inherited from interface se.conciliate.extensions.store.MTNamedObject
compareTo, getID, getParentRevisionID, getUUID
Methods inherited from interface se.conciliate.extensions.store.MTVertexHeader
expand, getBorderColor, getBorderStroke, getBounds, getID, getImageURL, getLabelBounds, getLabelBounds, getLabelColor, getLabelFont, getLanguages, getModelID, getSizeRatio, getSymbolID, getType, getUUID, getVariant, getZOrder, isBreakdownSymbol, isCenterLabel, isFrozen, isHolder, isLockedProportions, isManualLabelColor, isOwningSymbol, isShowLabel
-
Method Details
-
getTitle
- Specified by:
getTitle
in interfaceMTNamedObject
-
getTitle
- Specified by:
getTitle
in interfaceMTNamedObject
-
getSymbol
MTSymbolHeader getSymbol()Returns the symbol that this vertex represents.- Returns:
- Symbol that vertex represents.
- Since:
- 3.0
-
setSymbol
Sets the symbol that this vertex is showing. -
getLayer
MTLayerHeader getLayer()Returns the layer that this vertex is in.- Returns:
- the layer this vertex is in
- Since:
- 3.0
-
getColorTransformer
MTColorTransformer getColorTransformer()Returns the specific color settings for this vertex or null if this vertex has no specific color settings.- Returns:
- a color transformer that is used to colorize the vertex or null
- Since:
- 3.0
-
setSize
Sets the size of the vertex. By default the labels will move along with the resize.- Parameters:
size
- The new size of the vertex.
-
setSize
Sets the size of the vertex.- Parameters:
size
- The new size of the vertex.moveLabels
-true
if the labels should move when resizing.
-
setBounds
Sets the bounds of the vertex. By default the labels will move along with the vertex.- Parameters:
bounds
- The new bounds.- Since:
- 3.0
-
setBounds
Sets the bounds of the vertex.- Parameters:
bounds
- The new bounds.moveLabels
-true
if the labels should move along with the vertex.- Since:
- 3.2
-
setDefaultLabelBounds
void setDefaultLabelBounds()Updates the label bounds to a default size and position. This is calculated based on the size of the vertex and the current text.- Since:
- 3.2
-
setDefaultLabelBounds
Updates the label bounds to a default size and position. This is calculated based on the size of the vertex and the current text.- Parameters:
language
-- Since:
- 3.2
-
setDefaultLabelBounds
Updates the label bounds to a default size and position. This is calculated based on the size of the vertex and the current text.- Parameters:
language
-forceSide
- Force the label on this Direction- Since:
- 3.2
-
setLabelBounds
Sets the label bounds in the current language.- Parameters:
bounds
- The new label bounds.- Since:
- 3.0
-
setLabelBounds
Sets the label bounds in a given language.- Parameters:
language
- The language.bounds
- The new label bounds.- Since:
- 3.0
-
setLabelColor
Sets the labels text color.- Parameters:
color
- The new color.- Since:
- 3.0
-
setLabelFont
Sets the labels font.- Parameters:
font
- The new font.- Since:
- 3.0
-
setCenterLabel
void setCenterLabel(boolean centerLabel) Sets whether the vertex label should be centered in the vertex bounds.- Parameters:
centerLabel
-true
if label should be centered.- Since:
- 3.0
-
setHolder
void setHolder(boolean holder) Sets whether the vertex should be a holder.- Parameters:
holder
-true
to make the vertex a holder.- Since:
- 3.0
-
setFrozen
void setFrozen(boolean frozen) Sets whether the vertex should be frozen.- Parameters:
frozen
-true
to make the vertex frozen.- Since:
- 3.0
-
setLockedProportions
void setLockedProportions(boolean lockedProportions) Sets whether the vertex should have locked proportions.- Parameters:
lockedProportions
- true to lock the vertex proportions.- Since:
- 3.0
-
setSizeRatio
void setSizeRatio(float sizeRatio) Sets the size ratio (height/width) for a vertex with locked proportions.- Parameters:
sizeRatio
- The new sizeRatio.- Since:
- 3.2
-
setZOrder
void setZOrder(int zOrder) Sets the z-order of the vertex. Vertices with a higher z-order will be shown above other vertices in the same layer.- Parameters:
zOrder
- The new z-order of the vertex.
-
setShowLabel
void setShowLabel(boolean showLabel) Sets whether the vertex label should be shown.- Parameters:
showLabel
-true
to show the label.- Since:
- 3.0
-
setColorTransformer
Sets the specific color settings for this vertex.- Parameters:
transf
- the color transformer for this vertex- Since:
- 3.0
-
setImageURL
Sets the image URL or null.- Parameters:
imageURL
- An image URL or null.
-
setOwningSymbol
default void setOwningSymbol()Sets this vertex as the owner of the symbol. -
setOwningSymbol
void setOwningSymbol(boolean owning) Sets the symbol ownership.- Parameters:
owning
- If true, sets this vertex as owner of the symbol. If false, releases the ownership if this vertex is currently the owner.
-
queueSave
Puts this vertex on a save queue, making this call safe to do from the event dispatch thread. The vertex's symbol must be already persisted or on the save queue. If the symbol is persisted but not in the current workspace, the symbol is added to the current workspace.- Parameters:
exceptionHandler
- an exception handler that is called if an exception is raised during save, or null to let the saving thread's own exception handler deal with an uncaught (wrapping) runtime exception.
-
prepareSave
Prepares this vertex for saving. The returned edit can be batched together with other edits that needs to be saved in a single transaction. These can later be queued for saving with MTStore.queueEdits().- Parameters:
errorHandler
- an exception handler that is called if an exception is raised during save, or null to let the saving thread's own exception handler deal with an uncaught (wrapping) runtime exception.- Returns:
- An edit that can be queued to save the changes to the vertex.
-
save
Saves a new vertex or changes to an existing one. The vertex's symbol must be already persisted. If the symbol is persisted but not in the current workspace, the symbol is added to the current workspace.- Throws:
MTAccessException
MTRemoteChangeException
- Since:
- 3.0
-
setBorderColor
Sets the border color for the vertex. Note that this will only be saved upon calling save() if the vertex has a border stroke as well.- Parameters:
color
- The border color for the vertex.
-
setBorderStroke
Sets the border stroke for the vertex.- Parameters:
stroke
- The new stroke ornull
to use no border on the vertex.
-
getPropertyProviders
Returns all providers that have stored properties.- Returns:
- A set of provider ID:s
-
getPropertyKeys
Returns the property names of all properties stored by a provider.- Parameters:
provider
- The provider ID.- Returns:
- A set of property names.
-
getProperty
Returns a property value.- Parameters:
provider
- The ID of the provider that set this property.name
- The property name.- Returns:
- The property value or null.
-
setProperty
Sets a property value.- Parameters:
provider
- The ID of the provider setting this property.name
- The property name.value
- The new property value. Values longer than 255 characters will be truncated.
-
removeProperty
Removes a property.- Parameters:
provider
- The ID of the provider setting this property.name
- The property name.
-