本文整理汇总了Java中net.sf.memoranda.EventsManager.REPEAT_DAILY属性的典型用法代码示例。如果您正苦于以下问题:Java EventsManager.REPEAT_DAILY属性的具体用法?Java EventsManager.REPEAT_DAILY怎么用?Java EventsManager.REPEAT_DAILY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.sf.memoranda.EventsManager
的用法示例。
在下文中一共展示了EventsManager.REPEAT_DAILY属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateEvents
private void updateEvents(EventDialog dlg, int hh, int mm, String text) {
int rtype;
int period;
CalendarDate sd = new CalendarDate((Date) dlg.startDate.getModel().getValue());
CalendarDate ed = null;
if (dlg.enableEndDateCB.isSelected())
ed = new CalendarDate((Date) dlg.endDate.getModel().getValue());
if (dlg.dailyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_DAILY;
period = (Integer) dlg.daySpin.getModel().getValue();
} else if (dlg.weeklyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_WEEKLY;
period = dlg.weekdaysCB.getSelectedIndex() + 1;
if (Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
if (period == 7) period = 1;
else period++;
}
} else if (dlg.yearlyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_YEARLY;
period = sd.getCalendar().get(Calendar.DAY_OF_YEAR);
if ((sd.getYear() % 4) == 0 && sd.getCalendar().get(Calendar.DAY_OF_YEAR) > 60) period--;
} else {
rtype = EventsManager.REPEAT_MONTHLY;
period = (Integer) dlg.dayOfMonthSpin.getModel().getValue();
}
EventsManager.createRepeatableEvent(rtype, sd, ed, period, hh, mm, text, dlg.workingDaysOnlyCB.isSelected());
}
示例2: editEventB_actionPerformed_part1
void editEventB_actionPerformed_part1(int rep, EventDialog dlg, net.sf.memoranda.Event ev) {
if (rep > 0) {
dlg.startDate.getModel().setValue(ev.getStartDate().getDate());
if (rep == EventsManager.REPEAT_DAILY) {
dlg.dailyRepeatRB.setSelected(true);
dlg.dailyRepeatRB_actionPerformed(null);
dlg.daySpin.setValue(new Integer(ev.getPeriod()));
} else if (rep == EventsManager.REPEAT_WEEKLY) {
dlg.weeklyRepeatRB.setSelected(true);
dlg.weeklyRepeatRB_actionPerformed(null);
int d = ev.getPeriod() - 1;
if (Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
d--;
if (d < 0) {
d = 6;
}
}
dlg.weekdaysCB.setSelectedIndex(d);
} else if (rep == EventsManager.REPEAT_MONTHLY) {
dlg.monthlyRepeatRB.setSelected(true);
dlg.monthlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
} else if (rep == EventsManager.REPEAT_YEARLY) {
dlg.yearlyRepeatRB.setSelected(true);
dlg.yearlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
if (ev.getEndDate() != null) {
dlg.endDate.getModel().setValue(ev.getEndDate().getDate());
dlg.enableEndDateCB.setSelected(true);
dlg.enableEndDateCB_actionPerformed(null);
}
if (ev.getWorkingDays()) {
dlg.workingDaysOnlyCB.setSelected(true);
}
}
}
示例3: updateEvents
private void updateEvents(EventDialog dlg, int hh, int mm, String text) {
int rtype;
int period;
CalendarDate sd = new CalendarDate((Date) dlg.startDate.getModel().getValue());
CalendarDate ed = null;
if (dlg.enableEndDateCB.isSelected()) {
ed = new CalendarDate((Date) dlg.endDate.getModel().getValue());
}
if (dlg.dailyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_DAILY;
period = ((Integer) dlg.daySpin.getModel().getValue()).intValue();
} else if (dlg.weeklyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_WEEKLY;
period = dlg.weekdaysCB.getSelectedIndex() + 1;
if (Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
if (period == 7) {
period = 1;
} else {
period++;
}
}
} else if (dlg.yearlyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_YEARLY;
period = sd.getCalendar().get(Calendar.DAY_OF_YEAR);
if ((sd.getYear() % 4) == 0 && sd.getCalendar().get(Calendar.DAY_OF_YEAR) > 60) {
period--;
}
} else {
rtype = EventsManager.REPEAT_MONTHLY;
period = ((Integer) dlg.dayOfMonthSpin.getModel().getValue()).intValue();
}
EventsManager.createRepeatableEvent(rtype, sd, ed, period, hh, mm, text, dlg.workingDaysOnlyCB.isSelected());
}
示例4: updateEvents
private void updateEvents(EventDialog dlg, int hh, int mm, String text) {
int rtype;
int period;
CalendarDate sd = new CalendarDate((Date) dlg.startDate.getModel().getValue());
CalendarDate ed = null;
if (dlg.enableEndDateCB.isSelected())
ed = new CalendarDate((Date) dlg.endDate.getModel().getValue());
if (dlg.dailyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_DAILY;
period = ((Integer) dlg.daySpin.getModel().getValue()).intValue();
}
else if (dlg.weeklyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_WEEKLY;
period = dlg.weekdaysCB.getSelectedIndex() + 1;
if (Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
if(period==7) period=1;
else period++;
}
}
else if (dlg.yearlyRepeatRB.isSelected()) {
rtype = EventsManager.REPEAT_YEARLY;
period = sd.getCalendar().get(Calendar.DAY_OF_YEAR);
if((sd.getYear() % 4) == 0 && sd.getCalendar().get(Calendar.DAY_OF_YEAR) > 60) period--;
}
else {
rtype = EventsManager.REPEAT_MONTHLY;
period = ((Integer) dlg.dayOfMonthSpin.getModel().getValue()).intValue();
}
EventsManager.createRepeatableEvent(rtype, sd, ed, period, hh, mm, text, dlg.workingDaysOnlyCB.isSelected());
}
示例5: editEventB_actionPerformed
void editEventB_actionPerformed(ActionEvent e) {
EventDialog dlg = new EventDialog(App.getFrame(), Local.getString("Event"));
net.sf.memoranda.Event ev =
(net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
dlg.timeSpin.getModel().setValue(ev.getTime());
/*if (new CalendarDate(ev.getTime()).equals(CalendarDate.today()))
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(new Date());
else
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(CalendarDate.today().getDate());
((SpinnerDateModel)dlg.timeSpin.getModel()).setEnd(CalendarDate.tomorrow().getDate());*/
dlg.textField.setText(ev.getText());
int rep = ev.getRepeat();
if (rep > 0) {
dlg.startDate.getModel().setValue(ev.getStartDate().getDate());
if (rep == EventsManager.REPEAT_DAILY) {
dlg.dailyRepeatRB.setSelected(true);
dlg.dailyRepeatRB_actionPerformed(null);
dlg.daySpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_WEEKLY) {
dlg.weeklyRepeatRB.setSelected(true);
dlg.weeklyRepeatRB_actionPerformed(null);
int d = ev.getPeriod() - 1;
if(Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
d--;
if(d<0) d=6;
}
dlg.weekdaysCB.setSelectedIndex(d);
}
else if (rep == EventsManager.REPEAT_MONTHLY) {
dlg.monthlyRepeatRB.setSelected(true);
dlg.monthlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_YEARLY) {
dlg.yearlyRepeatRB.setSelected(true);
dlg.yearlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
if (ev.getEndDate() != null) {
dlg.endDate.getModel().setValue(ev.getEndDate().getDate());
dlg.enableEndDateCB.setSelected(true);
dlg.enableEndDateCB_actionPerformed(null);
}
if(ev.getWorkingDays()) {
dlg.workingDaysOnlyCB.setSelected(true);
}
}
Dimension frmSize = App.getFrame().getSize();
Point loc = App.getFrame().getLocation();
dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);
dlg.setVisible(true);
if (dlg.CANCELLED)
return;
EventsManager.removeEvent(ev);
Calendar calendar = new GregorianCalendar(Local.getCurrentLocale()); //Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
calendar.setTime(((Date)dlg.timeSpin.getModel().getValue()));//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int hh = calendar.get(Calendar.HOUR_OF_DAY);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int mm = calendar.get(Calendar.MINUTE);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
//int hh = ((Date) dlg.timeSpin.getModel().getValue()).getHours();
//int mm = ((Date) dlg.timeSpin.getModel().getValue()).getMinutes();
String text = dlg.textField.getText();
if (dlg.noRepeatRB.isSelected())
EventsManager.createEvent(CurrentDate.get(), hh, mm, text);
else {
updateEvents(dlg,hh,mm,text);
}
saveEvents();
}
示例6: editEventB_actionPerformed
void editEventB_actionPerformed(ActionEvent e) {
EventDialog dlg = new EventDialog(App.getFrame(), Local.getString("Event"));
net.sf.memoranda.Event ev =
(net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
dlg.timeSpin.getModel().setValue(ev.getTime());
/*if (new CalendarDate(ev.getTime()).equals(CalendarDate.today()))
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(new Date());
else
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(CalendarDate.today().getDate());
((SpinnerDateModel)dlg.timeSpin.getModel()).setEnd(CalendarDate.tomorrow().getDate());*/
dlg.textField.setText(ev.getText());
int rep = ev.getRepeat();
if (rep > 0) {
dlg.startDate.getModel().setValue(ev.getStartDate().getDate());
if (rep == EventsManager.REPEAT_DAILY) {
dlg.dailyRepeatRB.setSelected(true);
dlg.dailyRepeatRB_actionPerformed(null);
dlg.daySpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_WEEKLY) {
dlg.weeklyRepeatRB.setSelected(true);
dlg.weeklyRepeatRB_actionPerformed(null);
int d = ev.getPeriod() - 1;
if(Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
d--;
if(d<0) d=6;
}
dlg.weekdaysCB.setSelectedIndex(d);
}
else if (rep == EventsManager.REPEAT_MONTHLY) {
dlg.monthlyRepeatRB.setSelected(true);
dlg.monthlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_YEARLY) {
dlg.yearlyRepeatRB.setSelected(true);
dlg.yearlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
if (ev.getEndDate() != null) {
dlg.endDate.getModel().setValue(ev.getEndDate().getDate());
dlg.enableEndDateCB.setSelected(true);
dlg.enableEndDateCB_actionPerformed(null);
}
if(ev.getWorkingDays()) {
dlg.workingDaysOnlyCB.setSelected(true);
}
}
Dimension frmSize = App.getFrame().getSize();
Point loc = App.getFrame().getLocation();
dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);
dlg.setVisible(true);
if (dlg.CANCELLED)
return;
EventsManager.removeEvent(ev);
Calendar calendar = new GregorianCalendar(Local.getCurrentLocale()); //Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
calendar.setTime(((Date)dlg.timeSpin.getModel().getValue()));//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
//JOSH CHANGED THIS
int hh = calendar.get(Calendar.AM_PM);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int mm = calendar.get(Calendar.MINUTE);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
//int hh = ((Date) dlg.timeSpin.getModel().getValue()).getHours();
//int mm = ((Date) dlg.timeSpin.getModel().getValue()).getMinutes();
String text = dlg.textField.getText();
if (dlg.noRepeatRB.isSelected())
EventsManager.createEvent(CurrentDate.get(), hh, mm, text);
else {
updateEvents(dlg,hh,mm,text);
}
saveEvents();
}
示例7: editEventB_actionPerformed
void editEventB_actionPerformed(ActionEvent e) {
EventDialog dlg = new EventDialog(App.getFrame(), Local.getString("Event"));
net.sf.memoranda.Event ev =
(net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
dlg.timeSpin.getModel().setValue(ev.getTime());
/*if (new CalendarDate(ev.getTime()).equals(CalendarDate.today()))
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(new Date());
else
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(CalendarDate.today().getDate());
((SpinnerDateModel)dlg.timeSpin.getModel()).setEnd(CalendarDate.tomorrow().getDate());*/
dlg.textField.setText(ev.getText());
int rep = ev.getRepeat();
if (rep > 0) {
dlg.startDate.getModel().setValue(ev.getStartDate().getDate());
if (rep == EventsManager.REPEAT_DAILY) {
dlg.dailyRepeatRB.setSelected(true);
dlg.dailyRepeatRB_actionPerformed(null);
dlg.daySpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_WEEKLY) {
dlg.weeklyRepeatRB.setSelected(true);
dlg.weeklyRepeatRB_actionPerformed(null);
int d = ev.getPeriod() - 1;
if(Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
d--;
if(d<0) d=6;
}
dlg.weekdaysCB.setSelectedIndex(d);
}
else if (rep == EventsManager.REPEAT_MONTHLY) {
dlg.monthlyRepeatRB.setSelected(true);
dlg.monthlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_YEARLY) {
dlg.yearlyRepeatRB.setSelected(true);
dlg.yearlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
if (ev.getEndDate() != null) {
dlg.endDate.getModel().setValue(ev.getEndDate().getDate());
dlg.enableEndDateCB.setSelected(true);
dlg.enableEndDateCB_actionPerformed(null);
}
if(ev.getWorkingDays()) {
dlg.workingDaysOnlyCB.setSelected(true);
}
}
Dimension frmSize = App.getFrame().getSize();
Point loc = App.getFrame().getLocation();
dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);
dlg.setVisible(true);
if (dlg.CANCELLED)
return;
EventsManager.removeEvent(ev);
Calendar calendar = new GregorianCalendar(Local.getCurrentLocale()); //Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
calendar.setTime(((Date)dlg.timeSpin.getModel().getValue()));//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int hh = calendar.get(Calendar.HOUR_OF_DAY);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int mm = calendar.get(Calendar.MINUTE);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
//int hh = ((Date) dlg.timeSpin.getModel().getValue()).getHours();
//int mm = ((Date) dlg.timeSpin.getModel().getValue()).getMinutes();
String text = dlg.textField.getText();
Boolean smsSelected = dlg.selectSMS.isSelected();
if (dlg.noRepeatRB.isSelected())
EventsManager.createEvent(CurrentDate.get(), hh, mm, text, smsSelected);
else {
updateEvents(dlg,hh,mm,text, smsSelected);
}
saveEvents();
}
示例8: editEventB_actionPerformed
void editEventB_actionPerformed(ActionEvent e) {
EventDialog dlg = new EventDialog(App.getFrame(), Local.getString("Event"));
net.sf.memoranda.Event ev =
(net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
dlg.timeSpin.getModel().setValue(ev.getTime());
/*if (new CalendarDate(ev.getTime()).equals(CalendarDate.today()))
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(new Date());
else
((SpinnerDateModel)dlg.timeSpin.getModel()).setStart(CalendarDate.today().getDate());
((SpinnerDateModel)dlg.timeSpin.getModel()).setEnd(CalendarDate.tomorrow().getDate());*/
dlg.textField.setText(ev.getText());
int rep = ev.getRepeat();
if (rep > 0) {
dlg.startDate.getModel().setValue(ev.getStartDate().getDate());
if (rep == EventsManager.REPEAT_DAILY) {
dlg.dailyRepeatRB.setSelected(true);
dlg.dailyRepeatRB_actionPerformed(null);
dlg.daySpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_WEEKLY) {
dlg.weeklyRepeatRB.setSelected(true);
dlg.weeklyRepeatRB_actionPerformed(null);
int d = ev.getPeriod() - 1;
if(Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
d--;
if(d<0) d=6;
}
dlg.weekdaysCB.setSelectedIndex(d);
}
else if (rep == EventsManager.REPEAT_MONTHLY) {
dlg.monthlyRepeatRB.setSelected(true);
dlg.monthlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_YEARLY) {
dlg.yearlyRepeatRB.setSelected(true);
dlg.yearlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
if (ev.getEndDate() != null) {
dlg.endDate.getModel().setValue(ev.getEndDate().getDate());
dlg.enableEndDateCB.setSelected(true);
dlg.enableEndDateCB_actionPerformed(null);
}
if(ev.getWorkingDays()) {
dlg.workingDaysOnlyCB.setSelected(true);
}
}
Dimension frmSize = App.getFrame().getSize();
Point loc = App.getFrame().getLocation();
dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);
dlg.setVisible(true);
if (dlg.CANCELLED)
return;
EventsManager.removeEvent(ev);
Calendar calendar = new GregorianCalendar(Local.getCurrentLocale()); //Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
calendar.setTime(((Date)dlg.timeSpin.getModel().getValue()));//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int hh = calendar.get(Calendar.HOUR_OF_DAY);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int mm = calendar.get(Calendar.MINUTE);//Fix deprecated methods to get hours
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
//int hh = ((Date) dlg.timeSpin.getModel().getValue()).getHours();
//int mm = ((Date) dlg.timeSpin.getModel().getValue()).getMinutes();
String text = dlg.textField.getText();
if (dlg.noRepeatRB.isSelected())
EventsManager.createEvent(CurrentDate.get(), hh, mm, text);
else {
updateEvents(dlg,hh,mm,text);
}
saveEvents();
}
示例9: editEventB_actionPerformed
private void editEventB_actionPerformed(ActionEvent e) {
EventDialog dlg = new EventDialog(App.getFrame(), Local.getString("Event"));
net.sf.memoranda.Event ev =
(net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
dlg.timeSpin.getModel().setValue(ev.getTime());
dlg.textField.setText(ev.getText());
int rep = ev.getRepeat();
if (rep > 0) {
dlg.startDate.getModel().setValue(ev.getStartDate().getDate());
if (rep == EventsManager.REPEAT_DAILY) {
dlg.dailyRepeatRB.setSelected(true);
dlg.dailyRepeatRB_actionPerformed();
dlg.daySpin.setValue(ev.getPeriod());
} else if (rep == EventsManager.REPEAT_WEEKLY) {
dlg.weeklyRepeatRB.setSelected(true);
dlg.weeklyRepeatRB_actionPerformed();
int d = ev.getPeriod() - 1;
if (Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
d--;
if (d < 0) d = 6;
}
dlg.weekdaysCB.setSelectedIndex(d);
} else if (rep == EventsManager.REPEAT_MONTHLY) {
dlg.monthlyRepeatRB.setSelected(true);
dlg.monthlyRepeatRB_actionPerformed();
dlg.dayOfMonthSpin.setValue(ev.getPeriod());
} else if (rep == EventsManager.REPEAT_YEARLY) {
dlg.yearlyRepeatRB.setSelected(true);
dlg.yearlyRepeatRB_actionPerformed();
dlg.dayOfMonthSpin.setValue(ev.getPeriod());
}
if (ev.getEndDate() != null) {
dlg.endDate.getModel().setValue(ev.getEndDate().getDate());
dlg.enableEndDateCB.setSelected(true);
dlg.enableEndDateCB_actionPerformed(null);
}
if (ev.getWorkingDays()) {
dlg.workingDaysOnlyCB.setSelected(true);
}
}
Dimension frmSize = App.getFrame().getSize();
Point loc = App.getFrame().getLocation();
dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);
dlg.setVisible(true);
if (dlg.CANCELLED)
return;
EventsManager.removeEvent(ev);
Calendar startCalendar = new GregorianCalendar(Local.getCurrentLocale());
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
startCalendar.setTime(((Date) dlg.timeSpin.getModel().getValue()));
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int start_hour = startCalendar.get(Calendar.HOUR_OF_DAY);
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
int start_minute = startCalendar.get(Calendar.MINUTE);
//by (jcscoobyrs) 14-Nov-2003 at 10:24:38 AM
Calendar endCalendar = new GregorianCalendar(Local.getCurrentLocale());
endCalendar.setTime(((Date) dlg.durationSpin.getModel().getValue()));
int endHour = endCalendar.get(Calendar.HOUR_OF_DAY);
int endMinute = endCalendar.get(Calendar.MINUTE);
String text = dlg.textField.getText();
if (dlg.noRepeatRB.isSelected())
EventsManager.createEvent(CurrentDate.get(), start_hour, start_minute, endHour, endMinute, text);
else {
updateEvents(dlg, start_hour, start_minute, text);
}
saveEvents();
}
示例10: editEventB_actionPerformed
void editEventB_actionPerformed(ActionEvent e) {
EventDialog dlg = new EventDialog(App.getFrame(), Local.getString("Event"));
net.sf.memoranda.Event ev =
(net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
dlg.timeSpin.getModel().setValue(ev.getTime());
dlg.textField.setText(ev.getText());
int rep = ev.getRepeat();
if (rep > 0) {
dlg.startDate.getModel().setValue(ev.getStartDate().getDate());
if (rep == EventsManager.REPEAT_DAILY) {
dlg.dailyRepeatRB.setSelected(true);
dlg.dailyRepeatRB_actionPerformed(null);
dlg.daySpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_WEEKLY) {
dlg.weeklyRepeatRB.setSelected(true);
dlg.weeklyRepeatRB_actionPerformed(null);
int d = ev.getPeriod() - 1;
if(Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
d--;
if(d<0) d=6;
}
dlg.weekdaysCB.setSelectedIndex(d);
}
else if (rep == EventsManager.REPEAT_MONTHLY) {
dlg.monthlyRepeatRB.setSelected(true);
dlg.monthlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
else if (rep == EventsManager.REPEAT_YEARLY) {
dlg.yearlyRepeatRB.setSelected(true);
dlg.yearlyRepeatRB_actionPerformed(null);
dlg.dayOfMonthSpin.setValue(new Integer(ev.getPeriod()));
}
if (ev.getEndDate() != null) {
dlg.endDate.getModel().setValue(ev.getEndDate().getDate());
dlg.enableEndDateCB.setSelected(true);
dlg.enableEndDateCB_actionPerformed(null);
}
if(ev.getWorkingDays()) {
dlg.workingDaysOnlyCB.setSelected(true);
}
Vector<CalendarDate> exceptionDates = ev.getExceptionDates();
if(exceptionDates.size() > 0) {
for(int i = 0; i < exceptionDates.size(); i++ ) {
SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT);
CalendarDate exceptionDate = exceptionDates.get(i);
dlg.exceptionModel.addElement( exceptionDate.getMonth() + "/" + exceptionDate.getDay() + "/" + exceptionDate.getYear() );
}
}
}
Dimension frmSize = App.getFrame().getSize();
Point loc = App.getFrame().getLocation();
dlg.setLocation((frmSize.width - dlg.getSize().width) / 2 + loc.x, (frmSize.height - dlg.getSize().height) / 2 + loc.y);
dlg.setVisible(true);
if (dlg.CANCELLED)
return;
EventsManager.removeEvent(ev);
Calendar calendar = new GregorianCalendar(Local.getCurrentLocale());
calendar.setTime(((Date)dlg.timeSpin.getModel().getValue()));
int hh = calendar.get(Calendar.HOUR_OF_DAY);
int mm = calendar.get(Calendar.MINUTE);
String text = dlg.textField.getText();
if (dlg.noRepeatRB.isSelected()) {
EventsManager.createEvent(CurrentDate.get(), hh, mm, text);
} else {
EventsManager.buildRecurringEvent(dlg,hh,mm,text);
}
saveEvents();
}
示例11: updateEvents
private void updateEvents(EventDialog dialog, int hour, int minute, String text) {
int repeatType;
int period;
CalendarDate startDate = new CalendarDate((Date) dialog.startDate.getModel().getValue());
CalendarDate endDate = null;
if (dialog.enableEndDateCB.isSelected())
endDate = new CalendarDate((Date) dialog.endDate.getModel().getValue());
if (dialog.minutelyRepeatRB.isSelected()) {
repeatType = EventsManager.REPEAT_MINUTELY;
period = (Integer) dialog.minuteSpin.getModel().getValue();
} else if (dialog.hourlyRepeatRB.isSelected()) {
repeatType = EventsManager.REPEAT_HOURLY;
period = (Integer) dialog.hourSpin.getModel().getValue();
} else if (dialog.dailyRepeatRB.isSelected()) {
repeatType = EventsManager.REPEAT_DAILY;
period = (Integer) dialog.daySpin.getModel().getValue();
} else if (dialog.weeklyRepeatRB.isSelected()) {
repeatType = EventsManager.REPEAT_WEEKLY;
period = dialog.weekdaysCB.getSelectedIndex() + 1;
if (Configuration.get("FIRST_DAY_OF_WEEK").equals("mon")) {
if (period == 7)
period = 1;
else
period++;
}
} else if (dialog.yearlyRepeatRB.isSelected()) {
repeatType = EventsManager.REPEAT_YEARLY;
period = startDate.getCalendar().get(Calendar.DAY_OF_YEAR);
if ((startDate.getYear() % 4) == 0 && startDate.getCalendar().get(Calendar.DAY_OF_YEAR) > 60)
period--;
} else {
repeatType = EventsManager.REPEAT_MONTHLY;
period = (Integer) dialog.dayOfMonthSpin.getModel().getValue();
}
EventsManager.createRepeatableEvent(repeatType, startDate, endDate, period, hour, minute, text, dialog.workingDaysOnlyCB.isSelected());
}