List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT
Alignment MIDDLE_LEFT
To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.
Click Source Link
From source file:com.esofthead.mycollab.mobile.module.project.view.message.MessageReadViewImpl.java
License:Open Source License
@Override public void previewItem(SimpleMessage message) { this.bean = message; mainLayout.removeAllComponents();//from www . j av a2 s .c om HorizontalLayout messageBlock = new HorizontalLayout(); messageBlock.setStyleName("message-block"); Image userAvatarImg = UserAvatarControlFactory .createUserAvatarEmbeddedComponent(message.getPostedUserAvatarId(), 32); userAvatarImg.setStyleName("user-avatar"); messageBlock.addComponent(userAvatarImg); CssLayout rightCol = new CssLayout(); rightCol.setWidth("100%"); HorizontalLayout metadataRow = new HorizontalLayout(); metadataRow.setWidth("100%"); metadataRow.setStyleName("metadata-row"); Label userNameLbl = new Label(message.getFullPostedUserName()); userNameLbl.setStyleName("user-name"); metadataRow.addComponent(userNameLbl); metadataRow.setExpandRatio(userNameLbl, 1.0f); Label messageTimePost = new Label( DateTimeUtils.getPrettyDateValue(message.getPosteddate(), AppContext.getUserLocale())); messageTimePost.setStyleName("time-post"); messageTimePost.setWidthUndefined(); metadataRow.addComponent(messageTimePost); rightCol.addComponent(metadataRow); HorizontalLayout titleRow = new HorizontalLayout(); titleRow.setWidth("100%"); titleRow.setStyleName("title-row"); Label messageTitle = new Label(message.getTitle()); messageTitle.setStyleName("message-title"); titleRow.addComponent(messageTitle); titleRow.setExpandRatio(messageTitle, 1.0f); if (message.getCommentsCount() > 0) { Label msgCommentCount = new Label(String.valueOf(message.getCommentsCount())); msgCommentCount.setStyleName("comment-count"); msgCommentCount.setWidthUndefined(); titleRow.addComponent(msgCommentCount); titleRow.addStyleName("has-comment"); titleRow.setComponentAlignment(messageTitle, Alignment.MIDDLE_LEFT); } rightCol.addComponent(titleRow); Label messageContent = new Label( StringUtils.trim(StringUtils.trimHtmlTags(message.getMessage()), 150, true)); messageContent.setStyleName("message-content"); rightCol.addComponent(messageContent); ResourceService attachmentService = ApplicationContextUtil.getSpringBean(ResourceService.class); List<Content> attachments = attachmentService .getContents(AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(), message.getProjectid(), AttachmentType.PROJECT_MESSAGE, message.getId())); if (attachments != null && !attachments.isEmpty()) { CssLayout attachmentPanel = new CssLayout(); attachmentPanel.setStyleName("attachment-panel"); attachmentPanel.setWidth("100%"); for (Content attachment : attachments) { attachmentPanel.addComponent(MobileAttachmentUtils.renderAttachmentRow(attachment)); } rightCol.addComponent(attachmentPanel); } messageBlock.addComponent(rightCol); messageBlock.setExpandRatio(rightCol, 1.0f); messageBlock.setWidth("100%"); mainLayout.addComponent(messageBlock); MessageCommentListDisplay commentDisplay = new MessageCommentListDisplay(CommentType.PRJ_MESSAGE, CurrentProjectVariables.getProjectId(), true, true, MessageRelayEmailNotificationAction.class); commentDisplay.loadComments("" + message.getId()); this.setToolbar(commentDisplay.getCommentBox()); mainLayout.addComponent(commentDisplay); }
From source file:com.esofthead.mycollab.mobile.module.project.view.milestone.MilestoneReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/* w w w . j av a 2 s . co m*/ Button relatedBugs = new Button(); relatedBugs.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_BUG + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.VIEW_BUG) + "</div>"); relatedBugs.setHtmlContentAllowed(true); relatedBugs.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2113811477874305745L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, getRelatedBugs())); } }); toolbarLayout.addComponent(relatedBugs); Button relatedTasks = new Button(); relatedTasks.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_TASK + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK) + "</div>"); relatedTasks.setHtmlContentAllowed(true); relatedTasks.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -9171495386840452500L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, getRelatedTasks())); } }); toolbarLayout.addComponent(relatedTasks); relatedComments = new Button(); relatedComments.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_MESSAGE + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.TAB_COMMENT) + "</div>"); relatedComments.setHtmlContentAllowed(true); relatedComments.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2206489649468573076L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, associateComments)); } }); toolbarLayout.addComponent(relatedComments); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskGroupReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);//from w w w .j a v a 2 s . co m relatedComments = new Button(); relatedComments.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_MESSAGE + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.TAB_COMMENT) + "</div>"); relatedComments.setHtmlContentAllowed(true); relatedComments.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2276465280812964681L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, associateComments)); } }); toolbarLayout.addComponent(relatedComments); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/*from w w w. ja va 2s .c om*/ relatedComments = new Button(); relatedComments.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_MESSAGE + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.TAB_COMMENT) + "</div>"); relatedComments.setHtmlContentAllowed(true); relatedComments.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 4889821151518627676L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, associateComments)); } }); toolbarLayout.addComponent(relatedComments); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.user.ui.UserPanel.java
License:Open Source License
public UserPanel() { super();// ww w . ja va2s.c o m setStyleName("user-info-panel"); setSpacing(true); setMargin(true); setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); setHeightUndefined(); userAvatar = new Image(); userAvatar.setWidth("24px"); userAvatar.setHeight("24px"); userName = new Button(); userName.setWidth("100%"); userName.setStyleName("user-btn"); setUserInfo(); addComponent(userAvatar); addComponent(userName); setExpandRatio(userName, 1.0f); // add listener to listen the change avatar or user information to // update panel display info EventBusFactory.getInstance().register(new ApplicationEventListener<SessionEvent.UserProfileChangeEvent>() { private static final long serialVersionUID = 1L; @Subscribe @Override public void handle(UserProfileChangeEvent event) { setUserInfo(); } }); }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); HorizontalLayout attachmentRow = new HorizontalLayout(); attachmentRow.setStyleName("attachment-row"); attachmentRow.setWidth("100%"); attachmentRow.setSpacing(true);/*from www. j a va2 s.c o m*/ attachmentRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentRow.addComponent(thumbnailWrap); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); } if (MimeTypesUtil.isImageType(docName)) { Button b = new Button(attachment.getTitle(), new Button.ClickListener() { private static final long serialVersionUID = -1713187920922886934L; @Override public void buttonClick(Button.ClickEvent event) { AttachmentPreviewView previewView = new AttachmentPreviewView(VaadinResourceManager .getResourceManager().getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE)); EventBusFactory.getInstance().post(new ShellEvent.PushView(this, previewView)); } }); b.setWidth("100%"); attachmentRow.addComponent(b); attachmentRow.setExpandRatio(b, 1.0f); } else { Label l = new Label(attachment.getTitle()); l.setWidth("100%"); attachmentRow.addComponent(l); attachmentRow.setExpandRatio(l, 1.0f); } return attachmentRow; }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentFieldRow(final Content attachment, Button.ClickListener additionalListener) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/*from w w w. j a va 2 s . c o m*/ final HorizontalLayout attachmentLayout = new HorizontalLayout(); attachmentLayout.setSpacing(true); attachmentLayout.setStyleName("attachment-row"); attachmentLayout.setWidth("100%"); attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap); Label attachmentLink = new Label(docName); attachmentLayout.addComponent(attachmentLink); attachmentLayout.setExpandRatio(attachmentLink, 1.0f); Button removeAttachment = new Button( "<span aria-hidden=\"true\" data-icon=\"" + IconConstants.DELETE + "\"></span>", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.CloseListener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = ApplicationContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); if (additionalListener != null) { removeAttachment.addClickListener(additionalListener); } removeAttachment.setHtmlContentAllowed(true); removeAttachment.setStyleName("link"); attachmentLayout.addComponent(removeAttachment); return attachmentLayout; }
From source file:com.esofthead.mycollab.module.crm.ui.components.AbstractListItemComp.java
License:Open Source License
private void buildLayout() { final CssLayout layoutWrapper = new CssLayout(); layoutWrapper.setWidth("100%"); final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%"); layoutWrapper.addStyleName(UIConstants.TABLE_ACTION_CONTROLS); layoutWrapper.addComponent(layout);/*from w w w .ja va2 s . co m*/ this.selectOptionButton = new SelectionOptionButton(this.tableItem); this.selectOptionButton.setSizeUndefined(); layout.addComponent(this.selectOptionButton); final Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE)); deleteBtn.setEnabled(AppContext.canAccess(RolePermissionCollections.CRM_ACCOUNT)); this.tableActionControls = createActionControls(); layout.with(this.tableActionControls, this.selectedItemsNumberLabel) .withAlign(this.selectedItemsNumberLabel, Alignment.MIDDLE_LEFT) .setExpandRatio(this.selectedItemsNumberLabel, 1.0f); contentLayout.with(layoutWrapper, tableItem); extraControlsLayout = new ButtonGroup(); buildExtraControls(); layout.with(extraControlsLayout).withAlign(extraControlsLayout, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.module.crm.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%").withStyleName("message"); UserBlock memberBlock = new UserBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock);/*from ww w. j a v a2 s . com*/ CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML).withDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.with(timePostLbl).expand(timePostLbl); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment.getId(), AppContext.getUsername(), AppContext.getAccountId()); CommentRowDisplayHandler.this.owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withWidth("100%") .withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }
From source file:com.esofthead.mycollab.module.crm.ui.components.CrmActivityComponent.java
License:Open Source License
public CrmActivityComponent(String type) { withMargin(false).withStyleName("activity-comp"); this.type = type; this.groupFormatter = AuditLogRegistry.getFieldGroupFormatter(type); headerLbl = new ELabel(""); final OptionGroup sortDirection = new OptionGroup(); sortDirection.addStyleName("sortDirection"); String oldestFirstDirection = AppContext.getMessage(GenericI18Enum.OPT_OLDEST_FIRST); final String newestFirstDirection = AppContext.getMessage(GenericI18Enum.OPT_NEWEST_FIRST); sortDirection.addItems(newestFirstDirection, oldestFirstDirection); sortDirection.setValue(newestFirstDirection); sortDirection.addValueChangeListener(new Property.ValueChangeListener() { @Override/* w w w .j a va 2 s. c o m*/ public void valueChange(Property.ValueChangeEvent event) { Object value = sortDirection.getValue(); isAscending = newestFirstDirection.equals(value); displayActivities(); } }); MHorizontalLayout headerPanel = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true)) .withStyleName(UIConstants.FORM_SECTION, UIConstants.HOVER_EFFECT_NOT_BOX).withFullWidth() .with(headerLbl, sortDirection).withAlign(headerLbl, Alignment.MIDDLE_LEFT) .withAlign(sortDirection, Alignment.MIDDLE_RIGHT); commentBox = new CrmCommentInput(this, type); activityBox = new MVerticalLayout(); this.with(headerPanel, commentBox, activityBox); commentService = AppContextUtil.getSpringBean(CommentService.class); auditLogService = AppContextUtil.getSpringBean(AuditLogService.class); }