Class GlobalPlugins
- java.lang.Object
-
- org.pepstock.charba.client.plugins.GlobalPlugins
-
public final class GlobalPlugins extends Object
Global configuration to set plugins at global level.
It maps the CHART.JS object of default,chart.plugins
.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Constructor Description GlobalPlugins(ChartEnvelop<NativeObject> envelop)
Builds the object by the native object which mapschart.registry.plugins
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getIds()
Gets all global registered plugins ids.boolean
isEnabledAllCharts(String pluginId)
Returnstrue
if the plugin is enabled to all charts, otherwisefalse
.void
onChartConfigure(Configuration config, IsChart chart)
Invokes the on configuration method to inform the plugins that the chart is going to be initialized.boolean
register(Plugin plugin)
Registers a plugin as global, to apply to all charts.boolean
register(PluginContainer container)
Registers a plugin as global, to apply to all charts, by a containerboolean
register(SmartPlugin plugin)
Registers a plugin as global, to apply to all charts.boolean
register(SmartPluginContainer container)
Registers a plugin as global, to apply to all charts, by a containerboolean
register(AbstractInjectableResource resource)
Registers a plugin as global, to apply to all charts.
The plugin is a CHART.JS implementation which is added on top of existing library.boolean
register(AbstractInjectableResource resource, boolean enable)
Registers a plugin as global, to apply to all charts.
The plugin is a CHART.JS implementation which is added on top of existing library.void
setEnabledAllCharts(String pluginId, boolean enable)
Settingfalse
for plugin id, the global plugin is disable to all charts and to activate the plugin on a specific chart, is it enough to enable the plugin by options.boolean
unregister(String pluginId)
Unregisters a global plugin.
-
-
-
Constructor Detail
-
GlobalPlugins
public GlobalPlugins(ChartEnvelop<NativeObject> envelop)
Builds the object by the native object which mapschart.registry.plugins
- Parameters:
envelop
- envelop from root package to avoid invocation
-
-
Method Detail
-
register
public boolean register(PluginContainer container)
Registers a plugin as global, to apply to all charts, by a container- Parameters:
container
- plugin container instance- Returns:
true
if registered, otherwisefalse
if the plugin is already registered with the plugin id of plugin instance.
-
register
public boolean register(Plugin plugin)
Registers a plugin as global, to apply to all charts.- Parameters:
plugin
- plugin instance- Returns:
true
if registered, otherwisefalse
if the plugin is already registered with the plugin id of plugin instance.
-
register
public boolean register(SmartPluginContainer container)
Registers a plugin as global, to apply to all charts, by a container- Parameters:
container
- plugin container instance- Returns:
true
if registered, otherwisefalse
if the plugin is already registered with the plugin id of plugin instance.
-
register
public boolean register(SmartPlugin plugin)
Registers a plugin as global, to apply to all charts.- Parameters:
plugin
- plugin instance- Returns:
true
if registered, otherwisefalse
if the plugin is already registered with the plugin id of plugin instance.
-
register
public boolean register(AbstractInjectableResource resource)
Registers a plugin as global, to apply to all charts.
The plugin is a CHART.JS implementation which is added on top of existing library.- Parameters:
resource
- javascript code which is the extension as plugin to import and register- Returns:
true
if registered, otherwisefalse
if the plugin is already registered with the plugin id of plugin instance.
-
register
public boolean register(AbstractInjectableResource resource, boolean enable)
Registers a plugin as global, to apply to all charts.
The plugin is a CHART.JS implementation which is added on top of existing library.- Parameters:
resource
- javascript code which is the extension as plugin to import and registerenable
-true
to enable to all charts, otherwisefalse
.- Returns:
true
if registered, otherwisefalse
if the plugin is already registered with the plugin id of plugin instance.
-
unregister
public boolean unregister(String pluginId)
Unregisters a global plugin. This is possible ONLY for plugins added as custom ones.- Parameters:
pluginId
- plugin instance- Returns:
true
if unregistered, otherwisefalse
if the plugin is not a custom one.
-
getIds
public Set<String> getIds()
Gets all global registered plugins ids.- Returns:
- all global registered plugins ids.
-
setEnabledAllCharts
public void setEnabledAllCharts(String pluginId, boolean enable)
Settingfalse
for plugin id, the global plugin is disable to all charts and to activate the plugin on a specific chart, is it enough to enable the plugin by options.- Parameters:
pluginId
- plug id to enableenable
-true
to enable to all charts, otherwisefalse
.
-
isEnabledAllCharts
public boolean isEnabledAllCharts(String pluginId)
Returnstrue
if the plugin is enabled to all charts, otherwisefalse
.- Parameters:
pluginId
- plug id to check- Returns:
true
if the plugin is enabled to all charts, otherwisefalse
.
-
onChartConfigure
public void onChartConfigure(Configuration config, IsChart chart)
Invokes the on configuration method to inform the plugins that the chart is going to be initialized.- Parameters:
config
- configuration item. Added only to reduce visibility of public method.chart
- instance of the chart
-
-