Example usage for com.vaadin.ui Button setHeight

List of usage examples for com.vaadin.ui Button setHeight

Introduction

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

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java

License:Open Source License

private void createSubmissionButtons(final VaadinTestApplication app, final SubmissionIO submissionIO,
        final nl.amc.biolab.datamodel.objects.Error error) {
    final Link statusLink = new Link("download", new StreamResource(new StreamSource() {
        private static final long serialVersionUID = 2010850543250392280L;

        public InputStream getStream() {
            String status;//from   w  w  w  .  ja  va  2  s  .  com
            if (error != null) {
                status = error.getCode() + "\n" + error.getMessage() + "\n" + error.getDescription();
            } else {
                status = "No message";
            }
            return new ByteArrayInputStream(status.getBytes());
        }
    }, "status", getApplication()), "", 400, 300, 2);

    viewStatusButton = new NativeButton("Details");
    viewStatusButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -8337533736203519683L;

        @Override
        public void buttonClick(ClickEvent event) {
            app.getMainWindow().addWindow(new Window() {
                private static final long serialVersionUID = 1520192489661790818L;

                {
                    center();
                    setWidth("700px");
                    setHeight("500px");
                    VerticalLayout vl = new VerticalLayout();
                    vl.addComponent(statusLink);
                    String status;
                    if (error != null) {
                        status = error.getCode() + "\n" + error.getMessage() + "\n" + error.getDescription();
                    } else {
                        status = "No message";
                    }
                    //status += "<img src=\"images/prov.png\"";
                    vl.addComponent(new Label(status, Label.CONTENT_PREFORMATTED));
                    addComponent(vl);
                }
            });
        }
    });

    resubmitButton = new NativeButton("Resume");
    resubmitButton.setData(processingStatusForm);
    resubmitButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -6410875548044234734L;

        @Override
        public void buttonClick(ClickEvent event) {
            long dbId = processingStatus.getProcessing().getDbId();
            long liferayID = app.getLiferayId(processingStatus.getProcessing().getUser().getLiferayID());
            processingService.resubmit(dbId, submissionIO.getSubmission().getDbId(),
                    userDataService.getUserId(), liferayID);
            processingStatusForm.attach();
        }
    });

    markFailButton = new NativeButton("Abort");
    markFailButton.setData(processingStatusForm);
    markFailButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -5019762936706219454L;

        @Override
        public void buttonClick(ClickEvent event) {
            app.getMainWindow().addWindow(new Window() {
                private static final long serialVersionUID = 3852384470521127702L;

                {
                    final Window window = this;
                    center();
                    setWidth("500px");
                    setHeight("300px");
                    VerticalLayout vl = new VerticalLayout();

                    final TextField text = new TextField("Remarks to the user");
                    text.setWidth("97%");
                    text.setHeight("150px");
                    vl.addComponent(text);

                    final Button okButton = new NativeButton();
                    okButton.setCaption("Save");
                    okButton.setImmediate(true);
                    okButton.setWidth("-1px");
                    okButton.setHeight("-1px");
                    okButton.addListener(new Button.ClickListener() {
                        private static final long serialVersionUID = 1754437322024958253L;

                        public void buttonClick(ClickEvent event) {
                            long dbId = processingStatus.getProcessing().getDbId();
                            long userID = processingStatus.getProcessing().getUser().getDbId();
                            long liferayID = app
                                    .getLiferayId(processingStatus.getProcessing().getUser().getLiferayID());
                            processingService.markFailed(submissionIO.getSubmission().getDbId(),
                                    (String) text.getValue());
                            processingStatus = processingService.getProcessingStatus(
                                    userDataService.getProcessing(dbId), userID, liferayID, false);
                            refreshButton.setData(processingStatus);
                            processingStatusForm.fireValueChange(false);//fireEvent(new Event(refreshButton));
                            window.getParent().removeWindow(window);
                        }
                    });
                    vl.addComponent(okButton);
                    addComponent(vl);
                }
            });
        }
    });
    //      }

    remarksButton = new NativeButton("Why?");
    remarksButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -267778012100029422L;

        @Override
        public void buttonClick(ClickEvent event) {
            app.getMainWindow().addWindow(new Window() {
                private static final long serialVersionUID = -5026454769214596711L;

                {
                    List<nl.amc.biolab.datamodel.objects.Error> temp = submissionIO.getSubmission().getErrors();

                    center();
                    setWidth("700px");
                    setHeight("500px");
                    VerticalLayout vl = new VerticalLayout();
                    vl.addComponent(
                            new Label(temp.get(temp.size() - 1).getMessage(), Label.CONTENT_PREFORMATTED));
                    addComponent(vl);
                }
            });
        }
    });
}

