Class FontFamily

  • All Implemented Interfaces:
    CssProperty, java.io.Serializable, java.lang.Cloneable


    public class FontFamily
    extends AbstractCssProperty<FontFamily>
     font-family: font|initial|inherit;
    
     Value:       [[  |  ] [, | ]* ] | inherit
     Initial:        depends on user agent
     Applies to:     all elements
     Inherited:      yes
     Percentages:    N/A
     Media:          visual
     Computed value:         as specified
    
     Support Classes :-
     1. GenericFontFamilyNameContants
     
    Since:
    1.0.0
    See Also:
    Serialized Form
    • Field Detail

      • LOGGER

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

        public static final java.lang.String[] EMPTY_ARRAY
    • Constructor Detail

      • FontFamily

        public FontFamily​()
        The initial will be set as the value
      • FontFamily

        public FontFamily​(java.lang.String cssValue)
        Parameters:
        cssValue - the css value to set.
      • FontFamily

        public FontFamily​(java.lang.String... fontFamilyNames)
         Eg:-
         String[] fontFamilyNames = {"Times New Roman", "Georgia", GenericFontFamilyNameContants.SERIF};
        
         
        Parameters:
        fontFamilyNames - the font family names.
      • FontFamily

        public FontFamily​(FontFamily fontFamily)
        Parameters:
        fontFamily - the FontFamily object from which the cssValue to set.And, null will throw NullValueException
    • Method Detail

      • getBuiltCssValue

        protected static java.lang.String getBuiltCssValue​(java.lang.String... fontFamilyNames)
        Parameters:
        fontFamilyNames -
        Returns:
        the built cssValue string from the given fontFamilyNames.
        Since:
        1.0.0
      • getCssName

        public java.lang.String getCssName​()
        Returns:
        the name portion in style, eg align-content for style align-content: center.
      • getCssValue

        public java.lang.String getCssValue​()
        Returns:
        the value portion in style, eg center for style align-content: center.
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object
      • setCssValue

        public FontFamily setCssValue​(java.lang.String cssValue)
        Specified by:
        setCssValue in class AbstractCssProperty<FontFamily>
        Parameters:
        cssValue - The value should be a fontFamilies sequence for example \ * "Times New Roman\", Georgia, Serif Or initial/inherit.
        Returns:
        the current object.
        Since:
        1.0.0
      • getExtractedFamilyNames

        protected static java.lang.String[] getExtractedFamilyNames​(java.lang.String familyNames,
                                                                    boolean validate)
        Parameters:
        familyNames -
        validate - TODO
        Returns:
        an array containing extracted family names from the given input.
        Since:
        1.0.0
      • setFontFamilyNames

        public void setFontFamilyNames​(java.lang.String[] fontFamilyNames)
         Eg:-
         String[] fontFamilyNames = {"Times New Roman", "Georgia", GenericFontFamilyNameContants.SERIF};
        
         
        Parameters:
        fontFamilyNames - the fontFamilyNames to set
        Since:
        1.0.0
      • getFontFamilyNames

        public java.lang.String[] getFontFamilyNames​()
        gets the font family names as an array and if here is no names set then returns an empty array.
         Note: it will never return null.
         
        Returns:
        the fontFamilyNames. If there is no family name set then returns an empty array instead of null.
        Since:
        1.0.0
      • setAsInitial

        public void setAsInitial​()
        sets as initial
        Since:
        1.0.0
      • setAsInherit

        public void setAsInherit​()
        sets as inherit
        Since:
        1.0.0
      • addFontFamilyName

        public static void addFontFamilyName​(java.lang.String fontFamilyName)
        Parameters:
        fontFamilyName - the supported font-family.
        Since:
        1.0.0
      • addFontFamilyNames

        public static void addFontFamilyNames​(java.util.Collection<java.lang.String> fontFamilyNames)
        Parameters:
        fontFamilyNames - the supported font-family names.
        Since:
        1.0.0
      • getAddedFontFamilyNames

        public java.util.Set<java.lang.String> getAddedFontFamilyNames​()
        Returns:
        the set of font-family names added by FontFamily#addFontFamilyName(String) and FontFamily#addFontFamilyNames(Collection) methods.
        Since:
        1.0.0
      • isValidateFontFamilyName

        public boolean isValidateFontFamilyName​()
        Returns:
        the validateFontFamilyName
        Since:
        1.0.0
      • setValidateFontFamilyName

        public void setValidateFontFamilyName​(boolean validateFontFamilyName)
        Parameters:
        validateFontFamilyName - the validateFontFamilyName to set
        Since:
        1.0.0
      • isValidateFontFamilyNameGlobally

        public static boolean isValidateFontFamilyNameGlobally​()
        Returns:
        the validateFontFamilyNameGlobally
        Since:
        1.0.0
      • setValidateFontFamilyNameGlobally

        public static void setValidateFontFamilyNameGlobally​(boolean validateFontFamilyNameGlobally)
        Parameters:
        validateFontFamilyNameGlobally - the validateFontFamilyNameGlobally to set
        Since:
        1.0.0
      • isValid

        public static boolean isValid​(java.lang.String cssValue)
        Returns:
        true if the given cssValue is validate. It also checks whether the font-family names added by FontFamily#addFontFamilyName(String) and FontFamily#addFontFamilyNames(Collection) methods contain the given cssValue.
        Since:
        1.0.0