defaultWorkingTime.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setWorkingHours(null);
CalendarService service=CalendarService.getInstance();
WorkingCalendar wc=form.getCalendar();
service.makeDefaultDays(wc,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays());
dirtyWorkingHours = false;
updateWorkingHours();
updateView();
clearLastSelection();
}});
nonWorking.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setWorkingHours(null);
CalendarService service=CalendarService.getInstance();
WorkingCalendar wc=form.getCalendar();
WorkingCalendar copy = wc.makeScratchCopy();
try {
// try on copy first
service.setDaysNonWorking(copy,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays());
service.setDaysNonWorking(wc,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays());
} catch (InvalidCalendarException e1) {
Alert.error(e1.getMessage(),ChangeWorkingTimeDialogBox.this);
return;
}
dirtyWorkingHours = false;
updateWorkingHours();
updateView();
clearLastSelection();
}});
working.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
CalendarService service=CalendarService.getInstance();
WorkingCalendar wc=form.getCalendar();
setWorkingHours(defaultWorkingHours);
WorkingCalendar copy = wc.makeScratchCopy();
try {
service.setDaysWorkingHours(copy,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays(),defaultWorkingHours);
service.setDaysWorkingHours(wc,sdCalendar.getSelectedFixedIntervals(), sdCalendar.getSelectedWeekDays(),defaultWorkingHours);
dirtyWorkingHours = false;
updateWorkingHours();
updateView();
} catch (WorkRangeException e1) {
e1.printStackTrace();