Search in sources :

Example 1 with DailyReminder

use of jgnash.engine.recurring.DailyReminder in project jgnash by ccavanaugh.

the class EngineTest method testReminders.

@Test
public void testReminders() throws IOException {
    assertEquals(0, e.getReminders().size());
    assertEquals(0, e.getPendingReminders().size());
    Reminder r = new DailyReminder();
    r.setIncrement(1);
    r.setEndDate(null);
    assertTrue(e.addReminder(r));
    assertEquals(1, e.getReminders().size());
    assertEquals(1, e.getPendingReminders().size());
    // close and reopen to force check for persistence
    closeEngine();
    e = EngineFactory.bootLocalEngine(testFile, EngineFactory.DEFAULT, EngineFactory.EMPTY_PASSWORD);
    assertEquals(e.getReminders().size(), 1);
    // remove a reminder
    e.removeReminder(e.getReminders().get(0));
    assertEquals(0, e.getReminders().size());
    assertEquals(0, e.getPendingReminders().size());
    // close and reopen to force check for persistence
    closeEngine();
    e = EngineFactory.bootLocalEngine(testFile, EngineFactory.DEFAULT, EngineFactory.EMPTY_PASSWORD);
    assertEquals(0, e.getReminders().size());
    assertEquals(0, e.getPendingReminders().size());
}
Also used : Reminder(jgnash.engine.recurring.Reminder) DailyReminder(jgnash.engine.recurring.DailyReminder) DailyReminder(jgnash.engine.recurring.DailyReminder) Test(org.junit.Test)

Example 2 with DailyReminder

use of jgnash.engine.recurring.DailyReminder in project jgnash by ccavanaugh.

the class DayTab method getReminder.

/**
     * @see jgnash.ui.recurring.RecurringTab#getReminder()
     */
@Override
public Reminder getReminder() {
    DailyReminder r = (DailyReminder) reminder;
    int inc = ((Number) numberSpinner.getValue()).intValue();
    LocalDate endDate = null;
    if (endButton.isSelected()) {
        endDate = endDateField.getLocalDate();
    }
    r.setIncrement(inc);
    r.setEndDate(endDate);
    return reminder;
}
Also used : DailyReminder(jgnash.engine.recurring.DailyReminder) LocalDate(java.time.LocalDate)

Example 3 with DailyReminder

use of jgnash.engine.recurring.DailyReminder in project jgnash by ccavanaugh.

the class DayTab method setReminder.

/**
     * @see jgnash.ui.recurring.RecurringTab#setReminder(jgnash.engine.recurring.Reminder)
     */
@Override
public void setReminder(final Reminder reminder) {
    assert reminder instanceof DailyReminder;
    this.reminder = reminder;
    DailyReminder r = (DailyReminder) reminder;
    numberSpinner.setValue(r.getIncrement());
    if (r.getEndDate() != null) {
        endDateField.setDate(r.getEndDate());
        endButton.setSelected(true);
    }
    updateForm();
}
Also used : DailyReminder(jgnash.engine.recurring.DailyReminder)

Example 4 with DailyReminder

use of jgnash.engine.recurring.DailyReminder in project jgnash by ccavanaugh.

the class DayTabController method initialize.

@FXML
void initialize() {
    super.initialize();
    reminder = new DailyReminder();
    numberSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 365, 1, 1));
}
Also used : DailyReminder(jgnash.engine.recurring.DailyReminder) SpinnerValueFactory(javafx.scene.control.SpinnerValueFactory) FXML(javafx.fxml.FXML)

Aggregations

DailyReminder (jgnash.engine.recurring.DailyReminder)4 LocalDate (java.time.LocalDate)1 FXML (javafx.fxml.FXML)1 SpinnerValueFactory (javafx.scene.control.SpinnerValueFactory)1 Reminder (jgnash.engine.recurring.Reminder)1 Test (org.junit.Test)1