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;
});
}
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;
});
}
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");
}
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;
}
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;
}
Aggregations