Example usage for com.vaadin.ui HorizontalLayout setSpacing

List of usage examples for com.vaadin.ui HorizontalLayout setSpacing

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setSpacing.

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:com.trivago.mail.pigeon.web.components.mail.ModalAddNewsletter.java

License:Apache License

public ModalAddNewsletter(final NewsletterList nl) {
    super();/*w  w w . ja  v  a2  s .  com*/

    setModal(true);
    setWidth("600px");
    setClosable(false);

    Panel rootPanel = new Panel("Add new Newsletter");
    final VerticalLayout verticalLayout = new VerticalLayout();
    final SenderSelectBox senderSelectBox = new SenderSelectBox();
    final HorizontalLayout buttonLayout = new HorizontalLayout();
    final GroupSelectBox groupSelectBox = new GroupSelectBox();
    final UploadTextFileComponent uploadTextfile = new UploadTextFileComponent();
    final UploadHtmlFileComponent uploadHtmlfile = new UploadHtmlFileComponent();
    final TemplateSelectBox templateSelectBox = new TemplateSelectBox();
    final TextField tfSubject = new TextField("Subject");
    final DateField tfSendDate = new DateField("Send Date");
    final Button cancelButton = new Button("Cancel");
    final Button saveButton = new Button("Send");

    tfSendDate.setInvalidAllowed(false);
    tfSendDate.setResolution(DateField.RESOLUTION_MIN);
    tfSendDate.setValue(new Date());

    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            event.getButton().getWindow().setVisible(false);
            event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
        }
    });

    saveButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean hasError = false;
            // Validation
            if (tfSubject.getValue().equals("") && templateSelectBox.getSelectedTemplate() == null) {
                hasError = true;
                tfSubject.setComponentError(
                        new UserError("Subject cannot be empty if you do not choose a template."));
            } else {
                tfSubject.setComponentError(null);
            }

            if (tfSendDate.getValue() == null) {
                hasError = true;
                tfSendDate.setComponentError(new UserError("Date cannot be empty"));
            } else {
                tfSendDate.setComponentError(null);
            }

            if (templateSelectBox.getSelectedTemplate() == null) {
                if (!uploadTextfile.isUploadFinished()) {
                    hasError = true;
                    uploadTextfile.setComponentError(
                            new UserError("You must provide a text file if you do not choose a template"));
                } else {
                    uploadTextfile.setComponentError(null);
                }

                if (!uploadHtmlfile.isUploadFinished()) {
                    hasError = true;
                    uploadHtmlfile.setComponentError(
                            new UserError("You must provide a html file if you do not choose a template"));
                } else {
                    uploadHtmlfile.setComponentError(null);
                }
            }

            if (senderSelectBox.getSelectedSender() == 0) {
                hasError = true;
                senderSelectBox.setComponentError(new UserError("You must select a sender"));
            } else {
                senderSelectBox.setComponentError(null);
            }

            if (groupSelectBox.getSelectedGroup() == 0) {
                hasError = true;
                groupSelectBox.setComponentError(new UserError("You must select a recipient group"));
            } else {
                groupSelectBox.setComponentError(null);
            }
            log.debug("Has Error: " + hasError);
            if (!hasError) {
                log.info("No validation errors found, processing request");
                long mailId = Util.generateId();
                try {
                    Sender s = new Sender(senderSelectBox.getSelectedSender());

                    String text;
                    String html;
                    String subject;

                    if (templateSelectBox.getSelectedTemplate() == null) {
                        text = uploadTextfile.getTextData();
                        html = uploadHtmlfile.getHtmlData();
                        subject = tfSubject.getValue().toString();
                    } else {
                        MailTemplate mt = new MailTemplate(templateSelectBox.getSelectedTemplate());
                        text = mt.getText();
                        html = mt.getHtml();
                        subject = mt.getSubject();
                    }

                    Mail m = new Mail(mailId, text, html, (Date) tfSendDate.getValue(), subject, s);

                    QueueNewsletter queueNewsletter = new QueueNewsletter();
                    queueNewsletter.queueNewsletter(m, s,
                            new RecipientGroup(groupSelectBox.getSelectedGroup()));

                    event.getButton().getWindow().setVisible(false);
                    event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
                    event.getButton().getWindow().getParent().showNotification("Queued successfully",
                            Notification.TYPE_HUMANIZED_MESSAGE);

                    nl.getBeanContainer().addItem(m.getId(), m);

                } catch (RuntimeException e) {
                    log.error("RuntimeException", e);
                    event.getButton().getApplication().getMainWindow().showNotification(
                            "An error occured: " + e.getLocalizedMessage(), Notification.TYPE_ERROR_MESSAGE);
                }
            }
        }
    });

    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(saveButton);
    buttonLayout.addComponent(cancelButton);

    Panel metaData = new Panel("Basic Data");

    metaData.addComponent(tfSendDate);
    verticalLayout.addComponent(metaData);
    verticalLayout.addComponent(senderSelectBox);
    verticalLayout.addComponent(groupSelectBox);

    verticalLayout.addComponent(templateSelectBox);

    verticalLayout.addComponent(tfSubject);
    verticalLayout.addComponent(uploadTextfile);
    verticalLayout.addComponent(uploadHtmlfile);

    verticalLayout.addComponent(buttonLayout);

    rootPanel.addComponent(verticalLayout);
    this.addComponent(rootPanel);
}

