Package org.pepstock.charba.client
Class Injector
- java.lang.Object
-
- org.pepstock.charba.client.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
ensureCssInjected(AbstractInjectableResource resource)
Injects a CSS style resource if not injected yet.static void
ensureInjected(AbstractInjectableResource resource)
Injects a script resource if not injected yet.static boolean
isInjected(AbstractInjectableResource resource)
Returnstrue
if the script or style resource has been already injected.
-
-
-
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)
Returnstrue
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
-
-