本文整理汇总了Java中net.sf.memoranda.EventsManager.removeEvent方法的典型用法代码示例。如果您正苦于以下问题:Java EventsManager.removeEvent方法的具体用法?Java EventsManager.removeEvent怎么用?Java EventsManager.removeEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.memoranda.EventsManager
的用法示例。
在下文中一共展示了EventsManager.removeEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
void removeEventB_actionPerformed(ActionEvent e) {
String msg;
net.sf.memoranda.Event ev;
if(eventsTable.getSelectedRows().length > 1)
msg = Local.getString("Remove") + " " + eventsTable.getSelectedRows().length
+ " " + Local.getString("events") + "\n" + Local.getString("Are you sure?");
else {
ev = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
msg = Local.getString("Remove event") + "\n'"
+ ev.getText() + "'\n" + Local.getString("Are you sure?");
}
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Remove event"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) return;
for(int i=0; i< eventsTable.getSelectedRows().length;i++) {
ev = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRows()[i], EventsTable.EVENT);
EventsManager.removeEvent(ev);
}
eventsTable.getSelectionModel().clearSelection();
/* CurrentStorage.get().storeEventsManager();
eventsTable.refresh();
EventsScheduler.init();
parentPanel.calendar.jnCalendar.updateUI();
parentPanel.updateIndicators();
*/ saveEvents();
}
示例2: removeEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
void removeEventB_actionPerformed(ActionEvent e) {
String msg;
HashMap<String,Event> evs = new HashMap<String,Event>();
for(int i=0; i< eventsTable.getSelectedRows().length;i++) {
for(int j = 0;j<eventsTable.getSelectedColumns().length;j++){
Event ev = eventsTable.getEventAt(eventsTable.getSelectedRows()[i], eventsTable.getSelectedColumns()[j]);
if(ev != null && !evs.containsKey(ev.getId())) evs.put(ev.getId(),ev);
}
}
if(evs.size() == 0) return;
msg = Local.getString("Remove ") + evs.size() + Local.getString(" event(s)") + "\n" + Local.getString("Are you sure?");
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Remove event"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) return;
for(Event eo:evs.values())
EventsManager.removeEvent(eo);
eventsTable.getSelectionModel().clearSelection();
saveEvents();
}
示例3: removeEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
private void removeEventB_actionPerformed(ActionEvent e) {
String msg;
net.sf.memoranda.Event ev;
if (eventsTable.getSelectedRows().length > 1)
msg = Local.getString("Remove") + " " + eventsTable.getSelectedRows().length
+ " " + Local.getString("events") + "\n" + Local.getString("Are you sure?");
else {
ev = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
msg = Local.getString("Remove event") + "\n'"
+ ev.getText() + "'\n" + Local.getString("Are you sure?");
}
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Remove event"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) return;
for (int i = 0; i < eventsTable.getSelectedRows().length; i++) {
ev = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRows()[i], EventsTable.EVENT);
EventsManager.removeEvent(ev);
}
eventsTable.getSelectionModel().clearSelection();
saveEvents();
}
示例4: deleteB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
public void deleteB_actionPerformed(ActionEvent e) {
if (event != null) {
EventsManager.removeEvent(event);
EventsScheduler.notifyChanged();
CurrentStorage.get().storeEventsManager();
}
else if (task != null) {
CurrentProject.getTaskList().removeTask(task);
TaskPanel.notifyTaskListListeners();
}
}
示例5: testEventRemoval
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
@Test
public void testEventRemoval() {
//event 1
EventsManager.removeEvent(e1);
//event 2
EventsManager.removeEvent(e2);
//event 3
EventsManager.removeEvent(e3);
}
示例6: removeEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
void removeEventB_actionPerformed(ActionEvent e) {
String msg;
net.sf.memoranda.Event ev;
if (eventsTable.getSelectedRows().length > 1) {
msg = Local.getString("Remove") + " " + eventsTable.getSelectedRows().length + " "
+ Local.getString("events") + "\n" + Local.getString("Are you sure?");
} else {
ev = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(eventsTable.getSelectedRow(),
EventsTable.EVENT);
msg = Local.getString("Remove event") + "\n'" + ev.getText() + "'\n" + Local.getString("Are you sure?");
}
int n = JOptionPane.showConfirmDialog(App.getFrame(), msg, Local.getString("Remove event"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) {
return;
}
for (int i = 0; i < eventsTable.getSelectedRows().length; i++) {
ev = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(eventsTable.getSelectedRows()[i],
EventsTable.EVENT);
EventsManager.removeEvent(ev);
}
eventsTable.getSelectionModel().clearSelection();
/*
* CurrentStorage.get().storeEventsManager(); eventsTable.refresh();
* EventsScheduler.init(); parentPanel.calendar.jnCalendar.updateUI();
* parentPanel.updateIndicators();
*/ saveEvents();
}
示例7: editEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
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();
}
示例8: editEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
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();
}
示例9: editEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
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();
}
示例10: editEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
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();
}
示例11: editEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
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();
}
示例12: editEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
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();
}
示例13: testEventEdit
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
@Test
public void testEventEdit() {
//event 1
EventsManager.removeEvent(e1);
//event 2
EventsManager.removeEvent(e2);
//event 3
EventsManager.removeEvent(e3);
//date declarations
d1 = new CalendarDate(9,2,2016);
d2 = new CalendarDate(4,3,2016);
d3 = new CalendarDate(1,5,2016);
//hour declarations
hh1 = 5;
hh2 = 12;
hh3 = 9;
//minute declarations
mm1 = 59;
mm2 = 22;
mm3 = 17;
//text declarations
text1 = "This is text 1 edited!";
text2 = "This is text 2 edited!";
text3 = "This is text 3 edited!";
//event declarations
e1 = EventsManager.createEvent(d1, hh1, mm1, text1);
e2 = EventsManager.createEvent(d2, hh2, mm2, text2);
e3 = EventsManager.createEvent(d3, hh3, mm3, text3);
//event 1
assert(EventsManager.getEvent(d1, hh1, mm1) == e1);
assert(EventsManager.getEvent(d1, hh1, mm1).getText().equals(e1.getText()));
//event 2
assert(EventsManager.getEvent(d2, hh2, mm2) == e2);
assert(EventsManager.getEvent(d2, hh2, mm2).getText().equals(e2.getText()));
//event 3
assert(EventsManager.getEvent(d3, hh3, mm3) == e3);
assert(EventsManager.getEvent(d3, hh3, mm3).getText().equals(e3.getText()));
}
示例14: editEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
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();
editEventB_actionPerformed_part1(rep, dlg, ev);
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();
}
示例15: removeEventB_actionPerformed
import net.sf.memoranda.EventsManager; //导入方法依赖的package包/类
void removeEventB_actionPerformed(ActionEvent actionEvent) {
String message;
net.sf.memoranda.Event event;
if (eventsTable.getSelectedRows().length > 1)
message = Local.getString("Remove")
+ " "
+ eventsTable.getSelectedRows().length
+ " "
+ Local.getString("events")
+ "\n" + Local.getString("Are you sure?");
else {
event = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRow(),
EventsTable.EVENT);
message = Local.getString("Remove event")
+ "\n'"
+ event.getText()
+ "'\n"
+ Local.getString("Are you sure?");
}
int confirmation = JOptionPane.showConfirmDialog(
App.getFrame(), message, Local.getString("Remove event"),
JOptionPane.YES_NO_OPTION);
if (confirmation != JOptionPane.YES_OPTION)
return;
for (int i = 0; i < eventsTable.getSelectedRows().length; i++) {
event = (net.sf.memoranda.Event) eventsTable.getModel().getValueAt(
eventsTable.getSelectedRows()[i], EventsTable.EVENT);
EventsManager.removeEvent(event);
}
eventsTable.getSelectionModel().clearSelection();
/* CurrentStorage.get().storeEventsManager();
eventsTable.refresh();
EventsScheduler.init();
parentPanel.calendar.jnCalendar.updateUI();
parentPanel.updateIndicators();
*/
saveEvents();
}