Class AbstractImmutableFont
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.options.AbstractImmutableFont
-
- All Implemented Interfaces:
IsDefaultFont
,IsImmutableFont
public abstract class AbstractImmutableFont extends NativeObjectContainer implements IsImmutableFont
Base class to map a font element in read-only mode, normalized by CHART.JS byHelpers.toFont(org.pepstock.charba.client.items.FontItem)
, providing also the CSS string of font itself.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractImmutableFont(NativeObject nativeObject)
Creates a immutable font to use, wrapping a native object instance, and providing a CSS string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FontItem
create()
Creates a font options instance using default or cloning current instance.String
getFamily()
Returns the font family, follows CSS font-family options.double
getLineHeight()
Returns the height of an individual line of text.String
getLineHeightAsString()
Returns the height of an individual line of text as string.protected NativeObject
getObject()
Returns the native object instance.int
getSize()
Returns the font size.FontStyle
getStyle()
Returns the font style, follows CSS font-style options (i.e.Weight
getWeight()
Returns the font weight, follows CSS font-style-weight options.String
toCSSString()
Builds the font string (shorthand property of CSS font) to use in the canvas object.
See here CSS specification.-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.defaults.IsDefaultFont
create, create, getFamily, getLineHeight, getSize, getStyle, getWeight
-
-
-
-
Constructor Detail
-
AbstractImmutableFont
protected AbstractImmutableFont(NativeObject nativeObject)
Creates a immutable font to use, wrapping a native object instance, and providing a CSS string.- Parameters:
nativeObject
- native object to map java script properties
-
-
Method Detail
-
getLineHeightAsString
public final String getLineHeightAsString()
Description copied from interface:IsDefaultFont
Returns the height of an individual line of text as string.- Specified by:
getLineHeightAsString
in interfaceIsDefaultFont
- Returns:
- the height of an individual line of text as string.
-
toCSSString
public final String toCSSString()
Description copied from interface:IsImmutableFont
Builds the font string (shorthand property of CSS font) to use in the canvas object.
See here CSS specification.- Specified by:
toCSSString
in interfaceIsImmutableFont
- Returns:
- the font string to use in the canvas object.
-
getSize
public int getSize()
Description copied from interface:IsDefaultFont
Returns the font size.- Specified by:
getSize
in interfaceIsDefaultFont
- Returns:
- the font size.
-
getStyle
public FontStyle getStyle()
Description copied from interface:IsDefaultFont
Returns the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).- Specified by:
getStyle
in interfaceIsDefaultFont
- Returns:
- the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
-
getFamily
public String getFamily()
Description copied from interface:IsDefaultFont
Returns the font family, follows CSS font-family options.- Specified by:
getFamily
in interfaceIsDefaultFont
- Returns:
- Font family, follows CSS font-family options.
-
getWeight
public Weight getWeight()
Description copied from interface:IsDefaultFont
Returns the font weight, follows CSS font-style-weight options.- Specified by:
getWeight
in interfaceIsDefaultFont
- Returns:
- the font weight, follows CSS font-style-weight options.
-
getLineHeight
public double getLineHeight()
Description copied from interface:IsDefaultFont
Returns the height of an individual line of text.- Specified by:
getLineHeight
in interfaceIsDefaultFont
- Returns:
- the height of an individual line of text.
-
create
public FontItem create()
Description copied from interface:IsDefaultFont
Creates a font options instance using default or cloning current instance.- Specified by:
create
in interfaceIsDefaultFont
- Returns:
- a font options instance using default or cloning current instance
-
getObject
protected final NativeObject getObject()
Returns the native object instance.- Returns:
- the native object instance.
-
-