}
private void initTable(Date start, Date end) throws DAOException,
ResourceNotFoundException {
DAOFactory df = DAOFactory.getInstance();
final ProjectDAO projectDao = df.getProjectDAO();
ResourceDAO resourceDao = df.getResourceDAO();
int startNum = Timestamp.toInt(start);
int endNum = Timestamp.toInt(end);
historyTable.addContainerProperty("ProjectID", Integer.class, null);
historyTable.addContainerProperty("Project Name", String.class, null);
historyTable.addContainerProperty("StartDate", String.class, null);
historyTable.addContainerProperty("Deadline", String.class, null);
SimpleDateFormat formatter = new SimpleDateFormat("dd/MMM/yyyy");
Resource u = null;
try {
u = resourceDao.getResourceByUser(user);
} catch (Exception e) {
}
ArrayList<Project> projectList = null;
if (manager) {
projectList = projectDao.getAllProjectsByTimeFrame(startNum, endNum);
} else {
projectList = projectDao
.getAllProjectsByResourceInTimeFrame(startNum, endNum,
u.getResourceID());
}
for (Project p : projectList) {
Object o[] = new Object[] { p.getProjectID(), p.getProjectName(),
formatter.format(p.getStartDate()),
formatter.format(p.getDeadLineDate()), };
historyTable.addItem(o, p.getProjectID());
}
historyTable.setSelectable(true);
historyTable.addListener(new ItemClickListener() {
/**
*
*/
private static final long serialVersionUID = -1551161219444664337L;
public void itemClick(ItemClickEvent event) {
if (event.isDoubleClick()) {
int i = (Integer) event.getItem()
.getItemProperty("ProjectID").getValue();
Project p = null;
try {
p = projectDao.getProjectByProjectID(i);
System.out.println(p.getProjectName());
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProjectNotFoundException e) {