use of javafx.beans.property.SimpleStringProperty in project dolphin-platform by canoo.
the class FXBinderTest method testUnidirectionalChain.
@Test
public void testUnidirectionalChain() {
Property<String> stringDolphinProperty1 = new MockedProperty<>();
StringProperty stringJavaFXProperty1 = new SimpleStringProperty();
Property<String> stringDolphinProperty2 = new MockedProperty<>();
StringProperty stringJavaFXProperty2 = new SimpleStringProperty();
Binding binding1 = FXBinder.bind(stringDolphinProperty1).to(stringJavaFXProperty1);
Binding binding2 = FXBinder.bind(stringJavaFXProperty2).to(stringDolphinProperty1);
Binding binding3 = FXBinder.bind(stringDolphinProperty2).to(stringJavaFXProperty2);
stringJavaFXProperty1.setValue("Hello");
assertEquals(stringDolphinProperty1.get(), "Hello");
assertEquals(stringDolphinProperty2.get(), "Hello");
assertEquals(stringJavaFXProperty1.get(), "Hello");
assertEquals(stringJavaFXProperty2.get(), "Hello");
binding2.unbind();
stringJavaFXProperty1.setValue("Hello World");
assertEquals(stringDolphinProperty1.get(), "Hello World");
assertEquals(stringDolphinProperty2.get(), "Hello");
assertEquals(stringJavaFXProperty1.get(), "Hello World");
assertEquals(stringJavaFXProperty2.get(), "Hello");
binding1.unbind();
binding3.unbind();
}
use of javafx.beans.property.SimpleStringProperty in project dolphin-platform by canoo.
the class FXBinderTest method testBidirectionalChain.
@Test
public void testBidirectionalChain() {
Property<String> stringDolphinProperty1 = new MockedProperty<>();
StringProperty stringJavaFXProperty1 = new SimpleStringProperty();
Property<String> stringDolphinProperty2 = new MockedProperty<>();
StringProperty stringJavaFXProperty2 = new SimpleStringProperty();
Binding binding1 = FXBinder.bind(stringDolphinProperty1).bidirectionalTo(stringJavaFXProperty1);
Binding binding2 = FXBinder.bind(stringJavaFXProperty2).bidirectionalTo(stringDolphinProperty1);
Binding binding3 = FXBinder.bind(stringDolphinProperty2).bidirectionalTo(stringJavaFXProperty2);
stringJavaFXProperty1.setValue("Hello");
assertEquals(stringDolphinProperty1.get(), "Hello");
assertEquals(stringDolphinProperty2.get(), "Hello");
assertEquals(stringJavaFXProperty1.get(), "Hello");
assertEquals(stringJavaFXProperty2.get(), "Hello");
stringDolphinProperty1.set("Hello World");
assertEquals(stringDolphinProperty1.get(), "Hello World");
assertEquals(stringDolphinProperty2.get(), "Hello World");
assertEquals(stringJavaFXProperty1.get(), "Hello World");
assertEquals(stringJavaFXProperty2.get(), "Hello World");
stringJavaFXProperty2.setValue("Hello");
assertEquals(stringDolphinProperty1.get(), "Hello");
assertEquals(stringDolphinProperty2.get(), "Hello");
assertEquals(stringJavaFXProperty1.get(), "Hello");
assertEquals(stringJavaFXProperty2.get(), "Hello");
stringDolphinProperty2.set("Hello World");
assertEquals(stringDolphinProperty1.get(), "Hello World");
assertEquals(stringDolphinProperty2.get(), "Hello World");
assertEquals(stringJavaFXProperty1.get(), "Hello World");
assertEquals(stringJavaFXProperty2.get(), "Hello World");
binding2.unbind();
stringJavaFXProperty1.setValue("Hello");
assertEquals(stringDolphinProperty1.get(), "Hello");
assertEquals(stringDolphinProperty2.get(), "Hello World");
assertEquals(stringJavaFXProperty1.get(), "Hello");
assertEquals(stringJavaFXProperty2.get(), "Hello World");
binding1.unbind();
binding3.unbind();
}
use of javafx.beans.property.SimpleStringProperty in project jvarkit by lindenb.
the class JvarkitCentral method start.
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Jvarkit-Central");
StackPane root = new StackPane();
root.setPadding(new Insets(2));
final TableView<Class<?>> tableView = new TableView<>();
final TableColumn<Class<?>, String> nameCol = new TableColumn<>("Name");
nameCol.setCellValueFactory(CB -> {
final String value;
Class<?> clazz = CB.getValue();
final Program program = clazz.getAnnotation(Program.class);
if (!Launcher.class.isAssignableFrom(clazz) || program == null) {
value = null;
} else {
value = program.name();
}
return new SimpleStringProperty(value);
});
final TableColumn<Class<?>, String> descCol = new TableColumn<>("Description");
descCol.setCellValueFactory(CB -> {
final String value;
Class<?> clazz = CB.getValue();
final Program program = clazz.getAnnotation(Program.class);
if (!Launcher.class.isAssignableFrom(clazz) || program == null) {
value = null;
} else {
value = program.description();
}
return new SimpleStringProperty(value);
});
tableView.getColumns().addAll(nameCol, descCol);
final BorderPane borderPane1 = new BorderPane(tableView);
borderPane1.setPadding(new Insets(10));
final Button but = new Button("New Instance...");
but.setOnAction(AE -> {
final Class<?> clazz = tableView.getSelectionModel().getSelectedItem();
if (clazz == null)
return;
final Program program = clazz.getAnnotation(Program.class);
if (!Launcher.class.isAssignableFrom(clazz) || program == null)
return;
createNewInstanceOf(clazz);
});
FlowPane bottom = new FlowPane(but);
borderPane1.setBottom(bottom);
tableView.getItems().addAll(String.class, Integer.class, VCFFilterJS.class, BioAlcidae.class);
root.getChildren().add(borderPane1);
// root.getChildren().add(btn);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
use of javafx.beans.property.SimpleStringProperty in project dwoss by gg-net.
the class ProductListController method setCellValues.
/**
* Defining the cell values for each table column.
*/
private void setCellValues() {
productId.setCellValueFactory(new PropertyValueFactory<>("id"));
productName.setCellValueFactory(new PropertyValueFactory<>("name"));
productTradeName.setCellValueFactory(new PropertyValueFactory<>("tradeName"));
productGroup.setCellValueFactory(new PropertyValueFactory<>("group"));
productPartNo.setCellValueFactory(new PropertyValueFactory<>("partNo"));
productImageId.setCellValueFactory(new PropertyValueFactory<>("imageId"));
productGtin.setCellValueFactory(new PropertyValueFactory<>("gtin"));
productEol.setCellValueFactory(p -> {
SimpleStringProperty property = new SimpleStringProperty();
if (p.getValue().getEol() != null)
property.setValue(DateFormats.ISO.format(p.getValue().getEol()));
return property;
});
}
use of javafx.beans.property.SimpleStringProperty in project Smartcity-Smarthouse by TechnionYP5777.
the class UserInfoController method setCellsFactories.
private void setCellsFactories() {
nameColumn.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().contact.getName()));
idColumn.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().contact.getId()));
phoneColumn.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().contact.getPhoneNumber()));
emailColumn.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().contact.getEmailAddress()));
eLevelColumn.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().eLevel + ""));
contactsTable.setEditable(true);
phoneColumn.setCellFactory(TextFieldTableCell.forTableColumn());
phoneColumn.setOnEditCommit(¢ -> ¢.getTableView().getItems().get(¢.getTablePosition().getRow()).contact.setPhoneNumber(¢.getNewValue()));
emailColumn.setCellFactory(TextFieldTableCell.forTableColumn());
emailColumn.setOnEditCommit(¢ -> ¢.getTableView().getItems().get(¢.getTablePosition().getRow()).contact.setEmailAddress(¢.getNewValue()));
eLevelColumn.setCellFactory(ComboBoxTableCell.<ContactGUI, String>forTableColumn(FXCollections.observableArrayList(EmergencyLevel.stringValues())));
eLevelColumn.setOnEditCommit(¢ -> getModel().getUser().setContactEmergencyLevel(¢.getTableView().getItems().get(¢.getTablePosition().getRow()).contact.getId(), ¢.getNewValue()));
}
Aggregations