final ProjectDAO pDao = factory.getProjectDAO();
projectButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
Project p = null;
try {
p = pDao.getProjectByProjectID(
Integer.parseInt(projects.getItem(projects.getValue())
.getItemProperty("Project ID").toString())
);
me.getApplication().getMainWindow().setContent(new ProjectPageUI(user, p));
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProjectNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
ArrayList<Project> projectArray = null;
try {
projectArray = pDao.getProjectsByUser(user);
System.out.println(projectArray.get(0).getProjectName());
projects.addContainerProperty("Project ID", String.class, null);
projects.addContainerProperty("Project Name", String.class, null);
for (int i = 0; i < projectArray.size(); i++) {
Project p = projectArray.get(i);
projects.addItem(
new Object[] { Integer.toString(p.getProjectID()),
p.getProjectName() }, i);
}
projects.setVisibleColumns(new Object[] { "Project Name" });
} catch (DAOException e) {
// this.getApplication().getMainWindow().showNotification("Error connecting to Database");
e.printStackTrace();