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.request; import com.save.model.LiquidationForm; import com.save.service.RLService; import com.save.employee.serviceprovider.RLServiceImpl; import com.save.utilities.CommonUtilities; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.server.FontAwesome; import java.util.Date; /** * * @author jetdario */ public class RLDataContainer extends IndexedContainer { RLService rls = new RLServiceImpl(); private int employeeId; public RLDataContainer(int employeeId) { this.employeeId = employeeId; addContainerProperty("control no.", String.class, null); addContainerProperty("reimbursement", Double.class, null); // addContainerProperty("area", Integer.class, null); addContainerProperty("activity", String.class, null); addContainerProperty("date", String.class, null); addContainerProperty("venue", String.class, null); addContainerProperty("edit", String.class, null); addContainerProperty("liquidate", String.class, null); addContainerProperty("view", String.class, null); addContainerProperty("del", String.class, null); addContainerProperty("id", Integer.class, null); for (LiquidationForm lf : rls.getAllRLByEmployeeId(getEmployeeId())) { Item item = getItem(addItem()); item.getItemProperty("control no.").setValue(lf.getControlNo()); item.getItemProperty("reimbursement").setValue(lf.getReimbursedAmount()); // item.getItemProperty("area").setValue(lf.getAreaCode()); item.getItemProperty("activity").setValue(lf.getActivity()); item.getItemProperty("date").setValue( CommonUtilities.convertDateWithFormat(lf.getDateOfActivity().toString(), "yyyy-MMM-dd")); item.getItemProperty("venue").setValue(lf.getVenue()); item.getItemProperty("edit").setValue(FontAwesome.PENCIL.getHtml()); item.getItemProperty("liquidate").setValue(FontAwesome.LEAF.getHtml()); item.getItemProperty("view").setValue(FontAwesome.EYE.getHtml()); item.getItemProperty("del").setValue(FontAwesome.TRASH_O.getHtml()); item.getItemProperty("id").setValue(lf.getRequestId()); } } int getEmployeeId() { return employeeId; } }