use of javafx.beans.property.SimpleStringProperty in project dolphin-platform by canoo.
the class FXBinderTest method testJavaFXStringBidirectionalWithConverter.
@Test
public void testJavaFXStringBidirectionalWithConverter() {
Property<Double> doubleDolphinProperty = new MockedProperty<>();
StringProperty stringJavaFXProperty = new SimpleStringProperty();
Converter<String, Double> doubleStringConverter = s -> s == null ? null : Double.parseDouble(s);
Converter<Double, String> stringDoubleConverter = d -> d == null ? null : d.toString();
BidirectionalConverter<Double, String> doubleStringBidirectionalConverter = new DefaultBidirectionalConverter<>(stringDoubleConverter, doubleStringConverter);
doubleDolphinProperty.set(0.1);
assertNotEquals(stringJavaFXProperty.get(), "0.1");
Binding binding = FXBinder.bind(stringJavaFXProperty).bidirectionalTo(doubleDolphinProperty, doubleStringBidirectionalConverter);
assertEquals(stringJavaFXProperty.get(), "0.1");
doubleDolphinProperty.set(0.2);
assertEquals(stringJavaFXProperty.get(), "0.2");
doubleDolphinProperty.set(null);
assertEquals(stringJavaFXProperty.get(), null);
stringJavaFXProperty.set("0.1");
assertEquals(doubleDolphinProperty.get(), 0.1);
stringJavaFXProperty.setValue("0.2");
assertEquals(doubleDolphinProperty.get(), 0.2);
binding.unbind();
doubleDolphinProperty.set(0.3);
assertEquals(stringJavaFXProperty.get(), "0.2");
}
use of javafx.beans.property.SimpleStringProperty in project dolphin-platform by canoo.
the class FXWrapper method wrapStringProperty.
/**
* Create a JavaFX {@link javafx.beans.property.StringProperty} as a wrapper for a dolphin platform property
*
* @param dolphinProperty the dolphin platform property
* @return the JavaFX property
*/
public static StringProperty wrapStringProperty(final Property<String> dolphinProperty) {
Assert.requireNonNull(dolphinProperty, "dolphinProperty");
StringProperty property = new SimpleStringProperty();
FXBinder.bind(property).bidirectionalTo(dolphinProperty);
return property;
}
use of javafx.beans.property.SimpleStringProperty in project Smartcity-Smarthouse by TechnionYP5777.
the class ConfigConsumer method initPathDataAddingRegion.
private void initPathDataAddingRegion(final SystemCore model) {
titleField.setPromptText(titlefDefaultText);
// path fields
table.setItems(tableData);
nameCol.setCellValueFactory(new PropertyValueFactory<NamedPath, String>("name"));
pathCol.setCellValueFactory(new PropertyValueFactory<NamedPath, String>("path"));
cancelCol.setCellValueFactory(namedpath -> new SimpleStringProperty(""));
cancelCol.setCellFactory(namedpath -> new ButtonCell());
sysPathsComboBox.setItems(FXCollections.observableArrayList(getAvailablePaths(model.getFileSystem())));
sysPathsComboBox.getItems().set(0, pathscbDefaultText);
sysPathsComboBox.getSelectionModel().selectFirst();
sysPathsComboBox.setOnMouseClicked(e -> addPathBtn.setVisible(true));
setDefaultText(nameField, namefDefaultText);
nameField.setOnMouseClicked(e -> addPathBtn.setVisible(true));
addPathBtn.setOnMouseClicked(e -> {
if (sysPathsComboBox.getSelectionModel().getSelectedIndex() != 0) {
tableData.add(new NamedPath(nameField.getText(), sysPathsComboBox.getSelectionModel().getSelectedItem()));
addPathBtn.setVisible(false);
}
});
setDefaultText(unitField, unitfDefaultText);
}
use of javafx.beans.property.SimpleStringProperty in project cryptomator by cryptomator.
the class VaultModuleTest method setup.
@BeforeEach
public void setup(@TempDir Path tmpDir) {
Mockito.when(vaultSettings.mountName()).thenReturn(Bindings.createStringBinding(() -> "TEST"));
Mockito.when(vaultSettings.usesReadOnlyMode()).thenReturn(new SimpleBooleanProperty(true));
Mockito.when(vaultSettings.displayName()).thenReturn(new SimpleStringProperty("Vault"));
System.setProperty("user.home", tmpDir.toString());
}
use of javafx.beans.property.SimpleStringProperty in project trex-stateless-gui by cisco-system-traffic-generator.
the class InterfaceSelectDialogController method initTableView.
private void initTableView() {
propertyNameColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getKey()));
propertyValueColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getValue()));
}
Aggregations