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.esofthead.mycollab.module.file.view.components.FileDownloadWindow.java
License:Open Source License
private void constructBody() { final MVerticalLayout layout = new MVerticalLayout(); final Embedded iconEmbed = new Embedded(); iconEmbed.setSource(MyCollabResource.newResource("icons/page_white.png")); layout.with(iconEmbed).withAlign(iconEmbed, Alignment.MIDDLE_CENTER); final GridFormLayoutHelper info = new GridFormLayoutHelper(1, 4, "100%", "80px", Alignment.TOP_LEFT); info.getLayout().setWidth("100%"); info.getLayout().setMargin(new MarginInfo(false, true, false, true)); info.getLayout().setSpacing(false);//w w w . j a va 2 s. c o m if (this.content.getDescription() != null) { final Label desvalue = new Label(); if (!this.content.getDescription().equals("")) { desvalue.setData(this.content.getDescription()); } else { desvalue.setValue(" "); desvalue.setContentMode(ContentMode.HTML); } info.addComponent(desvalue, "Description", 0, 0); } final Label author = new Label(this.content.getCreatedBy()); info.addComponent(author, "Created by", 0, 1); final Label size = new Label(ResourceUtils.getVolumeDisplay(this.content.getSize())); info.addComponent(size, "Size", 0, 2); final Label dateCreate = new Label(AppContext.formatDate(this.content.getCreated().getTime())); info.addComponent(dateCreate, "Date created", 0, 3); layout.addComponent(info.getLayout()); final MHorizontalLayout buttonControls = new MHorizontalLayout(); buttonControls.setSpacing(true); buttonControls.setMargin(new MarginInfo(true, false, true, false)); final Button downloadBtn = new Button("Download"); List<Resource> resources = new ArrayList<Resource>(); resources.add(content); StreamResource downloadResource = StreamDownloadResourceUtil.getStreamResourceSupportExtDrive(resources); FileDownloader fileDownloader = new FileDownloader(downloadResource); fileDownloader.extend(downloadBtn); downloadBtn.addStyleName(UIConstants.THEME_GREEN_LINK); buttonControls.with(downloadBtn).withAlign(downloadBtn, Alignment.MIDDLE_CENTER); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { FileDownloadWindow.this.close(); } }); cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK); buttonControls.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER); layout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_CENTER); this.setContent(layout); }
From source file:com.esofthead.mycollab.module.project.ui.components.DynaFormLayout.java
License:Open Source License
@Override public ComponentContainer getLayout() { VerticalLayout layout = new VerticalLayout(); int sectionCount = dynaForm.getSectionCount(); sectionMappings = new HashMap<>(); for (int i = 0; i < sectionCount; i++) { DynaSection section = dynaForm.getSection(i); if (section.isDeletedSection()) { continue; }//from w ww. j a v a 2 s . c om GridFormLayoutHelper gridLayout; if (section.isDeletedSection() || section.getFieldCount() == 0) { continue; } if (section.getLayoutType() == LayoutType.ONE_COLUMN) { gridLayout = new GridFormLayoutHelper(2, 1, "100%", "167px", Alignment.TOP_LEFT); for (int j = 0; j < section.getFieldCount(); j++) { AbstractDynaField dynaField = section.getField(j); if (!excludeFields.contains(dynaField.getFieldName())) { gridLayout.buildCell(dynaField.getDisplayName(), 0, gridLayout.getRows() - 1, 2, "100%", Alignment.TOP_LEFT); if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } } } else if (section.getLayoutType() == LayoutType.TWO_COLUMN) { gridLayout = new GridFormLayoutHelper(2, 1, "100%", "167px", Alignment.TOP_LEFT); int columnIndex = 0; for (int j = 0; j < section.getFieldCount(); j++) { AbstractDynaField dynaField = section.getField(j); if (!excludeFields.contains(dynaField.getFieldName())) { if (dynaField.isColSpan()) { if (columnIndex > 0) { gridLayout.appendRow(); } LOG.debug("Build cell {}", new Object[] { dynaField.getDisplayName() }); gridLayout.buildCell(dynaField.getDisplayName(), 0, gridLayout.getRows() - 1, 2, "100%", Alignment.TOP_LEFT); columnIndex = 0; if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } else { LOG.debug("Build cell {}", new Object[] { dynaField.getDisplayName() }); gridLayout.buildCell(dynaField.getDisplayName(), columnIndex, gridLayout.getRows() - 1); columnIndex++; if (columnIndex == 2) { columnIndex = 0; if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } } } } } else { throw new MyCollabException("Does not support attachForm layout except 1 or 2 columns"); } gridLayout.getLayout().setWidth("100%"); gridLayout.getLayout().setMargin(false); gridLayout.getLayout().setSpacing(false); gridLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(gridLayout.getLayout()); sectionMappings.put(section, gridLayout); } return layout; }
From source file:com.esofthead.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.esofthead.mycollab.common.i18n.OptionI18nEnum.StatusI18nEnum.class, genericTask.getStatus()); } else if (genericTask.isTask()) { status = AppContext.getMessage(com.esofthead.mycollab.common.i18n.OptionI18nEnum.StatusI18nEnum.class, genericTask.getStatus()); }/* w ww . java2 s. c om*/ 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.esofthead.mycollab.module.project.ui.components.ProjectCommentInput.java
License:Open Source License
ProjectCommentInput(final ReloadableComponent component, final CommentType typeVal, final Integer extraTypeIdVal, final boolean cancelButtonEnable, final boolean isSendingEmailRelay, final Class<? extends SendingRelayEmailNotificationAction> emailHandler) { super();//from ww w. j a va2s. c o m this.withWidth("100%").withStyleName("message"); final SimpleUser currentUser = AppContext.getSession(); MVerticalLayout userBlock = new MVerticalLayout().withMargin(false).withWidth("80px"); userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER); ClickListener gotoUser = new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoRead(this, currentUser.getUsername())); } }; Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(currentUser.getAvatarid(), currentUser.getDisplayName()); userAvatarBtn.addClickListener(gotoUser); userBlock.addComponent(userAvatarBtn); Button userName = new Button(currentUser.getDisplayName()); userName.setStyleName("user-name"); userName.addStyleName("link"); userName.addStyleName(UIConstants.WORD_WRAP); userName.addClickListener(gotoUser); userBlock.addComponent(userName); this.addComponent(userBlock); MVerticalLayout textAreaWrap = new MVerticalLayout().withWidth("100%").withStyleName("message-container"); this.addComponent(textAreaWrap); this.setExpandRatio(textAreaWrap, 1.0f); type = typeVal; extraTypeId = extraTypeIdVal; commentArea = new RichTextArea(); commentArea.setWidth("100%"); commentArea.setHeight("200px"); final AttachmentPanel attachments = new AttachmentPanel(); final MHorizontalLayout controlsLayout = new MHorizontalLayout().withSpacing(true).withMargin(false) .withWidth("100%"); final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments); uploadExt.addComponent(attachments); controlsLayout.with(uploadExt).withAlign(uploadExt, Alignment.TOP_LEFT).expand(uploadExt); final Label emptySpace = new Label(); controlsLayout.addComponent(emptySpace); controlsLayout.setExpandRatio(emptySpace, 1.0f); if (cancelButtonEnable) { 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) { component.cancel(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); controlsLayout.addComponent(cancelBtn); controlsLayout.setComponentAlignment(cancelBtn, Alignment.TOP_RIGHT); } final Button newCommentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_POST), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final Comment comment = new Comment(); comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed())); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(type.toString()); comment.setTypeid("" + typeId); comment.setExtratypeid(extraTypeId); final CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); int commentId = commentService.saveWithSession(comment, AppContext.getUsername(), isSendingEmailRelay, emailHandler); String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(typeVal, AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeId, commentId); if (!"".equals(attachmentPath)) { attachments.saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentArea.setValue(""); attachments.removeAllAttachmentsDisplay(); component.reload(); } }); newCommentBtn.setStyleName(UIConstants.THEME_GREEN_LINK); newCommentBtn.setIcon(FontAwesome.SEND); controlsLayout.with(newCommentBtn).withAlign(newCommentBtn, Alignment.TOP_RIGHT); textAreaWrap.addComponent(commentArea); textAreaWrap.addComponent(controlsLayout); }
From source file:com.esofthead.mycollab.module.project.ui.components.ProjectTaskRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(AbstractBeanPagedList host, ProjectGenericTask genericTask, int rowIndex) { MHorizontalLayout rowComp = new MHorizontalLayout().withStyleName("list-row").withWidth("100%"); rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT); Div issueDiv = new Div(); String uid = UUID.randomUUID().toString(); A taskLink = new A().setId("tag" + uid); taskLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(uid, genericTask.getType(), genericTask.getTypeId() + "")); taskLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid)); if (ProjectTypeConstants.BUG.equals(genericTask.getType()) || ProjectTypeConstants.TASK.equals(genericTask.getType())) { taskLink.appendText(String.format("[#%d] - %s", genericTask.getExtraTypeId(), genericTask.getName())); taskLink.setHref(ProjectLinkBuilder.generateProjectItemLink(genericTask.getProjectShortName(), genericTask.getProjectId(), genericTask.getType(), genericTask.getExtraTypeId() + "")); } else {//from w w w . ja va2 s .c o m 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.LABEL_META_INFO)); } issueDiv.appendChild(TooltipHelper.buildDivTooltipEnable(uid)); Label issueLbl = new Label(issueDiv.write(), ContentMode.HTML); String avatarLink = StorageFactory.getInstance().getAvatarPath(genericTask.getAssignUserAvatarId(), 16); Img img = new Img(genericTask.getAssignUserFullName(), avatarLink) .setTitle(genericTask.getAssignUserFullName()); MHorizontalLayout iconsLayout = new MHorizontalLayout().with( new ELabel(ProjectAssetsManager.getAsset(genericTask.getType()).getHtml(), ContentMode.HTML), new ELabel(img.write(), ContentMode.HTML)); MCssLayout issueWrapper = new MCssLayout(issueLbl); rowComp.with(iconsLayout, issueWrapper).expand(issueWrapper); return rowComp; }
From source file:com.esofthead.mycollab.module.project.view.bug.BugAddFormLayoutFactory.java
License:Open Source License
@Override public Layout getLayout() { final VerticalLayout layout = new VerticalLayout(); this.informationLayout = new GridFormLayoutHelper(2, 9, "100%", "167px", Alignment.TOP_LEFT); this.informationLayout.getLayout().setWidth("100%"); this.informationLayout.getLayout().setMargin(false); this.informationLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(this.informationLayout.getLayout()); layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.BugRelatedField.java
License:Open Source License
public void displayRelatedBugs(final SimpleBug bug) { this.bug = bug; VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setWidth("100%"); mainLayout.setMargin(true);// w ww . j av a2 s .co m mainLayout.setSpacing(true); HorizontalLayout layoutAdd = new HorizontalLayout(); layoutAdd.setSpacing(true); Label lbBug = new Label("Bug:"); lbBug.setWidth("70px"); layoutAdd.addComponent(lbBug); layoutAdd.setComponentAlignment(lbBug, Alignment.MIDDLE_LEFT); itemField = new TextField(); itemField.setWidth("300px"); itemField.setNullRepresentation(""); itemField.setReadOnly(true); itemField.setEnabled(true); layoutAdd.addComponent(itemField); layoutAdd.setComponentAlignment(itemField, Alignment.MIDDLE_LEFT); browseBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { callItemSelectionWindow(); } }); browseBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_browseItem)); browseBtn.setStyleName("link"); layoutAdd.addComponent(browseBtn); layoutAdd.setComponentAlignment(browseBtn, Alignment.MIDDLE_LEFT); clearBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { setItemFieldValue(""); } }); clearBtn.setIcon(MyCollabResource.newResource("icons/16/clearItem.png")); clearBtn.setStyleName("link"); layoutAdd.addComponent(clearBtn); layoutAdd.setComponentAlignment(clearBtn, Alignment.MIDDLE_LEFT); Label lbIs = new Label("is"); layoutAdd.addComponent(lbIs); layoutAdd.setComponentAlignment(lbIs, Alignment.MIDDLE_LEFT); comboRelation = new BugRelationComboBox(); comboRelation.setWidth("200px"); layoutAdd.addComponent(comboRelation); layoutAdd.setComponentAlignment(comboRelation, Alignment.MIDDLE_LEFT); btnRelate = new Button("Relate"); btnRelate.setStyleName(UIConstants.THEME_GREEN_LINK); btnRelate.setIcon(MyCollabResource.newResource(WebResourceIds._16_addRecord)); ProjectMemberService memberService = ApplicationContextUtil.getSpringBean(ProjectMemberService.class); SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(), CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); if (member != null) { btnRelate.setEnabled((member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser())) || (AppContext.getUsername().equals(bug.getLogby()))) && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); } btnRelate.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { if (!itemField.getValue().toString().trim().equals("") && relatedBean != null && !relatedBean.getSummary().equals(bug.getSummary())) { SimpleRelatedBug relatedBug = new SimpleRelatedBug(); relatedBug.setBugid(bug.getId()); relatedBug.setRelatedid(relatedBean.getId()); relatedBug.setRelatetype((String) comboRelation.getValue()); relatedBug.setComment(txtComment.getValue().toString()); relatedBugService.saveWithSession(relatedBug, AppContext.getUsername()); SimpleRelatedBug oppositeRelation = new SimpleRelatedBug(); oppositeRelation.setBugid(relatedBean.getId()); oppositeRelation.setRelatedid(bug.getId()); oppositeRelation.setComment(txtComment.getValue().toString()); if (comboRelation.getValue().toString().equals(BugRelationConstants.PARENT)) { oppositeRelation.setRelatetype(BugRelationConstants.CHILD); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.CHILD)) { oppositeRelation.setRelatetype(BugRelationConstants.PARENT); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.RELATED)) { oppositeRelation.setRelatetype(BugRelationConstants.RELATED); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.BEFORE)) { oppositeRelation.setRelatetype(BugRelationConstants.AFTER); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.AFTER)) { oppositeRelation.setRelatetype(BugRelationConstants.BEFORE); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.DUPLICATED)) { oppositeRelation.setRelatetype(BugRelationConstants.DUPLICATED); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bug.setStatus(BugStatus.Resolved.name()); bug.setResolution(BugResolution.Duplicate.name()); bugService.updateWithSession(bug, AppContext.getUsername()); } relatedBugService.saveWithSession(oppositeRelation, AppContext.getUsername()); setCriteria(); setItemFieldValue(""); txtComment.setValue(""); relatedBean = null; } } }); layoutAdd.addComponent(btnRelate); layoutAdd.setComponentAlignment(btnRelate, Alignment.MIDDLE_LEFT); Label lbInstruction = new Label("<strong>Relate to an existing ticket</strong>", ContentMode.HTML); mainLayout.addComponent(lbInstruction); mainLayout.addComponent(layoutAdd); HorizontalLayout layoutComment = new HorizontalLayout(); layoutComment.setSpacing(true); Label lbComment = new Label("Comment:"); lbComment.setWidth("70px"); layoutComment.addComponent(lbComment); layoutComment.setComponentAlignment(lbComment, Alignment.TOP_LEFT); txtComment = new RichTextArea(); txtComment.setHeight("130px"); txtComment.setWidth("565px"); layoutComment.addComponent(txtComment); layoutComment.setComponentAlignment(txtComment, Alignment.MIDDLE_LEFT); mainLayout.addComponent(layoutComment); tableItem = new DefaultPagedBeanTable<RelatedBugService, BugRelatedSearchCriteria, SimpleRelatedBug>( ApplicationContextUtil.getSpringBean(RelatedBugService.class), SimpleRelatedBug.class, Arrays.asList( new TableViewField(BugI18nEnum.RELATED_BUG_NAME, "bugName", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(BugI18nEnum.RELATED_BUG_TYPE, "relatetype", UIConstants.TABLE_S_LABEL_WIDTH), new TableViewField(BugI18nEnum.RELATED_BUG_COMMENT, "comment", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH))); tableItem.addGeneratedColumn("bugName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId); String bugname = "[%s-%s] %s"; bugname = String.format(bugname, CurrentProjectVariables.getProject().getShortname(), relatedItem.getRelatedid(), relatedItem.getBugName()); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); final SimpleBug bug = bugService.findById(relatedItem.getRelatedid(), AppContext.getAccountId()); LabelLink b = new LabelLink(bugname, ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName())); if (StringUtils.isNotBlank(bug.getPriority())) { String iconPriority = ProjectResources.getIconResourceLink12ByBugPriority(bug.getPriority()); b.setIconLink(iconPriority); } if (BugStatus.Verified.name().equals(bug.getStatus())) { b.addStyleName(UIConstants.LINK_COMPLETED); } else if (bug.getDuedate() != null && (bug.getDuedate().before(new GregorianCalendar().getTime()))) { b.addStyleName(UIConstants.LINK_OVERDUE); } b.setWidth("100%"); return b; } }); tableItem.addGeneratedColumn("id", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId); Button deleteBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { BugRelatedSearchCriteria relateBugIdCriteria = new BugRelatedSearchCriteria(); relateBugIdCriteria.setBugId(new NumberSearchField(relatedItem.getBugid())); relateBugIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getRelatedid())); relatedBugService.removeByCriteria(relateBugIdCriteria, AppContext.getAccountId()); BugRelatedSearchCriteria relateIdCriteria = new BugRelatedSearchCriteria(); relateIdCriteria.setBugId(new NumberSearchField(relatedItem.getRelatedid())); relateIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getBugid())); relatedBugService.removeByCriteria(relateIdCriteria, AppContext.getAccountId()); BugRelatedField.this.setCriteria(); } }); deleteBtn.setStyleName("link"); deleteBtn.setIcon(MyCollabResource.newResource("icons/16/delete.png")); relatedItem.setExtraData(deleteBtn); ProjectMemberService memberService = ApplicationContextUtil .getSpringBean(ProjectMemberService.class); SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(), CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); if (member != null) { deleteBtn.setEnabled( member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser())) || (AppContext.getUsername().equals(bug.getLogby()))); } return deleteBtn; } }); mainLayout.addComponent(tableItem); setCriteria(); this.setCompositionRoot(mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.bug.ComponentFormLayoutFactory.java
License:Open Source License
@Override public Layout getLayout() { final VerticalLayout layout = new VerticalLayout(); this.gridFormLayout = new GridFormLayoutHelper(2, 3, "100%", "167px", Alignment.TOP_LEFT); this.gridFormLayout.getLayout().setWidth("100%"); this.gridFormLayout.getLayout().setMargin(false); this.gridFormLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(this.gridFormLayout.getLayout()); return layout; }
From source file:com.esofthead.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);/*w ww . ja v 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( new ELabel(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml(), ContentMode.HTML) .withWidthUndefined(), new ELabel(priorityLink.write(), ContentMode.HTML).withWidthUndefined(), new ELabel(statusSpan.write(), ContentMode.HTML).withWidthUndefined(), new ELabel(img.write(), ContentMode.HTML).withWidthUndefined(), toggleBugSummaryField) .expand(toggleBugSummaryField); return rowComp; }
From source file:com.esofthead.mycollab.module.project.view.bug.VersionFormLayoutFactory.java
License:Open Source License
@Override public Layout getLayout() { this.informationLayout = new GridFormLayoutHelper(2, 3, "100%", "167px", Alignment.TOP_LEFT); this.informationLayout.getLayout().setWidth("100%"); this.informationLayout.getLayout().setMargin(false); this.informationLayout.getLayout().addStyleName("colored-gridlayout"); final VerticalLayout layout = new VerticalLayout(); layout.addComponent(this.informationLayout.getLayout()); return layout; }