com.google.gwt.dom.client.IFrameElement Java Examples

The following examples show how to use com.google.gwt.dom.client.IFrameElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CubaFileDownloaderConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
public void downloadFileById(String resourceId) {
    final String url = getResourceUrl(resourceId);
    if (url != null && !url.isEmpty()) {
        final IFrameElement iframe = Document.get().createIFrameElement();

        Style style = iframe.getStyle();
        style.setVisibility(Style.Visibility.HIDDEN);
        style.setHeight(0, Style.Unit.PX);
        style.setWidth(0, Style.Unit.PX);

        iframe.setFrameBorder(0);
        iframe.setTabIndex(-1);
        iframe.setSrc(url);
        RootPanel.getBodyElement().appendChild(iframe);

        Timer removeTimer = new Timer() {
            @Override
            public void run() {
                iframe.removeFromParent();
            }
        };
        removeTimer.schedule(60 * 1000);
    }
}
 
Example #2
Source File: CubaRichTextAreaWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void setContentCharset() {
    rta.addInitializeHandler(event -> {
        IFrameElement iFrameElement = IFrameElement.as(rta.getElement());
        HeadElement headElement = iFrameElement.getContentDocument().getHead();

        MetaElement charsetMetaElement = Document.get().createMetaElement();
        charsetMetaElement.setHttpEquiv(HttpHeaders.CONTENT_TYPE);
        charsetMetaElement.setContent(HttpHeaders.CONTENT_TYPE_TEXT_HTML_UTF8);

        headElement.appendChild(charsetMetaElement);
    });
}
 
Example #3
Source File: CajolerFacade.java    From swellrt with Apache License 2.0 5 votes vote down vote up
private static IFrameElement createCajaFrame() {
  IFrameElement cajaFrame = Document.get().createIFrameElement();
  cajaFrame.setFrameBorder(0);
  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;
}
 
Example #4
Source File: GadgetWidgetUi.java    From swellrt with Apache License 2.0 5 votes vote down vote up
private void buildIFrame(String gadgetName) {
  gadgetIframe.getElement().setId(gadgetName);
  
  int height = 0;
  switch (throbberState) {
    case SMALL:
      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);
}
 
Example #5
Source File: CajolerFacade.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
private static IFrameElement createCajaFrame() {
  IFrameElement cajaFrame = Document.get().createIFrameElement();
  cajaFrame.setFrameBorder(0);
  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;
}
 
Example #6
Source File: GadgetWidgetUi.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
private void buildIFrame(String gadgetName) {
  gadgetIframe.getElement().setId(gadgetName);
  
  int height = 0;
  switch (throbberState) {
    case SMALL:
      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);
}
 
Example #7
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 5 votes vote down vote up
@Test
@SuppressWarnings("unused")
public void shouldAllowOnlyJavascriptCastsThatAreValidJavaCasts() {
  // Casts to ancestors should be legal
  JavaScriptObject o = Document.get().createDivElement().cast();
  Node n = Document.get().createDivElement().cast();
  DivElement d = Document.get().createDivElement().cast();

  // Casts to sibling elements shouldn't be legal (even though they are in javascript)
  try {
    IFrameElement i = Document.get().createDivElement().cast();
    fail("Exception not thrown");
  } catch (ClassCastException expected) {}
}
 
Example #8
Source File: RichTextToolbar.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/** Constructor of the Toolbar **/
public RichTextToolbar(final RichTextArea richtext) {
	//Initialize the main-panel
	outer = new VerticalPanel();

	//Initialize the two inner panels
	topPanel = new HorizontalPanel();
	bottomPanel = new HorizontalPanel();
	topPanel.setStyleName("RichTextToolbar");
	bottomPanel.setStyleName("RichTextToolbar");

	//Save the reference to the RichText area we refer to and get the interfaces to the stylings

	styleText = richtext;
	styleTextFormatter = styleText.getFormatter();

	//Set some graphical options, so this toolbar looks how we like it.
	topPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
	bottomPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);

	//Add the two inner panels to the main panel
	outer.add(topPanel);
	outer.add(bottomPanel);

	//Some graphical stuff to the main panel and the initialisation of the new widget
	outer.setStyleName("RichTextToolbar");
	initWidget(outer);

	//
	evHandler = new EventHandler();

	//Add KeyUp and Click-Handler to the RichText, so that we can actualize the toolbar if neccessary
	styleText.addKeyUpHandler(evHandler);
	styleText.addClickHandler(evHandler);

	// Changing styles
	IFrameElement e = IFrameElement.as(richtext.getElement());
	e.setSrc("iframe_richtext.html");
	e.setFrameBorder(0); // removing frame border

	richTextPopup = new RichTextPopup(this);
	richTextPopup.setWidth("300px");
	richTextPopup.setHeight("50px");
	richTextPopup.setStyleName("okm-Popup");

	//Now lets fill the new toolbar with life
	buildTools();
}
 
Example #9
Source File: CajolerFacade.java    From swellrt with Apache License 2.0 4 votes vote down vote up
private static CajolerFacade create() {
  IFrameElement cajaFrame = createCajaFrame();
  CajoleService service = new HttpCajoleService();
  return new CajolerFacade(service, cajaFrame);
}
 
Example #10
Source File: CajolerFacade.java    From swellrt with Apache License 2.0 4 votes vote down vote up
private CajolerFacade(CajoleService service, IFrameElement cajaFrame) {
  this.cajoleService = service;
  this.cajaFrame = cajaFrame;
}
 
Example #11
Source File: CajolerFacade.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
private static CajolerFacade create() {
  IFrameElement cajaFrame = createCajaFrame();
  CajoleService service = new HttpCajoleService();
  return new CajolerFacade(service, cajaFrame);
}
 
Example #12
Source File: CajolerFacade.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
private CajolerFacade(CajoleService service, IFrameElement cajaFrame) {
  this.cajoleService = service;
  this.cajaFrame = cajaFrame;
}
 
Example #13
Source File: GadgetWidgetUi.java    From swellrt with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the gadget iframe element.
 *
 * @return Gadget iframe element.
 */
public IFrameElement getIframeElement() {
  return IFrameElement.as(gadgetIframe.getElement());
}
 
Example #14
Source File: GadgetWidgetUi.java    From incubator-retired-wave with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the gadget iframe element.
 *
 * @return Gadget iframe element.
 */
public IFrameElement getIframeElement() {
  return IFrameElement.as(gadgetIframe.getElement());
}