From source file:com.trivago.mail.pigeon.web.components.recipients.RecipientList.java

License:Apache License

private void init() {
    final Panel rootPanel = new Panel("Recipients");
    rootPanel.setWidth("800px");

    //      Button senderListNewButton = new Button("Add Sender");
    //      senderListNewButton.setImmediate(true);
    //      senderListNewButton.setIcon(new ThemeResource("../runo/icons/16/document-add.png"));
    //      senderListNewButton.addListener(new Button.ClickListener()
    //      {/*from   www . j a v  a 2s  .  c om*/
    //         @Override
    //         public void buttonClick(Button.ClickEvent event)
    //         {
    //            Window modalNewWindow = new ModalAddNewSender(sl);
    //            event.getButton().getWindow().addWindow(modalNewWindow);
    //            modalNewWindow.setVisible(true);
    //         }
    //      });

    viewTable = new Table();
    viewTable.setWidth("100%");
    final Button editButton = new Button("Edit");
    editButton.setImmediate(true);
    editButton.setIcon(new ThemeResource("../runo/icons/16/document-txt.png"));
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (viewTable.isEditable()) {
                viewTable.setEditable(false);
                editButton.setCaption("Edit");
                viewTable.requestRepaintAll();
                editButton.getWindow().showNotification("Save successful",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
            } else {
                viewTable.setEditable(true);
                editButton.setCaption("Save");
                viewTable.requestRepaintAll();
            }
        }
    });

    Button exportTable = new Button("Export");
    exportTable.setImmediate(true);
    exportTable.setIcon(new ThemeResource("../runo/icons/16/document-xsl.png"));
    exportTable.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            log.debug("Starting export");
            TableExport te = new ExcelExport(viewTable, "Recipient list", "Recipient list",
                    "Recipient_list.xls", false);
            log.debug("Converting table");
            te.convertTable();
            log.debug("Sending converted table...");
            boolean success = te.sendConverted();
            if (success) {
                log.debug("Sending should be successful");
            } else {
                log.warn("Sending not successfull, maybe IOException occured?");
            }
        }
    });

    viewTable.setImmediate(true);
    beanContainer = new BeanContainer<>(Recipient.class);

    List<Recipient> recipientList = getRecipientList();
    for (Recipient recipient : recipientList) {
        beanContainer.addItem(recipient.getId(), recipient);
    }

    viewTable.setContainerDataSource(beanContainer);
    viewTable.addGeneratedColumn("Actions", new ActionButtonColumnGenerator());

    // First set the vis. cols, then the headlines (the other way round leads to an exception)
    viewTable.setVisibleColumns(new String[] { "id", "title", "firstname", "lastname", "email", "active",
            "gender", "birthday", "city", "country", "language", "Actions" });

    viewTable.setColumnHeaders(new String[] { "ID", "Title", "Firstname", "Lastname", "E-Mail", "Active",
            "Gender", "Birthday", "City", "Country", "Language", "Actions" });

    viewTable.setColumnCollapsingAllowed(true);

    viewTable.setColumnCollapsed("gender", true);
    viewTable.setColumnCollapsed("title", true);
    viewTable.setColumnCollapsed("birthday", true);
    viewTable.setColumnCollapsed("city", true);
    viewTable.setColumnCollapsed("country", true);
    viewTable.setColumnCollapsed("language", true);

    viewTable.setColumnExpandRatio(3, 2);
    viewTable.setColumnExpandRatio(4, 2);

    HorizontalLayout topButtonLayout = new HorizontalLayout();
    topButtonLayout.setSpacing(true);
    topButtonLayout.setMargin(false, false, true, false);
    topButtonLayout.addComponent(editButton);
    topButtonLayout.addComponent(exportTable);

    rootPanel.addComponent(topButtonLayout);
    rootPanel.addComponent(viewTable);

    setCompositionRoot(rootPanel);
}

