Package com.webfirmframework.wffweb.css
Class FontFamily
java.lang.Object
com.webfirmframework.wffweb.css.core.AbstractCssProperty<FontFamily>
com.webfirmframework.wffweb.css.FontFamily
- All Implemented Interfaces:
CssProperty
,Serializable
,Cloneable
font-family: font|initial|inherit;
Value: [[ <family-name> | <generic-family> ] [, <family-name>| <generic-family>]* ] | 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:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTheinitial
will be set as the valueFontFamily
(FontFamily fontFamily) FontFamily
(String cssValue) FontFamily
(String... fontFamilyNames) Eg:- String[] fontFamilyNames = {"Times New Roman", "Georgia", GenericFontFamilyNameContants.SERIF}; -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addFontFamilyName
(String fontFamilyName) static void
addFontFamilyNames
(Collection<String> fontFamilyNames) protected static String
getBuiltCssValue
(String... fontFamilyNames) protected static String[]
getExtractedFamilyNames
(String familyNames, boolean validate) String[]
gets the font family names as an array and if here is no names set then returns an empty array.static boolean
boolean
static boolean
void
sets asinherit
void
sets asinitial
setCssValue
(String cssValue) void
setFontFamilyNames
(String[] fontFamilyNames) Eg:- String[] fontFamilyNames = {"Times New Roman", "Georgia", GenericFontFamilyNameContants.SERIF};void
setValidateFontFamilyName
(boolean validateFontFamilyName) static void
setValidateFontFamilyNameGlobally
(boolean validateFontFamilyNameGlobally) toString()
Methods inherited from class com.webfirmframework.wffweb.css.core.AbstractCssProperty
clone, getStateChangeInformer, isAlreadyInUse, setAlreadyInUse, setStateChangeInformer, toCssString
-
Field Details
-
INITIAL
- See Also:
-
INHERIT
- See Also:
-
EMPTY_ARRAY
-
-
Constructor Details
-
FontFamily
public FontFamily()Theinitial
will be set as the value -
FontFamily
- Parameters:
cssValue
- the css value to set.
-
FontFamily
Eg:- String[] fontFamilyNames = {"Times New Roman", "Georgia", GenericFontFamilyNameContants.SERIF};
- Parameters:
fontFamilyNames
- the font family names.
-
FontFamily
- Parameters:
fontFamily
- theFontFamily
object from which the cssValue to set.And,null
will throwNullValueException
-
-
Method Details
-
getBuiltCssValue
- Parameters:
fontFamilyNames
-- Returns:
- the built cssValue string from the given fontFamilyNames.
- Since:
- 1.0.0
-
getCssName
- Returns:
- the name portion in style, eg
align-content
for stylealign-content: center
.
-
getCssValue
- Returns:
- the value portion in style, eg
center
for stylealign-content: center
.
-
toString
-
setCssValue
- Specified by:
setCssValue
in classAbstractCssProperty<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
- Parameters:
familyNames
-validate
- TODO- Returns:
- an array containing extracted family names from the given input.
- Since:
- 1.0.0
-
setFontFamilyNames
Eg:- String[] fontFamilyNames = {"Times New Roman", "Georgia", GenericFontFamilyNameContants.SERIF};
- Parameters:
fontFamilyNames
- the fontFamilyNames to set- Since:
- 1.0.0
-
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 asinitial
- Since:
- 1.0.0
-
setAsInherit
public void setAsInherit()sets asinherit
- Since:
- 1.0.0
-
addFontFamilyName
- Parameters:
fontFamilyName
- the supported font-family.- Since:
- 1.0.0
-
addFontFamilyNames
- Parameters:
fontFamilyNames
- the supported font-family names.- Since:
- 1.0.0
-
getAddedFontFamilyNames
- Returns:
- the set of font-family names added by
FontFamily#addFontFamilyName(String)
andFontFamily#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
- Returns:
- true if the given cssValue is validate. It also checks whether the
font-family names added by
FontFamily#addFontFamilyName(String)
andFontFamily#addFontFamilyNames(Collection)
methods contain the given cssValue. - Since:
- 1.0.0
-