Class Injector


  • public final class Injector
    extends Object
    This utility injects ChartJS java script and CHARBA custom java script implementation (for some utilities) in the web page of application, in the HEAD.
    It enables also to inject other script in the web page, necessary when you want to use some Chart.JS extensions.
    It tracks the resources which have been injected using as key their name and class name to avoid that however will inject own resources will use the same name of already injected resources.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • ensureInjected

        public static void ensureInjected​(AbstractInjectableResource resource)
        Injects a script resource if not injected yet.
        Parameters:
        resource - script resource
      • ensureCssInjected

        public static void ensureCssInjected​(AbstractInjectableResource resource)
        Injects a CSS style resource if not injected yet.
        Parameters:
        resource - CSS style resource
      • isInjected

        public static boolean isInjected​(AbstractInjectableResource resource)
        Returns true if the script or style resource has been already injected.
        Parameters:
        resource - script or CSS style resource
        Returns:
        true if the script or style resource has been already injected