Class AbstractScriptableFont<T extends ChartContext>
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.options.AbstractReadOnlyFont
-
- org.pepstock.charba.client.options.AbstractFont
-
- org.pepstock.charba.client.options.AbstractScriptableFont<T>
-
- Type Parameters:
T
- type of scriptable context
- All Implemented Interfaces:
IsDefaultFont
,IsFont
public abstract class AbstractScriptableFont<T extends ChartContext> extends AbstractFont
Object can be provided with additional configuration by callbacks to define font options at runtime, and with the possibility to resetFontCallback
if theIsScriptableFontProvider
instance has been set with aFontCallback
.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractScriptableFont(IsScriptableFontProvider<T> scriptableFontProvider, IsDefaultFont defaultValues)
Creates an empty font to use for chart configuration.protected
AbstractScriptableFont(IsScriptableFontProvider<T> scriptableFontProvider, IsDefaultFont defaultValues, NativeObject nativeObject)
Creates a font to use for chart configuration, wrapping a native object instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
resetCallback()
Invokes when any property of the font is being set, in order to reset theFontCallback
if existsvoid
setFamily(String family)
Sets the font family, follows CSS font-family options.void
setLineHeight(double lineHeight)
Sets the line height.void
setLineHeight(String lineHeight)
Sets the line height.void
setSize(int size)
Sets the font size.void
setStyle(FontStyle style)
Sets the font style, follows CSS font-style options (i.e.void
setWeight(Weight weight)
Sets the font weight, follows CSS font-style-weight options.-
Methods inherited from class org.pepstock.charba.client.options.AbstractFont
getUpdateListener, setUpdateListener
-
Methods inherited from class org.pepstock.charba.client.options.AbstractReadOnlyFont
create, getFamily, getLineHeight, getLineHeightAsString, getObject, getSize, getStyle, getWeight
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkAndGetColor, 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, 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, getLineHeightAsString, getSize, getStyle, getWeight
-
-
-
-
Constructor Detail
-
AbstractScriptableFont
protected AbstractScriptableFont(IsScriptableFontProvider<T> scriptableFontProvider, IsDefaultFont defaultValues)
Creates an empty font to use for chart configuration.- Parameters:
scriptableFontProvider
- the provider of font callbackdefaultValues
- default provider
-
AbstractScriptableFont
protected AbstractScriptableFont(IsScriptableFontProvider<T> scriptableFontProvider, IsDefaultFont defaultValues, NativeObject nativeObject)
Creates a font to use for chart configuration, wrapping a native object instance.- Parameters:
scriptableFontProvider
- the provider of font callbackdefaultValues
- default providernativeObject
- native object to map java script properties
-
-
Method Detail
-
setSize
public void setSize(int size)
Description copied from interface:IsFont
Sets the font size.- Specified by:
setSize
in interfaceIsFont
- Overrides:
setSize
in classAbstractFont
- Parameters:
size
- the font size.
-
setStyle
public void setStyle(FontStyle style)
Description copied from interface:IsFont
Sets the font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).- Specified by:
setStyle
in interfaceIsFont
- Overrides:
setStyle
in classAbstractFont
- Parameters:
style
- Font style, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
-
setFamily
public void setFamily(String family)
Description copied from interface:IsFont
Sets the font family, follows CSS font-family options.- Specified by:
setFamily
in interfaceIsFont
- Overrides:
setFamily
in classAbstractFont
- Parameters:
family
- Font family, follows CSS font-family options.
-
setWeight
public void setWeight(Weight weight)
Description copied from interface:IsFont
Sets the font weight, follows CSS font-style-weight options.- Specified by:
setWeight
in interfaceIsFont
- Overrides:
setWeight
in classAbstractFont
- Parameters:
weight
- font weight, follows CSS font-style-weight options.
-
setLineHeight
public void setLineHeight(double lineHeight)
Description copied from interface:IsFont
Sets the line height.- Specified by:
setLineHeight
in interfaceIsFont
- Overrides:
setLineHeight
in classAbstractFont
- Parameters:
lineHeight
- the line height.
-
setLineHeight
public void setLineHeight(String lineHeight)
Description copied from interface:IsFont
Sets the line height.- Specified by:
setLineHeight
in interfaceIsFont
- Overrides:
setLineHeight
in classAbstractFont
- Parameters:
lineHeight
- the line height.
-
resetCallback
protected void resetCallback()
Invokes when any property of the font is being set, in order to reset theFontCallback
if exists
-
-