/** if the reminder instance is a todo, then mark it as done/complete */ @Override public void do_todo(boolean delete) { if (appt != null) try { AppointmentModel.getReference().do_todo(appt.getKey(), delete); } catch (Exception e) { Errmsg.getErrorHandler().errmsg(e); } }
/** * reload the model entity from the db and check if it has changed. * * @return true if the entity has changed in a way that affects reminders */ @Override public boolean reloadAndCheckForChanges() { try { Appointment origAppt = appt; appt = AppointmentModel.getReference().getAppt(appt.getKey()); if (appt == null) { return true; } if (!appt.getDate().equals(origAppt.getDate())) { // date changed - delete. new instance will be added on // periodic update return true; } // delete it if the text changed - will be added back in // periodic check for // popups if (!appt.getText().equals(origAppt.getText())) { return true; } if (isTodo()) { // skip if inst time changed for untimed todos Date nt = appt.getNextTodo(); if (nt == null) nt = appt.getDate(); if (!getInstanceTime().equals(nt)) { return true; } } } catch (Exception e) { // appt cannot be read, must have been deleted // this is an expected case when appointments are deleted appt = null; return true; } return false; }
/** return true if the reminder is a note (is untimed) */ @Override public boolean isNote() { if (appt != null) return AppointmentModel.isNote(appt); return false; }