From source file:com.trivago.mail.pigeon.web.components.sender.ModalAddNewSender.java

License:Apache License

public ModalAddNewSender(final SenderList sl) {
    super();/*from   w ww  .  j a v a2  s .co  m*/
    setClosable(false);
    setModal(true);
    setWidth("300px");

    Panel rootPanel = new Panel("Add new Sender");
    final VerticalLayout verticalLayout = new VerticalLayout();
    final TextField tfName = new TextField("Name");
    final TextField tfFromMail = new TextField("From E-Mail");
    final TextField tfReplyTo = new TextField("ReplyTo E-Mail");

    verticalLayout.addComponent(tfName);
    verticalLayout.addComponent(tfFromMail);
    verticalLayout.addComponent(tfReplyTo);

    HorizontalLayout buttonLayout = new HorizontalLayout();

    Button saveButton = new Button("Save");
    Button cancelButton = new Button("Cancel");

    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            event.getButton().getWindow().setVisible(false);
            event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
        }
    });

    saveButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (tfName.getValue().equals("")) {
                tfName.setComponentError(new UserError("Name must not be empty"));
            } else {
                tfName.setComponentError(null);
            }

            if (tfFromMail.getValue().equals("")) {
                tfFromMail.setComponentError(new UserError("From E-Mail must not be empty"));
            } else {
                tfFromMail.setComponentError(null);
            }

            if (tfReplyTo.getValue().equals("")) {
                tfReplyTo.setComponentError(new UserError("Reply-To E-Mail must not be empty"));
            } else {
                tfReplyTo.setComponentError(null);
            }

            if (!tfName.getValue().equals("") && !tfFromMail.getValue().equals("")
                    && !tfReplyTo.getValue().equals("")) {
                tfName.setComponentError(null);
                tfFromMail.setComponentError(null);
                tfReplyTo.setComponentError(null);

                long senderId = Util.generateId();
                try {
                    Sender s = new Sender(senderId, tfFromMail.getValue().toString(),
                            tfReplyTo.getValue().toString(), tfName.getValue().toString());
                    event.getButton().getWindow().setVisible(false);
                    event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
                    event.getButton().getWindow().getParent().showNotification("Saved successfully",
                            Notification.TYPE_HUMANIZED_MESSAGE);
                    sl.getBeanContainer().addItem(s.getId(), s);

                    // The sender select could be placed anywhere but must be reloaded to reflect the changes.
                    SenderSelectBox.reloadSelect();
                } catch (RuntimeException e) {
                    // Should never happen ... hopefully :D
                }
            }
        }
    });

    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(saveButton);
    buttonLayout.addComponent(cancelButton);

    verticalLayout.addComponent(buttonLayout);
    rootPanel.addComponent(verticalLayout);
    this.addComponent(rootPanel);
}

From source file:com.trivago.mail.pigeon.web.components.sender.SenderList.java

License:Apache License

