Example usage for com.vaadin.ui Embedded TYPE_BROWSER

List of usage examples for com.vaadin.ui Embedded TYPE_BROWSER

Introduction

In this page you can find the example usage for com.vaadin.ui Embedded TYPE_BROWSER.

Prototype

int TYPE_BROWSER

To view the source code for com.vaadin.ui Embedded TYPE_BROWSER.

Click Source Link

Document

Browser ("iframe") type.

Usage

From source file:com.etest.pdfgenerator.TQViewer.java

public TQViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    //        setSizeFull();
    setWidth("900px");
    setHeight("600px");
    center();/* w  w w  . j a va2s  .c o m*/

    StreamResource resource = new StreamResource(new TQCoveragePDF(getTQCoverageId()), "TQ.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.ItemAnalysisOfSubjectReportViewer.java

public ItemAnalysisOfSubjectReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    setWidth("900px");
    setHeight("600px");
    center();/*  ww w.  jav a2s  .  c  o m*/

    StreamResource resource = new StreamResource(new ItemAnalysisOfSubjectReportPDF(getTQCoverageId()),
            "ItemAnalysis.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.ItemAnalysisReportViewer.java

public ItemAnalysisReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;

    setWidth("900px");
    setHeight("600px");
    center();//from  w w  w  .jav  a  2  s  .co  m

    StreamResource resource = new StreamResource(new ItemAnalysisReportPDF(getTqCoverageId()),
            "ItemAnalysis.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.MultipleChoiceHelpViewer.java

public MultipleChoiceHelpViewer() {
    setWidth("900px");
    setHeight("600px");
    center();/* w  ww  .jav  a 2 s . c om*/

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                return this.getClass().getResourceAsStream("/files/TestConstRules.pdf");
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

    StreamResource resource = new StreamResource(source, "TestConstRules.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.SummaryReportViewer.java

public SummaryReportViewer(String summaryType) {
    setCaption(summaryType);//from  w w w .j  a  v a2s. co m
    setWidth("900px");
    setHeight("600px");
    center();

    StreamResource resource; //= new StreamResource(new InventoryCasesReportPDF(), "InventoryOfCases.pdf");   
    if (summaryType.equals("Summary: Case vs Items")) {
        resource = new StreamResource(new InventoryCasesReportPDF(), "InventoryOfCases.pdf");
    } else {
        resource = new StreamResource(new InventoryItemsReportPDF(), "InventoryOfItems.pdf");
    }
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.etest.pdfviewer.TQCriticalIndexReportViewer.java

public TQCriticalIndexReportViewer(int tqCoverageId) {
    this.tqCoverageId = tqCoverageId;
    setWidth("900px");
    setHeight("600px");
    center();//from   w ww . j  a  v a2  s  .co  m

    StreamResource resource = new StreamResource(new TQCriticalIndexValuesReportPDF(getTQCoverageId()),
            "TQCriticalIndexValues.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    Embedded e = new Embedded();
    e.setSource(resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    setContent(v);
}

From source file:com.expressui.core.util.UrlUtil.java

License:Open Source License

/**
 * Only used by sample application to track usage statistics
 *
 * @param container container for adding the embedded iframe to
 *//* www .j ava2 s  .c  om*/
public static void addTrackingUrl(AbstractComponentContainer container, String tag) {
    try {
        URL url = new URL(EXPRESSUI_TEST_PAGE + tag);
        Embedded browser = new Embedded(null, new ExternalResource(url));
        browser.setType(Embedded.TYPE_BROWSER);
        browser.setWidth(0, Sizeable.UNITS_PIXELS);
        browser.setHeight(0, Sizeable.UNITS_PIXELS);
        container.addComponent(browser);
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.expressui.core.view.util.CodePopup.java

License:Open Source License

private Embedded getEmbeddedDoc(String u) {
    try {/*from   ww  w.java2s . c  o m*/
        URL url = new URL(u);
        Embedded browser = new Embedded("", new ExternalResource(url));
        browser.setHeight(15000, Sizeable.UNITS_PIXELS);
        browser.setType(Embedded.TYPE_BROWSER);
        return browser;
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.expressui.sample.view.HomePage.java

License:Open Source License

@Override
public void onDisplay() {
    try {//from  w  w w  .  j  a  va 2s . c o m
        URL url = new URL("http://www.expressui.com/");
        Embedded browser = new Embedded("", new ExternalResource(url));
        browser.setType(Embedded.TYPE_BROWSER);
        browser.setWidth(100, Sizeable.UNITS_PERCENTAGE);
        browser.setHeight(15000, Sizeable.UNITS_PIXELS);
        setCompositionRoot(browser);
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }

    getMainApplication().showTrayMessage("<h3>Feature Tip:</h3>" + "<ul>"
            + "<li>This illustrates how to embed any external page into ExpressUI" + "</ul>");
}

From source file:com.hris.payroll.reports.ReportViewer.java

public ReportViewer(String reportType, int branchId, Date payrollDate) {
    this.reportType = reportType;
    this.branchId = branchId;
    this.payrollDate = payrollDate;

    setWidth("900px");
    setHeight("600px");
    center();//from  w  w w .  j  a va 2 s.com

    StreamResource resource = null;

    switch (reportType) {
    case "Payslip": {
        String filename = "Payslip-" + new Date().getTime() + ".pdf";
        resource = new StreamResource(new PayslipReportPDF(getBranchId(), getPayrollDate()), filename);
        break;
    }

    case "Advances Summary": {
        String filename = "Advances-" + new Date().getTime() + ".pdf";
        resource = new StreamResource(new AdvancesSummaryReportPdf(getBranchId(), getPayrollDate()), filename);
        break;
    }

    default: {
        String filename = "Advances-" + new Date().getTime() + ".pdf";
        resource = new StreamResource(new AdvancesReportPdf(getBranchId(), getPayrollDate(), reportType),
                filename);
        break;
    }
    }

    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    v.setSpacing(true);
    v.setMargin(new MarginInfo(false, false, true, false));

    Embedded em = new Embedded();
    em.setSource(resource);
    em.setSizeFull();
    em.setType(Embedded.TYPE_BROWSER);
    v.addComponent(em);
    v.setExpandRatio(em, 1);

    setContent(v);
}