public static void load(Chronoscope.URLResolver resolver, final String libName, final String version, final Command callback) { if (!injectedLoader) { final ScriptElement se = Document.get().createScriptElement(); // se.setSrc(intrinsics.getCachedUrl("http://www.google.com/jsapi?callback=" + JSAPI_CALLBACK)); se.setSrc("http://www.google.com/jsapi?callback=" + JSAPI_CALLBACK); final HeadElement he = HeadElement.as(Document.get().getElementsByTagName("head").getItem(0)); exportHandler(new Command() { public void execute() { injectedLoader=true; he.removeChild(se); nativeLoad(libName, version, callback); } }); he.appendChild(se); } else { nativeLoad(libName, version, callback); } }
/** * Styles a multi-row selection with the number of elements. * * @param drag * the current drag event holding the context. */ void setMultiRowDragDecoration(VDragEvent drag) { Widget widget = drag.getTransferable().getDragSource().getWidget(); if (widget instanceof VScrollTable) { VScrollTable table = (VScrollTable) widget; int rowCount = table.selectedRowKeys.size(); Element dragCountElement = Document.get().getElementById(SP_DRAG_COUNT); if (rowCount > 1 && table.selectedRowKeys.contains(table.focusedRow.getKey())) { if (dragCountElement == null) { dragCountElement = Document.get().createStyleElement(); dragCountElement.setId(SP_DRAG_COUNT); HeadElement head = HeadElement.as(Document.get().getElementsByTagName(HeadElement.TAG).getItem(0)); head.appendChild(dragCountElement); } SafeHtml formattedCssStyle = getDraggableTemplate().multiSelectionStyle(determineActiveTheme(drag), String.valueOf(rowCount)); StyleElement dragCountStyleElement = StyleElement.as(dragCountElement); dragCountStyleElement.setInnerSafeHtml(formattedCssStyle); } else if (dragCountElement != null) { dragCountElement.removeFromParent(); } } }
public void onModuleLoad() { final String linkTxt = Resources.INSTANCE.linkTxt().getText(); final Document document = Document.get(); HeadElement headElement = document.getHead(); if (headElement == null) { headElement = document.createHeadElement(); document.appendChild(headElement); } LinkElement linkElement = document.createLinkElement(); linkElement.setType("text/css"); linkElement.setRel("stylesheet"); linkElement.setHref(linkTxt); headElement.appendChild(linkElement); }
private HeadElement getHead() { if(this.head == null) { Element element = Document.get().getElementsByTagName(HEAD_TAG_NAME).getItem(0); assert element != null : ERROR_HEAD_NOT_FOUND; this.head = HeadElement.as(element); } return this.head; }
private static HeadElement getHead() { if (head == null) { Element element = Document.get().getElementsByTagName("head").getItem(0); assert element != null : "HTML Head element required"; head = HeadElement.as(element); } return head; }
private static HeadElement getHead() { if (head == null) { Element element = Document.get().getElementsByTagName("head").getItem(0); assert element != null : "HTML Head element required"; HeadElement headElement = HeadElement.as(element); head = headElement; } return head; }
/** * Gets the head tag element. * * @return the head tag element */ protected HeadElement getHead() { if (this.head == null) { Element elt = Document.get().getElementsByTagName("head").getItem(0); assert elt != null : "The host HTML page does not have a <head> element" + " which is required by this injector"; this.head = HeadElement.as(elt); } return this.head; }
public static void injectStyleSheet(String href, String id) { HeadElement head = getHead(); LinkElement element = createLinkElement(); element.setHref(href); element.setId(id); head.appendChild(element); }
private static HeadElement getHead() { if (head == null) { Element element = Document.get().getElementsByTagName("head") .getItem(0); assert element != null : "HTML Head element required"; head = HeadElement.as(element); } return head; }
public static void inject(String javascript) { HeadElement head = getHead(); new Timer() { public void run() { // goJsPlumb(); goJS(); } }.schedule(1); ScriptElement element = createScriptElement(); element.setText(javascript); head.appendChild(element); }
private static HeadElement getHead() { if (head == null) { Element element = Document.get().getElementsByTagName("head").getItem(0); assert element != null : "HTML Head element required"; HeadElement head = HeadElement.as(element); ESBJavaScriptInjector.head = head; } return ESBJavaScriptInjector.head; }
private static HeadElement getHead() { if (head == null) { Element element = Document.get().getElementsByTagName("head") .getItem(0); assert element != null : "HTML Head element required"; HeadElement head = HeadElement.as(element); JSLibInjector.head = head; } return JSLibInjector.head; }
private static HeadElement getHead() { if (head == null) { Element element = Document.get().getElementsByTagName("head").getItem(0); assert element != null : "HTML Head element required"; HeadElement head = HeadElement.as(element); PlusOne.head = head; } return PlusOne.head; }
public static void intject(String javaScript) { HeadElement head = getHead(); ScriptElement element = createScriptElement(); element.setText(javaScript); head.appendChild(element); }
public static void inject(String javascript) { HeadElement head = getHead(); ScriptElement element = createScriptElement(); element.setText(javascript); head.appendChild(element); }
/** * Injects the css url code into a * {@code <link rel="stylesheet" href="...." />} element in the document * header. * * @param javascript * the JavaScript code */ public static void injectStyleSheet(String href) { HeadElement head = getHead(); LinkElement element = createLinkElement(); element.setHref(href); head.appendChild(element); }
/** * Convenience method for getting the document's head element. * * @return the document's head element */ private native HeadElement getHeadElement() /*-{ return $doc.getElementsByTagName("head")[0]; }-*/;