Java tutorial
/** * This file is part of mycollab-mobile. * * mycollab-mobile 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-mobile 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-mobile. If not, see <http://www.gnu.org/licenses/>. */ package com.esofthead.mycollab.mobile.module.crm.view.account; import com.esofthead.mycollab.core.arguments.NumberSearchField; import com.esofthead.mycollab.core.arguments.SearchField; import com.esofthead.mycollab.mobile.module.crm.view.cases.CaseListDisplay; import com.esofthead.mycollab.mobile.ui.AbstractRelatedListView; import com.esofthead.mycollab.module.crm.domain.Account; import com.esofthead.mycollab.module.crm.domain.SimpleCase; import com.esofthead.mycollab.module.crm.domain.criteria.CaseSearchCriteria; import com.esofthead.mycollab.module.crm.i18n.CaseI18nEnum; import com.esofthead.mycollab.vaadin.AppContext; import com.vaadin.ui.Button; import com.vaadin.ui.Component; public class AccountRelatedCaseView extends AbstractRelatedListView<SimpleCase, CaseSearchCriteria> { private static final long serialVersionUID = -4559344487784697088L; private Account account; public AccountRelatedCaseView() { initUI(); } private void initUI() { this.setCaption(AppContext.getMessage(CaseI18nEnum.M_TITLE_RELATED_CASES)); itemList = new CaseListDisplay(); this.setContent(itemList); } public void displayCases(final Account account) { this.account = account; loadCases(); } private void loadCases() { final CaseSearchCriteria criteria = new CaseSearchCriteria(); criteria.setSaccountid(new NumberSearchField(SearchField.AND, AppContext.getAccountId())); criteria.setAccountId(new NumberSearchField(SearchField.AND, account.getId())); setSearchCriteria(criteria); } @Override public void refresh() { loadCases(); } @Override protected Component createRightComponent() { Button addCase = new Button(); addCase.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent arg0) { fireNewRelatedItem(""); } }); addCase.setStyleName("add-btn"); return addCase; } }