Class Merger
- java.lang.Object
-
- org.pepstock.charba.client.commons.Merger
-
public final class Merger extends Object
Singleton utility to merge java script object in the another one and provide the service to get the chart options with all defaults.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Mergerget()Singleton method to get the instancevoidload(NativeObjectContainer options, ChartEnvelop<NativeObject> envelop)Merges the chart options, built after the chart initialization on the chart configuration in order that the configuration can contain all values, also the defaults.voidload(IsChart chart, NativeObjectContainer options, ChartEnvelop<NativeObject> envelop)Merges chart default options (by chart.defaults[type]), default scale options (by chart.defaults.scale) and global options (by chart.defaults.global) and chart options.
The chain of priority is:
chart options chart default options (by chart.defaults[type]) default scale options (by chart.defaults.scale) global options (by chart.defaults.global)voidload(Type type, ChartEnvelop<ChartOptions> options, ChartEnvelop<NativeObject> envelop)Merges chart default options (by chart.defaults[type]), default scale options (by chart.defaults.scale) and global options (by chart.defaults.global).
The chain of priority is:
chart default options (by chart.defaults[type]) default scale options (by chart.defaults.scale) global options (by chart.defaults.global)voidload(Type type, ChartEnvelop<NativeObject> envelop)Merges chart default options (by chart.defaults[type]), default scale options (by chart.defaults.scale) and global options (by chart.defaults.global).
The chain of priority is:
chart default options (by chart.defaults[type]) default scale options (by chart.defaults.scale) global options (by chart.defaults.global)NativeObjectmerge(NativeObjectContainer target, NativeObjectContainer source, String property)Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property isNativeObjectmerge(NativeObjectContainer target, NativeObject source, String property)Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property isNativeObjectmerge(NativeObject target, NativeObjectContainer source, String property)Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property isNativeObjectmerge(NativeObject target, NativeObject source, String property)Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property is
-
-
-
Method Detail
-
get
public static Merger get()
Singleton method to get the instance- Returns:
- merger instance
-
load
public void load(NativeObjectContainer options, ChartEnvelop<NativeObject> envelop)
Merges the chart options, built after the chart initialization on the chart configuration in order that the configuration can contain all values, also the defaults.- Parameters:
options- chart options configurationenvelop- the envelop for options as native options
-
load
public void load(IsChart chart, NativeObjectContainer options, ChartEnvelop<NativeObject> envelop)
Merges chart default options (by chart.defaults[type]), default scale options (by chart.defaults.scale) and global options (by chart.defaults.global) and chart options.
The chain of priority is:
- chart options
- chart default options (by chart.defaults[type])
- default scale options (by chart.defaults.scale)
- global options (by chart.defaults.global)
- Parameters:
chart- chart instance which contains the chart options to be mergedoptions- the options as native object container to be mergedenvelop- the envelop for options as native options
-
load
public void load(Type type, ChartEnvelop<NativeObject> envelop)
Merges chart default options (by chart.defaults[type]), default scale options (by chart.defaults.scale) and global options (by chart.defaults.global).
The chain of priority is:
- chart default options (by chart.defaults[type])
- default scale options (by chart.defaults.scale)
- global options (by chart.defaults.global)
- Parameters:
type- chart typeenvelop- the envelop for options as native options
-
load
public void load(Type type, ChartEnvelop<ChartOptions> options, ChartEnvelop<NativeObject> envelop)
Merges chart default options (by chart.defaults[type]), default scale options (by chart.defaults.scale) and global options (by chart.defaults.global).
The chain of priority is:
- chart default options (by chart.defaults[type])
- default scale options (by chart.defaults.scale)
- global options (by chart.defaults.global)
- Parameters:
type- chart typeoptions- temporary chart options in order to get a default for the chart optionsenvelop- the envelop for options as native options
-
merge
public NativeObject merge(NativeObjectContainer target, NativeObjectContainer source, String property)
Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property is- Parameters:
target- The target object in whichsourceis merged into.source- Object to merge in thetarget.property- property of root java script object to add- Returns:
- the added java script object
-
merge
public NativeObject merge(NativeObject target, NativeObjectContainer source, String property)
Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property is- Parameters:
target- The target object in whichsourceis merged into.source- Object to merge in thetarget.property- property of root java script object to add- Returns:
- the added java script object
-
merge
public NativeObject merge(NativeObjectContainer target, NativeObject source, String property)
Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property is- Parameters:
target- The target object in whichsourceis merged into.source- Object to merge in thetarget.property- property of root java script object to add- Returns:
- the added java script object
-
merge
public NativeObject merge(NativeObject target, NativeObject source, String property)
Copiessourceproperties (creating a new java script object and setting thesourceone with the property argument) in thetargetonly if not defined in target.
targetis not cloned and will be updated withsourceproperties.
The property is- Parameters:
target- The target object in whichsourceis merged into.source- Object to merge in thetarget.property- property of root java script object to add- Returns:
- the added java script object
-
-