List of usage examples for com.vaadin.ui Label Label
public Label(String text)
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 . ja va2 s . c o 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.BugSearchPanel.java
License:Open Source License
public BugSearchPanel() { this.project = CurrentProjectVariables.getProject(); this.bugTitle = new Label("Bugs"); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugTableDisplay.java
License:Open Source License
public BugTableDisplay(String viewId, TableViewField requiredColumn, List<TableViewField> displayColumns) { super(ApplicationContextUtil.getSpringBean(BugService.class), SimpleBug.class, viewId, requiredColumn, displayColumns);/*from w ww .j a va 2 s . c om*/ this.addGeneratedColumn("id", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); final Button bugSettingBtn = new Button(null, FontAwesome.COG); bugSettingBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); final ContextMenu contextMenu = new ContextMenu(); contextMenu.setAsContextMenuOf(bugSettingBtn); contextMenu.addItemClickListener(new ContextMenuItemClickListener() { @Override public void contextMenuItemClicked(ContextMenuItemClickEvent event) { if (((ContextMenuItem) event.getSource()).getData() == null) { return; } String category = ((MenuItemData) ((ContextMenuItem) event.getSource()).getData()) .getAction(); String value = ((MenuItemData) ((ContextMenuItem) event.getSource()).getData()).getKey(); if ("status".equals(category)) { if (AppContext.getMessage(BugStatus.Verified).equals(value)) { UI.getCurrent().addWindow(new ApproveInputWindow(BugTableDisplay.this, bug)); } else if (AppContext.getMessage(BugStatus.InProgress).equals(value)) { bug.setStatus(BugStatus.InProgress.name()); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateWithSession(bug, AppContext.getUsername()); } else if (AppContext.getMessage(BugStatus.Open).equals(value)) { UI.getCurrent().addWindow(new ReOpenWindow(BugTableDisplay.this, bug)); } else if (AppContext.getMessage(BugStatus.Resolved).equals(value)) { UI.getCurrent().addWindow(new ResolvedInputWindow(BugTableDisplay.this, bug)); } } else if ("severity".equals(category)) { bug.setSeverity(value); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateWithSession(bug, AppContext.getUsername()); refresh(); } else if ("priority".equals(category)) { bug.setPriority(value); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateWithSession(bug, AppContext.getUsername()); refresh(); } else if ("action".equals(category)) { if ("edit".equals(value)) { EventBusFactory.getInstance() .post(new BugEvent.GotoEdit(BugTableDisplay.this, bug)); } else if ("delete".equals(value)) { 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()) { BugService bugService = ApplicationContextUtil .getSpringBean(BugService.class); bugService.removeWithSession(bug.getId(), AppContext.getUsername(), AppContext.getAccountId()); refresh(); } } }); } } } }); bugSettingBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); bugSettingBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { displayContextMenuItem(contextMenu, bug, event.getClientX(), event.getClientY()); } }); return bugSettingBtn; } }); this.addGeneratedColumn("assignuserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new ProjectUserLink(bug.getAssignuser(), bug.getAssignUserAvatarId(), bug.getAssignuserFullName()); } }); this.addGeneratedColumn("loguserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new ProjectUserLink(bug.getLogby(), bug.getLoguserAvatarId(), bug.getLoguserFullName()); } }); this.addGeneratedColumn("summary", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); String bugname = "[%s-%s] %s"; bugname = String.format(bugname, CurrentProjectVariables.getProject().getShortname(), bug.getBugkey(), bug.getSummary()); LabelLink b = new LabelLink(bugname, ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName())); if (StringUtils.isNotBlank(bug.getPriority())) { b.setIconLink(ProjectResources.getIconResourceLink12ByBugPriority(bug.getPriority())); } b.setDescription(ProjectTooltipGenerator.generateToolTipBug(AppContext.getUserLocale(), bug, AppContext.getSiteUrl(), AppContext.getTimezone())); if (bug.isCompleted()) { b.addStyleName(UIConstants.LINK_COMPLETED); } else if (bug.isOverdue()) { b.addStyleName(UIConstants.LINK_OVERDUE); } return b; } }); this.addGeneratedColumn("severity", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); Resource iconPriority = new ExternalResource( ProjectResources.getIconResourceLink12ByBugSeverity(bug.getPriority())); Embedded iconEmbedded = new Embedded(null, iconPriority); Label lbPriority = new Label(AppContext.getMessage(BugSeverity.class, bug.getSeverity())); HorizontalLayout containerField = new HorizontalLayout(); containerField.setSpacing(true); containerField.addComponent(iconEmbedded); containerField.addComponent(lbPriority); containerField.setExpandRatio(lbPriority, 1.0f); return containerField; } }); this.addGeneratedColumn("duedate", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(bug.getDuedate())); } }); this.addGeneratedColumn("createdtime", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDateTime(bug.getCreatedtime())); } }); this.addGeneratedColumn("resolution", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.getMessage(BugResolution.class, bug.getResolution())); } }); this.setWidth("100%"); }
From source file:com.esofthead.mycollab.module.project.view.bug.components.BugRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(SimpleBug bug, int rowIndex) { MVerticalLayout rowContent = new MVerticalLayout().withSpacing(false).withWidth("100%"); final LabelLink defectLink = new LabelLink( "[" + CurrentProjectVariables.getProject().getShortname() + "-" + bug.getBugkey() + "]: " + bug.getSummary(),// w ww. j av a2 s .c o m ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName())); defectLink.setWidth("100%"); defectLink.setIconLink(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)); defectLink.setDescription(ProjectTooltipGenerator.generateToolTipBug(AppContext.getUserLocale(), bug, AppContext.getSiteUrl(), AppContext.getTimezone())); if (bug.isCompleted()) { defectLink.addStyleName(UIConstants.LINK_COMPLETED); } else if (bug.isOverdue()) { defectLink.addStyleName(UIConstants.LINK_OVERDUE); } rowContent.addComponent(defectLink); final LabelHTMLDisplayWidget descInfo = new LabelHTMLDisplayWidget(bug.getDescription()); descInfo.setWidth("100%"); rowContent.addComponent(descInfo); final Label dateInfo = new Label(AppContext.getMessage(DayI18nEnum.LAST_UPDATED_ON, AppContext.formatPrettyTime(bug.getLastupdatedtime()))); dateInfo.setStyleName(UIConstants.WIDGET_ROW_METADATA); rowContent.addComponent(dateInfo); final HorizontalLayout hLayoutAssigneeInfo = new HorizontalLayout(); hLayoutAssigneeInfo.setSpacing(true); final Label assignee = new Label(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE) + ": "); assignee.setStyleName(UIConstants.WIDGET_ROW_METADATA); hLayoutAssigneeInfo.addComponent(assignee); hLayoutAssigneeInfo.setComponentAlignment(assignee, Alignment.MIDDLE_CENTER); final ProjectUserLink userLink = new ProjectUserLink(bug.getAssignuser(), bug.getAssignUserAvatarId(), bug.getAssignuserFullName(), false, true); hLayoutAssigneeInfo.addComponent(userLink); hLayoutAssigneeInfo.setComponentAlignment(userLink, Alignment.MIDDLE_CENTER); rowContent.addComponent(hLayoutAssigneeInfo); rowContent.setStyleName(UIConstants.WIDGET_ROW); if ((rowIndex + 1) % 2 != 0) { rowContent.addStyleName("odd"); } return rowContent; }
From source file:com.esofthead.mycollab.module.project.view.bug.components.BugSelectionField.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout layout = new MHorizontalLayout(); Button browseBtn = new Button(FontAwesome.ELLIPSIS_H); browseBtn.addStyleName(UIConstants.BUTTON_OPTION); browseBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); browseBtn.addClickListener(new Button.ClickListener() { @Override//from ww w .j av a 2s .c om public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new BugSelectionWindow(BugSelectionField.this)); } }); layout.with(suggestField, new Label("or browse"), browseBtn); return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.VersionListViewImpl.java
License:Open Source License
private void generateDisplayTable() { this.tableItem = new DefaultPagedBeanTable<VersionService, VersionSearchCriteria, SimpleVersion>( ApplicationContextUtil.getSpringBean(VersionService.class), SimpleVersion.class, new TableViewField(null, "selected", UIConstants.TABLE_CONTROL_WIDTH), Arrays.asList(//w w w.j a v a 2s. c o m new TableViewField(VersionI18nEnum.FORM_NAME, "versionname", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_DESCRIPTION, "description", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(VersionI18nEnum.FORM_DUE_DATE, "duedate", UIConstants.TABLE_DATE_TIME_WIDTH))); this.tableItem.addGeneratedColumn("selected", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleVersion version = VersionListViewImpl.this.tableItem.getBeanByIndex(itemId); final CheckBoxDecor cb = new CheckBoxDecor("", version.isSelected()); cb.setImmediate(true); cb.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { VersionListViewImpl.this.tableItem.fireSelectItemEvent(version); } }); version.setExtraData(cb); return cb; } }); this.tableItem.addGeneratedColumn("versionname", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Component generateCell(final Table source, final Object itemId, final Object columnId) { final Version bugVersion = VersionListViewImpl.this.tableItem.getBeanByIndex(itemId); final LabelLink b = new LabelLink(bugVersion.getVersionname(), ProjectLinkBuilder .generateBugVersionPreviewFullLink(bugVersion.getProjectid(), bugVersion.getId())); if (bugVersion.getStatus() != null && bugVersion.getStatus().equals(StatusI18nEnum.Closed.name())) { b.addStyleName(UIConstants.LINK_COMPLETED); } else if (bugVersion.getDuedate() != null && (bugVersion.getDuedate().before(new GregorianCalendar().getTime()))) { b.addStyleName(UIConstants.LINK_OVERDUE); } b.setDescription(ProjectTooltipGenerator.generateToolTipVersion(AppContext.getUserLocale(), bugVersion, AppContext.getSiteUrl(), AppContext.getTimezone())); return b; } }); this.tableItem.addGeneratedColumn("duedate", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Component generateCell(final Table source, final Object itemId, final Object columnId) { final Version bugVersion = VersionListViewImpl.this.tableItem.getBeanByIndex(itemId); Date duedate = bugVersion.getDuedate(); if (duedate != null) { return new Label(AppContext.formatDate(duedate)); } else { return new Label(""); } } }); this.tableItem.setWidth("100%"); this.componentListLayout.addComponent(this.constructTableActionControls()); this.componentListLayout.addComponent(this.tableItem); }
From source file:com.esofthead.mycollab.module.project.view.FollowingTicketTableDisplay.java
License:Open Source License
public FollowingTicketTableDisplay() { super(ApplicationContextUtil.getSpringBean(ProjectFollowingTicketService.class), FollowingTicket.class, Arrays.asList(FollowingTicketFieldDef.summary, FollowingTicketFieldDef.project, FollowingTicketFieldDef.assignee, FollowingTicketFieldDef.createdDate)); this.addGeneratedColumn("summary", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override/*from w ww. ja v a2 s. c om*/ public Object generateCell(final Table source, final Object itemId, final Object columnId) { final FollowingTicket ticket = FollowingTicketTableDisplay.this.getBeanByIndex(itemId); final ButtonLink ticketLink = new ButtonLink(ticket.getSummary()); if (ProjectTypeConstants.BUG.equals(ticket.getType())) { ticketLink.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)); if (BugStatus.Verified.name().equals(ticket.getStatus())) { ticketLink.addStyleName(UIConstants.LINK_COMPLETED); } else if (ticket.getDueDate() != null && ticket.getDueDate().before(DateTimeUtils.getCurrentDateWithoutMS())) { ticketLink.addStyleName(UIConstants.LINK_OVERDUE); } ticketLink.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final int projectId = ticket.getProjectId(); final int bugId = ticket.getTypeId(); final PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(projectId), new BugScreenData.Read(bugId)); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); } }); } else if (ProjectTypeConstants.TASK.equals(ticket.getType())) { ticketLink.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK)); if ("Closed".equals(ticket.getStatus())) { ticketLink.addStyleName(UIConstants.LINK_COMPLETED); } else { if ("Pending".equals(ticket.getStatus())) { ticketLink.addStyleName(UIConstants.LINK_PENDING); } else if (ticket.getDueDate() != null && ticket.getDueDate().before(new GregorianCalendar().getTime())) { ticketLink.addStyleName(UIConstants.LINK_OVERDUE); } } ticketLink.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final int projectId = ticket.getProjectId(); final int taskId = ticket.getTypeId(); final PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(projectId), new TaskScreenData.Read(taskId)); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); } }); } else if (ProjectTypeConstants.PROBLEM.equals(ticket.getType())) { ticketLink.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROBLEM)); if ("Closed".equals(ticket.getStatus())) { ticketLink.addStyleName(UIConstants.LINK_COMPLETED); } else { if ("Pending".equals(ticket.getStatus())) { ticketLink.addStyleName(UIConstants.LINK_PENDING); } else if (ticket.getDueDate() != null && ticket.getDueDate().before(new GregorianCalendar().getTime())) { ticketLink.addStyleName(UIConstants.LINK_OVERDUE); } } ticketLink.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final int projectId = ticket.getProjectId(); final int problemId = ticket.getTypeId(); final PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(projectId), new ProblemScreenData.Read(problemId)); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); } }); } else if (ProjectTypeConstants.RISK.equals(ticket.getType())) { ticketLink.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.RISK)); if ("Closed".equals(ticket.getStatus())) { ticketLink.addStyleName(UIConstants.LINK_COMPLETED); } else { if ("Pending".equals(ticket.getStatus())) { ticketLink.addStyleName(UIConstants.LINK_PENDING); } else if (ticket.getDueDate() != null && ticket.getDueDate().before(new GregorianCalendar().getTime())) { ticketLink.addStyleName(UIConstants.LINK_OVERDUE); } } ticketLink.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final int projectId = ticket.getProjectId(); final int riskId = ticket.getTypeId(); final PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(projectId), new RiskScreenData.Read(riskId)); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); } }); } return ticketLink; } }); this.addGeneratedColumn("projectName", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { final FollowingTicket ticket = FollowingTicketTableDisplay.this.getBeanByIndex(itemId); final ButtonLink projectLink = new ButtonLink(ticket.getProjectName()); projectLink.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final int projectId = ticket.getProjectId(); final PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(projectId)); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); } }); projectLink.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROJECT)); return projectLink; } }); this.addGeneratedColumn("assignUser", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { final FollowingTicket ticket = FollowingTicketTableDisplay.this.getBeanByIndex(itemId); return new UserLink(ticket.getAssignUser(), ticket.getAssignUserAvatarId(), ticket.getAssignUserFullName()); } }); this.addGeneratedColumn("monitorDate", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, final Object columnId) { final FollowingTicket ticket = FollowingTicketTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(ticket.getMonitorDate())); } }); }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneBugListComp.java
License:Open Source License
private void constructHeader() { final HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);//from w w w .j a v a 2 s . c om header.setWidth("100%"); final Label taskGroupSelection = new Label(AppContext.getMessage(MilestoneI18nEnum.TAB_RELATED_BUGS)); taskGroupSelection.addStyleName("h2"); taskGroupSelection.addStyleName(UIConstants.THEME_NO_BORDER); header.addComponent(taskGroupSelection); header.setExpandRatio(taskGroupSelection, 1.0f); header.setComponentAlignment(taskGroupSelection, Alignment.MIDDLE_LEFT); this.viewGroup = new ToggleButtonGroup(); final Button simpleDisplay = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { MilestoneBugListComp.this.displaySimpleView(); } }); simpleDisplay.setIcon(MyCollabResource.newResource("icons/16/project/list_display.png")); this.viewGroup.addButton(simpleDisplay); final Button advanceDisplay = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { MilestoneBugListComp.this.displayAdvancedView(); } }); advanceDisplay.setIcon(MyCollabResource.newResource("icons/16/project/bug_advanced_display.png")); this.viewGroup.addButton(advanceDisplay); header.addComponent(this.viewGroup); header.setComponentAlignment(this.viewGroup, Alignment.MIDDLE_RIGHT); this.addComponent(header); }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneListViewImpl.java
License:Open Source License
private ComponentContainer constructMilestoneBox(final SimpleMilestone milestone) { final CssLayout layout = new CssLayout(); layout.addStyleName(UIConstants.MILESTONE_BOX); layout.setWidth("100%"); final LabelLink milestoneLink = new LabelLink(milestone.getName(), ProjectLinkBuilder.generateMilestonePreviewFullLink(milestone.getProjectid(), milestone.getId())); milestoneLink.setStyleName("link"); milestoneLink.addStyleName("bold"); milestoneLink.addStyleName(UIConstants.WORD_WRAP); milestoneLink.addStyleName("milestone-name"); milestoneLink.setWidth("100%"); MHorizontalLayout milestoneHeader = new MHorizontalLayout().withWidth("100%").with(milestoneLink) .expand(milestoneLink);/*from w ww . j a v a2 s . c om*/ PopupButton taskSettingPopupBtn = new PopupButton(); taskSettingPopupBtn.setWidth("20px"); MVerticalLayout filterBtnLayout = new MVerticalLayout().withWidth("100px"); Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance() .post(new MilestoneEvent.GotoEdit(MilestoneListViewImpl.this, milestone)); } }); editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)); editButton.setStyleName("link"); filterBtnLayout.addComponent(editButton); Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(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()) { MilestoneService projectTaskService = ApplicationContextUtil .getSpringBean(MilestoneService.class); projectTaskService.removeWithSession(milestone.getId(), AppContext.getUsername(), AppContext.getAccountId()); milestones.remove(milestone); displayMilestones(milestones); } } }); } }); deleteBtn.setStyleName("link"); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES)); filterBtnLayout.addComponent(deleteBtn); taskSettingPopupBtn.setIcon(FontAwesome.COG); taskSettingPopupBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); taskSettingPopupBtn.setContent(filterBtnLayout); milestoneHeader.addComponent(taskSettingPopupBtn); layout.addComponent(milestoneHeader); MHorizontalLayout spacing = new MHorizontalLayout().withHeight("8px").withWidth("100%"); layout.addComponent(spacing); final GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 5, "100%", "80px"); layoutHelper.addComponent( new Label(AppContext.formatDate(milestone.getStartdate(), AppContext.getMessage(GenericI18Enum.FORM_EMPTY))), AppContext.getMessage(MilestoneI18nEnum.FORM_START_DATE_FIELD), 0, 0, Alignment.MIDDLE_LEFT); layoutHelper.addComponent( new Label(AppContext.formatDate(milestone.getEnddate(), AppContext.getMessage(GenericI18Enum.FORM_EMPTY))), AppContext.getMessage(MilestoneI18nEnum.FORM_END_DATE_FIELD), 0, 1, Alignment.MIDDLE_LEFT); CssLayout linkWrapper = new CssLayout(); linkWrapper.setWidth("100%"); linkWrapper.addComponent(new ProjectUserLink(milestone.getOwner(), milestone.getOwnerAvatarId(), milestone.getOwnerFullName(), false, true)); layoutHelper.addComponent(linkWrapper, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 2, Alignment.MIDDLE_LEFT); final ProgressBarIndicator progressTask = new ProgressBarIndicator(milestone.getNumTasks(), milestone.getNumOpenTasks()); progressTask.setWidth("100%"); layoutHelper.addComponent(progressTask, AppContext.getMessage(MilestoneI18nEnum.FORM_TASK_FIELD), 0, 3, Alignment.MIDDLE_LEFT); final ProgressBarIndicator progressBug = new ProgressBarIndicator(milestone.getNumBugs(), milestone.getNumOpenBugs()); progressBug.setWidth("100%"); layoutHelper.addComponent(progressBug, AppContext.getMessage(MilestoneI18nEnum.FORM_BUG_FIELD), 0, 4, Alignment.MIDDLE_LEFT); final GridLayout milestoneInfoLayout = layoutHelper.getLayout(); milestoneInfoLayout.setWidth("100%"); milestoneInfoLayout.setMargin(false); milestoneInfoLayout.setSpacing(true); layout.addComponent(milestoneInfoLayout); return layout; }
From source file:com.esofthead.mycollab.module.project.view.page.PageListNoItemView.java
License:Open Source License
protected MHorizontalLayout createControlButtons() { Button createPageBtn = new Button(actionMessage(), actionListener()); createPageBtn.setEnabled(hasPermission()); createPageBtn.addStyleName(UIConstants.THEME_GREEN_LINK); Button createPageGroupBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_GROUP), new Button.ClickListener() { @Override/*from www .j a v a 2 s . c om*/ public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new GroupPageAddWindow()); } }); createPageGroupBtn.setEnabled(hasPermission()); createPageGroupBtn.addStyleName(UIConstants.THEME_GREEN_LINK); MHorizontalLayout links = new MHorizontalLayout(); links.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); links.with(createPageBtn, new Label(" or "), createPageGroupBtn); return links; }