All Implemented Interfaces:
StateChangeInformer<CssProperty>, TagBase, GlobalAttributable, Serializable, Cloneable

See Also:
  • Field Details

    • abstractCssPropertyClassObjects

      protected final Map<String,AbstractCssProperty<?>> abstractCssPropertyClassObjects
      style name as key and value as object of AbstractCssProperty
  • Constructor Details

    • Style

      public Style()
    • Style

      public Style(String styles)
      Parameters:
      styles - styles separated by semicolon.
      eg :- color:blue;text-align:center
    • Style

      public Style(Map<String,String> styles)
      Parameters:
      styles - Map containing styles,
      eg :
      Map<String, String> styles = new HashMap<String, String>();
      styles.put("color", "green");
    • Style

      public Style(CssProperty... cssProperties)
      Parameters:
      cssProperties - eg :- addCssProperties(AlignContent.FLEX_END, AlignItems.FLEX_END)
      Since:
      1.0.0
    • Style

      public Style(boolean important, CssProperty... cssProperties)
      Parameters:
      important - true to mark the given style as important.
      cssProperties - eg :- addStyles(true, AlignContent.FLEX_END, AlignItems.FLEX_END)
      Since:
      1.0.0
  • Method Details

    • addSupportForNewCustomCssClass

      public static void addSupportForNewCustomCssClass(String cssName, Class<?> cssClass)
      Parameters:
      cssName - custom css name eg:- "custom-width"
      cssClass - corresponding custom css class/enum for "custom-width" , may be CustomWidth.class
      Since:
      1.0.0
    • removeSupportOfCssClass

      public static void removeSupportOfCssClass(Class<?> cssClass)
      removes the support for the class from Style class or its extended class.
      Parameters:
      cssClass -
      Since:
      1.0.0
    • removeSupportOfCssClasses

      public static void removeSupportOfCssClasses(Class<?>... cssClasses)
      removes the support for the classes from Style class or its extended class.
      Parameters:
      cssClasses -
      Since:
      1.0.0
    • getStyleLock

      protected StampedLock getStyleLock()
      Returns:
      the lock for this object
      Since:
      3.0.1
    • addCssProperties

      public void addCssProperties(String cssProperties)
      Parameters:
      cssProperties - styles separated by semicolon.
      eg :- color:blue;text-align:center
      Since:
      1.0.0
    • addCssProperties

      public boolean addCssProperties(Map<String,String> cssProperties)
      Parameters:
      cssProperties - Map containing styles,
      eg :
      Map<String, String> cssProperties = new HashMap<String, String>();
      cssProperties.put("color", "green");
      Returns:
      true if the values are added otherwise false.
    • addCssProperty

      public boolean addCssProperty(String cssName, String cssValue)
      eg: addCssProperty("color", "green")
      Parameters:
      cssName - eg: color
      cssValue - eg: green (for color styleName)
      Returns:
      true if the cssName and cssValue has been added or modified. If it contains same style name and value then it will return false.
      Since:
      1.0.0
    • addCssProperties

      public void addCssProperties(boolean important, CssProperty... cssProperties)
      Parameters:
      important - true to mark the given style as important.
      cssProperties - eg :- addCssProperties(true, AlignContent.FLEX_END, AlignItems.FLEX_END)
      Since:
      1.0.0
    • addCssProperties

      public List<CssProperty> addCssProperties(CssProperty... cssProperties)
      Parameters:
      cssProperties - eg :- addStyles(AlignContent.FLEX_END, AlignItems.FLEX_END)
      Returns:
      the added CssProperty objects as a List<CssProperty>.
      Since:
      1.0.0
    • addCssProperties

      @Deprecated public List<CssProperty> addCssProperties(Collection<? extends CssProperty> cssProperties)
      Deprecated.
      After using this method, adding or removing any value in the collection will not have any effect on Style, so this method may be removed later.
      adds each cssProperty from the given collection.
      NB:- After using this method, adding or removing any value in the collection will not have any effect on Style, so this method may be removed later.
      Parameters:
      cssProperties - eg :- addStyles(Arrays.asList(AlignContent.FLEX_END, AlignItems.FLEX_END))
      Returns:
      the added CssProperty objects as a List<CssProperty>.
      Since:
      1.0.0
    • addCssProperty

      public CssProperty addCssProperty(CssProperty cssProperty)
      Parameters:
      cssProperty - eg :- addStyle(AlignContent.FLEX_END)
      Returns:
      the added CssProperty objects as a CssProperty.
      Since:
      1.0.0
    • removeCssProperty

      public boolean removeCssProperty(String cssName)
      removes the style.
      Parameters:
      cssName - eg: color
      Returns:
      true if the given cssName (as well as value contained corresponding to it) has been removed, if it contains no cssName then false.
      Since:
      1.0.0
    • removeCssProperty

      public boolean removeCssProperty(String cssName, String cssValue)
      removes only if it contains the given style name and value.
      Parameters:
      cssName - eg: color
      cssValue - eg: green (for color styleName)
      Returns:
      true if the given syleName (as well as value contained corresponding to it) has been removed, or false if it doesn't contain the given styleName and value.
      Since:
      1.0.0
    • removeCssProperty

      public boolean removeCssProperty(CssProperty cssProperty)
      removes the style.
      Parameters:
      cssProperty -
      Returns:
      true if the given syleName (as well as value contained corresponding to it) has been removed, or false if it doesn't contain the given styleName and value.
      Since:
      1.0.0
    • removeCssProperties

      public List<Boolean> removeCssProperties(CssProperty... cssProperties)
      Parameters:
      cssProperties -
      Returns:
      the List<Boolean> of status whether the corresponding object has been removed.
      Since:
      1.0.0
    • removeAllCssProperties

      public void removeAllCssProperties()
      Removes all css properties
      Since:
      3.0.1
    • contains

      public boolean contains(CssProperty cssProperty)
      Checks if the given cssProperty object exists in this style object.
      Returns:
      Since:
      3.0.1
    • removeCssProperties

      @Deprecated public List<Boolean> removeCssProperties(Collection<CssProperty> cssProperties)
      Deprecated.
      After using this method, adding or removing any value in the collection will not have any effect on Style, so this method may be removed later.
      NB:- After using this method, adding or removing any value in the collection will not have any effect on Style, so this method may be removed later.
      Parameters:
      cssProperties -
      Returns:
      the List<Boolean> of status whether the corresponding object has been removed.
      Since:
      1.0.0
    • markAsImportant

      public boolean markAsImportant(String styleName)
      marks as important. i.e. it will add !important from the corresponding styleName value
      Parameters:
      styleName -
      Returns:
      true if it's marked as important or false if it already marked as important
      Since:
      1.0.0
    • markAsUnimportant

      public boolean markAsUnimportant(String styleName)
      marks as unimportant. i.e. it will remove !important from the corresponding styleName value
      Parameters:
      styleName -
      Returns:
      true if it's marked as unimportant or false if it already marked as unimportant
      Since:
      1.0.0
    • init

      protected void init()
      invokes only once per object
      Since:
      1.0.0
    • isImportant

      public boolean isImportant(CssProperty cssProperty)
      Parameters:
      cssProperty -
      Returns:
      true if the given style value has been set as important otherwise false. eg : for content-align : flex-end, isImportant(AlignContent.FLEX_END) will return true but isImportant(AlignContent.CENTER) will return false. Use isImportant(alignContent.getName()) or isImportant(StyleContants.ALIGN_CONTENT) to avoid checking of the value.
      Since:
      1.0.0
    • isImportant

      public boolean isImportant(String styleName)
      Parameters:
      styleName -
      Returns:
      true if the given style name is marked as important. eg:- for content-align : flex-end, isImportant(alignContent.getName()) and isImportant(StyleContants.ALIGN_CONTENT) will return true.
      Since:
      1.0.0
    • getCssProperty

      public CssProperty getCssProperty(String cssName)
      Parameters:
      cssName -
      Returns:
      the Enum object which implements CssProperty interface. This object be may type casted in to the corresponding enum, eg:-
      CssProperty cssProperty = style.getCssProperty(CssConstants.ALIGN_CONTENT);
      if (cssProperty != null && CssConstants.ALIGN_CONTENT.equals(cssProperty.getName()))
      AlignContent alignContent = (AlignContent) cssProperty;

      Since:
      1.0.0
    • getCssProperties

      public Collection<CssProperty> getCssProperties()
      gets the Collection<CssProperty>. It's unmodifiable set since 3.0.1.
      Returns:
      Collection<CssProperty>
      Since:
      1.0.0
    • getCssPropertiesSize

      public int getCssPropertiesSize()
      Returns:
      the size
      Since:
      3.0.1
    • isCssPropertiesEmpty

      public boolean isCssPropertiesEmpty()
      Returns:
      true if empty
      Since:
      3.0.1
    • stateChanged

      public void stateChanged(CssProperty stateChangedObject)
      Specified by:
      stateChanged in interface StateChangeInformer<CssProperty>
    • beforePrintStructure

      protected void beforePrintStructure()
      Description copied from class: AbstractAttribute
      invokes just before getPrintStructure(final boolean method and only if the getPrintStructure(final boolean} rebuilds the structure.
      Overrides:
      beforePrintStructure in class AbstractAttribute
    • getSupportedCsspropertyClasses

      public static Map<String,Class<?>> getSupportedCsspropertyClasses()
      Returns:
      the csspropertyClasses
      Since:
      1.0.0
    • getAttributeValue

      public String getAttributeValue()
      Overrides:
      getAttributeValue in class AbstractAttribute
      Returns:
      the value string of css properties
      Since:
      2.1.9