public final class Plugins extends NativeObjectContainer implements IsDefaultPlugins
Modifier and Type | Method and 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. |
List<Key> |
getAllIds()
Returns the unmodifiable list of registered plugin ids.
|
protected Key |
getChildKey()
Returns the property name to use to add this element to its parent.
|
protected D |
getDefaultValues()
Returns the default provider instance.
|
<T extends AbstractPluginOptions> |
getOptions(AbstractPluginOptionsFactory<T> factory)
Returns the plugin options, if exist.
It uses a factory instance to create a plugin options. If factory argument is not consistent, null is returned. |
<T extends AbstractPluginOptions> |
getOptions(String pluginId,
AbstractPluginOptionsFactory<T> factory)
Returns the plugin options, if exist.
It uses a factory instance to create a plugin options. If factory argument is not consistent, null is returned. |
<T extends AbstractPluginOptions> |
getOptionsAsList(AbstractPluginOptionsFactory<T> factory)
Returns the plugin options as list, if exist.
It uses a factory instance to create a plugin options. |
<T extends AbstractPluginOptions> |
getOptionsAsList(String pluginId,
AbstractPluginOptionsFactory<T> factory)
Returns the plugin options as list, if exist.
It uses a factory instance to create a plugin options. |
ObjectType |
getOptionsType(String pluginId)
Returns the options type.
|
protected P |
getParent()
Returns the parent element.
|
boolean |
hasEnabled(String pluginId)
Returns if a global plugin has been set or not.
|
boolean |
hasOptions(String pluginId)
Checks if there is any options for a specific plugin, by its id.
|
boolean |
isEnabled(String pluginId)
Returns if a global plugin is enabled or not.
|
boolean |
isForcedlyDisabled(DefaultPlugin plugin)
Returns if a default CHART.JS plugin is enabled or not, forced directly by global plugin manager
|
boolean |
isForcedlyDisabled(String pluginId)
Returns if a global plugin is enabled or not, forced directly by global plugin manager
|
void |
removeOptions(String pluginId)
Removes the plugin options.
|
protected void |
setCallbackToModel(org.pepstock.charba.client.options.AbstractModel<?,?> model,
Key key,
CallbackProxy.Proxy proxy)
Adds a proxy function (for callbacks) to a model at the specific key.
|
void |
setEnabled(DefaultPlugin plugin,
boolean enabled)
Sets if a default CHART.JS plugin must be enabled or not.
|
void |
setEnabled(String pluginId,
boolean enabled)
Sets if a global plugin must be enabled or not.
|
protected void |
setEventToModel(org.pepstock.charba.client.options.AbstractModel<?,?> model,
Key key,
CallbackProxy.Proxy proxy)
Adds a proxy function (for events) to a model at the specific key.
|
<T extends AbstractPluginOptions> |
setOptions(List<T> options)
Sets the plugin options as list.
If the list is empty, it does nothing |
<T extends AbstractPluginOptions> |
setOptions(String pluginId,
List<T> options)
Sets the plugin options as list.
If passed options is null , the configuration of plugin will be removed. |
<T extends AbstractPluginOptions> |
setOptions(String pluginId,
T options)
Sets the plugin options.
If passed options is null , the configuration of plugin will be removed. |
<T extends AbstractPluginOptions> |
setOptions(T options)
Sets the plugin options.
|
checkValue, empty, getArrayValue, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, keys, remove, remove, removeIfExists, setArrayValue, setArrayValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
public List<Key> getAllIds()
public void setEnabled(String pluginId, boolean enabled)
pluginId
- plugin id.enabled
- false
disable a global plugin.public void setEnabled(DefaultPlugin plugin, boolean enabled)
plugin
- default CHART.JS plugin instance.enabled
- false
disable a default CHART.JS plugin.public boolean isEnabled(String pluginId)
isEnabled
in interface IsDefaultPlugins
pluginId
- plugin id.false
if a global plugin is not enabled otherwise true
.public boolean isForcedlyDisabled(String pluginId)
pluginId
- plugin id.true
if a global plugin is not enabled otherwise false
.public boolean isForcedlyDisabled(DefaultPlugin plugin)
plugin
- a default CHART.JS plugin.true
if a default CHART.JS plugin is not enabled otherwise false
.public boolean hasEnabled(String pluginId)
pluginId
- plugin id.false
if a global plugin has not been set otherwise true
.public void removeOptions(String pluginId)
pluginId
- plugin id.public <T extends AbstractPluginOptions> void setOptions(T options)
T
- type of plugin options to storeoptions
- plugin options used to configure the pluginpublic <T extends AbstractPluginOptions> void setOptions(List<T> options)
T
- type of plugin options to storeoptions
- list of plugin options used to configure the plugin.public <T extends AbstractPluginOptions> void setOptions(String pluginId, T options)
null
, the configuration of plugin will be removed.T
- type of plugin options to storepluginId
- plugin id.options
- plugin options used to configure the plugin.null
to remove the configuration if exist.public <T extends AbstractPluginOptions> void setOptions(String pluginId, List<T> options)
null
, the configuration of plugin will be removed.T
- type of plugin options to storepluginId
- plugin id.options
- list of plugin options used to configure the plugin.null
to remove the configuration if exist.public boolean hasOptions(String pluginId)
hasOptions
in interface IsDefaultPlugins
pluginId
- plugin id.true
if there is an options, otherwise false
.public ObjectType getOptionsType(String pluginId)
getOptionsType
in interface IsDefaultPlugins
pluginId
- plugin id.public <T extends AbstractPluginOptions> T getOptions(AbstractPluginOptionsFactory<T> factory)
null
is returned.T
- type of plugin options to returnfactory
- factory instance to create a plugin optionsnull
is returned.public <T extends AbstractPluginOptions> T getOptions(String pluginId, AbstractPluginOptionsFactory<T> factory)
null
is returned.getOptions
in interface IsDefaultPlugins
T
- type of plugin options to returnpluginId
- plugin id.factory
- factory instance to create a plugin optionsnull
is returned.public <T extends AbstractPluginOptions> List<T> getOptionsAsList(AbstractPluginOptionsFactory<T> factory)
T
- type of plugin options to returnfactory
- factory instance to create a plugin options.public <T extends AbstractPluginOptions> List<T> getOptionsAsList(String pluginId, AbstractPluginOptionsFactory<T> factory)
getOptionsAsList
in interface IsDefaultPlugins
T
- type of plugin options to returnpluginId
- plugin id.factory
- factory instance to create a plugin options.protected final Key getChildKey()
null
if is a root element.protected final P getParent()
null
if is a root element.protected final D getDefaultValues()
protected final void setEventToModel(org.pepstock.charba.client.options.AbstractModel<?,?> model, Key key, CallbackProxy.Proxy proxy)
model
- element where adding the function proxykey
- property name to use to add the function proxyproxy
- the function proxy instance to addprotected final void setCallbackToModel(org.pepstock.charba.client.options.AbstractModel<?,?> model, Key key, CallbackProxy.Proxy proxy)
model
- element where adding the function proxykey
- property name to use to add the function proxyproxy
- the function proxy instance to addprotected final void checkAndAddToParent()