script.setId(callbackId); script.setSrc(uri.toString()); timer = new Timer() {
script.setId(callbackId); script.setSrc(uri.toString()); timer = new Timer() {
script.setId(callbackId); script.setSrc(uri.toString()); timer = new Timer() {
public void load(DataReader<D> reader, Object loadConfig, AsyncCallback<D> callback) { this.callback = callback; this.reader = reader; this.config = loadConfig; String transId = "transId" + ID++; String prepend = url.indexOf("?") != -1 ? "&" : "?"; String u = url + prepend + "callback=" + CALLBACK_CONTAINER + "." + transId + generateUrl(loadConfig); createCallback(this, CALLBACK_CONTAINER, transId); ScriptElement script = Document.get().createScriptElement(); script.setId(transId); script.setType("text/javascript"); head.appendChild(script); script.setSrc(u); }
/** * Method injecting native chart.js code into the browser<br/> * In case code already been injected do nothing */ public static void ensureInjected(){ //TODO: do real injection (lazy loading) if(injected) return; Resources res = GWT.create(Resources.class); String source = res.chartJsSource().getText(); ScriptElement scriptElement = Document.get().createScriptElement(); scriptElement.setId("_chartjs"); scriptElement.setInnerText(source); Document.get().getBody().appendChild(scriptElement); injected = true; } }