Java tutorial
/** * This file is part of mycollab-web. * * mycollab-web is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * mycollab-web is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with mycollab-web. If not, see <http://www.gnu.org/licenses/>. */ package com.mycollab.module.project.view.task.components; import com.mycollab.common.domain.OptionVal; import com.mycollab.common.i18n.OptionI18nEnum; import com.mycollab.common.service.OptionValService; import com.mycollab.module.project.CurrentProjectVariables; import com.mycollab.module.project.ProjectTypeConstants; import com.mycollab.spring.AppContextUtil; import com.mycollab.vaadin.AppContext; import com.vaadin.ui.ListSelect; import java.util.List; /** * @author MyCollab Ltd * @since 5.1.1 */ public class TaskStatusListSelect extends ListSelect { public TaskStatusListSelect() { this.setItemCaptionMode(ItemCaptionMode.EXPLICIT); this.setNullSelectionAllowed(false); this.setMultiSelect(true); this.setRows(4); } @Override public void attach() { OptionValService optionValService = AppContextUtil.getSpringBean(OptionValService.class); List<OptionVal> options = optionValService.findOptionVals(ProjectTypeConstants.TASK, CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); for (OptionVal option : options) { this.addItem(option.getTypeval()); this.setItemCaption(option.getTypeval(), AppContext.getMessage(OptionI18nEnum.StatusI18nEnum.class, option.getTypeval())); } super.attach(); } }