use of org.kanonizo.display.fx.converters.ReadableConverter in project kanonizo by kanonizo.
the class KanonizoFrame method initialize.
@Override
public void initialize(URL location, ResourceBundle resources) {
assert sourceTree != null : "fx:id sourceTree was not injected";
this.fw = Framework.getInstance();
fw.addPropertyChangeListener(Framework.ROOT_FOLDER_PROPERTY_NAME, (e) -> {
File newRoot = (File) e.getNewValue();
rootFolderTextField.setText(newRoot.getAbsolutePath());
sourceTree.setRoot(GuiUtils.createDynamicFileTree(newRoot));
testTree.setRoot(GuiUtils.createDynamicFileTree(newRoot));
});
fw.addPropertyChangeListener(Framework.ALGORITHM_PROPERTY_NAME, (e) -> {
SearchAlgorithm alg = (SearchAlgorithm) e.getNewValue();
// remove existing children
paramLayout.getChildren().clear();
addParams(alg, paramLayout, true);
addErrors(alg);
});
fw.addPropertyChangeListener(Framework.INSTRUMENTER_PROPERTY_NAME, (e) -> {
org.kanonizo.framework.instrumentation.Instrumenter inst = (org.kanonizo.framework.instrumentation.Instrumenter) e.getNewValue();
instParamLayout.getChildren().clear();
addParams(inst, instParamLayout, false);
addErrors(inst);
});
fw.addPropertyChangeListener(Framework.LIBS_PROPERTY_NAME, (e) -> {
libs.getItems().add((File) e.getNewValue());
});
fw.setDisplay(this);
Screen main = Screen.getPrimary();
Rectangle2D bounds = main.getVisualBounds();
rootFolderTextField.setText(fw.getRootFolder().getAbsolutePath());
addSourceListeners();
addTestListeners();
addLibListeners();
selectRoot.setOnAction(ev -> selectRoot());
try {
algorithmChoices.getItems().addAll(Framework.getAvailableAlgorithms());
algorithmChoices.setConverter(new ReadableConverter());
algorithmChoices.valueProperty().addListener((ov, t, t1) -> {
SearchAlgorithm alg = (SearchAlgorithm) ov.getValue();
fw.setAlgorithm(alg);
});
algorithmChoices.getSelectionModel().select(fw.getAlgorithm());
instrumenterChoices.getItems().addAll(Framework.getAvailableInstrumenters());
instrumenterChoices.setConverter(new ReadableConverter());
instrumenterChoices.valueProperty().addListener((ov, t, t1) -> {
org.kanonizo.framework.instrumentation.Instrumenter inst = (org.kanonizo.framework.instrumentation.Instrumenter) ov.getValue();
fw.setInstrumenter(inst);
});
instrumenterChoices.getSelectionModel().select(fw.getInstrumenter());
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations