Example usage for javafx.beans.property StringProperty getValue

List of usage examples for javafx.beans.property StringProperty getValue

Introduction

In this page you can find the example usage for javafx.beans.property StringProperty getValue.

Prototype

@Override
    public String getValue() 

Source Link

Usage

From source file:Main.java

public static void main(String[] args) {
    Student contact = new Student("FirstName", "LastName");
    StringProperty fname = new SimpleStringProperty();
    fname.bindBidirectional(contact.firstNameProperty());
    StringProperty lname = new SimpleStringProperty();
    lname.bindBidirectional(contact.lastNameProperty());

    System.out.println(fname.getValue() + " " + lname.getValue());
    System.out.println(contact.getFirstName() + " " + contact.getLastName());

    fname.setValue("new FirstName");
    lname.setValue("new LastName");

    System.out.println(fname.getValue() + " " + lname.getValue());
    System.out.println(contact.getFirstName() + " " + contact.getLastName());
}

From source file:edu.kit.trufflehog.model.configdata.SettingsDataModelTest.java

/**
 * <p>/* w ww . ja  va2s.co m*/
 *     Checks if the retrieved values match the expected values and changes some of the values, and then checks if
 *     the file was updated by changing the value back to the original value.
 * </p>
 *
 * @param classType The class of the value
 * @param key The key of the value
 * @param oldValue The starting value to check against
 * @param newValue The new value to check against after is has been set
 * @throws Exception Passes any errors that occurred during the test on
 */
private void testGetEntrySuccess(Class classType, String key, String oldValue, String newValue)
        throws Exception {
    settingsDataModel = new SettingsDataModel(fileSystem);
    StringProperty property1 = settingsDataModel.get(classType, key);
    assertEquals(true, property1.getValue().equals(oldValue));

    StringProperty property2 = new SimpleStringProperty(property1.getValue());
    property1.bindBidirectional(property2);

    property2.setValue(newValue);

    Thread.sleep(1000); // sleep because the saving to file happens in another thread

    settingsDataModel = new SettingsDataModel(fileSystem);
    property1 = settingsDataModel.get(classType, key);
    assertEquals(true, property1.getValue().equals(newValue));

    property1.setValue(oldValue);

    Thread.sleep(1000); // sleep because the saving to file happens in another thread

    settingsDataModel = new SettingsDataModel(fileSystem);
    property1 = settingsDataModel.get(classType, key);
    assertEquals(true, property1.getValue().equals(oldValue));
}