Class Style

    • Field Detail

      • LOGGER

        public static final java.util.logging.Logger LOGGER
      • abstractCssPropertyClassObjects

        protected java.util.Map<java.lang.String,AbstractCssProperty<?>> abstractCssPropertyClassObjects
        style name as key and value as object of AbstractCssProperty
    • Constructor Detail

      • Style

        public Style​()
      • Style

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

        public Style​(java.util.Map<java.lang.String,java.lang.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 Detail

      • addSupportForNewCustomCssClass

        public static void addSupportForNewCustomCssClass​(java.lang.String cssName,
                                                          java.lang.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​(java.lang.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​(java.lang.Class<?>... cssClasses)
        removes the support for the classes from Style class or its extended class.
        Parameters:
        cssClasses -
        Since:
        1.0.0
      • addCssProperties

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

        public boolean addCssProperties​(java.util.Map<java.lang.String,java.lang.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​(java.lang.String cssName,
                                      java.lang.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 java.util.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 java.util.List<CssProperty> addCssProperties​(java.util.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​(java.lang.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​(java.lang.String cssName,
                                         java.lang.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 java.util.List<java.lang.Boolean> removeCssProperties​(CssProperty... cssProperties)
        Parameters:
        cssProperties -
        Returns:
        the List<Boolean> of status whether the corresponding object has been removed.
        Since:
        1.0.0
      • removeCssProperties

        @Deprecated
        public java.util.List<java.lang.Boolean> removeCssProperties​(java.util.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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 java.util.Collection<CssProperty> getCssProperties​()
        gets the Collection<CssProperty>.
        Returns:
        Collection<CssProperty>
        Since:
        1.0.0
      • 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 java.util.Map<java.lang.String,java.lang.Class<?>> getSupportedCsspropertyClasses​()
        Returns:
        the csspropertyClasses
        Since:
        1.0.0
      • getAttributeValue

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