List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT
Alignment MIDDLE_RIGHT
To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.
Click Source Link
From source file:com.esofthead.mycollab.vaadin.ui.AbstractBeanPagedList.java
License:Open Source License
protected CssLayout createPageControls() { this.controlBarWrapper = new CssLayout(); this.controlBarWrapper.setStyleName(listControlStyle); this.controlBarWrapper.setWidth("100%"); final HorizontalLayout controlBar = new HorizontalLayout(); controlBar.setWidth("100%"); this.controlBarWrapper.addComponent(controlBar); this.pageManagement = new HorizontalLayout(); // defined layout here --------------------------- if (this.currentPage > 1) { final Button firstLink = new ButtonLink("1", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//www . j a v a2s.com public void buttonClick(final ClickEvent event) { AbstractBeanPagedList.this.pageChange(1); } }, false); firstLink.addStyleName("buttonPaging"); this.pageManagement.addComponent(firstLink); } if (this.currentPage >= 5) { final Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); this.pageManagement.addComponent(ss1); } if (this.currentPage > 3) { final Button previous2 = new ButtonLink("" + (this.currentPage - 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage - 2); } }, false); previous2.addStyleName("buttonPaging"); this.pageManagement.addComponent(previous2); } if (this.currentPage > 2) { final Button previous1 = new ButtonLink("" + (this.currentPage - 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage - 1); } }, false); previous1.addStyleName("buttonPaging"); this.pageManagement.addComponent(previous1); } // Here add current ButtonLink final Button current = new ButtonLink("" + this.currentPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage); } }, false); current.addStyleName("buttonPaging"); current.addStyleName("buttonPagingcurrent"); this.pageManagement.addComponent(current); final int range = this.totalPage - this.currentPage; if (range >= 1) { final Button next1 = new ButtonLink("" + (this.currentPage + 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage + 1); } }, false); next1.addStyleName("buttonPaging"); this.pageManagement.addComponent(next1); } if (range >= 2) { final Button next2 = new ButtonLink("" + (this.currentPage + 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage + 2); } }, false); next2.addStyleName("buttonPaging"); this.pageManagement.addComponent(next2); } if (range >= 4) { final Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); this.pageManagement.addComponent(ss2); } if (range >= 3) { final Button last = new ButtonLink("" + this.totalPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.totalPage); } }, false); last.addStyleName("buttonPaging"); this.pageManagement.addComponent(last); } this.pageManagement.setWidth(null); this.pageManagement.setSpacing(true); controlBar.addComponent(this.pageManagement); controlBar.setComponentAlignment(this.pageManagement, Alignment.MIDDLE_RIGHT); return this.controlBarWrapper; }
From source file:com.esofthead.mycollab.vaadin.ui.DefaultGenericSearchPanel.java
License:Open Source License
protected ComponentContainer constructHeader() { headerText = buildSearchTitle();//from w w w. ja v a2s. c o m rightComponent = new MHorizontalLayout(); MHorizontalLayout header = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW).withWidth("100%") .withMargin(new MarginInfo(true, false, true, false)); header.with(headerText, rightComponent).withAlign(headerText, Alignment.MIDDLE_LEFT) .withAlign(rightComponent, Alignment.MIDDLE_RIGHT).expand(headerText); buildExtraControls(); return header; }
From source file:com.esofthead.mycollab.vaadin.ui.Depot.java
License:Open Source License
public void addHeaderElement(final Component component) { if (component != null) { this.headerContent.addComponent(component); this.headerContent.setComponentAlignment(component, Alignment.MIDDLE_RIGHT); this.headerContent.setVisible(true); }/*from w w w . j av a2s . co m*/ }
From source file:com.esofthead.mycollab.vaadin.ui.FeedbackWindow.java
License:Open Source License
private void initUI() { GridLayout mainLayout = new GridLayout(2, 5); mainLayout.setMargin(true);//from ww w. j a v a 2 s .co m mainLayout.setSpacing(true); emailNameTextField = new TextField(); emailNameTextField.setWidth("500px"); Label emailName = new Label("Your name: "); mainLayout.addComponent(emailName, 0, 0); mainLayout.addComponent(emailNameTextField, 1, 0); emailTextField = new TextField(); emailTextField.setWidth("500px"); emailTextField.setRequired(true); Label emailLbl = new Label("Your email: "); mainLayout.addComponent(emailLbl, 0, 1); mainLayout.addComponent(emailTextField, 1, 1); subjectTextField = new TextField(); subjectTextField.setWidth("500px"); subjectTextField.setRequired(true); Label subjectLbl = new Label("Subject: "); mainLayout.addComponent(subjectLbl, 0, 2); mainLayout.addComponent(subjectTextField, 1, 2); final RichTextArea contentArea = new RichTextArea(); contentArea.setImmediate(true); contentArea.setWidth(500, Sizeable.Unit.PIXELS); contentArea.setHeight(200, Sizeable.Unit.PIXELS); Label contentLbl = new Label("Your feedback: "); mainLayout.addComponent(contentLbl, 0, 3); mainLayout.addComponent(contentArea, 1, 3); initDefaultData(); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setWidth("100%"); final AttachmentPanel attachments = new AttachmentPanel(); attachments.setWidth("350px"); MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments); uploadExt.addComponent(attachments); // Panel attachedFilepanel = new Panel(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setHeight("80px"); contentLayout.setStyleName("noneBorder-panel"); contentLayout.setSizeUndefined(); contentLayout.addComponent(uploadExt); // attachedFilepanel.setContent(contentLayout); controlsLayout.addComponent(contentLayout); controlsLayout.setComponentAlignment(contentLayout, Alignment.BOTTOM_LEFT); controlsLayout.setExpandRatio(contentLayout, 1.0f); controlsLayout.setSpacing(true); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { FeedbackWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); controlsLayout.addComponent(cancelBtn); controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT); Button sendBtn = new Button("Send", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { String email = emailTextField.getValue().toString().trim(); String subject = subjectTextField.getValue().toString().trim(); if (!StringUtils.isValidEmail(email)) { NotificationUtil.showWarningNotification("The email is not valid, please check it again!"); return; } if (!email.equals("") && !subject.equals("")) { ExtMailService systemMailService = ApplicationContextUtil.getSpringBean(ExtMailService.class); List<File> listFile = attachments.getListFile(); List<EmailAttachementSource> emailAttachmentSource = null; if (CollectionUtils.isNotEmpty(listFile)) { emailAttachmentSource = new ArrayList<EmailAttachementSource>(); for (File file : listFile) { emailAttachmentSource.add(new FileEmailAttachmentSource(file)); } } String nameEmailFrom = emailNameTextField.getValue().toString().trim(); nameEmailFrom = nameEmailFrom.equals("") ? email : nameEmailFrom; String toEmail = SiteConfiguration.getSendErrorEmail(); FeedbackWindow.this.close(); systemMailService.sendHTMLMail(email, nameEmailFrom, Arrays.asList(new MailRecipientField(toEmail, toEmail)), null, null, subject, contentArea.getValue().toString(), emailAttachmentSource); } else { NotificationUtil.showWarningNotification( "The email field and subject field must be not empty! Please fulfil them before pressing enter button."); } } }); sendBtn.setStyleName(UIConstants.THEME_GREEN_LINK); controlsLayout.addComponent(sendBtn); controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT); mainLayout.addComponent(controlsLayout, 0, 4, 1, 4); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java
License:Open Source License
private Layout createTextFieldMail(String title, Component component) { HorizontalLayout layout = new HorizontalLayout(); Label lbTitle = new Label(title); lbTitle.setWidth("60px"); lbTitle.setStyleName("lbmail"); layout.addComponent(lbTitle);/* ww w . jav a2 s . c o m*/ layout.setComponentAlignment(lbTitle, Alignment.MIDDLE_RIGHT); layout.addComponent(component); layout.setComponentAlignment(component, Alignment.MIDDLE_LEFT); layout.setWidth("100%"); layout.setExpandRatio(component, 1.0f); return layout; }
From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java
License:Open Source License
private void initUI() { GridLayout mainLayout = new GridLayout(1, 5); mainLayout.setWidth("100%"); mainLayout.setMargin(true);//from ww w.j av a 2s . co m mainLayout.setSpacing(true); CssLayout inputPanel = new CssLayout(); inputPanel.setWidth("100%"); inputPanel.setStyleName("mail-panel"); inputLayout = new GridLayout(3, 4); inputLayout.setSpacing(true); inputLayout.setWidth("100%"); inputLayout.setColumnExpandRatio(0, 1.0f); inputPanel.addComponent(inputLayout); mainLayout.addComponent(inputPanel); tokenFieldMailTo = new EmailTokenField(); tokenFieldMailTo.setRequired(true); inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0); if (lstMail != null) { for (String mail : lstMail) { if (StringUtils.isNotBlank(mail)) { if (mail.indexOf("<") > -1) { String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">")); if (strMail != null && !strMail.equalsIgnoreCase("null")) { tokenFieldMailTo.addToken(mail); } } else { tokenFieldMailTo.addToken(mail); } } } } final TextField subject = new TextField(); subject.setRequired(true); subject.setWidth("100%"); subjectField = createTextFieldMail("Subject:", subject); inputLayout.addComponent(subjectField, 0, 1); initButtonLinkCcBcc(); ccField = createTextFieldMail("Cc:", tokenFieldMailCc); bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc); final RichTextArea noteArea = new RichTextArea(); noteArea.setWidth("100%"); noteArea.setHeight("200px"); mainLayout.addComponent(noteArea, 0, 1); mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER); HorizontalLayout controlsLayout = new HorizontalLayout(); controlsLayout.setWidth("100%"); final AttachmentPanel attachments = new AttachmentPanel(); attachments.setWidth("500px"); MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments); uploadExt.addComponent(attachments); controlsLayout.addComponent(uploadExt); controlsLayout.setExpandRatio(uploadExt, 1.0f); controlsLayout.setSpacing(true); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { MailFormWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); controlsLayout.addComponent(cancelBtn); controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT); Button sendBtn = new Button("Send", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) { NotificationUtil.showErrorNotification( "To Email field and Subject field must be not empty! Please fulfil them before sending email."); return; } if (AppContext.getSession().getEmail() != null && AppContext.getSession().getEmail().length() > 0) { ExtMailService systemMailService = ApplicationContextUtil.getSpringBean(ExtMailService.class); List<File> listFile = attachments.getListFile(); List<EmailAttachementSource> emailAttachmentSource = null; if (listFile != null && listFile.size() > 0) { emailAttachmentSource = new ArrayList<EmailAttachementSource>(); for (File file : listFile) { emailAttachmentSource.add(new FileEmailAttachmentSource(file)); } } systemMailService.sendHTMLMail(AppContext.getSession().getEmail(), AppContext.getSession().getDisplayName(), tokenFieldMailTo.getListRecipient(), tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(), subject.getValue().toString(), noteArea.getValue().toString(), emailAttachmentSource); MailFormWindow.this.close(); } else { NotificationUtil.showErrorNotification( "Your email is empty value, please fulfil it before sending email!"); } } }); sendBtn.setStyleName(UIConstants.THEME_GREEN_LINK); controlsLayout.addComponent(sendBtn); controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT); mainLayout.addComponent(controlsLayout, 0, 2); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.vaadin.ui.MassUpdateWindow.java
License:Open Source License
protected ComponentContainer buildButtonControls() { MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withStyleName("addNewControl") .withWidth("100%"); updateBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// www . j a va2 s. c o m public void buttonClick(ClickEvent event) { updateForm.commit(); massUpdateCommand.massUpdate(beanItem); MassUpdateWindow.this.close(); } }); updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK); updateBtn.setIcon(FontAwesome.SAVE); closeBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { MassUpdateWindow.this.close(); } }); closeBtn.setStyleName(UIConstants.THEME_GRAY_LINK); Label spacing = new Label(); controlsLayout.with(spacing, updateBtn, closeBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing); return controlsLayout; }
From source file:com.esofthead.mycollab.vaadin.ui.ProjectPreviewFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) { Button optionParentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/* w w w .java2 s . c o m*/ public void buttonClick(ClickEvent event) { optionBtn.setPopupVisible(true); } }); optionBtn = new SplitButton(optionParentBtn); optionBtn.setWidthUndefined(); optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK); if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) { addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); final T item = previewForm.getBean(); previewForm.fireAddForm(item); } }); addBtn.setIcon(FontAwesome.PLUS); addBtn.setStyleName(UIConstants.THEME_GREEN_LINK); editButtons.addComponent(addBtn); editButtons.setComponentAlignment(addBtn, Alignment.MIDDLE_CENTER); } if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); final T item = previewForm.getBean(); previewForm.fireEditForm(item); } }); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName(UIConstants.THEME_GREEN_LINK); editButtons.addComponent(editBtn); editButtons.setComponentAlignment(editBtn, Alignment.MIDDLE_CENTER); } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireDeleteForm(item); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName(UIConstants.THEME_RED_LINK); editButtons.addComponent(deleteBtn); editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER); } if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) { assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireAssignForm(item); } }); assignBtn.setIcon(FontAwesome.SHARE_SQUARE_O); assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK); editButtons.addComponent(assignBtn, 0); } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); final T item = previewForm.getBean(); previewForm.fireCloneForm(item); } }); cloneBtn.setIcon(FontAwesome.ROAD); cloneBtn.setStyleName("link"); popupButtonsControl.addComponent(cloneBtn); } if (popupButtonsControl.getComponentCount() > 0) { optionBtn.setContent(popupButtonsControl); editButtons.addComponent(optionBtn); editButtons.setComponentAlignment(optionBtn, Alignment.MIDDLE_CENTER); } layout.addComponent(editButtons); layout.setComponentAlignment(editButtons, Alignment.MIDDLE_CENTER); layout.setExpandRatio(editButtons, 1.0f); if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) { ButtonGroup navigationBtns = new ButtonGroup(); navigationBtns.setStyleName("navigation-btns"); Button previousItem = new Button("<", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireGotoPrevious(item); } }); previousItem.setStyleName(UIConstants.THEME_GREEN_LINK); previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM)); navigationBtns.addButton(previousItem); Button nextItemBtn = new Button(">", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireGotoNextItem(item); } }); nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK); nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM)); navigationBtns.addButton(nextItemBtn); layout.addComponent(navigationBtns); layout.setComponentAlignment(navigationBtns, Alignment.MIDDLE_RIGHT); } if (permissionItem != null) { final boolean canWrite = CurrentProjectVariables.canWrite(permissionItem); final boolean canAccess = CurrentProjectVariables.canAccess(permissionItem); if (assignBtn != null) { assignBtn.setEnabled(canWrite); } if (addBtn != null) { addBtn.setEnabled(canWrite); } if (editBtn != null) { editBtn.setEnabled(canWrite); } if (cloneBtn != null) { cloneBtn.setEnabled(canWrite); } if (deleteBtn != null) { deleteBtn.setEnabled(canAccess); } } return layout; }
From source file:com.esofthead.mycollab.vaadin.ui.SearchTextField.java
License:Open Source License
public SearchTextField() { this.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); icon = new FontIconLabel(FontAwesome.SEARCH); innerField = new TextField(); innerField.setImmediate(true);// w w w .j a v a2s . c om innerField.setInputPrompt("Search"); innerField.setWidth("180px"); this.with(icon, innerField).withStyleName("searchfield"); ShortcutExtension.installShortcutAction(innerField, shortcutListener); }
From source file:com.esofthead.mycollab.vaadin.ui.StyleCalendarExp.java
License:Open Source License
public StyleCalendarExp() { this.setWidth("230px"); this.setHeightUndefined(); this.setSpacing(false); this.setStyleName("stylecalendar-ext"); this.setMargin(new MarginInfo(true, false, false, false)); styleCalendar.setRenderHeader(false); styleCalendar.setRenderWeekNumbers(false); styleCalendar.setImmediate(true);/* w ww . j a v a2s.c o m*/ styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon(MyCollabResource.newResource("icons/16/cal_year_next.png")); btnShowNextYear.setStyleName("link"); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon(MyCollabResource.newResource("icons/16/cal_month_next.png")); btnShowNextMonth.setStyleName("link"); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon(MyCollabResource.newResource("icons/16/cal_month_pre.png")); btnShowPreviousMonth.setStyleName("link"); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon(MyCollabResource.newResource("icons/16/cal_year_pre.png")); btnShowPreviousYear.setStyleName("link"); lbSelectedDate.setValue(AppContext.formatDate(new Date())); lbSelectedDate.addStyleName("calendarDateLabel"); lbSelectedDate.setWidth("80"); HorizontalLayout layoutControl = new HorizontalLayout(); layoutControl.setStyleName("calendarHeader"); layoutControl.setWidth("100%"); layoutControl.setHeight("35px"); HorizontalLayout layoutButtonPrevious = new HorizontalLayout(); layoutButtonPrevious.setSpacing(true); layoutButtonPrevious.addComponent(btnShowPreviousYear); layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT); layoutButtonPrevious.addComponent(btnShowPreviousMonth); layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT); layoutControl.addComponent(layoutButtonPrevious); layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT); layoutControl.addComponent(lbSelectedDate); layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER); HorizontalLayout layoutButtonNext = new HorizontalLayout(); layoutButtonNext.setSpacing(true); layoutButtonNext.addComponent(btnShowNextMonth); layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT); layoutButtonNext.addComponent(btnShowNextYear); layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT); layoutControl.addComponent(layoutButtonNext); layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT); this.addComponent(layoutControl); this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER); this.addComponent(styleCalendar); this.setExpandRatio(styleCalendar, 1.0f); }