List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
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);// www .ja v a 2 s . c om 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); }
From source file:com.esofthead.mycollab.vaadin.ui.table.CustomizedTableWindow.java
License:Open Source License
public CustomizedTableWindow(final String viewId, final AbstractPagedBeanTable<?, ?> table) { super("Customize View"); this.viewId = viewId; this.addStyleName("customize-table-window"); this.setWidth("400px"); this.setResizable(false); this.setModal(true); this.center(); this.tableItem = table; customViewStoreService = ApplicationContextUtil.getSpringBean(CustomViewStoreService.class); final VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setSpacing(true);/*from ww w.jav a 2 s . c o m*/ contentLayout.setMargin(true); this.setContent(contentLayout); this.listBuilder = new ListBuilder(); this.listBuilder.setImmediate(true); this.listBuilder.setColumns(0); this.listBuilder.setLeftColumnCaption("Available Columns"); this.listBuilder.setRightColumnCaption("View Columns"); this.listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE); this.listBuilder.setItemCaptionMode(ItemCaptionMode.EXPLICIT); final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class, this.getAvailableColumns()); this.listBuilder.setContainerDataSource(container); Iterator<TableViewField> iterator = getAvailableColumns().iterator(); while (iterator.hasNext()) { TableViewField field = iterator.next(); this.listBuilder.setItemCaption(field, AppContext.getMessage(field.getDescKey())); } this.setSelectedViewColumns(); contentLayout.addComponent(this.listBuilder); contentLayout.setComponentAlignment(listBuilder, Alignment.MIDDLE_CENTER); Button restoreLink = new Button("Restore to default", new Button.ClickListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override public void buttonClick(ClickEvent event) { List<TableViewField> defaultSelectedColumns = tableItem.getDefaultSelectedColumns(); if (defaultSelectedColumns != null) { final List<TableViewField> selectedColumns = new ArrayList<>(); final BeanItemContainer<TableViewField> container = (BeanItemContainer<TableViewField>) CustomizedTableWindow.this.listBuilder .getContainerDataSource(); final Collection<TableViewField> itemIds = container.getItemIds(); for (TableViewField column : defaultSelectedColumns) { for (final TableViewField viewField : itemIds) { if (column.getField().equals(viewField.getField())) { selectedColumns.add(viewField); } } } CustomizedTableWindow.this.listBuilder.setValue(selectedColumns); } } }); restoreLink.setStyleName("link"); contentLayout.addComponent(restoreLink); contentLayout.setComponentAlignment(restoreLink, Alignment.MIDDLE_RIGHT); final HorizontalLayout buttonControls = new HorizontalLayout(); buttonControls.setSpacing(true); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override public void buttonClick(final ClickEvent event) { final List<TableViewField> selectedColumns = (List<TableViewField>) CustomizedTableWindow.this.listBuilder .getValue(); table.setDisplayColumns(selectedColumns); CustomizedTableWindow.this.close(); // Save custom table view def CustomViewStore viewDef = new CustomViewStore(); viewDef.setSaccountid(AppContext.getAccountId()); viewDef.setCreateduser(AppContext.getUsername()); viewDef.setViewid(viewId); viewDef.setViewinfo(XStreamJsonDeSerializer.toJson(new ArrayList<>(selectedColumns))); customViewStoreService.saveOrUpdateViewLayoutDef(viewDef); } }); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); saveBtn.setIcon(FontAwesome.SAVE); buttonControls.addComponent(saveBtn); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { CustomizedTableWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); buttonControls.addComponent(cancelBtn); contentLayout.addComponent(buttonControls); contentLayout.setComponentAlignment(buttonControls, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.vaadin.web.ui.DynamicQueryParamLayout.java
License:Open Source License
private HorizontalLayout createButtonControls() { MHorizontalLayout buttonControls = new MHorizontalLayout() .withMargin(new MarginInfo(false, true, false, true)); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww . j ava2s . c o m*/ public void buttonClick(final ClickEvent event) { callSearchAction(); } }); searchBtn.setStyleName(UIConstants.BUTTON_ACTION); searchBtn.setIcon(FontAwesome.SEARCH); buttonControls.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_CENTER); Button clearBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { clearFields(); } }); clearBtn.setStyleName(UIConstants.BUTTON_OPTION); buttonControls.with(clearBtn).withAlign(clearBtn, Alignment.MIDDLE_CENTER); Button basicSearchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_BASIC_SEARCH), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { ((DefaultGenericSearchPanel<S>) searchPanel).moveToBasicSearchLayout(); } }); basicSearchBtn.setStyleName(UIConstants.BUTTON_LINK); buttonControls.with(basicSearchBtn).withAlign(basicSearchBtn, Alignment.MIDDLE_CENTER); return buttonControls; }
From source file:com.esofthead.mycollab.vaadin.web.ui.EditFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(boolean isSaveBtnVisible, boolean isSaveAndNewBtnVisible, boolean isCancelBtnVisible) { MHorizontalLayout layout = new MHorizontalLayout().withStyleName("addNewControl"); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); layout.setSizeUndefined();//ww w . j a v a 2 s. c om if (isSaveBtnVisible) { final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (editForm.validateForm()) { editForm.fireSaveForm(); } } }); saveBtn.setIcon(FontAwesome.SAVE); saveBtn.setStyleName(UIConstants.BUTTON_ACTION); layout.addComponent(saveBtn); } if (isSaveAndNewBtnVisible) { Button saveAndNewBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (editForm.validateForm()) { editForm.fireSaveAndNewForm(); } } }); saveAndNewBtn.setIcon(FontAwesome.SHARE_ALT); saveAndNewBtn.setStyleName(UIConstants.BUTTON_ACTION); layout.addComponent(saveAndNewBtn); } if (isCancelBtnVisible) { Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { editForm.fireCancelForm(); } }); cancelBtn.setIcon(FontAwesome.MINUS); cancelBtn.setStyleName(UIConstants.BUTTON_OPTION); layout.addComponent(cancelBtn); } return layout; }
From source file:com.esofthead.mycollab.vaadin.web.ui.MailFormWindow.java
License:Open Source License
@SuppressWarnings("serial") private void initButtonLinkCcBcc() { btnLinkCc = new Button("Add Cc"); btnLinkCc.setStyleName(UIConstants.BUTTON_LINK); inputLayout.addComponent(btnLinkCc, 1, 0); inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER); btnLinkBcc = new Button("Add Bcc"); btnLinkBcc.setStyleName(UIConstants.BUTTON_LINK); inputLayout.addComponent(btnLinkBcc, 2, 0); inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER); btnLinkCc.addClickListener(new Button.ClickListener() { @Override// ww w .jav a 2s. c om public void buttonClick(ClickEvent event) { buttonLinkCcClick(event); } }); btnLinkBcc.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { butonLinkBccClick(event); } }); }
From source file:com.esofthead.mycollab.vaadin.web.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 a v a2s . c o 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(); 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")) { } } else { } } } } 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.BUTTON_OPTION); 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.getUser().getEmail() != null && AppContext.getUser().getEmail().length() > 0) { ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class); List<File> listFile = attachments.files(); List<EmailAttachmentSource> emailAttachmentSource = null; if (listFile != null && listFile.size() > 0) { emailAttachmentSource = new ArrayList<>(); for (File file : listFile) { emailAttachmentSource.add(new FileEmailAttachmentSource(file)); } } systemMailService.sendHTMLMail(AppContext.getUser().getEmail(), AppContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipient(), tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(), subject.getValue(), noteArea.getValue(), emailAttachmentSource); MailFormWindow.this.close(); } else { NotificationUtil.showErrorNotification( "Your email is empty value, please fulfil it before sending email!"); } } }); sendBtn.setIcon(FontAwesome.SEND); sendBtn.setStyleName(UIConstants.BUTTON_ACTION); controlsLayout.addComponent(sendBtn); controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT); mainLayout.addComponent(controlsLayout, 0, 2); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.vaadin.web.ui.MailFormWindow.java
License:Open Source License
private void buttonLinkCcClick(ClickEvent event) { removeAllInputField();/*from w w w. jav a 2 s. c om*/ if (!isAddCc) { btnLinkCc.setCaption("Remove Cc"); if (!isAddBcc) { inputLayout.addComponent(ccField, 0, 1); inputLayout.addComponent(btnLinkCc, 1, 1); inputLayout.addComponent(btnLinkBcc, 2, 1); inputLayout.addComponent(subjectField, 0, 2); } else { addFullInputFieldByOrder(); } } else { btnLinkCc.setCaption("Add Cc"); if (isAddBcc) { inputLayout.addComponent(bccField, 0, 1); inputLayout.addComponent(btnLinkBcc, 1, 1); inputLayout.addComponent(btnLinkCc, 2, 1); inputLayout.addComponent(subjectField, 0, 2); } else { inputLayout.addComponent(btnLinkBcc, 1, 0); inputLayout.addComponent(btnLinkCc, 2, 0); inputLayout.addComponent(subjectField, 0, 1); } } inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER); inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER); isAddCc = !isAddCc; checkToReInitCcBcc(); }
From source file:com.esofthead.mycollab.vaadin.web.ui.MailFormWindow.java
License:Open Source License
private void butonLinkBccClick(ClickEvent event) { removeAllInputField();/*from w w w . j av a2 s .c om*/ if (!isAddBcc) { btnLinkBcc.setCaption("Remove Bcc"); if (!isAddCc) { inputLayout.addComponent(bccField, 0, 1); inputLayout.addComponent(btnLinkCc, 1, 1); inputLayout.addComponent(btnLinkBcc, 2, 1); inputLayout.addComponent(subjectField, 0, 2); } else { addFullInputFieldByOrder(); } } else { btnLinkBcc.setCaption("Add Bcc"); if (isAddCc) { inputLayout.addComponent(ccField, 0, 1); inputLayout.addComponent(btnLinkCc, 1, 1); inputLayout.addComponent(btnLinkBcc, 2, 1); inputLayout.addComponent(subjectField, 0, 2); } else { inputLayout.addComponent(btnLinkBcc, 1, 0); inputLayout.addComponent(btnLinkCc, 2, 0); inputLayout.addComponent(subjectField, 0, 1); } } inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER); inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER); isAddBcc = !isAddBcc; checkToReInitCcBcc(); }
From source file:com.esofthead.mycollab.vaadin.web.ui.NotificationComponent.java
License:Open Source License
@Override public void popupVisibilityChange(PopupVisibilityEvent event) { notificationContainer.removeAllComponents(); if (notificationItems.size() > 0) { for (int i = 0; i < notificationItems.size(); i++) { AbstractNotification item = notificationItems.get(i); Component comp = buildComponentFromNotification(item); comp.setStyleName("notification-type"); comp.addStyleName("notification-type-" + item.getType()); notificationContainer.addComponent(comp); if (i < notificationItems.size() - 1) { notificationContainer.addComponent(ELabel.hr()); }/*from ww w.ja va2 s . com*/ } } else { Label noItemLbl = new Label(AppContext.getMessage(ShellI18nEnum.OPT_NO_NOTIFICATION)); notificationContainer.addComponent(noItemLbl); notificationContainer.setComponentAlignment(noItemLbl, Alignment.MIDDLE_CENTER); } }
From source file:com.esofthead.mycollab.vaadin.web.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 w w .j a va 2 s. co m styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon(new AssetResource("icons/16/cal_year_next.png")); btnShowNextYear.setStyleName(UIConstants.BUTTON_LINK); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon(new AssetResource("icons/16/cal_month_next.png")); btnShowNextMonth.setStyleName(UIConstants.BUTTON_LINK); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon(new AssetResource("icons/16/cal_month_pre.png")); btnShowPreviousMonth.setStyleName(UIConstants.BUTTON_LINK); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon(new AssetResource("icons/16/cal_year_pre.png")); btnShowPreviousYear.setStyleName(UIConstants.BUTTON_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); MHorizontalLayout layoutButtonNext = new MHorizontalLayout(); 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); }