use of javafx.beans.property.SimpleBooleanProperty in project Smartcity-Smarthouse by TechnionYP5777.
the class SendMessageController method addStringField.
private void addStringField(String fieldName) {
ObservableList<String> s = FXCollections.observableArrayList();
Label label = new Label(fieldName + ":");
TableView<String> table = new TableView<>(s);
TableColumn<String, String> valueCol = new TableColumn<String, String>("Value");
valueCol.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue()));
TableColumn<String, Boolean> deleteCol = new TableColumn<String, Boolean>();
deleteCol.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue() != null));
deleteCol.setCellFactory(p -> {
final ButtonCell $ = new ButtonCell();
$.setAction(__1 -> s.remove($.getTableView().getItems().get($.getIndex())));
$.setAlignment(Pos.CENTER);
return $;
});
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
table.setPrefSize(100, 100);
table.getColumns().setAll(Arrays.asList(valueCol, deleteCol));
Group group = new Group(table);
VBox.setVgrow(group, Priority.NEVER);
TextField addValue = new TextField();
Button addButton = new Button("Add");
addButton.setOnAction(__1 -> {
s.add(addValue.getText());
addValue.clear();
});
HBox hb = new HBox(addValue, addButton);
hb.setSpacing(3);
VBox vbox = new VBox(label, table, hb);
vbox.setSpacing(5);
vbox.setPadding(new Insets(10, 0, 0, 10));
mainPane.getChildren().add(vbox);
consumers.add(l -> {
if (!s.isEmpty())
l.put(fieldName, s);
else {
this.encounterdIssue = true;
issues.add("in " + fieldName + " must contain at least one String");
}
});
}
use of javafx.beans.property.SimpleBooleanProperty 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.SimpleBooleanProperty in project trex-stateless-gui by cisco-system-traffic-generator.
the class ConnectDialogController method initialize.
@Override
public void initialize(URL url, ResourceBundle rb) {
initializeConnections();
isConnectionInProgress = new SimpleBooleanProperty(false);
isConnectionInProgress.addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
if (newValue != null) {
mainViewContainer.setDisable(newValue);
mainViewContainer.getScene().setCursor(newValue ? Cursor.WAIT : Cursor.DEFAULT);
}
});
timeoutField.textProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue.matches("\\d*")) {
timeoutField.setText(newValue.replaceAll("[^\\d]", ""));
}
});
}
use of javafx.beans.property.SimpleBooleanProperty in project dolphin-platform by canoo.
the class FXBinderTest method testJavaFXBooleanBidirectional.
@Test
public void testJavaFXBooleanBidirectional() {
Property<Boolean> booleanDolphinProperty = new MockedProperty<>();
BooleanProperty booleanJavaFXProperty = new SimpleBooleanProperty();
booleanDolphinProperty.set(true);
assertNotEquals(booleanJavaFXProperty.get(), true);
Binding binding = FXBinder.bind(booleanJavaFXProperty).bidirectionalTo(booleanDolphinProperty);
assertEquals(booleanJavaFXProperty.get(), true);
booleanDolphinProperty.set(false);
assertEquals(booleanJavaFXProperty.get(), false);
booleanDolphinProperty.set(null);
assertEquals(booleanJavaFXProperty.get(), false);
booleanJavaFXProperty.set(true);
assertEquals(booleanDolphinProperty.get().booleanValue(), true);
booleanJavaFXProperty.setValue(null);
assertEquals(booleanDolphinProperty.get().booleanValue(), false);
binding.unbind();
booleanDolphinProperty.set(true);
assertEquals(booleanJavaFXProperty.get(), false);
}
use of javafx.beans.property.SimpleBooleanProperty in project dolphin-platform by canoo.
the class FXBinderTest method testJavaFXBooleanUnidirectional.
@Test
public void testJavaFXBooleanUnidirectional() {
Property<Boolean> booleanDolphinProperty = new MockedProperty<>();
BooleanProperty booleanJavaFXProperty = new SimpleBooleanProperty();
WritableBooleanValue writableBooleanValue = new SimpleBooleanProperty();
booleanDolphinProperty.set(true);
assertNotEquals(booleanJavaFXProperty.get(), true);
Binding binding = FXBinder.bind(booleanJavaFXProperty).to(booleanDolphinProperty);
assertEquals(booleanJavaFXProperty.get(), true);
booleanDolphinProperty.set(false);
assertEquals(booleanJavaFXProperty.get(), false);
booleanDolphinProperty.set(null);
assertEquals(booleanJavaFXProperty.get(), false);
binding.unbind();
booleanDolphinProperty.set(true);
assertEquals(booleanJavaFXProperty.get(), false);
binding = FXBinder.bind(writableBooleanValue).to(booleanDolphinProperty);
assertEquals(writableBooleanValue.get(), true);
booleanDolphinProperty.set(false);
assertEquals(writableBooleanValue.get(), false);
booleanDolphinProperty.set(null);
assertEquals(writableBooleanValue.get(), false);
binding.unbind();
booleanDolphinProperty.set(true);
assertEquals(writableBooleanValue.get(), false);
}
Aggregations