}
}
public void init_tab2() throws DAOException, ResourceNotFoundException, ResourceNotBookedException {
DAOFactory df = DAOFactory.getInstance();
BookingDAO bookDAO = df.getBookingDAO();
ResourceDAO resourceDAO = df.getResourceDAO();
ProjectDAO proDAO = df.getProjectDAO();
ArrayList<Project> projectList = proDAO.getProjectsByUser(user);
Resource userResource = resourceDAO.getResourceByUser(user);
int min,max = 0;
Booking bMinMax = bookDAO.getMinBookingByResource(userResource);
min = bMinMax.getWeek();
bMinMax = bookDAO.getMaxBookingByResource(userResource);
max = bMinMax.getWeek();
{
jobs.addContainerProperty("Project", String.class, null);
for(int i = min; i <= max; i++) {
String s = "Week " + Integer.toString(i);
jobs.addContainerProperty(s, String.class, null);
}
for(int j = 0; j < projectList.size(); j++) {
String[] obj = new String[max - min + 2];
obj[0] = projectList.get(j).getProjectName();
int i = 1;
for(int it = min; it <= max; it++) {
Booking b = bookDAO.getBookingByResourceIDAndProjectIDAndWeek(userResource.getResourceID(),projectList.get(j).getProjectID(), i);
obj[i] = Float.toString(b.getRatio());
i++;
}
jobs.addItem(obj,j);
}