List of usage examples for com.google.gwt.dom.client Document createIFrameElement
public IFrameElement createIFrameElement()
From source file:com.alkacon.geranium.client.util.impl.DOMImpl.java
License:Open Source License
/** * Creates an iFrame element with the given name attribute.<p> * /*from ww w. j a v a 2 s. c om*/ * @param doc the document * @param name the name attribute value * * @return the iFrame element */ public com.google.gwt.dom.client.Element createIFrameElement(Document doc, String name) { IFrameElement element = doc.createIFrameElement(); element.setName(name); return element; }
From source file:com.google.speedtracer.client.SourceViewer.java
License:Apache License
/** * Creates an instance of the SourceViewer and invokes the passed in callback * when the iFrame is loaded with the target source. * /* w ww . jav a2s. c o m*/ * We first load the proxy html page. This proxy page uses cross site XHR * enabled by Chrome extensions to fetch and format the target source. Once * the target source is loaded, we consider the viewer initialized. * * @param parent the parent container element we will attach the SourceViewer * to. * @param resources the ClientBundle instance for this class. * @param initializedCallback the {@link SourceViewerInitializedCallback} that * we pass the loaded SourceViewer to. */ public static void create(Element parent, final Resources resources, final SourceViewerInitializedCallback initializedCallback) { Document document = parent.getOwnerDocument(); // Create the iframe within which we will load the source. final IFrameElement sourceFrame = document.createIFrameElement(); Element frameWrapper = document.createDivElement(); frameWrapper.setClassName(resources.sourceViewerCss().frameWrapper()); frameWrapper.appendChild(sourceFrame); final Element baseElement = document.createDivElement(); final Element headerElem = document.createDivElement(); headerElem.setClassName(resources.sourceViewerCss().header()); baseElement.appendChild(headerElem); // IFrame must be attached to fire onload. baseElement.appendChild(frameWrapper); parent.appendChild(baseElement); Event.addEventListener("load", sourceFrame, new EventListener() { public void handleEvent(Event event) { // The source fetcher should be loaded. Lets now point it at the source // we want to load. SourceViewer sourceViewer = new SourceViewer(baseElement, headerElem, sourceFrame, resources); initializedCallback.onSourceViewerInitialized(sourceViewer); } }); sourceFrame.setSrc(Chrome.getExtension().getUrl("monitor/SourceFetcher.html")); }