List of usage examples for com.google.gwt.dom.client ScriptElement as
public static ScriptElement as(Element elem)
From source file:com.vaadin.client.ResourceLoader.java
License:Apache License
/** * Creates a new resource loader. You should generally not create you own * resource loader, but instead use {@link ResourceLoader#get()} to get an * instance./*from w w w .jav a2 s . co m*/ */ protected ResourceLoader() { Document document = Document.get(); head = document.getElementsByTagName("head").getItem(0); // detect already loaded scripts and stylesheets NodeList<Element> scripts = document.getElementsByTagName("script"); for (int i = 0; i < scripts.getLength(); i++) { ScriptElement element = ScriptElement.as(scripts.getItem(i)); String src = element.getSrc(); if (src != null && src.length() != 0) { loadedResources.add(src); } } NodeList<Element> links = document.getElementsByTagName("link"); for (int i = 0; i < links.getLength(); i++) { LinkElement linkElement = LinkElement.as(links.getItem(i)); String rel = linkElement.getRel(); String href = linkElement.getHref(); if ("stylesheet".equalsIgnoreCase(rel) && href != null && href.length() != 0) { loadedResources.add(href); } } }
From source file:nz.co.doltech.gwt.sdm.SuperDevCompiler.java
License:Apache License
public Element getDevModeOnScriptElement() { HeadElement head = Document.get().getHead(); NodeList<Node> childNodes = head.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node childNode = childNodes.getItem(i); if (Element.is(childNode)) { Element child = childNode.cast(); if (ScriptElement.is(child)) { ScriptElement scriptElement = ScriptElement.as(child); String scriptSrc = scriptElement.getSrc(); if (scriptSrc != null && scriptSrc.contains("dev_mode_on.js")) { return child; }// w ww. j ava2 s . c o m } } } return null; }