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.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public Embedded valo_GetFullScreenEmbedded(boolean createIfNeeded) {
    boolean inPopup = true;
    if (focVaadinMainWindow == null || focVaadinMainWindow instanceof FocWebVaadinWindow) {
        inPopup = false;/*from   w  ww  . j  a  v  a2  s .  c  o  m*/
    }
    if (valo_FullScreenEmbedded == null && createIfNeeded && !inPopup
            && !FocWebApplication.getInstanceForThread().isMobile() && ConfigInfo.showFullScreenButton()) {
        valo_FullScreenEmbedded = new Embedded();
        valo_FullScreenEmbedded.setDescription("Full screen");
        valo_FullScreenEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        refreshFullScreenIcon();
        valo_FullScreenEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                fullScreenButtonClickListener();
            }
        });
    }
    return valo_FullScreenEmbedded;
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public AbstractComponent valo_GetDeleteEmbedded(boolean createIfNeeded) {
    if (valo_DeleteEmbedded == null && createIfNeeded && !isObjectLocked()) {
        if (isNewLook()) {
            valo_DeleteEmbedded = new Button("Delete");
            if (isRTL()) {
                valo_DeleteEmbedded.setCaption("?");
                FocXMLGuiComponentStatic.applyStyleForArabicLabel(valo_DeleteEmbedded);
                //             valo_DeleteEmbedded.addStyleName("foc-deleteButtonAr");
            }/*from  w w  w. ja va2s .c o m*/
            valo_DeleteEmbedded.addStyleName("foc-deleteButton");
            ((Button) valo_DeleteEmbedded).addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    deleteButtonClickListener();
                }
            });
            //valo_DeleteEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);     
        } else {
            valo_DeleteEmbedded = new Embedded();
            valo_DeleteEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
            if (FocWebApplication.getInstanceForThread().isMobile()) {
                ((Embedded) valo_DeleteEmbedded)
                        .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_WHITE));
            } else {
                ((Embedded) valo_DeleteEmbedded)
                        .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_BLACK));
            }
            ((Embedded) valo_DeleteEmbedded).addClickListener(new MouseEvents.ClickListener() {
                @Override
                public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                    deleteButtonClickListener();
                }
            });
        }

        //        INavigationWindow mainWindow = getNavigationWindow();
        //        if(mainWindow instanceof FocWebVaadinWindow && ((FocWebVaadinWindow) mainWindow).isNewLook()) {            
        //         }else{
        //         }         
    }
    return valo_DeleteEmbedded;
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

private Embedded valo_GetInternalEmailEmbedded(boolean createIfNeeded) {
    if (valo_SendInternalEmailEmbedded == null && createIfNeeded) {
        valo_SendInternalEmailEmbedded = new Embedded();
        valo_SendInternalEmailEmbedded.setDescription("Send Internal Email");
        valo_SendInternalEmailEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_SendInternalEmailEmbedded/* ww  w.  j a  v  a2s  . co m*/
                .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_EMAIL));
        valo_SendInternalEmailEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                sendInternalEmailClickListener();
            }
        });
    }
    return valo_SendInternalEmailEmbedded;
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public Embedded valo_GetEmailEmbedded(boolean createIfNeeded) {
    if (valo_SendEmailEmbedded == null && createIfNeeded) {
        valo_SendEmailEmbedded = new Embedded();
        valo_SendEmailEmbedded.setDescription("Send Email");
        valo_SendEmailEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_SendEmailEmbedded.setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_EMAIL));
        valo_SendEmailEmbedded.addStyleName("noPrint");
        valo_SendEmailEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override//from  ww  w . ja  v a 2s  . c  o  m
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                emailClickListener();
            }
        });
    }
    return valo_SendEmailEmbedded;
}

From source file:com.foc.web.modules.photoAlbum.PhotoAlbum_Reduced_Form.java

License:Apache License

@Override
public void showValidationLayout(boolean showBackButton, int position) {
    super.showValidationLayout(showBackButton, position);

    FVValidationLayout vLay = getValidationLayout();
    if (vLay != null && getFocObject() != null && !getFocObject().isCreated()) {

        if (PhotoAlbumAppGroup.getCurrentAppGroup() != null
                && PhotoAlbumAppGroup.getCurrentAppGroup().isAllowDelete()) {
            Embedded valo_DeleteEmbedded = new Embedded();
            valo_DeleteEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
            if (FocWebApplication.getInstanceForThread().isMobile()) {
                valo_DeleteEmbedded/*from   w ww . ja v  a2 s.c o  m*/
                        .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_WHITE));
            } else {
                valo_DeleteEmbedded
                        .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_BLACK));
            }
            valo_DeleteEmbedded.addClickListener(new MouseEvents.ClickListener() {
                @Override
                public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                    deleteButtonClickListener();
                }
            });
            if (valo_DeleteEmbedded != null) {
                vLay.addComponent(valo_DeleteEmbedded);
                vLay.setComponentAlignment(valo_DeleteEmbedded, Alignment.BOTTOM_LEFT);
            }
        }
    }
}

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  ww w .  ja  va2s . co  m

    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);
}

From source file:com.jain.addon.component.upload.JImage.java

License:Apache License

public void createImage() {
    if (image != null)
        layout.removeComponent(image);//from w ww .  ja va2 s . co  m

    image = new Embedded();
    image.setWidth("100%");
    layout.addComponent(image, 0);
    layout.setComponentAlignment(image, Alignment.MIDDLE_LEFT);
}

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();// w w  w . j  a va 2s.  co  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.commons.UploadImage.java

public UploadImage(Panel imagePanel, Embedded avatar, String employeeId) {
    this.imagePanel = imagePanel;
    this.avatar = avatar;
    this.employeeId = employeeId;

    imagePanel = new Panel("Upload Component");
    imagePanel.setWidth("400px");
    addComponent(imagePanel);/*from   w  w w.j  a  v a2 s  .  c om*/

    // Create the Upload component.
    upload = new Upload("Upload the Image file here", receiver);
    // Use a custom button caption instead of plain "Upload".
    upload.setButtonCaption("Upload Now");

    // Listen for events regarding the success of upload. 
    upload.addListener((Upload.StartedListener) this);
    upload.addListener((Upload.SucceededListener) this);
    upload.addListener((Upload.FailedListener) this);

    panel.setWidth("100%");
    panel.addComponent(new Label("Click 'Choose file' to " + "select a file and then click 'Upload Now'. "
            + "image should have the same width and height so "
            + "that image will not look deformed when viewed."));

    imagePanel.addComponent(upload);
    imagePanel.addComponent(panel);

    avatar = new Embedded();
    avatar.setImmediate(true);
    avatar.setWidth(90, Sizeable.UNITS_PIXELS);
    avatar.setHeight(90, Sizeable.UNITS_PIXELS);
    imagePanel.addComponent(avatar);
}

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();//  w w w  .j av  a 2s  .co  m
    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");
}