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.table.AbstractPagedBeanTable.java
License:Open Source License
private CssLayout createControls() { this.controlBarWrapper = new CssLayout(); this.controlBarWrapper.setStyleName("listControl"); 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 ClickListener() { private static final long serialVersionUID = 1L; @Override/* w ww . j a v a2 s.c o m*/ public void buttonClick(final ClickEvent event) { AbstractPagedBeanTable.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) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.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) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.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) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.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) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.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) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.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) { AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.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.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);/*w ww . j a v a 2 s . co 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.AbstractBeanBlockList.java
License:Open Source License
protected CssLayout createPageControls() { this.controlBarWrapper = new CssLayout(); this.controlBarWrapper.setWidth("100%"); final HorizontalLayout controlBar = new HorizontalLayout(); controlBar.setWidth("100%"); this.controlBarWrapper.addComponent(controlBar); pageManagement = new MHorizontalLayout(); // defined layout here --------------------------- if (currentPage > 1) { final Button firstLink = new Button("1", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w . ja v a 2 s.c om public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(1); } }); firstLink.addStyleName("buttonPaging"); pageManagement.addComponent(firstLink); } if (currentPage >= 5) { final Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); pageManagement.addComponent(ss1); } if (currentPage > 3) { final Button previous2 = new Button("" + (currentPage - 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage - 2); } }); previous2.addStyleName("buttonPaging"); pageManagement.addComponent(previous2); } if (currentPage > 2) { final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage - 1); } }); previous1.addStyleName("buttonPaging"); pageManagement.addComponent(previous1); } // Here add current ButtonLinkLegacy final Button current = new Button("" + currentPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage); } }); current.addStyleName("buttonPaging"); current.addStyleName("current"); pageManagement.addComponent(current); final int range = totalPage - currentPage; if (range >= 1) { final Button next1 = new Button("" + (currentPage + 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage + 1); } }); next1.addStyleName("buttonPaging"); pageManagement.addComponent(next1); } if (range >= 2) { final Button next2 = new Button("" + (currentPage + 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { AbstractBeanBlockList.this.pageChange(currentPage + 2); } }); next2.addStyleName("buttonPaging"); pageManagement.addComponent(next2); } if (range >= 4) { final Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); pageManagement.addComponent(ss2); } if (range >= 3) { final Button last = new Button("" + totalPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(totalPage); } }); last.addStyleName("buttonPaging"); pageManagement.addComponent(last); } pageManagement.setWidth(null); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT); return this.controlBarWrapper; }
From source file:com.esofthead.mycollab.vaadin.web.ui.AbstractBeanPagedList.java
License:Open Source License
protected MHorizontalLayout createPageControls() { controlBarWrapper = new MHorizontalLayout().withFullWidth() .withMargin(new MarginInfo(false, true, false, true)).withStyleName(listControlStyle); pageManagement = new MHorizontalLayout().withWidth(null); // defined layout here --------------------------- if (currentPage > 1) { Button firstLink = new Button("1", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/* ww w. j a va 2 s . c om*/ public void buttonClick(final ClickEvent event) { pageChange(1); } }); firstLink.addStyleName("buttonPaging"); pageManagement.addComponent(firstLink); } if (currentPage >= 5) { final Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); pageManagement.addComponent(ss1); } if (currentPage > 3) { Button previous2 = new Button("" + (currentPage - 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage - 2); } }); previous2.addStyleName("buttonPaging"); pageManagement.addComponent(previous2); } if (currentPage > 2) { final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage - 1); } }); previous1.addStyleName("buttonPaging"); pageManagement.addComponent(previous1); } // Here add current ButtonLinkLegacy final Button current = new Button("" + currentPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage); } }); current.addStyleName("buttonPaging"); current.addStyleName("current"); pageManagement.addComponent(current); final int range = this.totalPage - currentPage; if (range >= 1) { final Button next1 = new Button("" + (currentPage + 1), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage + 1); } }); next1.addStyleName("buttonPaging"); pageManagement.addComponent(next1); } if (range >= 2) { Button next2 = new Button("" + (currentPage + 2), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(currentPage + 2); } }); next2.addStyleName("buttonPaging"); pageManagement.addComponent(next2); } if (range >= 4) { Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); pageManagement.addComponent(ss2); } if (range >= 3) { Button last = new Button("" + this.totalPage, new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { pageChange(totalPage); } }); last.addStyleName("buttonPaging"); pageManagement.addComponent(last); } controlBarWrapper.with(pageManagement).withAlign(pageManagement, Alignment.MIDDLE_RIGHT); return controlBarWrapper; }
From source file:com.esofthead.mycollab.vaadin.web.ui.DefaultGenericSearchPanel.java
License:Open Source License
protected ComponentContainer constructHeader() { if (header == null) { headerText = buildSearchTitle(); if (headerText != null) { MHorizontalLayout rightComponent = new MHorizontalLayout(); header = new MHorizontalLayout().withFullWidth() .withMargin(new MarginInfo(true, false, true, false)); header.with(headerText, rightComponent).withAlign(headerText, Alignment.MIDDLE_LEFT) .withAlign(rightComponent, Alignment.MIDDLE_RIGHT).expand(headerText); }/*from ww w .j a va2 s . c o m*/ Component extraControls = buildExtraControls(); if (extraControls != null) { addHeaderRight(extraControls); } return header; } else { return header; } }
From source file:com.esofthead.mycollab.vaadin.web.ui.Depot.java
License:Open Source License
public Depot(String title, ComponentContainer content) { this.addStyleName("depotComp"); this.setMargin(false); header = new MHorizontalLayout().withHeight("40px").withStyleName("depotHeader"); bodyContent = content;//from w w w .j a v a 2 s .co m bodyContent.setWidth("100%"); headerContent = new MHorizontalLayout().withMargin(true).withFullHeight(); headerContent.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); headerContent.setVisible(false); headerContent.setStyleName("header-elements"); headerContent.setWidthUndefined(); this.addComponent(header); headerLbl = new Label(title); final MHorizontalLayout headerLeft = new MHorizontalLayout(headerLbl).withStyleName("depot-title") .withAlign(headerLbl, Alignment.MIDDLE_LEFT).withFullWidth(); headerLeft.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @Override public void layoutClick(final LayoutClickEvent event) { isOpened = !isOpened; if (isOpened) { bodyContent.setVisible(true); removeStyleName("collapsed"); } else { bodyContent.setVisible(false); addStyleName("collapsed"); } } }); header.with(headerLeft, headerContent).withAlign(headerLeft, Alignment.MIDDLE_LEFT) .withAlign(headerContent, Alignment.MIDDLE_RIGHT).expand(headerLeft); final CustomComponent customComp = new CustomComponent(bodyContent); customComp.setWidth("100%"); bodyContent.addStyleName("depotContent"); this.addComponent(customComp); this.setComponentAlignment(customComp, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.vaadin.web.ui.Depot.java
License:Open Source License
public void addHeaderElement(final Component component) { if (component != null) { headerContent.with(component).withAlign(component, Alignment.MIDDLE_RIGHT); headerContent.setVisible(true);//from ww w. j a va2s . c om } }
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 va 2 s . 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.MassUpdateWindow.java
License:Open Source License
protected ComponentContainer buildButtonControls() { MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withFullWidth(); updateBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww . ja va 2 s . c om*/ public void buttonClick(ClickEvent event) { updateForm.commit(); massUpdateCommand.massUpdate(beanItem); MassUpdateWindow.this.close(); } }); updateBtn.setStyleName(UIConstants.BUTTON_ACTION); 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.BUTTON_OPTION); Label spacing = new Label(); controlsLayout.with(spacing, closeBtn, updateBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing); return controlsLayout; }
From source file:com.esofthead.mycollab.vaadin.web.ui.ProjectPreviewFormControlsGenerator.java
License:Open Source License
public ProjectPreviewFormControlsGenerator(AdvancedPreviewBeanForm<T> editForm) { this.previewForm = editForm; layout = new MHorizontalLayout(); layout.setSizeUndefined();//from w w w. j a v a 2 s .co m layout.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); popupButtonsControl = new OptionPopupContent(); editButtons = new MHorizontalLayout(); }