use of javafx.scene.control.TitledPane in project aic-praise by aic-sri-international.
the class QueryController method displayQueryErrors.
private void displayQueryErrors(String query, List<HOGMProblemError> queryErrors, HOGModel parsedModel, long millisecondsToCompute) {
String title = "Query '" + query + "' encountered " + queryErrors.size() + " error(s) when attempting to compute answer (took " + Util.toHoursMinutesAndSecondsString(millisecondsToCompute) + ")";
ListView<HOGMProblemError> errors = new ListView<>(FXCollections.observableList(queryErrors));
// errors.setFixedCellSize(24);
errors.setPrefHeight(24 * 5);
errors.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
errors.getSelectionModel().selectedIndexProperty().addListener((obs, oldValue, newValue) -> {
if (newValue.intValue() >= 0) {
HOGMProblemError qError = errors.getItems().get(newValue.intValue());
if (qError.getContext() == HOGMProblemError.Scope.MODEL) {
modelPageEditor.highlight(qError.getStartContextIndex(), qError.getEndContextIndex());
} else if (qError.getContext() == HOGMProblemError.Scope.QUERY) {
queryComboBox.getEditor().selectAll();
}
}
});
Node resultContent = null;
if (PRAiSEController.isInDebugMode()) {
HOGMCodeArea parsedModelArea = createParsedModelView(parsedModel);
TabPane resultTabs = new TabPane();
resultTabs.getTabs().add(new Tab("Errors", errors));
resultTabs.getTabs().add(new Tab("Parsed As", parsedModelArea));
resultContent = resultTabs;
} else {
resultContent = errors;
}
TitledPane resultPane = new TitledPane(title, resultContent);
FXUtil.setTitledPaneIcon(resultPane, FontAwesomeIcons.TIMES);
showResultPane(resultPane);
errors.getSelectionModel().selectFirst();
}
Aggregations