Example usage for com.vaadin.ui Embedded Embedded

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

Introduction

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

Prototype

public Embedded() 

Source Link

Document

Creates a new empty Embedded object.

Usage

From source file:com.openhris.payroll.reports.AdvancesReport.java

public AdvancesReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("Advances Report");
    setSizeFull();//from ww  w .  jav a 2 s .  com
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = AdvancesReport.class.getResource("/com/openhris/reports/AdvancesReport.jasper");
    File url = new File("C:/reportsJasper/AdvancesReport.jasper");

    try {
        //            Path path = Paths.get(url.toURI());
        //            String subReportDir = "/"+path.getParent().toString().replace("\\", "/")+"/";

        final HashMap hm = new HashMap();
        hm.put("BRANCH_ID", getBranchId());
        hm.put("PAYROLL_DATE", getPayrollDate());
        //            hm.put("SUBREPORT_DIR", subReportDir);

        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //            file = File.createTempFile("AdvancesReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/AdvancesReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.AllowanceForLiquidation.java

public AllowanceForLiquidation(String corporate, String payrollDate, int branchId,
        Application payrollApplication) {
    this.corporate = corporate;
    this.payrollDate = payrollDate;
    this.branchId = branchId;
    this.payrollApplication = payrollApplication;

    setCaption("Advances Report");
    setSizeFull();//from   ww w. jav a2 s  . c om
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/AllowanceForLiquidation.jasper");
    File url = new File("C:/reportsJasper/AllowanceForLiquidation.jasper");

    final HashMap hm = new HashMap();
    hm.put("CORPORATE_NAME", getCorporate());
    hm.put("PAYROLL_DATE", getPayrollDate());
    hm.put("BRANCH_ID", getBranchId());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("AllowanceForLiquidation_"+timestamp, ".pdf");
        file = "C:/reportsPdf/AllowanceForLiquidation_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.AllowanceReport.java

public AllowanceReport(int branchId, String payrollDate, Application payrollApplication) {

    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("Advances Report");
    setSizeFull();//from  w  ww  .j a va 2 s  .  c  om
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/AllowancesReport.jasper");
    File url = new File("C:/reportsJasper/AllowancesReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("AllowancesReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/AllowancesReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.AttendanceReport.java

public AttendanceReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("Attendance Report");
    setSizeFull();//from w w  w . j a v a 2s . com
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/AttendanceReport.jasper");
    File url = new File("C:/reportsJasper/AttendanceReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("AttendanceReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/AttendanceReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.BankDebitMemoReport.java

public BankDebitMemoReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("Bank Debit Memo Report");
    setSizeFull();/*from   w  ww .  j  a  v a 2  s  .  co  m*/
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/BankDebitMemo.jasper");
    File url = new File("C:/reportsJasper/BankDebitMemo.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("BankDebitMemo_"+timestamp, ".pdf");
        file = "C:/reportsPdf/BankDebitMemo_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.HDMFLoansPayableReport.java

public HDMFLoansPayableReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("HDMF Loans Payable Report");
    setSizeFull();/*from  ww w  .j ava 2  s  .c o  m*/
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/HdmfLoanReport.jasper");
    File url = new File("C:/reportsJasper/HdmfLoanReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("HdmfLoanReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/HdmfLoanReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.HDMFReport.java

public HDMFReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("HDMF Report");
    setSizeFull();//from w w w.  jav a2  s .  co  m
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/HdmfReport.jasper");
    File reportFile = new File("C:/reportsJasper/HdmfReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(reportFile.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("HdmfReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/HdmfReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.HDMFSavingsReport.java

public HDMFSavingsReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("HDMF Savings Report");
    setSizeFull();//from  www  . j  a va 2s. c  om
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/HdmfVoluntarySavingsReport.jasper");
    File url = new File("C:/reportsJasper/HdmfVoluntarySavingsReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("HdmfVoluntarySavingsReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/HdmfVoluntarySavingsReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.PayslipReport.java

public PayslipReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("Payslip Report");
    setSizeFull();//from ww  w  .j  a v a 2s.c om
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/PayslipReport.jasper");
    File reportFile = new File("C:/reportsJasper/PayslipReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(reportFile.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("PayslipReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/PayslipReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}

From source file:com.openhris.payroll.reports.PHICReport.java

public PHICReport(int branchId, String payrollDate, Application payrollApplication) {
    this.branchId = branchId;
    this.payrollDate = payrollDate;
    this.payrollApplication = payrollApplication;

    setCaption("PHIC Report");
    setSizeFull();/*from w  w  w  .j ava  2 s. c om*/
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/PhilhealthReport.jasper");
    File url = new File("C:/reportsJasper/PhicReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("BRANCH_ID", getBranchId());
    hm.put("PAYROLL_DATE", getPayrollDate());

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(url.getPath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        //             file = File.createTempFile("PhilhealthReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/PhicReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, file);
    } catch (Exception e) {
        e.getMessage();
    }

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
            try {
                File f = new File(file);
                FileInputStream fis = new FileInputStream(f);
                return fis;
            } catch (Exception e) {
                e.getMessage();
                return null;
            }
        }
    };

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

    Embedded e = new Embedded();
    e.setMimeType("application/pdf");
    e.setType(Embedded.TYPE_OBJECT);
    e.setSizeFull();
    e.setSource(resource);
    e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

    addComponent(e);
    getPayrollApplication().getMainWindow().open(resource, "_blank");
}