use of javafx.beans.property.SimpleStringProperty in project Gargoyle by callakrsos.
the class TextBaseDiffAppController 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(compareResultListener);
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();
if (selectedItem != null) {
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) {
LOGGER.error(ValueUtil.toString(e));
}
}
});
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.SimpleStringProperty 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.SimpleStringProperty in project Gargoyle by callakrsos.
the class SkinPreviewViewComposite method buttonTabInit.
@FxPostInitialize
public void buttonTabInit() {
loadButtonStyles();
if (SkinManager.getInstance().isUsedCustomButton()) {
tgbUseBtnDefault.setSelected(false);
tbBtnSkins.setOpacity(1.0d);
} else {
tbBtnSkins.setOpacity(0.5d);
}
tgbUseBtnDefault.selectedProperty().addListener((oba, o, n) -> {
if (n) {
tbBtnSkins.setOpacity(0.5d);
} else
tbBtnSkins.setOpacity(1.0d);
});
colSkinName.setCellValueFactory(param -> {
return new SimpleStringProperty(param.getValue().getName());
});
tbBtnSkins.getSelectionModel().selectedItemProperty().addListener((oba, o, n) -> {
File selectedItem = n;
if (selectedItem != null && selectedItem.exists()) {
String readFile = FileUtil.readFile(selectedItem, true, null);
txtStyle.setText(readFile);
try {
List<Node> findAllByNodes = FxUtil.findAllByNodes(borPreview, node -> node instanceof Button);
String className = String.format("%s", selectedItem.getName().replaceAll(".css", ""));
findAllByNodes.forEach(btn -> {
btn.getStyleClass().add("button");
btn.getStyleClass().add(className);
});
borPreview.getStylesheets().clear();
borPreview.getStylesheets().add(selectedItem.toURI().toURL().toExternalForm());
selectedBtnStyleClassName.set(className);
borPreview.applyCss();
} catch (Exception e) {
e.printStackTrace();
}
} else {
txtStyle.setText("");
selectedBtnStyleClassName.set(null);
}
});
}
use of javafx.beans.property.SimpleStringProperty 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.SimpleStringProperty 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");
}
Aggregations