List of usage examples for com.vaadin.ui Alignment TOP_LEFT
Alignment TOP_LEFT
To view the source code for com.vaadin.ui Alignment TOP_LEFT.
Click Source Link
From source file:com.mycollab.mobile.module.project.view.milestone.MilestoneReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { MVerticalLayout toolbarLayout = new MVerticalLayout().withSpacing(false).withMargin(false); toolbarLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); ticketNavigatorButton = new TicketNavigatorButton(); Component issueSection = FormSectionBuilder.build(FontAwesome.TICKET, ticketNavigatorButton); toolbarLayout.addComponent(issueSection); relatedComments = new CommentNavigationButton(ProjectTypeConstants.MILESTONE, beanItem.getId() + ""); Component commentSection = FormSectionBuilder.build(FontAwesome.COMMENT, relatedComments); toolbarLayout.addComponent(commentSection); return toolbarLayout; }
From source file:com.mycollab.mobile.module.project.view.task.TaskReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { MVerticalLayout toolbarLayout = new MVerticalLayout().withSpacing(false).withMargin(false); toolbarLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); relatedComments = new CommentNavigationButton(ProjectTypeConstants.TASK, beanItem.getId() + ""); Component section = FormSectionBuilder.build(FontAwesome.COMMENT, relatedComments); toolbarLayout.addComponent(section); if (!SiteConfiguration.isCommunityEdition()) { taskTimeLogComp = new TaskTimeLogComp(); toolbarLayout.addComponent(taskTimeLogComp); }/*www .ja v a 2 s . c om*/ return toolbarLayout; }
From source file:com.mycollab.mobile.ui.grid.GridFormLayoutHelper.java
License:Open Source License
public static GridFormLayoutHelper defaultFormLayoutHelper(int columns, int rows) { GridFormLayoutHelper helper = new GridFormLayoutHelper(columns, rows, "100%", "150px", Alignment.TOP_LEFT); helper.getLayout().setWidth("100%"); helper.getLayout().addStyleName(MobileUIConstants.GRIDFORM_STANDARD); return helper; }
From source file:com.mycollab.module.project.ui.components.GenericTaskRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(AbstractBeanPagedList host, ProjectGenericTask genericTask, int rowIndex) { MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName("list-row").withFullWidth(); rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT); Div issueDiv = new Div(); issueDiv.appendText(ProjectAssetsManager.getAsset(genericTask.getType()).getHtml()); String status = ""; if (genericTask.isBug()) { status = AppContext.getMessage(OptionI18nEnum.BugStatus.class, genericTask.getStatus()); } else if (genericTask.isMilestone()) { status = AppContext.getMessage(OptionI18nEnum.MilestoneStatus.class, genericTask.getStatus()); } else if (genericTask.isRisk()) { status = AppContext.getMessage(com.mycollab.common.i18n.OptionI18nEnum.StatusI18nEnum.class, genericTask.getStatus()); } else if (genericTask.isTask()) { status = AppContext.getMessage(com.mycollab.common.i18n.OptionI18nEnum.StatusI18nEnum.class, genericTask.getStatus()); }/*from ww w . j a va 2 s . c o m*/ issueDiv.appendChild(new Span().appendText(status).setCSSClass(UIConstants.FIELD_NOTE)); String avatarLink = StorageFactory.getInstance().getAvatarPath(genericTask.getAssignUserAvatarId(), 16); Img img = new Img(genericTask.getAssignUserFullName(), avatarLink) .setTitle(genericTask.getAssignUserFullName()); issueDiv.appendChild(img, DivLessFormatter.EMPTY_SPACE()); A taskLink = new A().setId("tag" + TOOLTIP_ID); taskLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(genericTask.getType(), genericTask.getTypeId() + "")); taskLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction()); if (ProjectTypeConstants.BUG.equals(genericTask.getType()) || ProjectTypeConstants.TASK.equals(genericTask.getType())) { taskLink.appendText(genericTask.getName()); taskLink.setHref(ProjectLinkBuilder.generateProjectItemLink(genericTask.getProjectShortName(), genericTask.getProjectId(), genericTask.getType(), genericTask.getExtraTypeId() + "")); } else { taskLink.appendText(genericTask.getName()); taskLink.setHref(ProjectLinkBuilder.generateProjectItemLink(genericTask.getProjectShortName(), genericTask.getProjectId(), genericTask.getType(), genericTask.getTypeId() + "")); } issueDiv.appendChild(taskLink); if (genericTask.isClosed()) { taskLink.setCSSClass("completed"); } else if (genericTask.isOverdue()) { taskLink.setCSSClass("overdue"); issueDiv.appendChild( new Span().appendText(" - Due in " + AppContext.formatDuration(genericTask.getDueDate())) .setCSSClass(UIConstants.META_INFO)); } Label issueLbl = new Label(issueDiv.write(), ContentMode.HTML); rowComp.with(issueLbl); return rowComp; }
From source file:com.mycollab.module.project.view.bug.BugRowRenderer.java
License:Open Source License
@Override public Component generateRow(IBeanList<SimpleBug> host, SimpleBug bug, int rowIndex) { ToggleBugSummaryField toggleBugSummaryField = new ToggleBugSummaryField(bug); MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName(WebThemes.HOVER_EFFECT_NOT_BOX); rowComp.addStyleName("margin-bottom"); rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT); String bugPriority = bug.getPriority(); Span priorityLink = new Span().appendText(ProjectAssetsManager.getPriorityHtml(bugPriority)) .setTitle(bugPriority);//w w w .j ava 2 s . c o m Span statusSpan = new Span() .appendText(UserUIContext.getMessage(OptionI18nEnum.BugStatus.class, bug.getStatus())) .setCSSClass(UIConstants.BLOCK); String avatarLink = StorageFactory.getAvatarPath(bug.getAssignUserAvatarId(), 16); Img img = new Img(bug.getAssignuserFullName(), avatarLink).setTitle(bug.getAssignuserFullName()) .setCSSClass(UIConstants.CIRCLE_BOX); rowComp.with(ELabel.fontIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)).withWidthUndefined(), ELabel.html(priorityLink.write()).withWidthUndefined(), ELabel.html(statusSpan.write()).withWidthUndefined(), ELabel.html(img.write()).withWidthUndefined(), toggleBugSummaryField).expand(toggleBugSummaryField); return rowComp; }
From source file:com.mycollab.module.project.view.bug.components.BugRowRenderer.java
License:Open Source License
@Override public Component generateRow(AbstractBeanPagedList host, SimpleBug bug, int rowIndex) { ToggleBugSummaryField toggleBugSummaryField = new ToggleBugSummaryField(bug); MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName(UIConstants.HOVER_EFFECT_NOT_BOX); rowComp.addStyleName("margin-bottom"); rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT); String bugPriority = bug.getPriority(); Span priorityLink = new Span().appendText(ProjectAssetsManager.getBugPriorityHtml(bugPriority)) .setTitle(bugPriority);/* www. jav a 2 s. c om*/ Span statusSpan = new Span() .appendText(AppContext.getMessage(OptionI18nEnum.BugStatus.class, bug.getStatus())) .setCSSClass(UIConstants.FIELD_NOTE); String avatarLink = StorageFactory.getInstance().getAvatarPath(bug.getAssignUserAvatarId(), 16); Img img = new Img(bug.getAssignuserFullName(), avatarLink).setTitle(bug.getAssignuserFullName()); rowComp.with(ELabel.fontIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)).withWidthUndefined(), ELabel.html(priorityLink.write()).withWidthUndefined(), ELabel.html(statusSpan.write()).withWidthUndefined(), ELabel.html(img.write()).withWidthUndefined(), toggleBugSummaryField).expand(toggleBugSummaryField); return rowComp; }
From source file:com.mycollab.module.project.view.ticket.TicketRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(IBeanList<ProjectTicket> host, ProjectTicket ticket, int rowIndex) { MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName("list-row").withFullWidth(); rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT); Div issueDiv = new Div(); issueDiv.appendText(ProjectAssetsManager.getAsset(ticket.getType()).getHtml()); String status = ""; if (ticket.isBug()) { status = UserUIContext.getMessage(BugStatus.class, ticket.getStatus()); rowComp.addStyleName("bug"); } else if (ticket.isMilestone()) { status = UserUIContext.getMessage(MilestoneStatus.class, ticket.getStatus()); rowComp.addStyleName("milestone"); } else if (ticket.isRisk()) { status = UserUIContext.getMessage(StatusI18nEnum.class, ticket.getStatus()); rowComp.addStyleName("risk"); } else if (ticket.isTask()) { status = UserUIContext.getMessage(StatusI18nEnum.class, ticket.getStatus()); rowComp.addStyleName("task"); }// w w w . j av a2 s . c om issueDiv.appendChild(new Span().appendText(status).setCSSClass(UIConstants.BLOCK)); String avatarLink = StorageFactory.getAvatarPath(ticket.getAssignUserAvatarId(), 16); Img img = new Img(ticket.getAssignUserFullName(), avatarLink).setCSSClass(UIConstants.CIRCLE_BOX) .setTitle(ticket.getAssignUserFullName()); issueDiv.appendChild(img, DivLessFormatter.EMPTY_SPACE()); A ticketLink = new A().setId("tag" + TOOLTIP_ID); ticketLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(ticket.getType(), ticket.getTypeId() + "")); ticketLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction()); if (ProjectTypeConstants.BUG.equals(ticket.getType()) || ProjectTypeConstants.TASK.equals(ticket.getType())) { ticketLink.appendText(String.format("[%s-%d] - %s", ticket.getProjectShortName(), ticket.getExtraTypeId(), ticket.getName())); ticketLink.setHref(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(), ticket.getProjectId(), ticket.getType(), ticket.getExtraTypeId() + "")); } else { ticketLink.appendText(ticket.getName()); ticketLink.setHref(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(), ticket.getProjectId(), ticket.getType(), ticket.getTypeId() + "")); } issueDiv.appendChild(ticketLink); if (ticket.isClosed()) { ticketLink.setCSSClass("completed"); } else if (ticket.isOverdue()) { ticketLink.setCSSClass("overdue"); issueDiv.appendChild( new Span() .appendText(" - " + UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_DUE_IN, UserUIContext.formatDuration(ticket.getDueDate()))) .setCSSClass(UIConstants.META_INFO)); } rowComp.with(ELabel.html(issueDiv.write())); return rowComp; }
From source file:com.mycollab.module.project.view.ticket.ToggleTicketSummaryField.java
License:Open Source License
public ToggleTicketSummaryField(final ProjectTicket ticket) { this.ticket = ticket; this.setWidth("100%"); titleLinkLbl = ELabel.html(buildTicketLink()) .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined(); if (ticket.isClosed()) { titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED); } else if (ticket.isOverdue()) { titleLinkLbl.addStyleName(WebThemes.LINK_OVERDUE); }//w w w .j av a2 s . co m this.addComponent(titleLinkLbl); if (CurrentProjectVariables.canWriteTicket(ticket)) { this.addStyleName("editable-field"); buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)) .withStyleName("toggle"); buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT); MButton instantEditBtn = new MButton("", clickEvent -> { if (isRead) { removeComponent(titleLinkLbl); removeComponent(buttonControls); final TextField editField = new TextField(); editField.setValue(ticket.getName()); editField.setWidth("100%"); editField.focus(); addComponent(editField); removeStyleName("editable-field"); editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField)); editField.addBlurListener(blurEvent -> updateFieldValue(editField)); isRead = !isRead; } }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); instantEditBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_CLICK_TO_EDIT)); buttonControls.with(instantEditBtn); if ((ticket.isRisk() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.RISKS)) || (ticket.isBug() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.BUGS)) || (ticket.isTask() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS))) { MButton removeBtn = new MButton("", 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()) { AppContextUtil.getSpringBean(ProjectTicketService.class).removeTicket(ticket, UserUIContext.getUsername()); BlockRowRender rowRenderer = UIUtils.getRoot(ToggleTicketSummaryField.this, BlockRowRender.class); if (rowRenderer != null) { rowRenderer.selfRemoved(); } EventBusFactory.getInstance() .post(new TicketEvent.HasTicketPropertyChanged(this, "all")); } }); }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); buttonControls.with(removeBtn); } this.addComponent(buttonControls); } }
From source file:com.mycollab.module.project.view.user.GenericTaskRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(AbstractBeanPagedList host, ProjectGenericTask genericTask, int rowIndex) { MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName("list-row").withFullWidth(); rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT); Div issueDiv = new Div(); issueDiv.appendText(ProjectAssetsManager.getAsset(genericTask.getType()).getHtml()); String status = ""; if (genericTask.isBug()) { status = AppContext.getMessage(OptionI18nEnum.BugStatus.class, genericTask.getStatus()); } else if (genericTask.isMilestone()) { status = AppContext.getMessage(OptionI18nEnum.MilestoneStatus.class, genericTask.getStatus()); } else if (genericTask.isRisk()) { status = AppContext.getMessage(com.mycollab.common.i18n.OptionI18nEnum.StatusI18nEnum.class, genericTask.getStatus()); } else if (genericTask.isTask()) { status = AppContext.getMessage(com.mycollab.common.i18n.OptionI18nEnum.StatusI18nEnum.class, genericTask.getStatus()); }/*from w w w . ja va2 s. co m*/ issueDiv.appendChild(new Span().appendText(status).setCSSClass(UIConstants.FIELD_NOTE)); String avatarLink = StorageFactory.getInstance().getAvatarPath(genericTask.getAssignUserAvatarId(), 16); Img img = new Img(genericTask.getAssignUserFullName(), avatarLink) .setTitle(genericTask.getAssignUserFullName()); issueDiv.appendChild(img, DivLessFormatter.EMPTY_SPACE()); A taskLink = new A().setId("tag" + TOOLTIP_ID); taskLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(genericTask.getType(), genericTask.getTypeId() + "")); taskLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction()); if (ProjectTypeConstants.BUG.equals(genericTask.getType()) || ProjectTypeConstants.TASK.equals(genericTask.getType())) { taskLink.appendText(String.format("[%s-%d] - %s", genericTask.getProjectShortName(), genericTask.getExtraTypeId(), genericTask.getName())); taskLink.setHref(ProjectLinkBuilder.generateProjectItemLink(genericTask.getProjectShortName(), genericTask.getProjectId(), genericTask.getType(), genericTask.getExtraTypeId() + "")); } else { taskLink.appendText(genericTask.getName()); taskLink.setHref(ProjectLinkBuilder.generateProjectItemLink(genericTask.getProjectShortName(), genericTask.getProjectId(), genericTask.getType(), genericTask.getTypeId() + "")); } issueDiv.appendChild(taskLink); if (genericTask.isClosed()) { taskLink.setCSSClass("completed"); } else if (genericTask.isOverdue()) { taskLink.setCSSClass("overdue"); issueDiv.appendChild( new Span().appendText(" - Due in " + AppContext.formatDuration(genericTask.getDueDate())) .setCSSClass(UIConstants.META_INFO)); } MHorizontalLayout iconsLayout = new MHorizontalLayout().with( new ELabel(ProjectAssetsManager.getAsset(genericTask.getType()).getHtml(), ContentMode.HTML), new ELabel(img.write(), ContentMode.HTML)); Label issueLbl = new Label(issueDiv.write(), ContentMode.HTML); rowComp.with(issueLbl); return rowComp; }
From source file:com.mycollab.module.project.view.user.ProjectActivityStreamPagedList.java
License:Open Source License
protected void feedBlocksPut(Date currentDate, Date nextDate, ComponentContainer currentBlock) { MHorizontalLayout blockWrapper = new MHorizontalLayout().withSpacing(false).withFullWidth() .withStyleName("feed-block-wrap"); blockWrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT); Calendar cal1 = Calendar.getInstance(); cal1.setTime(currentDate);//ww w . ja v a2s . com Calendar cal2 = Calendar.getInstance(); cal2.setTime(nextDate); if (cal1.get(Calendar.YEAR) != cal2.get(Calendar.YEAR)) { int currentYear = cal2.get(Calendar.YEAR); Label yearLbl = new Label("<div>" + String.valueOf(currentYear) + "</div>", ContentMode.HTML); yearLbl.setStyleName("year-lbl"); yearLbl.setWidthUndefined(); listContainer.addComponent(yearLbl); } else { blockWrapper.setMargin(new MarginInfo(true, false, false, false)); } Label dateLbl = new Label(UserUIContext.formatShortDate(nextDate)); dateLbl.setStyleName("date-lbl"); dateLbl.setWidthUndefined(); blockWrapper.with(dateLbl, currentBlock).expand(currentBlock); this.listContainer.addComponent(blockWrapper); }