TimeTableModel tableModel = null;
SheduleIndividualLocal sil = new SheduleIndividualLocal(collaborator);
WeekIndex weekIndex = new WeekIndex(day);
JTimeTable table = new JTimeTable();
if (sil.daySelector(weekIndex, dayOfWeek).hasNext()) {
tableModel = new SheduleTemplateTableModel(sil, weekIndex, getAuditManager());
table.setDay(day);
System.out.println("TimeTable set day to " + day + " week:" + weekIndex);
} else {
WeekIndex planWeekIndex = new WeekIndex(weekIndex.getIndex() % sil.getWeekCount());
tableModel = new SheduleTemplateTableModel(sil, planWeekIndex, getAuditManager());
Day planDay = planWeekIndex.getDay(dayOfWeek);
table.setDay(planDay);
System.out.println("PlanTimeTable set day to " + planDay + " week:" + planWeekIndex);
}
JTableRuler ruler = new JTableRuler(scaler);
table.setScaler(scaler);
table.setReadOnly(true);
int shiftBegin = di.getClinicShiftBegin().getMilliseconds();
int shiftEnd = di.getClinicShiftEnd().getMilliseconds();
table.setShiftBegin(shiftBegin);
table.setShiftEnd(shiftEnd);
ruler.setShiftBegin(shiftBegin);
ruler.setShiftEnd(shiftEnd);
table.setModel(tableModel);
planPlacement.setLayout(new BorderLayout(0, 0));
planPlacement.add(ruler, java.awt.BorderLayout.WEST);
planPlacement.add(table, java.awt.BorderLayout.CENTER);
}