Example usage for com.vaadin.ui Embedded TYPE_OBJECT

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

Introduction

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

Prototype

int TYPE_OBJECT

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

Click Source Link

Document

General object type.

Usage

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();// w  w  w .  ja  v  a 2  s  .c  o m
    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();//  w w w  . j  a v a 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");
}

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

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

    setCaption("SSS General Report");
    setSizeFull();/*  w ww .ja  v  a 2s  . com*/
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/SssReport.jasper");
    File reportFile = new File("C:/reportsJasper/SssReport.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("SssReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/SssReport_" + 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.SSSLoansPayable.java

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

    setCaption("SSS Loans Payable Report");
    setSizeFull();/*from  w w w  .java  2s  .  com*/
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/SssLoanReport.jasper");
    File url = new File("C:/reportsJasper/SssLoanReport.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("SssLoanReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/SssLoanReport_" + 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.SSSSbarroReport.java

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

    setCaption("SSS Sbarro Report");
    setSizeFull();//  www.ja  v  a  2s  . c om
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/SssReportSbarro.jasper");
    File reportFile = new File("C:/reportsJasper/SssReportSbarro.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("SssReportSbarro_"+timestamp, ".pdf");
        file = "C:/reportsPdf/SssReportSbarro_" + 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.WitholdingTaxReport.java

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

    setCaption("Witholding Tax Report");
    setSizeFull();//from w  w w.  jav  a 2  s  .c  om
    setWidth("800px");
    setHeight("600px");
    center();

    Connection conn = getConnection.connection();
    //        URL url = this.getClass().getResource("/com/openhris/reports/WitholdingTaxesReport.jasper");
    File url = new File("C:/reportsJasper/WitholdingTaxesReport.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("WitholdingTaxesReport_"+timestamp, ".pdf");
        file = "C:/reportsPdf/WitholdingTaxesReport_" + 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.timekeeping.reports.IndividualAttendanceReport.java

public IndividualAttendanceReport(int payrollId, Application attendanceApplication) {
    this.payrollId = payrollId;
    this.attendanceApplication = attendanceApplication;

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

    Connection conn = getConnection.connection();
    File reportFile = new File("C:/reportsJasper/IndividualAttendanceReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("PAYROLL_ID", getPayrollId());

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

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

    StreamResource resource = new StreamResource(source, filePath, getAttendanceApplication());
    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);
    getAttendanceApplication().getMainWindow().open(resource, "_blank");
}