Search in sources :

Example 31 with SimpleBooleanProperty

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));
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Test(org.junit.Test)

Example 32 with SimpleBooleanProperty

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);
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Test(org.junit.Test)

Example 33 with SimpleBooleanProperty

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);
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Test(org.junit.Test)

Example 34 with SimpleBooleanProperty

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));
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) BooleanBinding(javafx.beans.binding.BooleanBinding)

Example 35 with SimpleBooleanProperty

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));
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) PendingReminder(jgnash.engine.recurring.PendingReminder) Reminder(jgnash.engine.recurring.Reminder) TableColumn(javafx.scene.control.TableColumn) LocalDate(java.time.LocalDate) BigDecimal(java.math.BigDecimal) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FXML(javafx.fxml.FXML)

Aggregations

SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)46 BooleanProperty (javafx.beans.property.BooleanProperty)22 Test (org.junit.Test)7 FXCollections (javafx.collections.FXCollections)6 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)5 FXML (javafx.fxml.FXML)5 UserThread (bisq.common.UserThread)4 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)4 Binding (com.canoo.platform.core.functional.Binding)4 ReadOnlyStringWrapper (javafx.beans.property.ReadOnlyStringWrapper)4 P2PServiceListener (bisq.network.p2p.P2PServiceListener)3 CloseConnectionReason (bisq.network.p2p.network.CloseConnectionReason)3 Connection (bisq.network.p2p.network.Connection)3 ConnectionListener (bisq.network.p2p.network.ConnectionListener)3 Arrays (java.util.Arrays)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 StringProperty (javafx.beans.property.StringProperty)3 ChangeListener (javafx.beans.value.ChangeListener)3 TableColumn (javafx.scene.control.TableColumn)3 Inject (javax.inject.Inject)3