Example usage for com.vaadin.ui BrowserFrame setSource

List of usage examples for com.vaadin.ui BrowserFrame setSource

Introduction

In this page you can find the example usage for com.vaadin.ui BrowserFrame setSource.

Prototype

public void setSource(Resource source) 

Source Link

Document

Sets the object source resource.

Usage

From source file:de.metas.ui.web.vaadin.report.VaadinJRViewerProvider.java

License:Open Source License

@Override
public void openViewer(final byte[] data, final OutputType type, final String title, final ProcessInfo pi)
        throws JRException {
    final StreamResource pdfResource = new StreamResource(() -> new ByteArrayInputStream(data), "report.pdf");

    final Window window = new Window();
    window.setCaption(title);/*from w  ww. j  a  v  a 2 s .  c  o m*/

    window.setStyleName(STYLE);
    window.center();
    window.setWidth(800, Unit.PIXELS);
    window.setHeight(600, Unit.PIXELS);

    final BrowserFrame pdfComp = new BrowserFrame();
    pdfComp.setPrimaryStyleName(STYLE + "-content");
    pdfComp.setSizeFull();
    pdfComp.setSource(pdfResource);
    window.setContent(pdfComp);

    UI.getCurrent().addWindow(window);
}