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.mycollab.module.crm.view.setting.CrmNotificationSettingViewImpl.java
License:Open Source License
@Override public void showNotificationSettings(final CrmNotificationSetting notification) { this.removeAllComponents(); MVerticalLayout bodyWrapper = new MVerticalLayout(); bodyWrapper.setSizeFull();//from ww w .ja v a2s .co m MVerticalLayout body = new MVerticalLayout().withMargin(new MarginInfo(true, false, false, false)); final OptionGroup optionGroup = new OptionGroup(null); optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT); optionGroup.addItem(NotificationType.Default.name()); optionGroup.setItemCaption(NotificationType.Default.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING)); optionGroup.addItem(NotificationType.None.name()); optionGroup.setItemCaption(NotificationType.None.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING)); optionGroup.addItem(NotificationType.Minimal.name()); optionGroup.setItemCaption(NotificationType.Minimal.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING)); optionGroup.addItem(NotificationType.Full.name()); optionGroup.setItemCaption(NotificationType.Full.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING)); optionGroup.setHeight("100%"); body.with(optionGroup).withAlign(optionGroup, Alignment.MIDDLE_LEFT).expand(optionGroup); String levelVal = notification.getLevel(); if (levelVal == null) { optionGroup.select(NotificationType.Default.name()); } else { optionGroup.select(levelVal); } Button updateBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), clickEvent -> { try { notification.setLevel((String) optionGroup.getValue()); CrmNotificationSettingService crmNotificationSettingService = AppContextUtil .getSpringBean(CrmNotificationSettingService.class); if (notification.getId() == null) { crmNotificationSettingService.saveWithSession(notification, UserUIContext.getUsername()); } else { crmNotificationSettingService.updateWithSession(notification, UserUIContext.getUsername()); } NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS), UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS)); } catch (Exception e) { throw new MyCollabException(e); } }).withIcon(FontAwesome.REFRESH).withStyleName(WebThemes.BUTTON_ACTION); body.with(updateBtn).withAlign(updateBtn, Alignment.BOTTOM_LEFT); bodyWrapper.addComponent(body); this.addComponent(bodyWrapper); }
From source file:com.mycollab.module.project.ui.components.AbstractPreviewItemComp.java
License:Open Source License
public AbstractPreviewItemComp(String headerText, FontAwesome iconResource, ReadViewLayout layout) { ELabel headerLbl = ELabel.h2("").withWidthUndefined(); this.previewLayout = layout; header = new MHorizontalLayout().withStyleName("hdr-view").withFullWidth() .withMargin(new MarginInfo(true, false, true, false)); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); if (iconResource != null) { String title = iconResource.getHtml() + " " + headerText; headerLbl.setValue(title);/*from w ww . j av a 2 s . c o m*/ } else { headerLbl.setValue(headerText); } if (SiteConfiguration.isCommunityEdition()) { header.with(headerLbl).expand(headerLbl); } else { favoriteBtn = new Button(FontAwesome.STAR); favoriteBtn.addClickListener(clickEvent -> toggleFavorite()); Label spaceLbl = new Label(); header.with(headerLbl, favoriteBtn, spaceLbl).expand(spaceLbl); } this.addComponent(header); ComponentContainer extraComp; if ((extraComp = createExtraControls()) != null) { this.addComponent(extraComp); } initContent(); }
From source file:com.mycollab.module.project.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(IBeanList<SimpleComment> host, final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false)) .withFullWidth();//w ww .j a v a 2 s. c om ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock); MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth() .withStyleName(WebThemes.MESSAGE_CONTAINER); MHorizontalLayout messageHeader = new MHorizontalLayout().withMargin(false).withFullWidth(); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = ELabel .html(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime()))) .withDescription(UserUIContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setStyleName(UIConstants.META_INFO); if (hasDeletePermission(comment)) { MButton msgDeleteBtn = new MButton(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY) .withListener(clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { CommentService commentService = AppContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment, UserUIContext.getUsername(), MyCollabUI.getAccountId()); ((BeanList) host).removeRow(layout); } }); }); messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl); } else { messageHeader.with(timePostLbl).expand(timePostLbl); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withFullWidth(); 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.mycollab.module.project.ui.components.ProjectActivityComponent.java
License:Open Source License
public ProjectActivityComponent(String type, Integer extraTypeId) { withMargin(false).withStyleName("activity-comp"); this.type = type; this.groupFormatter = AuditLogRegistry.getFieldGroupFormatterOfType(type); headerLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_HISTORY, 0)); final OptionGroup sortDirection = new OptionGroup(); sortDirection.addStyleName("sortDirection"); String oldestFirstDirection = UserUIContext.getMessage(GenericI18Enum.OPT_OLDEST_FIRST); final String newestFirstDirection = UserUIContext.getMessage(GenericI18Enum.OPT_NEWEST_FIRST); sortDirection.addItems(newestFirstDirection, oldestFirstDirection); sortDirection.setValue(newestFirstDirection); sortDirection.addValueChangeListener(valueChangeEvent -> { Object value = sortDirection.getValue(); isAscending = newestFirstDirection.equals(value); displayActivities();//from w w w . j a v a 2 s . c o m }); MHorizontalLayout headerPanel = new MHorizontalLayout().withMargin(true) .withStyleName(WebThemes.FORM_SECTION).withFullWidth().with(headerLbl, sortDirection) .withAlign(headerLbl, Alignment.MIDDLE_LEFT).withAlign(sortDirection, Alignment.MIDDLE_RIGHT); commentBox = new ProjectCommentInput(this, type, extraTypeId); activityBox = new MVerticalLayout().withMargin(new MMarginInfo(true, true, true, false)); this.with(headerPanel, commentBox, activityBox); commentService = AppContextUtil.getSpringBean(CommentService.class); auditLogService = AppContextUtil.getSpringBean(AuditLogService.class); }
From source file:com.mycollab.module.project.ui.components.ProjectActivityComponent.java
License:Open Source License
private Component buildCommentBlock(final SimpleComment comment) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)).withFullWidth(); ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock);//from w w w .ja v a 2 s .com MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth() .withStyleName(WebThemes.MESSAGE_CONTAINER); MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth(); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = ELabel .html(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime()))) .withDescription(UserUIContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setStyleName(UIConstants.META_INFO); if (hasDeletePermission(comment)) { MButton msgDeleteBtn = new MButton(FontAwesome.TRASH_O).withListener(clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { CommentService commentService = AppContextUtil.getSpringBean(CommentService.class); commentService.removeWithSession(comment, UserUIContext.getUsername(), MyCollabUI.getAccountId()); activityBox.removeComponent(layout); } }); }).withStyleName(WebThemes.BUTTON_ICON_ONLY); messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl); } else { messageHeader.with(timePostLbl).expand(timePostLbl); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withMargin(false).withSpacing(false) .withFullWidth(); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.with(attachmentDisplay); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }
From source file:com.mycollab.module.project.ui.components.ProjectActivityComponent.java
License:Open Source License
private Component buildAuditBlock(SimpleAuditLog auditLog) { List<AuditChangeItem> changeItems = auditLog.getChangeItems(); if (CollectionUtils.isNotEmpty(changeItems)) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)).withFullWidth(); ProjectMemberBlock memberBlock = new ProjectMemberBlock(auditLog.getPosteduser(), auditLog.getPostedUserAvatarId(), auditLog.getPostedUserFullName()); layout.addComponent(memberBlock); MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth() .withStyleName(WebThemes.MESSAGE_CONTAINER); MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth(); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(GenericI18Enum.EXT_MODIFIED_ITEM, auditLog.getPostedUserFullName(), UserUIContext.formatPrettyTime(auditLog.getPosteddate()))) .withDescription(UserUIContext.formatDateTime(auditLog.getPosteddate())); timePostLbl.setStyleName(UIConstants.META_INFO); messageHeader.with(timePostLbl).expand(timePostLbl); rowLayout.addComponent(messageHeader); for (AuditChangeItem item : changeItems) { String fieldName = item.getField(); DefaultFieldDisplayHandler fieldDisplayHandler = groupFormatter.getFieldDisplayHandler(fieldName); if (fieldDisplayHandler != null) { Span fieldBlock = new Span() .appendText(UserUIContext.getMessage(fieldDisplayHandler.getDisplayName())) .setCSSClass(UIConstants.BLOCK); Div historyDiv = new Div().appendChild(fieldBlock) .appendText(fieldDisplayHandler.getFormat().toString(item.getOldvalue())) .appendText(" " + FontAwesome.LONG_ARROW_RIGHT.getHtml() + " ") .appendText(fieldDisplayHandler.getFormat().toString(item.getNewvalue())); rowLayout.addComponent(new Label(historyDiv.write(), ContentMode.HTML)); }/*from w w w.j a v a2s .co m*/ } layout.with(rowLayout).expand(rowLayout); return layout; } else { return null; } }
From source file:com.mycollab.module.project.ui.components.ProjectFollowersComp.java
License:Open Source License
public void displayFollowers(final V bean) { this.bean = bean; try {//from w w w . j av a2 s . co m typeId = (Integer) PropertyUtils.getProperty(bean, "id"); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOG.error("Error", e); return; } this.removeAllComponents(); MHorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label followerHeader = new Label( FontAwesome.EYE.getHtml() + " " + UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS), ContentMode.HTML); header.addComponent(followerHeader); if (hasEditPermission()) { final PopupView addPopupView = new PopupView(UserUIContext.getMessage(GenericI18Enum.ACTION_MODIFY), new MVerticalLayout()); addPopupView.addPopupVisibilityListener(popupVisibilityEvent -> { PopupView.Content content = addPopupView.getContent(); if (popupVisibilityEvent.isPopupVisible()) { MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent(); popupComponent.removeAllComponents(); popupComponent.with(new ELabel(UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS)) .withStyleName(ValoTheme.LABEL_H3), new ModifyWatcherPopup()); } else { MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent(); ModifyWatcherPopup popup = (ModifyWatcherPopup) popupComponent.getComponent(1); List<MonitorItem> unsavedItems = popup.getUnsavedItems(); monitorItemService.saveMonitorItems(unsavedItems); loadWatchers(); } }); header.addComponent(addPopupView); } header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE).withStyleName(WebThemes.INLINE_HELP) .withDescription(UserUIContext.getMessage(FollowerI18nEnum.FOLLOWER_EXPLAIN_HELP))); this.addComponent(header); watcherLayout = new MCssLayout().withFullWidth().withStyleName(WebThemes.FLEX_DISPLAY); this.addComponent(watcherLayout); loadWatchers(); }
From source file:com.mycollab.module.project.ui.components.TimeLogComp.java
License:Open Source License
protected TimeLogComp() { this.itemTimeLoggingService = AppContextUtil.getSpringBean(ItemTimeLoggingService.class); this.withMargin(false); HorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label dateInfoHeader = new Label( FontAwesome.CLOCK_O.getHtml() + " " + UserUIContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME), ContentMode.HTML);/*from w w w . jav a 2s .c o m*/ header.addComponent(dateInfoHeader); if (hasEditPermission()) { MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> showEditTimeWindow(beanItem)).withStyleName(WebThemes.BUTTON_LINK); header.addComponent(editBtn); } header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE) .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.TIME_EXPLAIN_HELP)) .withStyleName(WebThemes.INLINE_HELP)); this.addComponent(header); MVerticalLayout layout = new MVerticalLayout().withFullWidth() .withMargin(new MarginInfo(false, false, false, true)); billableHoursLbl = new Label(); nonBillableHoursLbl = new Label(); remainHoursLbl = new Label(); layout.addComponent(billableHoursLbl); layout.addComponent(nonBillableHoursLbl); layout.addComponent(remainHoursLbl); this.addComponent(layout); }
From source file:com.mycollab.module.project.view.AbstractProjectPageView.java
License:Open Source License
private ComponentContainer constructHeader() { header = new MHorizontalLayout().with(headerText).withStyleName("hdr-view").withFullWidth() .withMargin(true);/*from w ww . j a va 2 s .co m*/ header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); return header; }
From source file:com.mycollab.module.project.view.bug.BugKanbanViewImpl.java
License:Open Source License
public BugKanbanViewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new BugSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); MButton advanceDisplayBtn = new MButton("List", clickEvent -> EventBusFactory.getInstance().post(new BugEvent.GotoList(this, null))) .withWidth("100px").withIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Detail"); MButton kanbanBtn = new MButton("Kanban").withWidth("100px").withIcon(FontAwesome.TH); kanbanBtn.setDescription("Kanban View"); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn);// w ww . j av a 2 s . com viewButtons.withDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withStyleName("kanban-layout").withFullHeight(); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }