Search in sources :

Example 1 with StringExpression

use of javafx.beans.binding.StringExpression in project VocabHunter by VocabHunter.

the class ProgressController method bindValueLabel.

private void bindValueLabel(final Label valueLabel, final ObservableNumberValue property) {
    StringExpression binding = i18nManager.textBinding(PROGRESS_WORD_COUNT, property);
    valueLabel.textProperty().bind(binding);
}
Also used : StringExpression(javafx.beans.binding.StringExpression)

Example 2 with StringExpression

use of javafx.beans.binding.StringExpression in project VocabHunter by VocabHunter.

the class I18nManagerTest method validatePercentage.

private void validatePercentage(final String expected, final double value) {
    SimpleDoubleProperty property = new SimpleDoubleProperty(value);
    StringExpression result = target.textBinding(STATUS_MARKED_PERCENTAGE, property);
    assertEquals(expected, result.getValue());
}
Also used : SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) StringExpression(javafx.beans.binding.StringExpression)

Example 3 with StringExpression

use of javafx.beans.binding.StringExpression in project NMEAParser by tvesalainen.

the class MainApp method start.

@Override
public void start(Stage stage) throws Exception {
    Locale locale = Locale.getDefault();
    bundle = I18n.get(locale);
    // preferences
    preferences = new ViewerPreferences();
    ViewerPage preferencesPage = ViewerPage.loadPreferencePage(preferences, "/fxml/preferences.fxml", bundle);
    service = new ViewerService(executor, preferences, locale);
    StringBinding colorBinding = service.bindBackgroundColors();
    StringExpression styleExpression = Bindings.concat("-fx-base: ", colorBinding, ";", "-fx-font-family: ", preferences.getBinding("fontFamily"), ";");
    preferencesPage.getParent().styleProperty().bind(styleExpression);
    // pages
    ViewerPage sailPage1 = ViewerPage.loadPage(service, "/fxml/sailPage1.fxml", bundle, styleExpression);
    service.start();
    Property<Integer> currentPage = new SimpleObjectProperty<>(0);
    preferences.bindInteger("currentPage", 0, currentPage);
    Scene scene = new ViewerScene(stage, currentPage, preferencesPage, sailPage1);
    scene.getStylesheets().add("/styles/Styles.css");
    stage.setScene(scene);
    // stage.setFullScreen(true);
    I18n.bind(stage.titleProperty(), "mainTitle");
    I18n.bind(stage.fullScreenExitHintProperty(), "fullScreenExitHint");
    stage.show();
}
Also used : Locale(java.util.Locale) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) StringBinding(javafx.beans.binding.StringBinding) StringExpression(javafx.beans.binding.StringExpression) Scene(javafx.scene.Scene)

Aggregations

StringExpression (javafx.beans.binding.StringExpression)3 Locale (java.util.Locale)1 StringBinding (javafx.beans.binding.StringBinding)1 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 Scene (javafx.scene.Scene)1