use of javafx.beans.property.SimpleBooleanProperty in project TestFX by TestFX.
the class DebugUtilsTest method runCodeBlock.
@Test
public void runCodeBlock() {
// given:
SimpleBooleanProperty prop = new SimpleBooleanProperty(false);
// when:
getThrownErrorPostMapper(runCode(() -> prop.set(true)));
// then:
assertThat(prop.get(), is(true));
}
use of javafx.beans.property.SimpleBooleanProperty in project TestFX by TestFX.
the class WaitForAsyncUtilsTest method waitFor_with_booleanValue.
@Test
public void waitFor_with_booleanValue() throws Exception {
// given:
BooleanProperty property = new SimpleBooleanProperty(false);
// when:
WaitForAsyncUtils.async(() -> {
WaitForAsyncUtils.sleepWithException(50, MILLISECONDS);
property.set(true);
return null;
});
// then:
WaitForAsyncUtils.waitFor(250, MILLISECONDS, property);
}
use of javafx.beans.property.SimpleBooleanProperty in project TestFX by TestFX.
the class WaitForAsyncUtilsTest method waitFor_with_booleanValue_with_false.
@Test
public void waitFor_with_booleanValue_with_false() throws Exception {
// given:
BooleanProperty property = new SimpleBooleanProperty(false);
// when:
WaitForAsyncUtils.async(() -> {
WaitForAsyncUtils.sleepWithException(50, MILLISECONDS);
property.set(false);
return null;
});
// then:
exception.expect(TimeoutException.class);
WaitForAsyncUtils.waitFor(250, MILLISECONDS, property);
}
use of javafx.beans.property.SimpleBooleanProperty in project VocabHunter by VocabHunter.
the class WordStateHandler method initialise.
public void initialise(final Button buttonUnseen, final Button buttonKnown, final Button buttonUnknown, final SessionModel sessionModel, final ObjectBinding<WordState> wordStateProperty, final Runnable nextWordSelector) {
this.sessionModel = sessionModel;
this.nextWordSelector = nextWordSelector;
SimpleBooleanProperty editableProperty = sessionModel.editableProperty();
BooleanBinding resettableProperty = editableProperty.and(notEqual(WordState.UNSEEN, wordStateProperty));
buttonUnseen.visibleProperty().bind(resettableProperty);
buttonKnown.visibleProperty().bind(editableProperty);
buttonUnknown.visibleProperty().bind(editableProperty);
buttonUnseen.setOnAction(e -> processResponse(WordState.UNSEEN, false));
buttonKnown.setOnAction(e -> processResponse(WordState.KNOWN, true));
buttonUnknown.setOnAction(e -> processResponse(WordState.UNKNOWN, true));
}
use of javafx.beans.property.SimpleBooleanProperty in project jgnash by ccavanaugh.
the class RecurringViewController method initialize.
@FXML
private void initialize() {
tableView.setClipBoardStringFunction(this::reminderToExcel);
tableView.setTableMenuButtonVisible(true);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
// hide the horizontal scrollbar and prevent ghosting
tableView.getStylesheets().addAll(StyleClass.HIDE_HORIZONTAL_CSS);
final TableColumn<Reminder, String> descriptionColumn = new TableColumn<>(resources.getString("Column.Description"));
descriptionColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDescription()));
tableView.getColumns().add(descriptionColumn);
final TableColumn<Reminder, String> accountColumn = new TableColumn<>(resources.getString("Column.Account"));
accountColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDescription()));
accountColumn.setCellValueFactory(param -> {
if (param.getValue().getAccount() != null) {
return new SimpleObjectProperty<>(param.getValue().getAccount().toString());
}
return null;
});
tableView.getColumns().add(accountColumn);
final TableColumn<Reminder, BigDecimal> amountColumn = new TableColumn<>(resources.getString("Column.Amount"));
amountColumn.setCellValueFactory(param -> {
if (param.getValue().getTransaction() != null) {
return new SimpleObjectProperty<>(param.getValue().getTransaction().getAmount(param.getValue().getAccount()));
}
return null;
});
amountColumn.setCellFactory(param -> new ReminderBigDecimalTableCell());
tableView.getColumns().add(amountColumn);
final TableColumn<Reminder, String> frequencyColumn = new TableColumn<>(resources.getString("Column.Freq"));
frequencyColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getReminderType().toString()));
tableView.getColumns().add(frequencyColumn);
final TableColumn<Reminder, Boolean> enabledColumn = new TableColumn<>(resources.getString("Column.Enabled"));
enabledColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue().isEnabled()));
enabledColumn.setCellFactory(CheckBoxTableCell.forTableColumn(enabledColumn));
tableView.getColumns().add(enabledColumn);
final TableColumn<Reminder, LocalDate> lastPosted = new TableColumn<>(resources.getString("Column.LastPosted"));
lastPosted.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getLastDate()));
lastPosted.setCellFactory(cell -> new ShortDateTableCell<>());
tableView.getColumns().add(lastPosted);
final TableColumn<Reminder, LocalDate> due = new TableColumn<>(resources.getString("Column.Due"));
due.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getIterator().next()));
due.setCellFactory(cell -> new ShortDateTableCell<>());
tableView.getColumns().add(due);
sortedReminderList.comparatorProperty().bind(tableView.comparatorProperty());
tableView.setItems(sortedReminderList);
selectedReminder.bind(tableView.getSelectionModel().selectedItemProperty());
// bind enabled state of the buttons to the selected reminder property
deleteButton.disableProperty().bind(Bindings.isNull(selectedReminder));
modifyButton.disableProperty().bind(Bindings.isNull(selectedReminder));
nowButton.disableProperty().bind(Bindings.isNull(selectedReminder));
MessageBus.getInstance().registerListener(this, MessageChannel.SYSTEM, MessageChannel.REMINDER);
JavaFXUtils.runLater(this::loadTable);
startTimer(true);
// Update the period when the snooze value changes
snoozePeriodListener = (observable, oldValue, newValue) -> {
stopTimer();
// while the dialog is up.
if (!dialogShowing.get()) {
startTimer(false);
}
};
Options.reminderSnoozePeriodProperty().addListener(new WeakChangeListener<>(snoozePeriodListener));
}
Aggregations