Mutiny bindings for JavaFX
<dependency>
<groupId>com.mulgish</groupId>
<artifactId>mutinyfx</artifactId>
<version>1.0.0</version>
</dependency>
FxMulti.createFrom().observableValue(observableValue);
FxMulti.createFrom().observableList(observableList);
FxMulti.createFrom().observableSet(observableSet);
FxMulti.createFrom().observableMap(observableMap);
Observing list additions
FxMulti.createFrom().observableList(observableList)
.filter(ListChangeListener.Change::wasAdded)
.subscribe().with((change) -> {
System.out.println("Item(s) added: "+change.getAddedSubList());
});
Observing user input every 200ms
FxMulti.createFrom().observableValue(textField)
.group().intoMultis().every(Duration.ofMillis(200))
.onItem().transformToMulti(items->items.select().last()).merge()
.subscribe().with((change) -> {
System.out.println("User entered: "+change.getNewValue());
});