Search in sources :

Example 21 with StringProperty

use of javafx.beans.property.StringProperty in project Gargoyle by callakrsos.

the class TextSameLineDiffAppController method initialize.

@FXML
public void initialize() {
    /* initControls */
    ivReviced = new ImageView();
    ivpReviced = new ImageViewPane(ivReviced);
    ivpReviced.setPrefWidth(200);
    ivpReviced.setPrefHeight(150);
    ivOrigin = new ImageView();
    ivpOrigin = new ImageViewPane(ivOrigin);
    ivpOrigin.setPrefWidth(200);
    ivpOrigin.setPrefHeight(150);
    gpSnap.add(ivpReviced, 0, 0);
    gpSnap.add(ivpOrigin, 1, 0);
    lvOrinal.setCellFactory(param -> new DefaultTextFieldListCell(ORIGINAL));
    lvRevice.setCellFactory(param -> new DefaultTextFieldListCell(REVICED));
    fileCompareResultProperty.addListener((oba, oldresult, newresult) -> {
        if (newresult == null)
            return;
        List<ChunkWrapper> wrapperedOrigin = extractedWrapperedChunk(DeltaType.ORIGINAL, newresult);
        List<ChunkWrapper> wrapperedReviced = extractedWrapperedChunk(DeltaType.REVICED, newresult);
        lvOrinal.getItems().addAll(wrapperedOrigin);
        lvRevice.getItems().addAll(wrapperedReviced);
        tvChgHis.getItems().addAll(wrapperedOrigin.stream().filter(w -> w.getDelta() != null).collect(Collectors.toList()));
    });
    lvRevice.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            int movePosition = -1;
            ChunkWrapper selectedItem = lvRevice.getSelectionModel().getSelectedItem();
            Delta delta = selectedItem.getDelta();
            if (delta != null && delta.getOriginal() != null) {
                movePosition = selectedItem.getPosition();
                lvOrinal.scrollTo(movePosition - 1);
                lvOrinal.getSelectionModel().select(movePosition);
            }
        }
    });
    lvOrinal.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            int movePosition = -1;
            ChunkWrapper selectedItem = lvOrinal.getSelectionModel().getSelectedItem();
            Delta delta = selectedItem.getDelta();
            if (delta != null && delta.getRevised() != null) {
                movePosition = delta.getRevised().getPosition();
                lvRevice.scrollTo(movePosition - 1);
                lvRevice.getSelectionModel().select(movePosition);
            }
        }
    });
    lvOrinal.addEventFilter(ScrollEvent.SCROLL, event -> {
        snappOriginShot();
    });
    lvRevice.addEventFilter(ScrollEvent.SCROLL, event -> {
        snappReviceShot();
    });
    btnCompare.setOnMouseClicked(event -> {
        String ori = txtOrigin.getText();
        String rev = txtRevice.getText();
        if (!(ori.isEmpty() && rev.isEmpty())) {
            clear();
            try {
                this.compare.setOriginal(ori);
                this.compare.setRevised(rev);
                CompareResult chunkResult = this.compare.getChunkResult();
                this.fileCompareResultProperty.set(chunkResult);
                snappOriginShot();
                snappReviceShot();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    colStatus.setCellValueFactory(new Callback<CellDataFeatures<ChunkWrapper, String>, ObservableValue<String>>() {

        @Override
        public ObservableValue<String> call(CellDataFeatures<ChunkWrapper, String> param) {
            TYPE type = param.getValue().getType();
            StringProperty prop = new SimpleStringProperty();
            if (type != null)
                prop.set(type.name());
            return prop;
        }
    });
    colPosition.setCellValueFactory(param -> new SimpleIntegerProperty(new Integer(param.getValue().getPosition() + 1)));
    colRevice.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getRevised();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
    colOrigin.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getOriginal();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
}
Also used : CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) ObservableValue(javafx.beans.value.ObservableValue) ChunkWrapper(com.kyj.fx.voeditor.visual.diff.ChunkWrapper) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Chunk(difflib.Chunk) CompareResult(com.kyj.fx.voeditor.visual.diff.CompareResult) IOException(java.io.IOException) Delta(difflib.Delta) ImageView(javafx.scene.image.ImageView) TYPE(difflib.Delta.TYPE) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) FXML(javafx.fxml.FXML)

Example 22 with StringProperty

use of javafx.beans.property.StringProperty in project Gargoyle by callakrsos.

the class HtmlBaseDiffAppController method initialize.

@FXML
public void initialize() {
    /* initControls */
    ivReviced = new ImageView();
    ivpReviced = new ImageViewPane(ivReviced);
    ivpReviced.setPrefWidth(200);
    ivpReviced.setPrefHeight(150);
    ivOrigin = new ImageView();
    ivpOrigin = new ImageViewPane(ivOrigin);
    ivpOrigin.setPrefWidth(200);
    ivpOrigin.setPrefHeight(150);
    gpSnap.add(ivpReviced, 0, 0);
    gpSnap.add(ivpOrigin, 1, 0);
    // lvOrinal.setCellFactory(param -> new
    // DefaultTextFieldListCell(ORIGINAL));
    // lvRevice.setCellFactory(param -> new
    // DefaultTextFieldListCell(REVICED));
    fileCompareResultProperty.addListener((oba, oldresult, newresult) -> {
        if (newresult == null)
            return;
    // List<ChunkWrapper> wrapperedOrigin =
    // extractedWrapperedChunk(DeltaType.ORIGINAL, newresult);
    // List<ChunkWrapper> wrapperedReviced =
    // extractedWrapperedChunk(DeltaType.REVICED, newresult);
    // lvOrinal.getItems().addAll(wrapperedOrigin);
    // lvRevice.getItems().addAll(wrapperedReviced);
    // tvChgHis.getItems().addAll(wrapperedOrigin.stream().filter(w
    // -> w.getDelta() != null).collect(Collectors.toList()));
    });
    // lvRevice.setOnMouseClicked(event -> {
    // if (event.getClickCount() == 2) {
    // int movePosition = -1;
    // ChunkWrapper selectedItem =
    // lvRevice.getSelectionModel().getSelectedItem();
    // Delta delta = selectedItem.getDelta();
    // if (delta != null && delta.getOriginal() != null) {
    // movePosition = selectedItem.getPosition();
    // lvOrinal.scrollTo(movePosition - 1);
    // lvOrinal.getSelectionModel().select(movePosition);
    // }
    //
    // }
    // });
    // lvOrinal.setOnMouseClicked(event -> {
    // if (event.getClickCount() == 2) {
    // int movePosition = -1;
    // ChunkWrapper selectedItem =
    // lvOrinal.getSelectionModel().getSelectedItem();
    // Delta delta = selectedItem.getDelta();
    // if (delta != null && delta.getRevised() != null) {
    // movePosition = delta.getRevised().getPosition();
    // lvRevice.scrollTo(movePosition - 1);
    // lvRevice.getSelectionModel().select(movePosition);
    // }
    // }
    //
    // });
    // lvOrinal.addEventFilter(ScrollEvent.SCROLL, event -> {
    // snappOriginShot();
    // });
    //
    // lvRevice.addEventFilter(ScrollEvent.SCROLL, event -> {
    // snappReviceShot();
    // });
    btnCompare.setOnMouseClicked(event -> {
        String ori = txtOrigin.getText();
        String rev = txtRevice.getText();
        if (!(ori.isEmpty() && rev.isEmpty())) {
            clear();
            try {
                this.compare.setOriginal(ori);
                this.compare.setRevised(rev);
                CompareResult chunkResult = this.compare.getChunkResult();
                this.fileCompareResultProperty.set(chunkResult);
                snappOriginShot();
                snappReviceShot();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    colStatus.setCellValueFactory(new Callback<CellDataFeatures<ChunkWrapper, String>, ObservableValue<String>>() {

        @Override
        public ObservableValue<String> call(CellDataFeatures<ChunkWrapper, String> param) {
            TYPE type = param.getValue().getType();
            StringProperty prop = new SimpleStringProperty();
            if (type != null)
                prop.set(type.name());
            return prop;
        }
    });
    colPosition.setCellValueFactory(param -> new SimpleIntegerProperty(new Integer(param.getValue().getPosition() + 1)));
    colRevice.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getRevised();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
    colOrigin.setCellValueFactory(param -> {
        Delta delta = param.getValue().getDelta();
        SimpleStringProperty prop = new SimpleStringProperty();
        if (delta != null) {
            Chunk c = delta.getOriginal();
            prop.setValue(c.getLines().toString());
        }
        return prop;
    });
}
Also used : CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) ObservableValue(javafx.beans.value.ObservableValue) ChunkWrapper(com.kyj.fx.voeditor.visual.diff.ChunkWrapper) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Chunk(difflib.Chunk) CompareResult(com.kyj.fx.voeditor.visual.diff.CompareResult) IOException(java.io.IOException) Delta(difflib.Delta) ImageView(javafx.scene.image.ImageView) TYPE(difflib.Delta.TYPE) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) FXML(javafx.fxml.FXML)

Example 23 with StringProperty

use of javafx.beans.property.StringProperty in project Gargoyle by callakrsos.

the class CheckYnColumn method getProperty.

private StringProperty getProperty(Object param) throws Exception {
    Field declaredField = param.getClass().getDeclaredField(columnName);
    if (declaredField != null) {
        declaredField.setAccessible(true);
        Object object = declaredField.get(param);
        if (object instanceof StringProperty) {
            StringProperty se = (StringProperty) object;
            return se;
        } else if (object == null)
            return new SimpleStringProperty("N");
        return new SimpleStringProperty("N");
    }
    return new SimpleStringProperty("N");
}
Also used : Field(java.lang.reflect.Field) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty)

Example 24 with StringProperty

use of javafx.beans.property.StringProperty in project Board-Instrumentation-Framework by intel.

the class LedBuilder method build.

public final Led build() {
    final Led CONTROL = new Led();
    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("minSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("maxSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("prefWidth".equals(key)) {
            CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("prefHeight".equals(key)) {
            CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("minWidth".equals(key)) {
            CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("minHeight".equals(key)) {
            CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("maxWidth".equals(key)) {
            CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("maxHeight".equals(key)) {
            CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleX".equals(key)) {
            CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleY".equals(key)) {
            CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutX".equals(key)) {
            CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutY".equals(key)) {
            CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
        } else if ("translateX".equals(key)) {
            CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
        } else if ("translateY".equals(key)) {
            CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            CONTROL.getStyleClass().setAll("led", ((StringProperty) properties.get(key)).get());
        } else if ("ledColor".equals(key)) {
            CONTROL.setLedColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("on".equals(key)) {
            CONTROL.setOn(((BooleanProperty) properties.get(key)).get());
        } else if ("blinking".equals(key)) {
            CONTROL.setBlinking(((BooleanProperty) properties.get(key)).get());
        } else if ("interval".equals(key)) {
            CONTROL.setInterval(((IntegerProperty) properties.get(key)).get());
        } else if ("frameVisible".equals(key)) {
            CONTROL.setFrameVisible(((BooleanProperty) properties.get(key)).get());
        }
    }
    return CONTROL;
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Dimension2D(javafx.geometry.Dimension2D) Color(javafx.scene.paint.Color) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty)

Example 25 with StringProperty

use of javafx.beans.property.StringProperty in project Board-Instrumentation-Framework by intel.

the class SimpleLineChartBuilder method build.

public final SimpleLineChart build() {
    final SimpleLineChart CONTROL = new SimpleLineChart();
    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("minSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("maxSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("prefWidth".equals(key)) {
            CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("prefHeight".equals(key)) {
            CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("minWidth".equals(key)) {
            CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("minHeight".equals(key)) {
            CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("maxWidth".equals(key)) {
            CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("maxHeight".equals(key)) {
            CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleX".equals(key)) {
            CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleY".equals(key)) {
            CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutX".equals(key)) {
            CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutY".equals(key)) {
            CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
        } else if ("translateX".equals(key)) {
            CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
        } else if ("translateY".equals(key)) {
            CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            CONTROL.getStyleClass().setAll("simple-line-chart", ((StringProperty) properties.get(key)).get());
        } else if ("series".equals(key)) {
            CONTROL.setSeries(((ObjectProperty<XYChart.Series>) properties.get(key)).get());
        } else if ("sectionRangeVisible".equals(key)) {
            CONTROL.setSectionRangeVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("sectionsArray".equals(key)) {
            CONTROL.setSections(((ObjectProperty<Section[]>) properties.get(key)).get());
        } else if ("sectionsList".equals(key)) {
            CONTROL.setSections(((ObjectProperty<List<Section>>) properties.get(key)).get());
        }
    }
    return CONTROL;
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Dimension2D(javafx.geometry.Dimension2D) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) Section(eu.hansolo.enzo.common.Section)

Aggregations

StringProperty (javafx.beans.property.StringProperty)40 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)37 DoubleProperty (javafx.beans.property.DoubleProperty)26 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)25 ObjectProperty (javafx.beans.property.ObjectProperty)24 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)24 Dimension2D (javafx.geometry.Dimension2D)23 BooleanProperty (javafx.beans.property.BooleanProperty)20 SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)20 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)14 Color (javafx.scene.paint.Color)14 IntegerProperty (javafx.beans.property.IntegerProperty)11 List (java.util.List)8 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)4 Binding (com.canoo.platform.core.functional.Binding)4 Section (eu.hansolo.enzo.common.Section)4 IOException (java.io.IOException)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