From source file:org.escidoc.browser.ui.maincontent.CreateOrgUnitView.java

License:Open Source License

@SuppressWarnings("serial")
private void buildForm() {
    form.setImmediate(true);//from ww w  .  j  a v  a2 s.c  om

    // Name
    final TextField txtNameContext = new TextField();
    txtNameContext.setCaption("Name");
    txtNameContext.setImmediate(false);
    txtNameContext.setWidth("-1px");
    txtNameContext.setHeight("-1px");
    txtNameContext.setInvalidAllowed(false);
    txtNameContext.setRequired(true);
    form.addField("txtNameContext", txtNameContext);

    // Description
    final TextField txtDescContext = new TextField("Description");
    txtDescContext.setImmediate(false);
    txtDescContext.setWidth("-1px");
    txtDescContext.setHeight("-1px");
    form.addField("txtDescContext", txtDescContext);

    // btnAddContext
    final Button btnAddContext = new Button("Submit", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                final OrgUnitModel child = storeInRepository(txtNameContext, txtDescContext);
                updateTree(child);
                form.commit();
                resetFields();
                showSuccesfullMessage(txtNameContext);
            } catch (final EmptyValueException e) {
                mainWindow.showNotification("Please fill in all the required elements in the form",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
            } catch (final Exception e) {
                mainWindow.showNotification(ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            } finally {
                closeSubWindow();
            }
        }

        private void updateTree(final OrgUnitModel child) {
            dataSource.addChild(parent, child);
        }

        private void showSuccesfullMessage(final TextField txtNameContext) {
            mainWindow.showNotification(
                    "Organizational Unit " + txtNameContext.getValue().toString() + " created successfully ",
                    Window.Notification.TYPE_TRAY_NOTIFICATION);
        }

        private void resetFields() {
            form.getField("txtNameContext").setValue("");
            form.getField("txtDescContext").setValue("");
        }

        private void closeSubWindow() {
            mainWindow.removeWindow(subwindow);
        }

        private OrgUnitModel storeInRepository(final TextField txtNameContext, final TextField txtDescContext)
                throws EscidocClientException, ParserConfigurationException, SAXException, IOException {
            final OrgUnitBuilder orgBuilder = new OrgUnitBuilder();
            OrganizationalUnit orgUnit = orgBuilder
                    .with(txtNameContext.getValue().toString(), txtDescContext.getValue().toString()).build();

            if (parent != null) {
                Set set = new HashSet();
                set.add(parent.getId());
                orgBuilder.parents(set);
            }
            return repo.create(orgUnit);

        }
    });

    btnAddContext.setWidth("-1px");
    btnAddContext.setHeight("-1px");
    form.getLayout().addComponent(btnAddContext);

    form.getField("txtNameContext").setRequired(true);
    form.getField("txtNameContext").setRequiredError("Name is missing");

    form.getField("txtDescContext").setRequired(true);
    form.getField("txtDescContext").setRequiredError("Description is missing");
}

From source file:org.escidoc.browser.ui.mainpage.HeaderContainer.java

License:Open Source License

private static void configureButton(final Button button) {
    button.setStyleName(BaseTheme.BUTTON_LINK);
    button.setWidth("60px");
    button.setHeight("15px");
    button.setImmediate(true);//from ww w . j av a2 s . c  om
    button.addStyleName("paddingright10");
}

From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java

License:Open Source License

