Java Code Examples for com.vaadin.ui.CheckBox#addValueChangeListener()
The following examples show how to use
com.vaadin.ui.CheckBox#addValueChangeListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DistributionSetSelectWindow.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
private VerticalLayout initView() { final Label label = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_DESC)); checkBox = new CheckBox(i18n.getMessage(UIMessageIdProvider.LABEL_AUTO_ASSIGNMENT_ENABLE)); checkBox.setId(UIComponentIdProvider.DIST_SET_SELECT_ENABLE_ID); checkBox.setImmediate(true); checkBox.addValueChangeListener( event -> switchAutoAssignmentInputsVisibility((boolean) event.getProperty().getValue())); actionTypeOptionGroupLayout = new ActionTypeOptionGroupAutoAssignmentLayout(i18n); dsCombo = new DistributionSetSelectComboBox(i18n); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.addComponent(label); verticalLayout.addComponent(checkBox); verticalLayout.addComponent(actionTypeOptionGroupLayout); verticalLayout.addComponent(dsCombo); return verticalLayout; }
Example 2
Source File: TicketOverdueWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public TicketOverdueWidget() { super(UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS) + " (0)", new CssLayout()); final CheckBox myItemsOnly = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsOnly.addValueChangeListener(valueChangeEvent -> { if (searchCriteria != null) { boolean selectMyItemsOnly = myItemsOnly.getValue(); if (selectMyItemsOnly) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } ticketOverdueComponent.setSearchCriteria(searchCriteria); } }); this.addHeaderElement(myItemsOnly); ticketOverdueComponent = new TicketOverduePagedList(); bodyContent.addComponent(ticketOverdueComponent); }
Example 3
Source File: MilestoneTimelineWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public void display() { final CheckBox noDateSetMilestone = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET)); noDateSetMilestone.setValue(false); final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed)); includeClosedMilestone.setValue(false); noDateSetMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue())); includeClosedMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue())); addHeaderElement(noDateSetMilestone); addHeaderElement(includeClosedMilestone); MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC"))); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestones = (List<SimpleMilestone>) milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria)); bodyContent.addStyleName("tm-wrapper"); displayTimelines(false, false); }
Example 4
Source File: AllMilestoneTimelineWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public void display(List<Integer> projectIds) { CheckBox includeNoDateSet = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET)); includeNoDateSet.setValue(false); CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed)); includeClosedMilestone.setValue(false); includeNoDateSet.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue())); includeClosedMilestone.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue())); addHeaderElement(includeNoDateSet); addHeaderElement(includeClosedMilestone); MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(projectIds)); searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC"))); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestones = (List<SimpleMilestone>) milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria)); bodyContent.addStyleName("tm-wrapper"); displayTimelines(false, false); }
Example 5
Source File: UserUnresolvedTicketWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public UserUnresolvedTicketWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (searchCriteria != null) { if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); } }); ticketList = new DefaultBeanPagedList<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket> (AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(true), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET); } }; this.addHeaderElement(myItemsSelection); this.bodyContent.addComponent(ticketList); }
Example 6
Source File: ProjectOverdueTicketsWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public ProjectOverdueTicketsWidget() { super(String.format("%s (0)", UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS)), new CssLayout()); this.setWidth("100%"); CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); }); ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(false), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_OVERDUE_TICKET); } }; this.addHeaderElement(myItemsSelection); bodyContent.addComponent(ticketList); }
Example 7
Source File: ProjectUnresolvedTicketsWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public ProjectUnresolvedTicketsWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); }); ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(false), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET); } }; addHeaderElement(myItemsSelection); bodyContent.addComponent(ticketList); }
Example 8
Source File: TargetAssignmentOperations.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private static CheckBox maintenanceWindowControl(final VaadinMessageSource i18n, final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle) { final CheckBox enableMaintenanceWindow = new CheckBox(i18n.getMessage("caption.maintenancewindow.enabled")); enableMaintenanceWindow.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID); enableMaintenanceWindow.addStyleName(ValoTheme.CHECKBOX_SMALL); enableMaintenanceWindow.addStyleName("dist-window-maintenance-window-enable"); enableMaintenanceWindow.addValueChangeListener(event -> { final Boolean isMaintenanceWindowEnabled = enableMaintenanceWindow.getValue(); maintenanceWindowLayout.setVisible(isMaintenanceWindowEnabled); maintenanceWindowLayout.setEnabled(isMaintenanceWindowEnabled); saveButtonToggle.accept(!isMaintenanceWindowEnabled); maintenanceWindowLayout.clearAllControls(); }); return enableMaintenanceWindow; }
Example 9
Source File: SwMetadataPopupLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private CheckBox createTargetVisibleField() { final CheckBox checkBox = new CheckBox(); checkBox.setId(UIComponentIdProvider.METADATA_TARGET_VISIBLE_ID); checkBox.setCaption(i18n.getMessage("metadata.targetvisible")); checkBox.addValueChangeListener(this::onCheckBoxChange); return checkBox; }
Example 10
Source File: VersionPreviewForm.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
TicketsComp(Version beanItem) { withMargin(false).withFullWidth().withStyleName(WebThemes.NO_SCROLLABLE_CONTAINER); CheckBox openSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Open), true); openSelection.addValueChangeListener(valueChangeEvent -> { if (openSelection.getValue()) { searchCriteria.setOpen(new SearchField()); } else { searchCriteria.setOpen(null); } updateSearchStatus(); }); CheckBox overdueSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Overdue), false); overdueSelection.addValueChangeListener(valueChangeEvent -> { if (overdueSelection.getValue()) { searchCriteria.setDueDate(new DateSearchField(DateTimeUtils.getCurrentDateWithoutMS().toLocalDate(), DateSearchField.LESS_THAN)); } else { searchCriteria.setDueDate(null); } updateSearchStatus(); }); MHorizontalLayout header = new MHorizontalLayout(openSelection, overdueSelection); ticketList = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowRenderer()); searchCriteria = new ProjectTicketSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.TASK)); searchCriteria.setVersionIds(new SetSearchField<>(beanItem.getId())); searchCriteria.setOpen(new SearchField()); updateSearchStatus(); this.with(header, ticketList); }
Example 11
Source File: ComponentPreviewForm.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
TicketsComp(SimpleComponent beanItem) { withMargin(false).withFullWidth().withStyleName(WebThemes.NO_SCROLLABLE_CONTAINER); CheckBox openSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Open), true); openSelection.addValueChangeListener(valueChangeEvent -> { if (openSelection.getValue()) { searchCriteria.setOpen(new SearchField()); } else { searchCriteria.setOpen(null); } updateSearchStatus(); }); CheckBox overdueSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Overdue), false); overdueSelection.addValueChangeListener(valueChangeEvent -> { if (overdueSelection.getValue()) { searchCriteria.setDueDate(new DateSearchField(DateTimeUtils.getCurrentDateWithoutMS().toLocalDate(), DateSearchField.LESS_THAN)); } else { searchCriteria.setDueDate(null); } updateSearchStatus(); }); MHorizontalLayout header = new MHorizontalLayout(openSelection, overdueSelection); ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowRenderer()); searchCriteria = new ProjectTicketSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setComponentIds(new SetSearchField<>(beanItem.getId())); searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.TASK)); searchCriteria.setOpen(new SearchField()); updateSearchStatus(); this.with(header, ticketList); }
Example 12
Source File: ProjectSubscribersComp.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected Component initContent() { ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class); List<SimpleUser> members = projectMemberService.getActiveUsersInProject(projectId, AppUI.getAccountId()); CssLayout container = new CssLayout(); container.setStyleName("followers-container"); final CheckBox selectAllCheckbox = new CheckBox("All", defaultSelectAll); selectAllCheckbox.addValueChangeListener(valueChangeEvent -> { boolean val = selectAllCheckbox.getValue(); for (FollowerCheckbox followerCheckbox : memberSelections) { followerCheckbox.setValue(val); } }); container.addComponent(selectAllCheckbox); for (SimpleUser user : members) { final FollowerCheckbox memberCheckbox = new FollowerCheckbox(user); memberCheckbox.addValueChangeListener(valueChangeEvent -> { if (!memberCheckbox.getValue()) { selectAllCheckbox.setValue(false); } }); if (defaultSelectAll || selectedUsers.contains(user.getUsername())) { memberCheckbox.setValue(true); } memberSelections.add(memberCheckbox); container.addComponent(memberCheckbox); } return container; }
Example 13
Source File: MilestonePreviewForm.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
AssignmentsComp(SimpleMilestone milestone) { this.beanItem = milestone; withMargin(false).withFullWidth().withStyleName(WebThemes.NO_SCROLLABLE_CONTAINER); MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, false, true, false)).withFullWidth(); CheckBox openSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Open), true); openSelection.addValueChangeListener(valueChangeEvent -> { if (openSelection.getValue()) { searchCriteria.setOpen(new SearchField()); } else { searchCriteria.setOpen(null); } updateSearchStatus(); }); CheckBox overdueSelection = new CheckBox(UserUIContext.getMessage(StatusI18nEnum.Overdue), false); overdueSelection.addValueChangeListener(valueChangeEvent -> { if (overdueSelection.getValue()) { searchCriteria.setDueDate(new DateSearchField(DateTimeUtils.getCurrentDateWithoutMS().toLocalDate(), DateSearchField.LESS_THAN)); } else { searchCriteria.setDueDate(null); } updateSearchStatus(); }); Label spacingLbl1 = new Label(""); CheckBox taskSelection = new CheckBox(UserUIContext.getMessage(TaskI18nEnum.LIST), true); taskSelection.addValueChangeListener(valueChangeEvent -> updateTypeSearchStatus(taskSelection.getValue(), ProjectTypeConstants.TASK)); CheckBox bugSelection = new CheckBox(UserUIContext.getMessage(BugI18nEnum.LIST), true); bugSelection.addValueChangeListener(valueChangeEvent -> updateTypeSearchStatus(bugSelection.getValue(), ProjectTypeConstants.BUG)); CheckBox riskSelection = new CheckBox(UserUIContext.getMessage(RiskI18nEnum.LIST), true); riskSelection.addValueChangeListener(valueChangeEvent -> updateTypeSearchStatus(riskSelection.getValue(), ProjectTypeConstants.RISK)); header.with(openSelection, overdueSelection, spacingLbl1, taskSelection, bugSelection, riskSelection) .withAlign(openSelection, Alignment.MIDDLE_LEFT).withAlign(overdueSelection, Alignment.MIDDLE_LEFT) .withAlign(taskSelection, Alignment.MIDDLE_LEFT).withAlign(bugSelection, Alignment.MIDDLE_LEFT) .withAlign(riskSelection, Alignment.MIDDLE_LEFT).expand(spacingLbl1); assignmentsLayout = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowRenderer()); this.with(header, assignmentsLayout); searchCriteria = new ProjectTicketSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setOpen(new SearchField()); searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.TASK, ProjectTypeConstants.RISK)); searchCriteria.setMilestoneId(new NumberSearchField(beanItem.getId())); updateSearchStatus(); }
Example 14
Source File: ToggleMilestoneSummaryField.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
ToggleMilestoneSummaryField(final SimpleMilestone milestone, int maxLength, boolean toggleStatusSupport, boolean isDeleteSupport) { this.milestone = milestone; this.maxLength = maxLength; this.setWidth("100%"); this.addStyleName("editable-field"); if (toggleStatusSupport && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) { toggleStatusSelect = new CheckBox(); toggleStatusSelect.setValue(milestone.isCompleted()); this.addComponent(toggleStatusSelect); this.addComponent(ELabel.EMPTY_SPACE()); displayTooltip(); toggleStatusSelect.addValueChangeListener(valueChangeEvent -> { if (milestone.isCompleted()) { milestone.setStatus(MilestoneStatus.InProgress.name()); titleLinkLbl.removeStyleName(WebThemes.LINK_COMPLETED); } else { milestone.setStatus(MilestoneStatus.Closed.name()); titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED); } displayTooltip(); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestoneService.updateSelectiveWithSession(milestone, UserUIContext.getUsername()); ProjectTicketSearchCriteria searchCriteria = new ProjectTicketSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.RISK, ProjectTypeConstants.TASK)); searchCriteria.setMilestoneId(NumberSearchField.equal(milestone.getId())); searchCriteria.setOpen(new SearchField()); ProjectTicketService genericTaskService = AppContextUtil.getSpringBean(ProjectTicketService.class); int openAssignmentsCount = genericTaskService.getTotalCount(searchCriteria); if (openAssignmentsCount > 0) { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, AppUI.getSiteName()), UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { genericTaskService.closeSubAssignmentOfMilestone(milestone.getId()); } }); } }); } titleLinkLbl = ELabel.h3(buildMilestoneLink()).withStyleName(WebThemes.LABEL_WORD_WRAP).withUndefinedWidth(); this.addComponent(titleLinkLbl); buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)).withStyleName("toggle"); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) { MButton instantEditBtn = new MButton("", clickEvent -> { if (isRead) { ToggleMilestoneSummaryField.this.removeComponent(titleLinkLbl); ToggleMilestoneSummaryField.this.removeComponent(buttonControls); final MTextField editField = new MTextField(milestone.getName()).withFullWidth(); editField.focus(); ToggleMilestoneSummaryField.this.addComponent(editField); ToggleMilestoneSummaryField.this.removeStyleName("editable-field"); editField.addShortcutListener(new ShortcutListener("enter", ShortcutAction.KeyCode.ENTER, (int[]) null) { @Override public void handleAction(Object sender, Object target) { updateFieldValue(editField); } }); editField.addBlurListener(blurEvent -> updateFieldValue(editField)); isRead = !isRead; } }).withDescription(UserUIContext.getMessage(MilestoneI18nEnum.OPT_EDIT_PHASE_NAME)) .withIcon(VaadinIcons.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); buttonControls.with(instantEditBtn); } if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES)) { MButton removeBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { AppContextUtil.getSpringBean(MilestoneService.class).removeWithSession(milestone, UserUIContext.getUsername(), AppUI.getAccountId()); TicketRowRender rowRenderer = UIUtils.getRoot(ToggleMilestoneSummaryField.this, TicketRowRender.class); if (rowRenderer != null) { rowRenderer.selfRemoved(); } EventBusFactory.getInstance().post(new MilestoneEvent.MilestoneDeleted(this, milestone.getId())); } }); }).withIcon(VaadinIcons.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); buttonControls.with(removeBtn); } if (buttonControls.getComponentCount() > 0) { this.addComponent(buttonControls); } }
Example 15
Source File: ToggleTaskSummaryField.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
public ToggleTaskSummaryField(SimpleTask task, int maxLength, boolean toggleStatusSupport, boolean canRemove) { this.setWidth("100%"); this.maxLength = maxLength; this.task = task; titleLinkLbl = ELabel.html(buildTaskLink()).withUndefinedWidth().withStyleName(WebThemes.LABEL_WORD_WRAP); if (toggleStatusSupport && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { toggleStatusSelect = new CheckBox(); toggleStatusSelect.setValue(task.isCompleted()); displayTooltip(); toggleStatusSelect.addValueChangeListener(valueChangeEvent -> { if (task.isCompleted()) { task.setStatus(StatusI18nEnum.Open.name()); task.setPercentagecomplete(0d); titleLinkLbl.removeStyleName(WebThemes.LINK_COMPLETED); } else { task.setStatus(StatusI18nEnum.Closed.name()); task.setPercentagecomplete(100d); titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED); } displayTooltip(); TaskService taskService = AppContextUtil.getSpringBean(TaskService.class); taskService.updateWithSession(task, UserUIContext.getUsername()); if (StatusI18nEnum.Closed.name().equals(task.getStatus())) { Integer countOfOpenSubTasks = taskService.getCountOfOpenSubTasks(task.getId()); if (countOfOpenSubTasks > 0) { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, AppUI.getSiteName()), UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { taskService.massUpdateTaskStatuses(task.getId(), StatusI18nEnum.Closed.name(), AppUI.getAccountId()); } }); } } }); this.withComponents(toggleStatusSelect, ELabel.EMPTY_SPACE()); } this.addComponent(titleLinkLbl); buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)).withStyleName("toggle"); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { this.addStyleName("editable-field"); MButton instantEditBtn = new MButton("", clickEvent -> { if (isRead) { ToggleTaskSummaryField.this.removeComponent(titleLinkLbl); ToggleTaskSummaryField.this.removeComponent(buttonControls); final TextField editField = new TextField(); editField.setValue(task.getName()); editField.setWidth("100%"); editField.focus(); ToggleTaskSummaryField.this.addComponent(editField); ToggleTaskSummaryField.this.removeStyleName("editable-field"); editField.addShortcutListener(new ShortcutListener("enter", ShortcutAction.KeyCode.ENTER, (int[]) null) { @Override public void handleAction(Object sender, Object target) { updateFieldValue(editField); } }); editField.addBlurListener(blurEvent -> updateFieldValue(editField)); isRead = !isRead; } }).withIcon(VaadinIcons.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); instantEditBtn.setDescription(UserUIContext.getMessage(TaskI18nEnum.OPT_EDIT_TASK_NAME)); buttonControls.with(instantEditBtn); } if (canRemove && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)) { MButton removeBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { AppContextUtil.getSpringBean(TaskService.class).removeWithSession(task, UserUIContext.getUsername(), AppUI.getAccountId()); TicketRowRender rowRenderer = UIUtils.getRoot(ToggleTaskSummaryField.this, TicketRowRender.class); if (rowRenderer != null) { rowRenderer.selfRemoved(); } EventBusFactory.getInstance().post(new TaskEvent.TaskDeleted(this, task.getId())); } }); }).withIcon(VaadinIcons.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); buttonControls.with(removeBtn); } if (buttonControls.getComponentCount() > 0) { this.addComponent(buttonControls); } }