Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.save.employee.maintenance; import com.save.model.MaintenanceReimbursement; import com.save.service.MRService; import com.save.employee.serviceprovider.MRServiceImpl; import com.save.utilities.CommonUtilities; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.server.FontAwesome; /** * * @author jetdario */ public class MRDataContainer extends IndexedContainer { MRService mrs = new MRServiceImpl(); private int employeeId; public MRDataContainer(int employeeId) { this.employeeId = employeeId; addContainerProperty("plate no.", String.class, null); addContainerProperty("amount", Double.class, null); addContainerProperty("date", String.class, null); addContainerProperty("type", String.class, null); addContainerProperty("edit", String.class, null); addContainerProperty("del", String.class, null); addContainerProperty("id", String.class, null); for (MaintenanceReimbursement mr : mrs.getMaintenanceReimbursementByEmployee(getEmployeeId())) { Item item = getItem(addItem()); item.getItemProperty("plate no.").setValue(mr.getPlateNo()); item.getItemProperty("amount").setValue(mr.getAmount()); item.getItemProperty("date") .setValue(CommonUtilities.convertDateWithFormat(mr.getDateCovered().toString(), "yyyy-MMM-dd")); item.getItemProperty("type").setValue(mr.getFormType()); item.getItemProperty("edit").setValue(FontAwesome.PENCIL.getHtml()); item.getItemProperty("del").setValue(FontAwesome.TRASH_O.getHtml()); item.getItemProperty("id").setValue(String.valueOf(mr.getMaintenanceId())); } } int getEmployeeId() { return employeeId; } }