001package com.github.gwtbootstrap.timepicker.client.ui.resources;
002
003import com.github.gwtbootstrap.client.ui.resources.JavaScriptInjector;
004import com.github.gwtbootstrap.client.ui.resources.ResourceInjector;
005import com.google.gwt.resources.client.TextResource;
006
007/**
008 * Utility class to inject our resources into modules page. Use it to inject
009 * JavaScript and CSS files.
010 *
011 * @author Carlos Alexandro Becker
012 * @author Joshua Godi
013 * @since 2.3.2.0
014 */
015public class TimepickerResourceInjector {
016
017    /**
018     * Injects the required CSS styles and JavaScript files into the document header.
019     * <pre>
020     * It's for NoStyle Module.
021     * </pre>
022     */
023    public static void configureWithCssFile() {
024        ResourceInjector.injectResourceCssAsFile("bootstrap-timepicker.css");
025        configure();
026    }
027
028
029    /**
030     * Injects the required CSS styles and JavaScript files into the document
031     * header.
032     */
033    public static void configure() {
034        Resources r = Resources.RESOURCES;
035        injectJs(r.timepickerJs());
036    }
037
038    private static void injectJs(TextResource r) {
039        JavaScriptInjector.inject(r.getText());
040    }
041}