public SenderList() {
    final SenderList sl = this;
    final Panel rootPanel = new Panel("Sender");
    rootPanel.setWidth("800px");

    Button senderListNewButton = new Button("Add Sender");
    senderListNewButton.setImmediate(true);
    senderListNewButton.setIcon(new ThemeResource("../runo/icons/16/document-add.png"));
    senderListNewButton.addListener(new Button.ClickListener() {
        @Override//  w  w w  .  j a  va2 s.co  m
        public void buttonClick(Button.ClickEvent event) {
            Window modalNewWindow = new ModalAddNewSender(sl);
            event.getButton().getWindow().addWindow(modalNewWindow);
            modalNewWindow.setVisible(true);
        }
    });

    viewTable = new Table();
    viewTable.setWidth("100%");
    final Button editButton = new Button("Edit");
    editButton.setImmediate(true);
    editButton.setIcon(new ThemeResource("../runo/icons/16/document-txt.png"));
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (viewTable.isEditable()) {
                viewTable.setEditable(false);
                editButton.setCaption("Edit");
                viewTable.requestRepaintAll();
                editButton.getWindow().showNotification("Save successful",
                        Window.Notification.TYPE_HUMANIZED_MESSAGE);
            } else {
                viewTable.setEditable(true);
                editButton.setCaption("Save");
                viewTable.requestRepaintAll();
            }
        }
    });

    viewTable.setImmediate(true);
    beanContainer = new BeanContainer<Long, Sender>(Sender.class);

    List<Sender> senderList = getSenderList();
    for (Sender sender : senderList) {
        beanContainer.addItem(sender.getId(), sender);
    }

    viewTable.setContainerDataSource(beanContainer);
    viewTable.addGeneratedColumn("Actions", new ActionButtonColumnGenerator());

    // First set the vis. cols, then the headlines (the other way round leads to an exception)
    viewTable.setVisibleColumns(
            new String[] { "id", "name", "fromMail", "replytoMail", "sentMailsCount", "Actions" });

    viewTable.setColumnHeaders(new String[] { "ID", "Name", "E-Mail", "Reply To", "E-Mails sent", "Actions" });

    viewTable.setColumnExpandRatio(3, 2);
    viewTable.setColumnExpandRatio(4, 2);

    HorizontalLayout topButtonLayout = new HorizontalLayout();
    topButtonLayout.setSpacing(true);
    topButtonLayout.setMargin(false, false, true, false);
    topButtonLayout.addComponent(senderListNewButton);
    topButtonLayout.addComponent(editButton);

    rootPanel.addComponent(topButtonLayout);
    rootPanel.addComponent(viewTable);

    setCompositionRoot(rootPanel);

}

From source file:com.trivago.mail.pigeon.web.components.templates.ModalAddTemplate.java

License:Apache License

