Interface MTVertex

All Superinterfaces:
Comparable<MTNamedObject>, MTHistoryEnabled, MTNamedObject, MTVertexHeader
All Known Subinterfaces:
MTCompleteVertex

public interface MTVertex extends MTVertexHeader, MTHistoryEnabled, MTNamedObject
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 Details

    • getTitle

      default String getTitle()
      Specified by:
      getTitle in interface MTNamedObject
    • getTitle

      default String getTitle(MTLanguageHeader lang)
      Specified by:
      getTitle in interface MTNamedObject
    • getSymbol

      MTSymbolHeader getSymbol()
      Returns the symbol that this vertex represents.
      Returns:
      Symbol that vertex represents.
      Since:
      3.0
    • setSymbol

      void setSymbol(MTSymbol symbol)
      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

      void setSize(Dimension size)
      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

      void setSize(Dimension size, boolean moveLabels)
      Sets the size of the vertex.
      Parameters:
      size - The new size of the vertex.
      moveLabels - true if the labels should move when resizing.
    • setBounds

      void setBounds(Rectangle bounds)
      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

      void setBounds(Rectangle bounds, boolean moveLabels)
      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

      void setDefaultLabelBounds(MTLanguage language)
      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

      void setDefaultLabelBounds(MTLanguage language, Optional<Direction> forceSide)
      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

      void setLabelBounds(Rectangle bounds)
      Sets the label bounds in the current language.
      Parameters:
      bounds - The new label bounds.
      Since:
      3.0
    • setLabelBounds

      void setLabelBounds(MTLanguageHeader language, Rectangle bounds)
      Sets the label bounds in a given language.
      Parameters:
      language - The language.
      bounds - The new label bounds.
      Since:
      3.0
    • setLabelColor

      void setLabelColor(Color color)
      Sets the labels text color.
      Parameters:
      color - The new color.
      Since:
      3.0
    • setLabelFont

      void setLabelFont(Font font)
      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

      void setColorTransformer(MTColorTransformer transf)
      Sets the specific color settings for this vertex.
      Parameters:
      transf - the color transformer for this vertex
      Since:
      3.0
    • setImageURL

      void setImageURL(URL imageURL)
      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

      void queueSave(MTRemoteChangeHandler exceptionHandler)
      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

      default MTEdit prepareSave(MTRemoteChangeHandler errorHandler)
      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

      void setBorderColor(Color color)
      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

      void setBorderStroke(BasicStroke stroke)
      Sets the border stroke for the vertex.
      Parameters:
      stroke - The new stroke or null to use no border on the vertex.
    • getPropertyProviders

      Set<String> getPropertyProviders()
      Returns all providers that have stored properties.
      Returns:
      A set of provider ID:s
    • getPropertyKeys

      Set<String> getPropertyKeys(String provider)
      Returns the property names of all properties stored by a provider.
      Parameters:
      provider - The provider ID.
      Returns:
      A set of property names.
    • getProperty

      String getProperty(String provider, String name)
      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

      void setProperty(String provider, String name, String value)
      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

      void removeProperty(String provider, String name)
      Removes a property.
      Parameters:
      provider - The ID of the provider setting this property.
      name - The property name.