return (NurseRoster) solutionBusiness.getSolution();
}
public void resetPanel() {
removeAll();
NurseRoster nurseRoster = getNurseRoster();
gridLayout.setColumns(nurseRoster.getShiftDateList().size() + 1);
JLabel headerCornerLabel = new JLabel("E \\ SD");
headerCornerLabel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(Color.DARK_GRAY),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
headerCornerLabel.setBackground(HEADER_COLOR);
headerCornerLabel.setOpaque(true);
add(headerCornerLabel);
for (ShiftDate shiftDate : nurseRoster.getShiftDateList()) {
JLabel shiftDateLabel = new JLabel(shiftDate.getLabel());
shiftDateLabel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(Color.DARK_GRAY),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
shiftDateLabel.setBackground(HEADER_COLOR);
shiftDateLabel.setOpaque(true);
add(shiftDateLabel);
}
Map<Employee, Map<ShiftDate, EmployeeShiftDatePanel>> employeeShiftDatePanelMap = new HashMap<Employee, Map<ShiftDate, EmployeeShiftDatePanel>>();
for (Employee employee : nurseRoster.getEmployeeList()) {
JLabel employeeLabel = new JLabel(employee.toString());
employeeLabel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(Color.DARK_GRAY),
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
employeeLabel.setBackground(HEADER_COLOR);
employeeLabel.setOpaque(true);
add(employeeLabel);
Map<ShiftDate, EmployeeShiftDatePanel> shiftDatePanelMap = new HashMap<ShiftDate, EmployeeShiftDatePanel>();
employeeShiftDatePanelMap.put(employee, shiftDatePanelMap);
for (ShiftDate shiftDate : nurseRoster.getShiftDateList()) {
EmployeeShiftDatePanel employeeShiftDatePanel = new EmployeeShiftDatePanel();
if (employee.getContract().getWeekendDefinition().isWeekend(shiftDate.getDayOfWeek())) {
employeeShiftDatePanel.setBackground(Color.LIGHT_GRAY);
}
employeeShiftDatePanel.setToolTipText("employee " + employee.getCode()
+ " on dayIndex " + shiftDate.getDayIndex());
add(employeeShiftDatePanel);
shiftDatePanelMap.put(shiftDate, employeeShiftDatePanel);
}
}
if (nurseRoster.isInitialized()) {
for (Assignment assignment : nurseRoster.getAssignmentList()) {
Employee employee = assignment.getEmployee();
EmployeeShiftDatePanel employeeShiftDatePanel = employeeShiftDatePanelMap.get(employee).get(assignment.getShiftDate());
employeeShiftDatePanel.addAssignment(assignment);
}
}