Class StyleManager

java.lang.Object
com.nomagic.magicdraw.properties.StyleManager
All Implemented Interfaces:
com.nomagic.magicdraw.core.project.options.PersistentStyleManager, PropertyVisitorAcceptor, PropertyChangeListener, Cloneable, EventListener

@OpenApiAll public class StyleManager extends Object implements PropertyVisitorAcceptor, PropertyChangeListener, Cloneable, com.nomagic.magicdraw.core.project.options.PersistentStyleManager
Style manager stores and manages a set of Styles.
  • Constructor Details

    • StyleManager

      public StyleManager()
      Default constructor.
  • Method Details

    • addStyle

      public void addStyle(Style style)
      Adds given style.
      Parameters:
      style - the style to add.
    • removeStyle

      public void removeStyle(Style style)
      Removes given style.
      Parameters:
      style - the style to remove.
    • getDefaultStyle

      @CheckForNull public Style getDefaultStyle()
      Returns default style.
      Returns:
      the default style of this manager.
    • getStyle

      @CheckForNull public Style getStyle(String name)
      Returns style with the specified name.
      Parameters:
      name - style name.
      Returns:
      style if such exists or null if not found.
    • getStyleByID

      @CheckForNull public Style getStyleByID(@CheckForNull String id)
    • setDefaultStyle

      public void setDefaultStyle(@CheckForNull Style style)
      Sets default style for this manager.
      Parameters:
      style - - the style to be default.
    • getStyles

      public List<Style> getStyles()
      Returns all styles of this manager.
      Returns:
      all styles. Collection is unmodifiable.
    • getOrderedStyles

      public List<Style> getOrderedStyles()
      Returns styles ordered by names.
      Returns:
      all styles ordered by name.
    • setStyles

      public void setStyles(Collection<Style> styles)
      Sets all styles.
      Parameters:
      styles - a collection of new styles.
    • accept

      public void accept(PropertyVisitor visitor) throws Exception
      Accepts the given visitor.
      Specified by:
      accept in interface PropertyVisitorAcceptor
      Parameters:
      visitor - the PropertyVisitor.
      Throws:
      Exception
    • getClassType

      public String getClassType()
      Returns property class type.
      Specified by:
      getClassType in interface PropertyVisitorAcceptor
      Returns:
      PropertyID.STYLE_MANAGER
      See Also:
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Listens to PropertyNames.STYLE_MANAGER property change event. Takes StyleManagerfrom new value and sets all styles from this manager to itself.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - the property change event.
    • clone

      public Object clone()
      Makes a copy of this manager. Does deep clone.
      Overrides:
      clone in class Object
      Returns:
      a clone of this manager.
    • fireStyleAdded

      public static void fireStyleAdded(StyleManager manager, Style style)
    • addStyleListener

      public static void addStyleListener(StyleManager.StyleListener listener)
      Adds static listener for listen style event. Listener is added in application scope and does not depends on project.
      Parameters:
      listener - Listener to be added.
    • removeStyleListener

      public static void removeStyleListener(StyleManager.StyleListener listener)
      Removes listener for listen style creation event.
      Parameters:
      listener - Listener to be removed.