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.commons.reports.AdvancesReport.java

public void openAdvancesReport() {
    Connection conn = getConnection.connection();
    File reportFile = new File("C:/reportsJasper/AdvancesReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("CORPORATE", getCorporate());
    hm.put("PAYROLL_DATE", getPayrollDate());

    Window subWindow = new Window("Advances Report");
    ((VerticalLayout) subWindow.getContent()).setSizeFull();
    subWindow.setWidth("800px");
    subWindow.setHeight("600px");
    subWindow.center();//from   w w w. jav a 2  s .c o  m

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

        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, getApplication());
        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());

        subWindow.addComponent(e);

        getApplication().getMainWindow().open(resource, "_blank");
    } catch (Exception e) {
        e.getMessage();
    }
}

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

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

    setCaption("Adjusted Payroll Register Report");
    setSizeFull();//from   ww  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/PayrollRegisterReportAdjusted.jasper");
    File reportFile = new File("C:/reportsJasper/PayrollRegisterReportAdjusted.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("payrollRegisterReportAdjusted_"+timestamp, ".pdf");
        file = "C:/reportsPdf/payrollRegisterReportAdjusted_" + 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.AdvancesReport.java

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

    setCaption("Advances Report");
    setSizeFull();//from  w ww  .  j  a v  a 2  s. c om
    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();/*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/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 w w.j a  va  2  s.  c  o  m*/
    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  www. jav  a  2  s .co m
    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();//w  ww  . j ava2s.  c  o  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();//  w ww.j  a va2s .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  ww  w.  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/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();/*w w 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/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");
}