Class AbstractNode
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- Direct Known Subclasses:
AbstractAnnotation
,AbstractConfigurationItem
,AbstractModel
,AbstractNumberFormat
,AbstractPluginOptions
,AbstractReadOnlyPoint
,Action
,AlignPosition
,Animation
,AnimationCollection
,Animations
,AnimationTransition
,Arrow
,BorderRadiusItem
,BoxLabel
,Callout
,Captions
,ChartElementOptions
,Colors
,Dataset
,DefaultToastOptions
,Dividers
,Drag
,EllipseLabel
,Font
,Label
,Label
,Labels
,Legend
,LegendItem
,LineLabel
,Listeners
,Padding
,Pinch
,PropertyOptions
,ScaleLabelItem
,Title
,ToastOptions
,Transitions
,Wheel
public abstract class AbstractNode extends NativeObjectContainer
Base class for all options nodes, which will wraps a native object and manages the relations about parent and children elements.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNode(AbstractNode parent, Key childKey, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.protected
AbstractNode(NativeObject nativeObject)
Creates the object with native object to map java script properties.
This is used for the root of tree composed by native objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkAndAddToParent()
Called recursively when a property has been set in the item.
This is mandatory because it could happen that the parent item is not present, therefore it must be added.protected Key
getChildKey()
Returns the property name to use to add this element to its parent.protected AbstractNode
getParentNode()
Returns the parent node.protected AbstractNode
getRootNode()
Returns the root node.NodeUpdateListener
getUpdateListener()
Returns the update listener instance if there is.protected AbstractNode
retrieveRoot()
Called recursively till the root of nodes.protected void
setArrayValueAndAddToParent(Key key, ArrayDoubleArrayList<?> container)
Sets a value (Array from a double array container list) in the embedded JavaScript object at specific property.protected void
setArrayValueAndAddToParent(Key key, ArrayObjectContainerList<?> container)
Sets a value (Array from a container list) in the embedded JavaScript object at specific property.protected <T extends Array>
voidsetArrayValueAndAddToParent(Key key, T value)
Sets a value (Array) in the embedded JavaScript object at specific property.protected void
setElementAndAddToParent(Key key, BaseHtmlElement value)
Sets a value (BaseHtmlElement) in the embedded JavaScript object at specific property.protected void
setInternalCallbackToModel(AbstractNode model, Key key, NativeCallback callback)
Adds a native callback function to a model at the specific key.protected void
setInternalCallbackToModel(AbstractNode model, Key key, CallbackProxy.Proxy proxy)
Adds a proxy function to a model at the specific key.void
setUpdateListener(NodeUpdateListener updateListener)
Sets an update listener instance to be invoked at every update.protected void
setValueAndAddToParent(Key key, boolean value)
Sets a value (boolean) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, double value)
Sets a value (double) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, int value)
Sets a value (int) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, String value)
Sets a value (string) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, Date value)
Sets a value (date) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, NativeCallback value)
Sets a value (callback function) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, Chart value)
Sets a value (chart) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, CallbackProxy.Proxy value)
Sets a value (callback proxy function) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, NativeArrayContainer<?> value)
Sets a value (JavaScript Object) in the embedded JavaScript object at specific property by array container.protected void
setValueAndAddToParent(Key key, NativeObject value)
Sets a value (JavaScript Object) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, NativeObjectContainer value)
Sets a value (JavaScript Object) in the embedded JavaScript object at specific property by object container.protected void
setValueAndAddToParent(Key key, Canvas value)
Sets a value (canvas) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, CanvasGradientItem value)
Sets a value (gradient) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, CanvasPatternItem value)
Sets a value (pattern) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, Img value)
Sets a value (image) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, NativeBaseEvent value)
Sets a value (event) in the embedded JavaScript object at specific property.protected void
setValueAndAddToParent(Key key, NativeHook value)
Sets a value (hook function for plugin) in the embedded JavaScript object at specific property.protected <T extends Key>
voidsetValueAndAddToParent(Key key, T value)
Sets a value (EnumValue) in the embedded JavaScript object at specific property.protected void
setValueOrArrayAndAddToParent(Key key, double... values)
Sets a value (Array or double) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a double.protected void
setValueOrArrayAndAddToParent(Key key, int... values)
Sets a value (Array or integer) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a integer.protected void
setValueOrArrayAndAddToParent(Key key, String... values)
Sets a value (Array or string) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a string.protected void
setValueOrArrayAndAddToParent(Key key, IsColor... values)
Sets a value (Array or string by colors) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a string.protected void
setValueOrArrayAndAddToParent(Key key, Key... values)
Sets a value (Array or string by keys) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a string.protected void
setValueOrArrayAndAddToParent(Key key, NativeObjectContainer... values)
Sets a value (array or native object container) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a native object container.protected void
setValueOrArrayAndAddToParent(Key key, Canvas... values)
Sets a value (array or canvas) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a canvas.protected void
setValueOrArrayAndAddToParent(Key key, CanvasGradientItem... values)
Sets a value (Array or gradient) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a gradient.protected void
setValueOrArrayAndAddToParent(Key key, CanvasPatternItem... values)
Sets a value (Array or pattern) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a pattern.protected void
setValueOrArrayAndAddToParent(Key key, Img... values)
Sets a value (array or image) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a image.-
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
-
-
-
-
Constructor Detail
-
AbstractNode
protected AbstractNode(NativeObject nativeObject)
Creates the object with native object to map java script properties.
This is used for the root of tree composed by native objects.- Parameters:
nativeObject
- native object to map java script properties
-
AbstractNode
protected AbstractNode(AbstractNode parent, Key childKey, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.- Parameters:
parent
- parent node to use to add this element where changedchildKey
- the property name of this element to use to add it to the parent.nativeObject
- native object to map java script properties
-
-
Method Detail
-
getChildKey
protected final Key getChildKey()
Returns the property name to use to add this element to its parent.- Returns:
- the childKey or
null
if is a root element.
-
getParentNode
protected final AbstractNode getParentNode()
Returns the parent node.- Returns:
- the parent node or
null
if is a root node.
-
getRootNode
protected final AbstractNode getRootNode()
Returns the root node.- Returns:
- the root node
-
getUpdateListener
public final NodeUpdateListener getUpdateListener()
Returns the update listener instance if there is.- Returns:
- the update listener
-
setUpdateListener
public final void setUpdateListener(NodeUpdateListener updateListener)
Sets an update listener instance to be invoked at every update.- Parameters:
updateListener
- an update listener instance to be invoked at every update
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, int value)
Sets a value (int) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, int... values)
Sets a value (Array or integer) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a integer.- Parameters:
key
- key of the property of JavaScript object.values
- values of integers to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, double value)
Sets a value (double) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, double... values)
Sets a value (Array or double) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a double.- Parameters:
key
- key of the property of JavaScript object.values
- values of doubles to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, boolean value)
Sets a value (boolean) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, String value)
Sets a value (string) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, String... values)
Sets a value (Array or string) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a string.- Parameters:
key
- key of the property of JavaScript object.values
- values of strings to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, Date value)
Sets a value (date) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, NativeObject value)
Sets a value (JavaScript Object) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, NativeObjectContainer value)
Sets a value (JavaScript Object) in the embedded JavaScript object at specific property by object container.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, NativeObjectContainer... values)
Sets a value (array or native object container) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a native object container.- Parameters:
key
- key of the property of JavaScript object.values
- native object containers to be set
-
setArrayValueAndAddToParent
protected final void setArrayValueAndAddToParent(Key key, ArrayObjectContainerList<?> container)
Sets a value (Array from a container list) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.container
- container of array
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, NativeArrayContainer<?> value)
Sets a value (JavaScript Object) in the embedded JavaScript object at specific property by array container.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setArrayValueAndAddToParent
protected final void setArrayValueAndAddToParent(Key key, ArrayDoubleArrayList<?> container)
Sets a value (Array from a double array container list) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.container
- container of array of doubles
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, CallbackProxy.Proxy value)
Sets a value (callback proxy function) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, NativeCallback value)
Sets a value (callback function) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, NativeHook value)
Sets a value (hook function for plugin) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, Canvas value)
Sets a value (canvas) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, Canvas... values)
Sets a value (array or canvas) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a canvas.- Parameters:
key
- key of the property of JavaScript object.values
- canvas to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, Img value)
Sets a value (image) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, Img... values)
Sets a value (array or image) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a image.- Parameters:
key
- key of the property of JavaScript object.values
- images to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, CanvasGradientItem value)
Sets a value (gradient) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, CanvasGradientItem... values)
Sets a value (Array or gradient) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a gradient.- Parameters:
key
- key of the property of JavaScript object.values
- gradients to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, CanvasPatternItem value)
Sets a value (pattern) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, CanvasPatternItem... values)
Sets a value (Array or pattern) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a pattern.- Parameters:
key
- key of the property of JavaScript object.values
- patterns to be set
-
setValueAndAddToParent
protected final <T extends Key> void setValueAndAddToParent(Key key, T value)
Sets a value (EnumValue) in the embedded JavaScript object at specific property.- Type Parameters:
T
- type of key- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, Key... values)
Sets a value (Array or string by keys) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a string.- Parameters:
key
- key of the property of JavaScript object.values
- value of keys to be set
-
setArrayValueAndAddToParent
protected final <T extends Array> void setArrayValueAndAddToParent(Key key, T value)
Sets a value (Array) in the embedded JavaScript object at specific property.- Type Parameters:
T
- type of array- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueOrArrayAndAddToParent
protected final void setValueOrArrayAndAddToParent(Key key, IsColor... values)
Sets a value (Array or string by colors) in the embedded JavaScript object at specific property.
This must be used when a java script property can contain an array or a string.- Parameters:
key
- key of the property of JavaScript object.values
- values of colors to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, Chart value)
Sets a value (chart) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setValueAndAddToParent
protected final void setValueAndAddToParent(Key key, NativeBaseEvent value)
Sets a value (event) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setElementAndAddToParent
protected final void setElementAndAddToParent(Key key, BaseHtmlElement value)
Sets a value (BaseHtmlElement) in the embedded JavaScript object at specific property.- Parameters:
key
- key of the property of JavaScript object.value
- value to be set
-
setInternalCallbackToModel
protected final void setInternalCallbackToModel(AbstractNode model, Key key, CallbackProxy.Proxy proxy)
Adds a proxy function 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
-
setInternalCallbackToModel
protected final void setInternalCallbackToModel(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
-
checkAndAddToParent
protected final void checkAndAddToParent()
Called recursively when a property has been set in the item.
This is mandatory because it could happen that the parent item is not present, therefore it must be added.
-
retrieveRoot
protected final AbstractNode retrieveRoot()
Called recursively till the root of nodes.- Returns:
- the root of the node
-
-