Example usage for javafx.beans.binding Bindings convert

List of usage examples for javafx.beans.binding Bindings convert

Introduction

In this page you can find the example usage for javafx.beans.binding Bindings convert.

Prototype

public static StringExpression convert(ObservableValue<?> observableValue) 

Source Link

Document

Returns a javafx.beans.binding.StringExpression that wraps a javafx.beans.value.ObservableValue .

Usage

From source file:jp.co.heppokoact.autocapture.FXMLDocumentController.java

@Override
public void initialize(URL url, ResourceBundle rb) {
    // ???/*from  ww w  . ja v a2 s.  c  om*/
    prop = new Properties();
    if (CONFIG_FILE.exists()) {
        try (InputStream in = new FileInputStream(CONFIG_FILE)) {
            prop.loadFromXML(in);
        } catch (IOException e) {
            throw new RuntimeException("????????", e);
        }
    }

    // ????????
    String saveDirectoryPath = prop.getProperty("saveDirectoryPath");
    if (saveDirectoryPath != null) {
        File tempSaveDirectory = new File(saveDirectoryPath);
        if (tempSaveDirectory.exists()) {
            saveDirectory.set(tempSaveDirectory);
        }
    }

    // ???
    saveDirectoryLabel.textProperty().bind(Bindings.createStringBinding(() -> {
        File sd = saveDirectory.get();
        return (sd == null) ? "" : sd.getName();
    }, saveDirectory));
    areaStartXLabel.textProperty().bind(Bindings.convert(areaStartX));
    areaStartYLabel.textProperty().bind(Bindings.convert(areaStartY));
    areaEndXLabel.textProperty().bind(Bindings.convert(areaEndX));
    areaEndYLabel.textProperty().bind(Bindings.convert(areaEndY));
    nextPointXLabel.textProperty().bind(Bindings.convert(nextPointX));
    nextPointYLabel.textProperty().bind(Bindings.convert(nextPointY));
    prevPointXLabel.textProperty().bind(Bindings.convert(prevPointX));
    prevPointYLabel.textProperty().bind(Bindings.convert(prevPointY));

    // ???
    stopButton.setDisable(true);

    // ????
    captureService = new CaptureService();
    captureTimeline = new Timeline(new KeyFrame(new Duration(CAPTURE_INTERVAL), e -> {
        captureService.restart();
    }));
    captureTimeline.setCycleCount(Timeline.INDEFINITE);
    try {
        robot = new Robot();
    } catch (AWTException e) {
        throw new RuntimeException("???????", e);
    }

    // ??
    clip = new AudioClip(ClassLoader.getSystemResource("ayashi.wav").toString());
}

From source file:acmi.l2.clientmod.l2smr.Controller.java

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
    stageProperty().addListener(observable -> initializeKeyCombinations());

    this.l2Path.textProperty().bind(
            Bindings.when(l2DirProperty().isNotNull()).then(Bindings.convert(l2DirProperty())).otherwise(""));

    initializeUnr();/* w  w w . j  a  va 2s.c  om*/
    initializeUsx();

    this.filterPane.setExpanded(false);
    this.filterPane.setDisable(true);

    this.smaPane.setDisable(true);

    table.itemsProperty().bind(Bindings.createObjectBinding(() -> {
        if (actors.get() == null)
            return FXCollections.emptyObservableList();

        return FXCollections
                .observableArrayList(
                        actors.get().stream()
                                .filter(actor -> !rotatable.isSelected() || actor.getRotation() != null)
                                .filter(actor -> !scalable.isSelected() || actor.getScale() != null
                                        || actor.getScale3D() != null)
                                .filter(actor -> !rotating.isSelected() || actor.getRotationRate() != null)
                                .filter(actor -> filterStaticMesh.getText() == null
                                        || filterStaticMesh.getText().isEmpty()
                                        || actor.getStaticMesh().toLowerCase()
                                                .contains(filterStaticMesh.getText().toLowerCase()))
                                .filter(actor -> {
                                    Double x = getDoubleOrClearTextField(filterX);
                                    Double y = getDoubleOrClearTextField(filterY);
                                    Double z = getDoubleOrClearTextField(filterZ);
                                    Double range = getDoubleOrClearTextField(filterRange);

                                    return range == null || range(actor.getLocation(), x, y, z) < range;
                                }).collect(Collectors.toList()));
    }, actors, filterStaticMesh.textProperty(), filterX.textProperty(), filterY.textProperty(),
            filterZ.textProperty(), filterRange.textProperty(), rotatable.selectedProperty(),
            scalable.selectedProperty(), rotating.selectedProperty()));
}