public ModalAddTemplate(final TemplateList tl, final Long templateId) {
    setResizable(true);//from   ww w . j  ava 2s. co  m
    setWidth("972px");
    setHeight("700px");
    Panel rootPanel = new Panel("Add new Template");
    TabSheet tSheet = new TabSheet();
    HorizontalLayout hLayout = new HorizontalLayout();

    final TextField title = new TextField("Template description");
    final TextField subject = new TextField("Newsletter Subject");

    final TextArea textContent = new TextArea("Text Version");
    textContent.setRows(40);
    textContent.setColumns(100);

    final CKEditorTextField htmlContent = new CKEditorTextField();
    htmlContent.setWidth("100%");
    htmlContent.setHeight("650px");

    // Load the content, if we receive a template id
    if (templateId != null) {
        MailTemplate mt = new MailTemplate(templateId);
        title.setValue(mt.getTitle());
        subject.setValue(mt.getSubject());
        textContent.setValue(mt.getText());
        htmlContent.setValue(mt.getHtml());
    }

    Button saveButton = new Button("Save");
    Button cancel = new Button("Cancel");

    saveButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean hasError = false;
            if (title.getValue().equals("")) {
                title.setComponentError(new UserError("Name must not be empty"));
                hasError = true;
            } else {
                title.setComponentError(null);
            }

            if (subject.getValue().equals("")) {
                subject.setComponentError(new UserError("Subject must not be empty"));
                hasError = true;
            } else {
                subject.setComponentError(null);
            }

            if (htmlContent.getValue().equals("")) {
                htmlContent.setComponentError(new UserError("Please provide some HTML content"));
                hasError = true;
            } else {
                htmlContent.setComponentError(null);
            }

            if (textContent.getValue().equals("")) {
                textContent.setComponentError(new UserError("Please provide some text content"));
                hasError = true;
            } else {
                textContent.setComponentError(null);
            }

            if (!hasError) {
                if (templateId == null) {
                    long templateId = Util.generateId();
                    try {
                        MailTemplate mt = new MailTemplate(templateId, title.getValue().toString(),
                                textContent.getValue().toString(), htmlContent.getValue().toString(),
                                subject.getValue().toString());
                        event.getButton().getWindow().setVisible(false);
                        event.getButton().getWindow().getParent()
                                .removeComponent(event.getButton().getWindow());
                        event.getButton().getWindow().getParent().showNotification("Saved successfully",
                                Notification.TYPE_HUMANIZED_MESSAGE);
                        tl.getBeanContainer().addItem(mt.getId(), mt);
                    } catch (RuntimeException e) {
                        // Should never happen ... hopefully :D
                    }
                } else {
                    MailTemplate mt = new MailTemplate(templateId);

                    mt.setHtml(htmlContent.getValue().toString());
                    mt.setSubject(subject.getValue().toString());
                    mt.setText(textContent.getValue().toString());
                    mt.setTitle(title.getValue().toString());

                    event.getButton().getWindow().setVisible(false);
                    event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
                    event.getButton().getWindow().getParent().showNotification("Saved successfully",
                            Notification.TYPE_HUMANIZED_MESSAGE);

                    final int beanIndex = tl.getBeanContainer().indexOfId(mt.getId());
                    tl.getBeanContainer().removeItem(mt.getId());
                    tl.getBeanContainer().addItemAt(beanIndex, mt.getId(), mt);
                }
                TemplateSelectBox.reloadSelect();
            }
        }
    });

    hLayout.addComponent(saveButton);
    hLayout.addComponent(cancel);
    hLayout.setSpacing(true);

    VerticalLayout metaDataLayout = new VerticalLayout();

    Panel textFieldPanel = new Panel("Meta Data");
    VerticalLayout metaLayout = new VerticalLayout();
    metaLayout.addComponent(title);
    metaLayout.addComponent(subject);
    textFieldPanel.addComponent(metaLayout);

    Panel helpPanel = new Panel("Template Documentation");
    assembleHelpComponents(helpPanel);

    metaDataLayout.addComponent(textFieldPanel);
    metaDataLayout.addComponent(helpPanel);

    tSheet.addTab(metaDataLayout).setCaption("Meta Data");

    VerticalLayout textLayout = new VerticalLayout();
    textLayout.addComponent(textContent);
    tSheet.addTab(textLayout).setCaption("Text Content");

    VerticalLayout htmlLayout = new VerticalLayout();
    htmlLayout.addComponent(htmlContent);
    tSheet.addTab(htmlLayout).setCaption("HTML Content");

    rootPanel.addComponent(tSheet);
    rootPanel.addComponent(hLayout);
    addComponent(rootPanel);
}

From source file:com.vaadHL.window.base.FWindow.java

License:Apache License

/**
 * Creates ( does not display) panel containing default window buttons
 * //  w  w w  . j  av a 2  s . c o m
 * @return the created buttons panel
 */
