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.SSSGeneralReport.java

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

    setCaption("SSS General Report");
    setSizeFull();//from  w  w w  . j ava 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();/* w  w w  .  ja v  a2  s  . c  om*/
    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();//w  w  w  . java  2s .co  m
    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.  j  av  a  2s. com
    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 2  s .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");
}

From source file:com.parship.roperty.ui.LoginUI.java

License:Apache License

@AutoGenerated
private HorizontalLayout buildHorizontalLayout_1() {
    // common part: create layout
    horizontalLayout_1 = new HorizontalLayout();
    horizontalLayout_1.setImmediate(false);
    horizontalLayout_1.setWidth("-1px");
    horizontalLayout_1.setHeight("-1px");
    horizontalLayout_1.setMargin(false);

    // logoImage// www.j a  v a2  s.  c o  m
    logoImage = new Embedded();
    logoImage.setImmediate(false);
    logoImage.setWidth("-1px");
    logoImage.setHeight("-1px");
    logoImage.setSource(new ThemeResource("img/component/embedded_icon.png"));
    logoImage.setType(1);
    logoImage.setMimeType("image/jpg");
    horizontalLayout_1.addComponent(logoImage);

    return horizontalLayout_1;
}

From source file:com.save.reports.PromoDealAcknowledgementReport.java

public PromoDealAcknowledgementReport(int promoId) {
    this.promoId = promoId;

    setCaption("Acknowledgement Report");
    setWidth("800px");
    setHeight("600px");
    center();//from   ww  w .  j av  a2s. co m

    Connection conn = DBConnection.connect();

    HashMap hm = new HashMap();
    hm.put("PROMO_ID", getPromoId());

    InputStream template = this.getClass()
            .getResourceAsStream("/reports/PromoDealAcknowledgementFormReport.jasper");

    try {
        JasperPrint print = JasperFillManager.fillReport(template, hm, conn);
        file = File.createTempFile("output", ".pdf");
        JasperExportManager.exportReportToPdfFile(print, file.getPath());
    } catch (JRException | IOException ex) {
        Logger.getLogger(PromoDealAcknowledgementReport.class.getName()).log(Level.SEVERE, null, ex);
    }

    StreamResource.StreamSource source = () -> {
        try {
            FileInputStream fis = new FileInputStream(file);
            return fis;
        } catch (Exception e) {
            e.getMessage();
            return null;
        }
    };

    StreamResource resource = new StreamResource(source, "PromoDealAcknowledgementForm.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.vaushell.treetasker.application.actionbar.TTWActionBar.java

License:Open Source License

@AutoGenerated
private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);//  w  w w.ja v a 2s  .  co  m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("70px");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100.0%");
    setHeight("70px");

    // vBGactionbar
    vBGactionbar = new Embedded();
    vBGactionbar.setImmediate(false);
    vBGactionbar.setWidth("100.0%");
    vBGactionbar.setHeight("100.0%");
    vBGactionbar.setSource(new ThemeResource("icons/toolbar-bg.png"));
    vBGactionbar.setType(1);
    vBGactionbar.setMimeType("image/png");
    mainLayout.addComponent(vBGactionbar, "top:0.0px;left:0.0px;");

    // contentLayout
    contentLayout = buildContentLayout();
    mainLayout.addComponent(contentLayout, "top:0.0px;left:0.0px;");

    return mainLayout;
}

From source file:com.vaushell.treetasker.application.header.TTWHeader.java

License:Open Source License