private Form buildCreateUserAccountForm() {
    final Form form = new Form();
    form.setImmediate(true);/* w w w .j a  v  a  2 s.  c o  m*/

    // loginName
    final TextField loginNameField = new TextField("Login Name");
    loginNameField.setImmediate(false);
    loginNameField.setWidth("-1px");
    loginNameField.setHeight("-1px");
    form.addField("loginName", loginNameField);

    // Name
    final TextField realNameField = new TextField();
    realNameField.setCaption("Real Name");
    realNameField.setImmediate(false);
    realNameField.setWidth("-1px");
    realNameField.setHeight("-1px");
    realNameField.setInvalidAllowed(false);
    realNameField.setRequired(true);
    form.addField("realName", realNameField);

    // Password
    final PasswordField txtPassword = new PasswordField("Password");
    txtPassword.setImmediate(false);
    txtPassword.setNullSettingAllowed(false);
    txtPassword.setWidth("-1px");
    txtPassword.setHeight("-1px");
    form.addField("txtPassword", txtPassword);

    // Verify Password
    final PasswordField txtPassword2 = new PasswordField("Verify Password");
    txtPassword2.setImmediate(false);
    txtPassword2.setWidth("-1px");
    txtPassword2.setHeight("-1px");
    form.addField("txtPassword2", txtPassword2);

    // btnAddContext
    final Button addButton = new Button("Submit", new Button.ClickListener() {
        private static final long serialVersionUID = -1373866726572059290L;

        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                form.commit();
                if (!txtPassword.getValue().equals(txtPassword2.getValue())) {
                    router.getMainWindow().showNotification(
                            "Password verification failed, please try again and make sure you are typing the same password twice ",
                            Window.Notification.TYPE_WARNING_MESSAGE);
                    return;
                }

                controller.createResourceAddUserAccount(realNameField.getValue().toString(),
                        loginNameField.getValue().toString(), txtPassword.getValue().toString());

                router.getMainWindow().showNotification(
                        "User Account" + realNameField.getValue().toString() + " created successfully ",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);

                form.getField("loginName").setValue("");
                form.getField("realName").setValue("");
                form.getField("txtPassword").setValue("");
                form.getField("txtPassword2").setValue("");
            } catch (final EmptyValueException e) {
                router.getMainWindow().showNotification("Please fill in all the required elements in the form",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
            } catch (final Exception e) {
                router.getMainWindow().showNotification(
                        ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    addButton.setWidth("-1px");
    addButton.setHeight("-1px");
    form.getLayout().addComponent(addButton);

    form.getField("loginName").setRequired(true);
    form.getField("loginName").setRequiredError("Login Name is missing");

    form.getField("realName").setRequired(true);
    form.getField("realName").setRequiredError("Real Name is missing");

    return form;
}

From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java

License:Open Source License

private Form buildCreateOrgUnitForm() {
    final Form form = new Form();
    form.setImmediate(true);/*from w  ww. ja v a 2  s  .co m*/

    // Name
    final TextField txtNameContext = new TextField();
    txtNameContext.setCaption("Name");
    txtNameContext.setImmediate(false);
    txtNameContext.setWidth("-1px");
    txtNameContext.setHeight("-1px");
    txtNameContext.setInvalidAllowed(false);
    txtNameContext.setRequired(true);
    form.addField("txtNameContext", txtNameContext);

    // Description
    final TextField txtDescContext = new TextField("Description");
    txtDescContext.setImmediate(false);
    txtDescContext.setWidth("-1px");
    txtDescContext.setHeight("-1px");
    form.addField("txtDescContext", txtDescContext);

    final CheckBox checkStatusOpened = new CheckBox("Create OrgUnit in Status opened?", true);
    checkStatusOpened.setImmediate(true);
    form.addField("checkStatusOpened", checkStatusOpened);

    // btnAddContext
    final Button btnAddContext = new Button("Submit", new Button.ClickListener() {
        private static final long serialVersionUID = -1373866726572059290L;

        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                form.commit();
                controller.createResourceAddOrgUnit(txtNameContext.getValue().toString(),
                        txtDescContext.getValue().toString(), (Boolean) checkStatusOpened.getValue(), router,
                        router.getServiceLocation());
                router.getMainWindow().showNotification("Organizational Unit "
                        + txtNameContext.getValue().toString() + " created successfully ",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
                form.getField("txtNameContext").setValue("");
                form.getField("txtDescContext").setValue("");
            } catch (final EmptyValueException e) {
                router.getMainWindow().showNotification("Please fill in all the required elements in the form",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
            } catch (final Exception e) {
                router.getMainWindow().showNotification(
                        ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    btnAddContext.setWidth("-1px");
    btnAddContext.setHeight("-1px");
    form.getLayout().addComponent(btnAddContext);

    form.getField("txtNameContext").setRequired(true);
    form.getField("txtNameContext").setRequiredError("Name is missing");

    form.getField("txtDescContext").setRequired(true);
    form.getField("txtDescContext").setRequiredError("Description is missing");
    return form;
}

From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java

License:Open Source License

private void formAddContentModel(final VerticalLayout vlAccCreateContentModel) {
    final Form frm = new Form();
    frm.setImmediate(true);/* w  w  w  .j  av  a 2 s.  com*/
    // Name
    final TextField txtNameContext = new TextField();
    txtNameContext.setCaption("Name");
    txtNameContext.setImmediate(false);
    txtNameContext.setWidth("-1px");
    txtNameContext.setHeight("-1px");
    txtNameContext.setInvalidAllowed(false);
    txtNameContext.setRequired(true);
    frm.addField("txtNameContext", txtNameContext);

    // Description
    final TextField txtDescContext = new TextField("Description");
    txtDescContext.setImmediate(false);
    txtDescContext.setWidth("-1px");
    txtDescContext.setHeight("-1px");
    frm.addField("txtDescContext", txtDescContext);

    // btnAddContext
    final Button btnAddContext = new Button("Submit", new Button.ClickListener() {
        private static final long serialVersionUID = -6461338505705399082L;

        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                frm.commit();
                controller.createResourceAddContentModel(txtNameContext.getValue().toString(),
                        txtDescContext.getValue().toString(), router, router.getServiceLocation());
                router.getMainWindow().showNotification(
                        "ContentModel " + txtNameContext.getValue().toString() + " created successfully ",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
                frm.getField("txtNameContext").setValue("");
                frm.getField("txtDescContext").setValue("");
            } catch (final EmptyValueException e) {
                router.getMainWindow().showNotification("Please fill in all the required elements in the form",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
            } catch (final EscidocClientException e) {
                router.getMainWindow().showNotification(
                        ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    btnAddContext.setWidth("-1px");
    btnAddContext.setHeight("-1px");
    frm.getLayout().addComponent(btnAddContext);

    frm.getField("txtNameContext").setRequired(true);
    frm.getField("txtNameContext").setRequiredError("Name is missing");

    frm.getField("txtDescContext").setRequired(true);
    frm.getField("txtDescContext").setRequiredError("Description is missing");

    vlAccCreateContentModel.addComponent(frm);
}

From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java

License:Open Source License

private void formAddContext(final VerticalLayout vlAccCreateContext) throws EscidocClientException {
    final Form frm = new Form();
    frm.setImmediate(true);// w  w w. j a va 2s.c o  m
    // Name
    final TextField txtNameContext = new TextField();
    txtNameContext.setCaption("Name");
    txtNameContext.setImmediate(false);
    txtNameContext.setWidth("-1px");
    txtNameContext.setHeight("-1px");
    txtNameContext.setInvalidAllowed(false);
    txtNameContext.setRequired(true);
    frm.addField("txtNameContext", txtNameContext);

    // Description
    final TextField txtDescContext = new TextField("Description");
    txtDescContext.setImmediate(false);
    txtDescContext.setWidth("-1px");
    txtDescContext.setHeight("-1px");
    frm.addField("txtDescContext", txtDescContext);

    // Description
    final TextField txtType = new TextField("Type");
    txtType.setImmediate(false);
    txtType.setWidth("-1px");
    txtType.setHeight("-1px");
    frm.addField("txtType", txtType);

    // OrgUnit
    final NativeSelect slOrgUnit = new NativeSelect("Organizational Unit");
    slOrgUnit.setImmediate(true);
    slOrgUnit.setWidth("-1px");
    slOrgUnit.setHeight("-1px");
    slOrgUnit.setRequired(true);
    slOrgUnit.setNullSelectionAllowed(false);
    frm.addField("slOrgUnit", slOrgUnit);

    final OrgUnitService orgUnitService = new OrgUnitService(router.getServiceLocation().getEscidocUri(),
            router.getApp().getCurrentUser().getToken());
    final Collection<OrganizationalUnit> orgUnits = orgUnitService.findAll();
    for (final OrganizationalUnit organizationalUnit : orgUnits) {
        slOrgUnit.addItem(organizationalUnit.getObjid());
        slOrgUnit.setItemCaption(organizationalUnit.getObjid(), organizationalUnit.getXLinkTitle());
    }

    frm.getLayout().addComponent(slOrgUnit);
    final CheckBox checkStatusOpened = new CheckBox("Create Context in Status opened?", true);
    checkStatusOpened.setImmediate(true);
    frm.addField("checkStatusOpened", checkStatusOpened);

    // btnAddContext
    final Button btnAddContext = new Button("Submit", new Button.ClickListener() {
        private static final long serialVersionUID = -4696167135894721166L;

        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                frm.commit();
                controller.createResourceAddContext(txtNameContext.getValue().toString(),
                        txtDescContext.getValue().toString(), txtType.getValue().toString(),
                        slOrgUnit.getValue().toString(), (Boolean) checkStatusOpened.getValue(), repositories,
                        router.getServiceLocation());
                router.getMainWindow().showNotification(
                        "Context " + txtNameContext.getValue().toString() + " created successfully ",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
                frm.getField("txtNameContext").setValue("");
                frm.getField("txtDescContext").setValue("");
                frm.getField("txtType").setValue("");
                frm.getField("slOrgUnit").setValue(null);
                // Ideally here should be a sync method to sync the tree

            } catch (final EmptyValueException e) {
                router.getMainWindow().showNotification("Please fill in all the required elements in the form",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);
            } catch (final EscidocClientException e) {
                router.getMainWindow().showNotification(
                        ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    btnAddContext.setWidth("-1px");
    btnAddContext.setHeight("-1px");
    frm.getLayout().addComponent(btnAddContext);

    frm.getField("txtNameContext").setRequired(true);
    frm.getField("txtNameContext").setRequiredError("Name is missing");

    frm.getField("txtDescContext").setRequired(true);
    frm.getField("txtDescContext").setRequiredError("Description is missing");

    frm.getField("txtType").setRequired(true);
    frm.getField("txtType").setRequiredError("Context Type is missing");
    //
    frm.getField("slOrgUnit").setRequired(true);
    frm.getField("slOrgUnit").setRequiredError("Organizazional Unit is required");

    vlAccCreateContext.addComponent(frm);
}

From source file:org.ikasan.dashboard.ui.framework.panel.PersistanceSetupPanel.java

License:BSD License

protected void createNotCreatedView() {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth("100%");
    verticalLayout.setHeight("100%");
    verticalLayout.setMargin(true);// ww  w  .ja v  a  2  s  . c o  m

    Label ikasanWelcomeLabel1 = new Label("Welcome to Ikasan!");
    ikasanWelcomeLabel1.setStyleName("xlarge");
    ikasanWelcomeLabel1.setWidth("100%");
    ikasanWelcomeLabel1.setHeight("30px");

    Label ikasanWelcomeLabel2 = new Label("It appears that you are setting up Ikasan for the"
            + " first time and we need to create some database tables. If this is not the first time accessing the "
            + "Ikasan Console, it appears that there is an issue with the Ikasan database. If this is the case please "
            + "contact your local database administrator.");

    ikasanWelcomeLabel2.setStyleName("large");
    ikasanWelcomeLabel2.setWidth("60%");
    ikasanWelcomeLabel2.setHeight("70px");

    verticalLayout.addComponent(ikasanWelcomeLabel1);
    verticalLayout.addComponent(ikasanWelcomeLabel2);

    verticalLayout.addComponent(persistanceStoreTypeCombo);
    persistanceStoreTypeCombo.setHeight("30px");

    Button button = new Button("Create");
    button.setStyleName(ValoTheme.BUTTON_SMALL);
    button.setHeight("30px");

    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            String persistenceProvider = (String) PersistanceSetupPanel.this.persistanceStoreTypeCombo
                    .getValue();

            if (persistenceProvider == null) {
                Notification.show("Please select a database type!");
                return;
            }

            PersistenceService persistanceService = persistenceServiceFactory
                    .getPersistenceService(persistenceProvider);

            try {
                persistanceService.createPersistence();
                persistanceService.createAdminAccount();
            } catch (RuntimeException e) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);

                Notification.show("Error trying to create Ikasan database!", sw.toString(),
                        Notification.Type.ERROR_MESSAGE);
            }

            Notification.show("Database successfully created!");
        }
    });

    verticalLayout.addComponent(button);
    this.setContent(verticalLayout);
}

From source file:org.vaadin.addons.forms.LocationApplication.java

License:Apache License

public void init() {
    Window mainWindow = new Window("Location Form Sample");

    Button button = new Button("Open Location Form");
    button.setWidth("150px");
    button.setHeight("30px");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            Window window = new Window("Update Location");
            window.addComponent(new LocationForm());
            window.setModal(true);/*w  w w . j  a v a2s . c o  m*/
            window.setResizable(false);
            window.setWidth("510px");
            window.setHeight("370px");
            getMainWindow().addWindow(window);
            window.center();
        }
    });
    mainWindow.addComponent(button);
    setMainWindow(mainWindow);
}

From source file:probe.com.view.body.quantcompare.PieChart.java

public PieChart(String title, double full, double found, final String notfound) {

    this.setWidth(200 + "px");
    this.setHeight(200 + "px");
    defaultKeyColorMap.put("Found", new Color(110, 177, 206));
    defaultKeyColorMap.put("Not found", new Color(219, 169, 1));
    otherSymbols.setGroupingSeparator('.');
    this.setStyleName("click");

    labels = new String[] { "Found", "Not found" };

    double foundPercent = ((found / full) * 100.0);
    df = new DecimalFormat("#.##", otherSymbols);
    valuesMap.put("Found", ((int) found) + " (" + df.format(foundPercent) + "%)");
    values = new Double[] { foundPercent, 100.0 - foundPercent };
    valuesMap.put("Not found", ((int) (full - found)) + " (" + df.format(100.0 - foundPercent) + "%)");

    String defaultImgURL = initPieChart(200, 200, title);
    chartImg.setSource(new ExternalResource(defaultImgURL));
    this.addComponent(chartImg);
    this.addLayoutClickListener(PieChart.this);

    popupLayout = new PopupView(null, popupBody);
    popupLayout.setHideOnMouseOut(false);
    popupBody.setWidth("300px");
    popupBody.setStyleName(Reindeer.LAYOUT_WHITE);
    popupBody.setHeightUndefined();// w ww  .  j  a  v  a2 s  .  c  o  m
    this.addComponent(popupLayout);
    this.notfound = notfound.replace(" ", "").replace(",", "/n");

    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.setHeight("20px");

    Label header = new Label("<b>Not Found (New Proteins)</b>");
    header.setStyleName(Reindeer.LABEL_SMALL);
    topLayout.addComponent(header);
    header.setContentMode(ContentMode.HTML);

    VerticalLayout closeBtn = new VerticalLayout();
    closeBtn.setWidth("10px");
    closeBtn.setHeight("10px");
    closeBtn.setStyleName("closebtn");
    topLayout.addComponent(closeBtn);
    topLayout.setComponentAlignment(closeBtn, Alignment.TOP_RIGHT);
    closeBtn.addLayoutClickListener(new LayoutEvents.LayoutClickListener() {

        @Override
        public void layoutClick(LayoutEvents.LayoutClickEvent event) {
            popupLayout.setPopupVisible(false);
        }
    });
    popupBody.addComponent(topLayout);
    popupBody.addComponent(textArea);
    textArea.setWidth("100%");
    textArea.setHeight("150px");
    textArea.setValue(this.notfound);
    textArea.setReadOnly(true);
    popupBody.setSpacing(true);

    HorizontalLayout bottomLayout = new HorizontalLayout();
    bottomLayout.setWidth("100%");
    bottomLayout.setHeight("40px");
    bottomLayout.setMargin(new MarginInfo(false, true, true, true));
    popupBody.addComponent(bottomLayout);

    Button exportTableBtn = new Button("");
    exportTableBtn.setHeight("24px");
    exportTableBtn.setWidth("24px");
    exportTableBtn.setPrimaryStyleName("exportxslbtn");
    exportTableBtn.setDescription("Export table data");
    exportTableBtn.addClickListener(new Button.ClickListener() {

        private Table table;

        @Override
        public void buttonClick(Button.ClickEvent event) {

            if (table == null) {
                table = new Table();
                table.addContainerProperty("Index", Integer.class, null, "", null, Table.Align.RIGHT);
                table.addContainerProperty("Accession", String.class, Table.Align.CENTER);
                table.setVisible(false);
                addComponent(table);
                int i = 1;
                for (String str : notfound.replace(" ", "").replace(",", "\n").split("\n")) {
                    table.addItem(new Object[] { i, str }, i++);
                }

            }

            ExcelExport csvExport = new ExcelExport(table, "Not found protein accessions (New proteins)");
            //                csvExport.setReportTitle("CSF-PR /  Not found protein accessions (New proteins) ");
            csvExport.setExportFileName("CSF-PR - Not found protein accessions" + ".xls");
            csvExport.setMimeType(CsvExport.EXCEL_MIME_TYPE);
            csvExport.setDisplayTotals(false);
            csvExport.setExcelFormatOfProperty("Index", "#0;[Red] #0");
            csvExport.export();

        }
    });

    bottomLayout.addComponent(exportTableBtn);
    bottomLayout.setComponentAlignment(exportTableBtn, Alignment.MIDDLE_RIGHT);

}