Class ColorProperty

java.lang.Object
com.nomagic.magicdraw.properties.Property
com.nomagic.magicdraw.properties.ColorProperty
All Implemented Interfaces:
PropertyVisitorAcceptor, Cloneable

@OpenApiAll public class ColorProperty extends Property
The property for storing and editing some Color value.
  • Field Details

  • Constructor Details

    • ColorProperty

      public ColorProperty()
      Default constructor. Value of the property will be null. ID will be empty string.
    • ColorProperty

      public ColorProperty(String id, @CheckForNull Color value)
      The property constructor.
      Parameters:
      id - the ID of property.
      value - the color value of the property.
  • Method Details

    • getValueStringRepresentation

      public String getValueStringRepresentation()
      Returns value's string representation.
      Overrides:
      getValueStringRepresentation in class Property
      Returns:
      value's string representation - "RGB [red, green, blue]". If value null, returns "".
    • getStringRepresentation

      public static String getStringRepresentation(Color c)
    • isValueCompatible

      protected boolean isValueCompatible(Object value)
      Overrides:
      isValueCompatible in class Property
      Returns:
      true if given object can be assigned as value to this property
    • accept

      public void accept(PropertyVisitor v) throws Exception
      Accepts the given visitor.
      Specified by:
      accept in interface PropertyVisitorAcceptor
      Overrides:
      accept in class Property
      Parameters:
      v - the PropertyVisitor.
      Throws:
      Exception
    • getColor

      public Color getColor()
      Returns value as color object.
      Returns:
      value as color.
    • getClassType

      public String getClassType()
      Returns property class type.
      Specified by:
      getClassType in interface PropertyVisitorAcceptor
      Overrides:
      getClassType in class Property
      Returns:
      PropertyID.COLOR_PROPERTY
      See Also:
    • clone

      public ColorProperty clone()
      Description copied from class: Property
      Clones the property. Clone is not deep, the clone will have the same instance of value. The clone will not have registered PropertyChangeListeners.
      Overrides:
      clone in class Property
      Returns:
      the cloned property.