Class AbstractModel<P extends AbstractModel<?,?>,D>
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.options.AbstractModel<P,D>
-
- Type Parameters:
P
- parent node classD
- defaults provider class
- Direct Known Subclasses:
AbstractElement
,AbstractScale
,AbstractTitle
,Adapters
,AngleLines
,Datasets
,Decimation
,DisplayFormats
,Elements
,Filler
,Grid
,Interaction
,Layout
,Legend
,LegendLabels
,LegendTitle
,Major
,Options
,Plugins
,PointLabels
,ScaleBorder
,ScaleDateAdapter
,Scales
,ScaleTitle
,Segment
,Ticks
,Time
,Tooltips
,TooltipsCallbacks
,TypedDataset
public abstract class AbstractModel<P extends AbstractModel<?,?>,D> extends AbstractNode
Base class for all options, which will wraps a native object and manages the relations about parent and children elements.
Provides also a set of methods to manages callbacks and events.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected D
getDefaultValues()
Returns the default provider instance.protected P
getParent()
Returns the parent element.protected Padding
loadPadding(Key property, IsDefaultPadding defaultPadding)
Loads the padding size or object from the abstract model, replacing the property, if is a number, with the object which is returned.protected void
setCallbackToModel(AbstractNode model, Key key, NativeCallback callback)
Adds a native callback function to a model at the specific key.protected void
setCallbackToModel(AbstractNode model, Key key, CallbackProxy.Proxy proxy)
Adds a proxy function (for callbacks) to a model at the specific key.protected void
setEventToModel(AbstractNode model, Key key, CallbackProxy.Proxy proxy)
Adds a proxy function (for events) to a model at the specific key.-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, getUpdateListener, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setUpdateListener, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
-
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, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Method Detail
-
getParent
protected final P getParent()
Returns the parent element.- Returns:
- the parent or
null
if is a root element.
-
getDefaultValues
protected final D getDefaultValues()
Returns the default provider instance.- Returns:
- the default provider instance.
-
setEventToModel
protected final void setEventToModel(AbstractNode model, Key key, CallbackProxy.Proxy proxy)
Adds a proxy function (for events) to a model at the specific key.- Parameters:
model
- element where adding the function proxykey
- property name to use to add the function proxyproxy
- the function proxy instance to add
-
setCallbackToModel
protected final void setCallbackToModel(AbstractNode model, Key key, CallbackProxy.Proxy proxy)
Adds a proxy function (for callbacks) to a model at the specific key.- Parameters:
model
- element where adding the function proxykey
- property name to use to add the function proxyproxy
- the function proxy instance to add
-
setCallbackToModel
protected final void setCallbackToModel(AbstractNode model, Key key, NativeCallback callback)
Adds a native callback function to a model at the specific key.- Parameters:
model
- element where adding the function callbackkey
- property name to use to add the function callbackcallback
- the function callback instance to add
-
loadPadding
protected final Padding loadPadding(Key property, IsDefaultPadding defaultPadding)
Loads the padding size or object from the abstract model, replacing the property, if is a number, with the object which is returned.- Parameters:
property
- property where the padding is stored inside the model.defaultPadding
- default padding instance- Returns:
- a padding object, attached to this model
-
-