public Component makeButtonsPanel() {
    HorizontalLayout bottPanel = new HorizontalLayout();
    if (getLaunchMode() == MWLaunchMode.VIEW_EDIT) {
        bottPanel.addComponent(btCreate);
        bottPanel.addComponent(btDelete);
        bottPanel.addComponent(btEdit);
    } else {
        crudActions.setVisible(false);
    }

    // record move buttons
    if ((getLaunchMode() == MWLaunchMode.VIEW_EDIT || getLaunchMode() == MWLaunchMode.EDIT
            || getLaunchMode() == MWLaunchMode.VIEW_ONLY) && isPrevNextFunc()) {
        bottPanel.addComponent(btPrevRec);
        bottPanel.addComponent(btNextRec);
    }

    // save cancel buttons
    if (getLaunchMode() == MWLaunchMode.VIEW_EDIT || getLaunchMode() == MWLaunchMode.EDIT) {
        bottPanel.addComponent(btSave);
        bottPanel.addComponent(btDiscard);
        if (isShowOKCancel()) {
            bottPanel.addComponent(btOk);
            bottPanel.addComponent(btCancel);
        } else
            bottPanel.addComponent(btClose);
    }

    if (getLaunchMode() == MWLaunchMode.NEW_REC) {
        bottPanel.addComponent(btOk);
        bottPanel.addComponent(btCancel);
    } else if (getLaunchMode() == MWLaunchMode.DELETE) {
        bottPanel.addComponent(btDelete);
        getAction(ActionsIds.AC_DELETE).setVisible(true);
        bottPanel.addComponent(btCancel);
    } else if (getLaunchMode() == MWLaunchMode.VIEW_ONLY)
        bottPanel.addComponent(btClose);

    // bottPanel.setWidth("100%");
    bottPanel.setSpacing(true);
    return bottPanel;
}

From source file:com.vaadHL.window.base.LWindow.java

License:Apache License

/**
 * Creates ( does not display) panel containing default window buttons
 * /*from w ww . j a v  a  2 s .c o m*/
 * @return the created buttons panel
 */
public Component makeButtonsPanel() {
    HorizontalLayout bottPanel = new HorizontalLayout();

    if (isDetailsFunc())
        bottPanel.addComponent(btDetails);
    if (isAddFunc())
        bottPanel.addComponent(btCreate);
    if (isDeleteFunc())
        bottPanel.addComponent(btDelete);
    if (isEditFunc())
        bottPanel.addComponent(btEdit);
    if (isViewFunc())
        bottPanel.addComponent(btView);

    if (getChooseMode() == ChoosingMode.NO_CHOOSE) {
        bottPanel.addComponent(btClose);
    } else {
        bottPanel.addComponent(btOk);
        bottPanel.addComponent(btCancel);
    }

    // bottPanel.setWidth("100%");
    bottPanel.setSpacing(true);
    return bottPanel;

}

From source file:com.vphakala.SubscriberUI.java

public SubscriberUI(SubscriberService service) {
    super();/*www .j a v  a  2s .c o  m*/

    this.service = service;

    setMargin(true);
    setSpacing(true);
    setCaption("Subscriber");

    Toolbar toolbar = new Toolbar(this.getCaption(), read, create, update, delete);

    recharge.setStyleName(BaseTheme.BUTTON_LINK);
    HorizontalLayout account = new HorizontalLayout(balance, recharge, rechargeResponse);
    account.setSpacing(true);
    account.setComponentAlignment(recharge, Alignment.BOTTOM_LEFT);

    voucher = voucherService.getRtBVoucherWSImplPort();

    addComponents(toolbar, email, phoneNumber, account);
}

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.ui.ConfirmDialog.java

License:Apache License

private HorizontalLayout createButtonLayout() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);

    yes = new Button(confirmYes);
    yes.addClickListener(new Button.ClickListener() {
        @Override//from   www .java2 s .c  om
        public void buttonClick(Button.ClickEvent event) {
            hide();
            if (action != null) {
                action.execute();
            }
        }
    });
    buttonLayout.addComponent(yes);

    no = new Button(confirmNo);
    no.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            hide();
        }
    });
    buttonLayout.addComponent(no);

    return buttonLayout;
}

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DummyRegWithReCaptcha.java

License:Apache License

private void buildContent() {
    content.setMargin(true);/*w  ww  .  j a  va 2 s  .  c  o  m*/
    content.addComponent(createForm());
    content.addComponent(reCaptcha);
    Button reconfigBtn = createCancelBtn();
    Button submitBtn = new Button("Register", this);
    submitBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    submitBtn.addStyleName(Reindeer.BUTTON_DEFAULT);
    HorizontalLayout actionsLayout = new HorizontalLayout(submitBtn, reconfigBtn);
    actionsLayout.setSpacing(true);
    actionsLayout.setWidth(100, Unit.PERCENTAGE);
    actionsLayout.setComponentAlignment(reconfigBtn, Alignment.MIDDLE_RIGHT);
    content.addComponent(actionsLayout);
}