if(getDlgResult() == ModalDialog.DLG_CANCEL) {
return null;
} else if(oneDayBtn.isSelected()) {
SheduleHolidayDetails details = new SheduleHolidayDetails();
details.day = (Integer)day.getSelectedItem();
details.month = (Integer)month.getSelectedItem();
details.description = description.getText();
return details;
} else if(periodDayBtn.isSelected()) {
try {
GregorianCalendar gcb = (GregorianCalendar) GregorianCalendar.getInstance();
gcb.set(Calendar.DAY_OF_MONTH, (Integer)dayBegin.getSelectedItem());
gcb.set(Calendar.MONTH, (Integer)monthBegin.getSelectedItem()-1);
GregorianCalendar gce = (GregorianCalendar) GregorianCalendar.getInstance();
gce.set(Calendar.DAY_OF_MONTH, (Integer)dayEnd.getSelectedItem());
gce.set(Calendar.MONTH, (Integer)monthEnd.getSelectedItem()-1);
if(gce.get(Calendar.DAY_OF_YEAR) >= gcb.get(Calendar.DAY_OF_YEAR)
&& index <= gce.get(Calendar.DAY_OF_YEAR) - gcb.get(Calendar.DAY_OF_YEAR)) {
gcb.add(Calendar.DAY_OF_YEAR, index);
SheduleHolidayDetails details = new SheduleHolidayDetails();
details.day = gcb.get(Calendar.DAY_OF_MONTH);
details.month = gcb.get(Calendar.MONTH)+1;
details.description = description.getText();
return details;
}