Search in sources :

Example 16 with SimpleStringProperty

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();
}
Also used : Binding(com.canoo.platform.core.functional.Binding) MockedProperty(com.canoo.dp.impl.remoting.MockedProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Test(org.testng.annotations.Test)

Example 17 with SimpleStringProperty

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();
}
Also used : Binding(com.canoo.platform.core.functional.Binding) MockedProperty(com.canoo.dp.impl.remoting.MockedProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Test(org.testng.annotations.Test)

Example 18 with SimpleStringProperty

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();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Insets(javafx.geometry.Insets) Program(com.github.lindenb.jvarkit.util.jcommander.Program) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Scene(javafx.scene.Scene) TableColumn(javafx.scene.control.TableColumn) Button(javafx.scene.control.Button) FlowPane(javafx.scene.layout.FlowPane) StackPane(javafx.scene.layout.StackPane) TableView(javafx.scene.control.TableView)

Example 19 with SimpleStringProperty

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

Example 20 with SimpleStringProperty

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

Aggregations

SimpleStringProperty (javafx.beans.property.SimpleStringProperty)40 StringProperty (javafx.beans.property.StringProperty)14 TableColumn (javafx.scene.control.TableColumn)12 FXML (javafx.fxml.FXML)9 BigDecimal (java.math.BigDecimal)7 Button (javafx.scene.control.Button)7 IOException (java.io.IOException)5 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)5 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)5 ObservableValue (javafx.beans.value.ObservableValue)5 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)4 Binding (com.canoo.platform.core.functional.Binding)4 List (java.util.List)4 Map (java.util.Map)4 Label (javafx.scene.control.Label)4 CellDataFeatures (javafx.scene.control.TableColumn.CellDataFeatures)4 ImageView (javafx.scene.image.ImageView)4 Test (org.testng.annotations.Test)4 ChunkWrapper (com.kyj.fx.voeditor.visual.diff.ChunkWrapper)3 CompareResult (com.kyj.fx.voeditor.visual.diff.CompareResult)3