Package com.nomagic.magicdraw.properties
Class StyleManager
- java.lang.Object
-
- com.nomagic.magicdraw.properties.StyleManager
-
- All Implemented Interfaces:
com.nomagic.magicdraw.core.project.options.PersistentStyleManager
,PropertyVisitorAcceptor
,java.beans.PropertyChangeListener
,java.lang.Cloneable
,java.util.EventListener
@OpenApiAll public class StyleManager extends java.lang.Object implements PropertyVisitorAcceptor, java.beans.PropertyChangeListener, java.lang.Cloneable, com.nomagic.magicdraw.core.project.options.PersistentStyleManager
Style manager stores and manages a set of Styles.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
StyleManager.StyleListener
Listener for style events.
-
Constructor Summary
Constructors Constructor Description StyleManager()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(PropertyVisitor visitor)
Accepts the given visitor.void
addStyle(Style style)
Adds given style.static void
addStyleListener(StyleManager.StyleListener listener)
Adds static listener for listen style event.java.lang.Object
clone()
Makes a copy of this manager.static void
fireStyleAdded(StyleManager manager, Style style)
java.lang.String
getClassType()
Returns property class type.Style
getDefaultStyle()
Returns default style.java.util.List<Style>
getOrderedStyles()
Returns styles ordered by names.Style
getStyle(java.lang.String name)
Returns style with the specified name.Style
getStyleByID(java.lang.String id)
java.util.List<Style>
getStyles()
Returns all styles of this manager.void
propertyChange(java.beans.PropertyChangeEvent e)
Listens to PropertyNames.STYLE_MANAGER property change event.void
removeStyle(Style style)
Removes given style.static void
removeStyleListener(StyleManager.StyleListener listener)
Removes listener for listen style creation event.void
setDefaultStyle(Style style)
Sets default style for this manager.void
setStyles(java.util.Collection<Style> styles)
Sets all styles.
-
-
-
Method Detail
-
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(java.lang.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 java.lang.String id)
-
setDefaultStyle
public void setDefaultStyle(@CheckForNull Style style)
Sets default style for this manager.- Parameters:
style
- - the style to be default.
-
getStyles
public java.util.List<Style> getStyles()
Returns all styles of this manager.- Returns:
- all styles. Collection is unmodifiable.
-
getOrderedStyles
public java.util.List<Style> getOrderedStyles()
Returns styles ordered by names.- Returns:
- all styles ordered by name.
-
setStyles
public void setStyles(java.util.Collection<Style> styles)
Sets all styles.- Parameters:
styles
- a collection of new styles.
-
accept
public void accept(PropertyVisitor visitor) throws java.lang.Exception
Accepts the given visitor.- Specified by:
accept
in interfacePropertyVisitorAcceptor
- Parameters:
visitor
- the PropertyVisitor.- Throws:
java.lang.Exception
-
getClassType
public java.lang.String getClassType()
Returns property class type.- Specified by:
getClassType
in interfacePropertyVisitorAcceptor
- Returns:
- PropertyID.STYLE_MANAGER
- See Also:
PropertyID.STYLE_MANAGER
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
Listens to PropertyNames.STYLE_MANAGER property change event. TakesStyleManager
from new value and sets all styles from this manager to itself.- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Parameters:
e
- the property change event.
-
clone
public java.lang.Object clone()
Makes a copy of this manager. Does deep clone.- Overrides:
clone
in classjava.lang.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.
-
-