@AutoGenerated
private HorizontalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new HorizontalLayout();
    mainLayout.setImmediate(false);/*from w w  w. j  a  v  a  2 s . c o m*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight("163px");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100.0%");
    setHeight("163px");

    // vBGleft
    vBGleft = new Embedded();
    vBGleft.setImmediate(false);
    vBGleft.setWidth("-1px");
    vBGleft.setHeight("-1px");
    vBGleft.setSource(new ThemeResource("icons/header-left.png"));
    vBGleft.setType(1);
    vBGleft.setMimeType("image/png");
    mainLayout.addComponent(vBGleft);

    // vBGright
    vBGright = new Embedded();
    vBGright.setImmediate(false);
    vBGright.setWidth("100.0%");
    vBGright.setHeight("100.0%");
    vBGright.setSource(new ThemeResource("icons/header-right.png"));
    vBGright.setType(1);
    vBGright.setMimeType("image/png");
    mainLayout.addComponent(vBGright);
    mainLayout.setExpandRatio(vBGright, 1.0f);

    return mainLayout;
}

From source file:de.unioninvestment.portal.explorer.view.vfs.VFSMainView.java

License:Apache License

public VFSMainView(ConfigBean cb, VFSFileExplorerPortlet instance) throws Exception {

    final String vfsUrl = cb.getVfsUrl();
    if (vfsUrl.length() != 0) {
        removeAllComponents();//  w  ww  .j a va2s . co m
        explorerPanel.setStyleName(Reindeer.PANEL_LIGHT);
        filePanel.setStyleName(Reindeer.PANEL_LIGHT);
        FileSystemOptions opts = new FileSystemOptions();

        logger.log(Level.INFO, "Check Type ");

        if (cb.getVfsType().equalsIgnoreCase("FTP") || cb.getVfsType().equalsIgnoreCase("SFTP")) {
            if (cb.getUsername() != null && cb.getUsername().length() > 0) {
                StaticUserAuthenticator auth = new StaticUserAuthenticator(null, cb.getUsername(),
                        cb.getPassword());
                DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
            }
        }

        if (cb.getVfsType().equalsIgnoreCase("FTP")) {
            FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true);
            FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true);
        }

        if (cb.getVfsType().equalsIgnoreCase("SFTP")) {
            SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true);
            if (cb.getKeyfile() != null && cb.getKeyfile().length() > 0) {
                logger.log(Level.INFO, "Keyfile " + cb.getKeyfile());
                SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no");
                File keyFile = new File(cb.getKeyfile());
                SftpFileSystemConfigBuilder.getInstance().setIdentities(opts, new File[] { keyFile });

            }

            SftpFileSystemConfigBuilder.getInstance().setProxyType(opts,
                    SftpFileSystemConfigBuilder.PROXY_HTTP);
            if (cb.getProxyHost() != null && cb.getProxyHost().length() > 0) {
                SftpFileSystemConfigBuilder.getInstance().setProxyHost(opts, cb.getProxyHost());
                logger.log(Level.INFO, "ProxyHost " + cb.getProxyHost());
            }
            if (cb.getProxyPort() != null && cb.getProxyPort().length() > 0) {
                SftpFileSystemConfigBuilder.getInstance().setProxyPort(opts,
                        Integer.valueOf(cb.getProxyPort()));
                logger.log(Level.INFO, "ProxyPort " + cb.getProxyPort());
            }
        }

        DefaultFileSystemManager fsManager = null;
        fsManager = getManager();

        final HorizontalSplitPanel panel = new HorizontalSplitPanel();
        panel.setHeight(500, UNITS_PIXELS);
        panel.setWidth(1400, UNITS_PIXELS);
        panel.setSplitPosition(350, Sizeable.UNITS_PIXELS);
        panel.setFirstComponent(explorerPanel);
        panel.setSecondComponent(filePanel);
        addComponent(panel);

        final Embedded image = new Embedded();
        image.setType(Embedded.TYPE_IMAGE);
        image.setSource(FOLDER);
        image.setHeight(15, Sizeable.UNITS_PIXELS);

        explorerPanel.setSizeFull();
        filePanel.setSizeFull();
        explorerPanel.addComponent(tree);

        filePanel.addComponent(new TableView(instance, fsManager, opts, cb));
        tree.setImmediate(true);

        tree.addListener(new ItemClickEvent.ItemClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void itemClick(ItemClickEvent event) {
                VFSFileExplorerPortlet app = (VFSFileExplorerPortlet) getApplication();
                String newDir = (String) event.getItemId();
                app.getEventBus().fireEvent(new TableChangedEvent(newDir));
            }
        });

        scanDirectory(fsManager, opts, vfsUrl);
    } else {

        addComponent(new Label("Please configure Portlet !"));
    }
}