List of usage examples for com.google.gwt.dom.client IFrameElement setAttribute
@Override
public void setAttribute(String name, String value)
From source file:com.nitrous.gwt.earth.client.demo.ShimDemo.java
License:Apache License
/** * This is how to display a GWT PopupPanel over the top of the Google Earth * Plug-in using the 'shim' technique. The shim technique places an IFrame * in-front of the earth plug-in but behind the PopupPanel by configuring * the absolute position, size and z-index of the IFrame. *///from w ww.j a v a 2s .co m private void showPopupWindow() { // the HTML content to be rendered inside the PopupPanel HTML content = new HTML("<b>Window test</b><br>" + "This PopupPanel is visible since we have an IFrame (shim) between the PopupPanel and the Google Earth Plugin. " + "View source code <a href=\"" + "http://code.google.com/p/gwt-earth-3/source/browse/trunk/src/com/nitrous/gwt/earth/client/demo/ShimDemo.java\"" + " target=\"new\">here</a>"); // configure the PopupPanel size and position final PopupPanel window = new PopupPanel(false, false); window.setTitle("Shim test"); window.add(content); final int width = 300; final int height = 80; window.setSize(width + "px", height + "px"); window.center(); final int left = window.getPopupLeft(); final int top = window.getPopupTop(); // Configure the z-index of the PopupPanel HTML content so that it is rendered in-front of everything (highest z-index) content.getElement().setAttribute("style", "z-index: " + (Integer.MAX_VALUE) + ";" + " width: " + width + "px;" + " height: " + height + "px;"); // PopupPanel is to be displayed immediately behind content (slightly lower z-index) window.getElement().setAttribute("style", "z-index: " + (Integer.MAX_VALUE - 1) + ";" + " position: absolute;" + " left: " + left + "px;" + " top: " + top + "px;"); window.show(); // Allow some time for the browser to render the window and then configure the IFrame shim Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { final IFrameElement iframe = Document.get().createIFrameElement(); // Initialize the IFrame to be the same size and position as the // window but with a smaller z-index value. // The size of the IFrame is tweaked by +9px to allow the border of the PopupPanel to be rendered correctly. iframe.setAttribute("style", "z-index: " + (Integer.MAX_VALUE - 2) + ";" + " width: " + (width + 9) + "px;" + " height: " + (height + 9) + "px;" + " position: absolute;" + " left: " + left + "px;" + " top: " + top + "px;"); // add the IFrame to the document body Document.get().getBody().appendChild(iframe); // remove the IFrame when the PopupPanel is closed window.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { iframe.removeFromParent(); } }); } }); }
From source file:org.sakaiproject.sgs2.client.Sgs2.java
License:Educational Community License
private void configureSakaiParentIframe(int setHeight) { // Resize parent Sakai iframe Document doc = getWindowParentDocument(); NodeList<Element> nodeList = doc.getElementsByTagName("iframe"); for (int i = 0; i < nodeList.getLength(); i++) { IFrameElement iframe = (IFrameElement) nodeList.getItem(i); if (iframe.getId().startsWith("Main")) { iframe.setAttribute("height", setHeight + "px"); iframe.setAttribute("style", "height: " + setHeight + "px;"); // IE Fix iframe.getStyle().setPropertyPx("height", setHeight); break; }// w ww . j a v a2 s . co m } }
From source file:org.vectomatic.dom.svg.utils.IFrameXmlLoader.java
License:Open Source License
public void loadResource(String resourceName, AsyncXmlLoaderCallback callback) { IFrameElement iframe = Document.get().createIFrameElement(); iframe.setAttribute("tabIndex", "-1"); iframe.setAttribute("style", "position: absolute; width: 0; height: 0; border: 0"); iframe.setAttribute("src", "javascript:''"); Element body = RootPanel.get().getElement(); body.appendChild(iframe);/*from www .ja v a 2 s.c o m*/ setFrameLocation(resourceName, iframe, callback); }
From source file:org.waveprotocol.wave.client.doodad.experimental.htmltemplate.CajolerFacade.java
License:Apache License
private static IFrameElement createCajaFrame() { IFrameElement cajaFrame = Document.get().createIFrameElement(); cajaFrame.setFrameBorder(0);//from w w w . j a v a 2 s.c o m cajaFrame.setAttribute("width", "0"); cajaFrame.setAttribute("height", "0"); Document.get().getBody().appendChild(cajaFrame); Document cajaFrameDoc = cajaFrame.getContentDocument(); cajaFrameDoc.getBody().appendChild(cajaFrameDoc.createScriptElement(RESOURCES.supportingJs().getText())); cajaFrameDoc.getBody().appendChild(cajaFrameDoc.createScriptElement(RESOURCES.taming().getText())); return cajaFrame; }
From source file:org.waveprotocol.wave.client.gadget.renderer.GadgetWidgetUi.java
License:Apache License
private void buildIFrame(String gadgetName) { gadgetIframe.getElement().setId(gadgetName); int height = 0; switch (throbberState) { case SMALL:/*from w ww . j a v a2 s . c om*/ gadgetIframe.addStyleName(CSS.loadingGadgetSmallThrobber()); height = Resources.RESOURCES.loadingGadgetSmall().getHeight(); break; case LARGE: gadgetIframe.addStyleName(CSS.loadingGadgetLargeThrobber()); height = Resources.RESOURCES.loadingGadgetLarge().getHeight(); break; } IFrameElement iframe = getIframeElement(); iframe.setAttribute("vspace", "0"); iframe.setAttribute("hspace", "0"); iframe.setAttribute("frameBorder", "no"); iframe.setAttribute("moduleId", gadgetName); iframe.setAttribute("display", "block"); iframe.setAttribute("height", height + "px"); // TODO(user): scrolling policy/settings for the wave gadgets. iframe.setScrolling("no"); //remove default style gadgetIframe.removeStyleName("gwt-Frame"); gadgetIframe.addStyleName(CSS.gadgetIframe()); iframeDiv.add(gadgetIframe); }