Class CSSClassNamesProp

All Implemented Interfaces:
EventListener, IGProp<String>, Cloneable

public final class CSSClassNamesProp extends StringProp
The class names property is basically a StringProp that hold the class names separated by space or commas used for UI components.
Author:
Christopher Mindus
  • Constructor Details

    • CSSClassNamesProp

      protected CSSClassNamesProp()
      Creates a Asset References property with no name and with a null value.
    • CSSClassNamesProp

      public CSSClassNamesProp(Atom propertyAtom)
      Creates a Asset References property with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
    • CSSClassNamesProp

      public CSSClassNamesProp(Atom propertyAtom, String newValue) throws PropValidateException
      Creates a Asset References property with the specified name and value.
      Parameters:
      propertyAtom - the property atom.
      newValue - the new string value for the property.
      Throws:
      PropValidateException - When the constraints are not met.
  • Method Details

    • clone

      public CSSClassNamesProp clone()
      Clones this property.
      Overrides:
      clone in class StringProp
      Returns:
      An AssetReferences instance.
    • getClassNames

      public final List<String> getClassNames()
      Gets the class names referenced. Each class name should be valid.
      Returns:
      The class names without whitespaces, empty entries are ignored, but duplicates may be returned.
    • getCSSClassNamesString

      public static String getCSSClassNamesString(Collection<String> cssNames)
      Validates the CSS class names collection and returns a String to use.

      A valid CSS class name consists of a string with the characters 'a-z', 'A-Z', '0-9' or '-_' and cannot start with a digit.

      Parameters:
      cssNames - A collection of Strings for the class names.
      Returns:
      The string to use without duplicates. Duplicate class names will just be removed, no exception will be thrown. If there are no classes names, null is returned.
      Throws:
      IllegalArgumentException - If one of the class names are invalid.
    • verify

      public final boolean verify(PropVerification verification)
      Verifies this property. The check performed is the extension of classes and that no circular reference is present.
      Specified by:
      verify in interface IGProp<String>
      Overrides:
      verify in class GProp<String>
      Parameters:
      verification - The property verification class.
      Returns:
      true if verification should proceed, false if disposed of and verification should not take place.