Class 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 Detail

      • GlobalPlugins

        public GlobalPlugins​(ChartEnvelop<NativeObject> envelop)
        Builds the object by the native object which maps chart.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, otherwise false 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, otherwise false 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, otherwise false 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, otherwise false 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, otherwise false 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)
        Setting false 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 enable
        enable - true to enable to all charts, otherwise false.
      • isEnabledAllCharts

        public boolean isEnabledAllCharts​(String pluginId)
        Returns true if the plugin is enabled to all charts, otherwise false.
        Parameters:
        pluginId - plug id to check
        Returns:
        true if the plugin is enabled to all charts, otherwise false.
      • 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