List of usage examples for com.vaadin.ui VerticalLayout setMargin
@Override public void setMargin(boolean enabled)
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); mainLayout.setSpacing(true);//from w ww . ja v a 2 s. c o m 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.BugSelectionWindow.java
License:Open Source License
public BugSelectionWindow(BugRelatedField fieldSelection) { super("Bug Lookup"); this.setWidth("900px"); this.setHeight("500px"); this.fieldSelection = fieldSelection; this.setModal(true); this.setResizable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/* ww w.j a va 2s.c o m*/ layout.setMargin(true); BugSimpleSearchPanel contactSimpleSearchPanel = new BugSimpleSearchPanel(); contactSimpleSearchPanel.addSearchHandler(new SearchHandler<BugSearchCriteria>() { @Override public void onSearch(BugSearchCriteria criteria) { tableItem.setSearchCriteria(criteria); } }); layout.addComponent(contactSimpleSearchPanel); createBugList(); layout.addComponent(tableItem); this.setContent(layout); }
From source file:com.esofthead.mycollab.module.project.view.bug.ResolvedInputWindow.java
License:Open Source License
ResolvedInputWindow(final IBugCallbackStatusComp callbackForm, final SimpleBug bug) { super("Resolve bug '" + bug.getSummary() + "'"); this.bug = bug; this.callbackForm = callbackForm; VerticalLayout contentLayout = new VerticalLayout(); this.setWidth("800px"); this.setResizable(false); this.setModal(true); this.editForm = new EditForm(); contentLayout.addComponent(this.editForm); this.editForm.setBean(bug); contentLayout.setMargin(new MarginInfo(false, false, true, false)); this.setContent(contentLayout); this.center(); }
From source file:com.esofthead.mycollab.module.project.view.bug.WontFixExplainWindow.java
License:Open Source License
WontFixExplainWindow(final IBugCallbackStatusComp callbackForm, final SimpleBug bug) { super("Won't fix bug '" + bug.getSummary() + "'"); this.bug = bug; this.callbackForm = callbackForm; this.setWidth("750px"); this.setResizable(false); this.setModal(true); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setMargin(new MarginInfo(false, false, true, false)); EditForm editForm = new EditForm(); contentLayout.addComponent(editForm); editForm.setBean(bug);/*from w w w . j a v a 2 s. c o m*/ this.setContent(contentLayout); this.center(); }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneBugListComp.java
License:Open Source License
private void displayAdvancedView() { if (this.getComponentCount() > 1) { this.removeComponent(this.getComponent(1)); }//from www . j av a 2s. c o m final HorizontalLayout bodyLayout = new HorizontalLayout(); bodyLayout.setSpacing(false); bodyLayout.setWidth("100%"); final VerticalLayout leftColumn = new VerticalLayout(); leftColumn.setMargin(new MarginInfo(false, true, false, false)); bodyLayout.addComponent(leftColumn); bodyLayout.setExpandRatio(leftColumn, 1.0f); final VerticalLayout rightColumn = new VerticalLayout(); bodyLayout.addComponent(rightColumn); final UnresolvedBugsByPriorityWidget unresolvedBugWidget = new UnresolvedBugsByPriorityWidget(this); unresolvedBugWidget.setWidth("100%"); leftColumn.addComponent(unresolvedBugWidget); final BugSearchCriteria unresolvedByPrioritySearchCriteria = new BugSearchCriteria(); unresolvedByPrioritySearchCriteria .setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); unresolvedByPrioritySearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); unresolvedByPrioritySearchCriteria.setStatuses(new SetSearchField<String>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); unresolvedBugWidget.setSearchCriteria(unresolvedByPrioritySearchCriteria); final UnresolvedBugsByAssigneeWidget unresolvedByAssigneeWidget = new UnresolvedBugsByAssigneeWidget(this); unresolvedByAssigneeWidget.setWidth("100%"); leftColumn.addComponent(unresolvedByAssigneeWidget); final BugSearchCriteria unresolvedByAssigneeSearchCriteria = new BugSearchCriteria(); unresolvedByAssigneeSearchCriteria .setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); unresolvedByAssigneeSearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); unresolvedByAssigneeSearchCriteria.setStatuses(new SetSearchField<String>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); unresolvedByAssigneeWidget.setSearchCriteria(unresolvedByAssigneeSearchCriteria); final BugSearchCriteria chartSearchCriteria = new BugSearchCriteria(); chartSearchCriteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); chartSearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); BugChartComponent bugChartComponent = null; bugChartComponent = new BugChartComponent(chartSearchCriteria, 400, 200); rightColumn.addComponent(bugChartComponent); rightColumn.setWidth("400px"); this.addComponent(bodyLayout); }
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectNotificationSettingViewComponent.java
License:Open Source License
public ProjectNotificationSettingViewComponent(final ProjectNotificationSetting bean) { super(AppContext.getMessage(ProjectSettingI18nEnum.VIEW_TITLE)); VerticalLayout bodyWrapper = new VerticalLayout(); bodyWrapper.setSpacing(true);//from w w w. j a v a 2 s . co m bodyWrapper.setMargin(true); bodyWrapper.setSizeFull(); HorizontalLayout notificationLabelWrapper = new HorizontalLayout(); notificationLabelWrapper.setSizeFull(); notificationLabelWrapper.setMargin(true); notificationLabelWrapper.setStyleName("notification-label"); Label notificationLabel = new Label(AppContext.getMessage(ProjectSettingI18nEnum.EXT_LEVEL)); notificationLabel.addStyleName("h2"); notificationLabel.setHeightUndefined(); notificationLabelWrapper.addComponent(notificationLabel); bodyWrapper.addComponent(notificationLabelWrapper); VerticalLayout body = new VerticalLayout(); body.setSpacing(true); body.setMargin(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(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING)); optionGroup.addItem(NotificationType.None.name()); optionGroup.setItemCaption(NotificationType.None.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING)); optionGroup.addItem(NotificationType.Minimal.name()); optionGroup.setItemCaption(NotificationType.Minimal.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING)); optionGroup.addItem(NotificationType.Full.name()); optionGroup.setItemCaption(NotificationType.Full.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING)); optionGroup.setHeight("100%"); body.addComponent(optionGroup); body.setExpandRatio(optionGroup, 1.0f); body.setComponentAlignment(optionGroup, Alignment.MIDDLE_LEFT); String levelVal = bean.getLevel(); if (levelVal == null) { optionGroup.select(NotificationType.Default.name()); } else { optionGroup.select(levelVal); } Button updateBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { bean.setLevel((String) optionGroup.getValue()); ProjectNotificationSettingService projectNotificationSettingService = ApplicationContextUtil .getSpringBean(ProjectNotificationSettingService.class); if (bean.getId() == null) { projectNotificationSettingService.saveWithSession(bean, AppContext.getUsername()); } else { projectNotificationSettingService.updateWithSession(bean, AppContext.getUsername()); } NotificationUtil.showNotification( AppContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS)); } catch (Exception e) { throw new MyCollabException(e); } } }); updateBtn.addStyleName(UIConstants.THEME_GREEN_LINK); updateBtn.setIcon(FontAwesome.REFRESH); body.addComponent(updateBtn); body.setComponentAlignment(updateBtn, Alignment.BOTTOM_LEFT); bodyWrapper.addComponent(body); this.addComponent(bodyWrapper); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskAddPopup.java
License:Open Source License
public TaskAddPopup(final TaskDisplayComponent taskDisplayComp, final TaskList taskList) { final VerticalLayout taskLayout = new VerticalLayout(); taskLayout.addStyleName("taskadd-popup"); final VerticalLayout popupHeader = new VerticalLayout(); popupHeader.setWidth("100%"); popupHeader.setMargin(true); popupHeader.addStyleName("popup-header"); final Label titleLbl = new Label(AppContext.getMessage(TaskI18nEnum.DIALOG_NEW_TASK_TITLE)); titleLbl.addStyleName("bold"); popupHeader.addComponent(titleLbl);/*from www.ja v a 2s. c o m*/ taskLayout.addComponent(popupHeader); this.task = new SimpleTask(); TabSheet taskContainer = new TabSheet(); final TaskInputForm taskInputForm = new TaskInputForm(); taskInputForm.setWidth("100%"); taskContainer.addTab(taskInputForm, AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE)); this.taskNoteComponent = new TaskNoteLayout(); taskContainer.addTab(this.taskNoteComponent, AppContext.getMessage(TaskI18nEnum.FORM_NOTES_ATTACHMENT)); taskLayout.addComponent(taskContainer); final MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true); controlsLayout.addStyleName("popup-footer"); 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) { taskDisplayComp.closeTaskAdd(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (taskInputForm.validateForm()) { final ProjectTaskService taskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); task.setTasklistid(taskList.getId()); task.setProjectid(CurrentProjectVariables.getProjectId()); task.setSaccountid(AppContext.getAccountId()); task.setNotes(taskNoteComponent.getNote()); taskService.saveWithSession(task, AppContext.getUsername()); taskNoteComponent.saveContentsToRepo(task.getId()); taskDisplayComp.saveTaskSuccess(task); taskDisplayComp.closeTaskAdd(); } } }); saveBtn.setIcon(FontAwesome.SAVE); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); controlsLayout.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER); taskLayout.addComponent(controlsLayout); taskLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT); this.setCompositionRoot(taskLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskDisplayComponent.java
License:Open Source License
private void showTaskGroupInfo() { if (this.isDisplayTaskListInfo) { AdvancedPreviewBeanForm<SimpleTaskList> previewForm = new AdvancedPreviewBeanForm<>(); previewForm.setWidth("100%"); previewForm.setFormLayoutFactory(new IFormLayoutFactory() { private static final long serialVersionUID = 1L; private GridFormLayoutHelper layoutHelper; @Override/*from w w w .j a v a 2s . c o m*/ public ComponentContainer getLayout() { this.layoutHelper = new GridFormLayoutHelper(2, 3, "100%", "180px", Alignment.TOP_LEFT); this.layoutHelper.getLayout().setWidth("100%"); this.layoutHelper.getLayout().addStyleName("colored-gridlayout"); this.layoutHelper.getLayout().setMargin(false); return this.layoutHelper.getLayout(); } @Override public void attachField(Object propertyId, Field<?> field) { if ("description".equals(propertyId)) { layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 0, 2, "100%"); } else if ("owner".equals(propertyId)) { layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 1); } else if ("milestoneid".equals(propertyId)) { layoutHelper.addComponent(field, AppContext.getMessage(TaskGroupI18nEnum.FORM_PHASE_FIELD), 1, 1); } } }); previewForm.setBeanFormFieldFactory( new AbstractBeanFieldGroupViewFieldFactory<SimpleTaskList>(previewForm) { private static final long serialVersionUID = 1L; @Override protected Field<?> onCreateField(Object propertyId) { if ("description".equals(propertyId)) { return new DefaultViewField(taskList.getDescription(), ContentMode.HTML); } else if ("owner".equals(propertyId)) { return new ProjectUserFormLinkField(taskList.getOwner(), taskList.getOwnerAvatarId(), taskList.getOwnerFullName()); } else if ("milestoneid".equals(propertyId)) { return new LinkViewField(taskList.getMilestoneName(), ProjectLinkBuilder.generateMilestonePreviewFullLink(taskList.getProjectid(), taskList.getMilestoneid()), ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE)); } return null; } }); this.addComponent(previewForm); previewForm.setBean(this.taskList); } this.taskDisplay = new TaskTableDisplay(TaskTableFieldDef.id, Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate, TaskTableFieldDef.assignee, TaskTableFieldDef.percentagecomplete)); this.addComponent(this.taskDisplay); this.taskDisplay.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleTask task = (SimpleTask) event.getData(); if ("taskname".equals(event.getFieldName())) { EventBusFactory.getInstance() .post(new TaskEvent.GotoRead(TaskDisplayComponent.this, task.getId())); } else if ("closeTask".equals(event.getFieldName()) || "reopenTask".equals(event.getFieldName()) || "pendingTask".equals(event.getFieldName()) || "deleteTask".equals(event.getFieldName())) { TaskDisplayComponent.this.removeAllComponents(); final ProjectTaskListService taskListService = ApplicationContextUtil .getSpringBean(ProjectTaskListService.class); TaskDisplayComponent.this.taskList = taskListService .findById(TaskDisplayComponent.this.taskList.getId(), AppContext.getAccountId()); TaskDisplayComponent.this.showTaskGroupInfo(); } } }); this.createTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { TaskDisplayComponent.this .removeComponent(TaskDisplayComponent.this.createTaskBtn.getParent()); TaskAddPopup taskAddView = new TaskAddPopup(TaskDisplayComponent.this, TaskDisplayComponent.this.taskList); TaskDisplayComponent.this.addComponent(taskAddView); } }); this.createTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); this.createTaskBtn.setIcon(FontAwesome.PLUS); this.createTaskBtn.setStyleName(UIConstants.THEME_GREEN_LINK); final VerticalLayout taskGroupFooter = new VerticalLayout(); taskGroupFooter.setMargin(true); taskGroupFooter.addStyleName("task-list-footer"); taskGroupFooter.addComponent(this.createTaskBtn); taskGroupFooter.setComponentAlignment(this.createTaskBtn, Alignment.MIDDLE_RIGHT); this.addComponent(taskGroupFooter); if (CollectionUtils.isNotEmpty(taskList.getSubTasks())) { taskDisplay.setCurrentDataList(taskList.getSubTasks()); } else { taskDisplay.setCurrentDataList(new ArrayList<SimpleTask>()); } }
From source file:com.esofthead.mycollab.module.project.view.task.TaskDisplayComponent.java
License:Open Source License
public void closeTaskAdd() { final VerticalLayout taskGroupFooter = new VerticalLayout(); taskGroupFooter.setMargin(true); taskGroupFooter.addStyleName("task-list-footer"); taskGroupFooter.addComponent(this.createTaskBtn); taskGroupFooter.setComponentAlignment(this.createTaskBtn, Alignment.MIDDLE_RIGHT); this.addComponent(taskGroupFooter); Iterator<Component> comps = this.iterator(); while (comps.hasNext()) { Component component = comps.next(); if (component instanceof TaskAddPopup) { this.removeComponent(component); return; }// www . j a v a2s . c o m } }
From source file:com.esofthead.mycollab.module.project.view.task.TaskFormLayoutFactory.java
License:Open Source License
@Override public Layout getLayout() { this.informationLayout = new GridFormLayoutHelper(2, 8, "100%", "180px", Alignment.TOP_LEFT); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); this.informationLayout.getLayout().setMargin(false); this.informationLayout.getLayout().setWidth("100%"); this.informationLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(this.informationLayout.getLayout()); layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER); return layout; }