Search in sources :

Example 11 with TitledPane

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();
}
Also used : TitledPane(javafx.scene.control.TitledPane) TabPane(javafx.scene.control.TabPane) HOGMProblemError(com.sri.ai.praise.core.inference.byinputrepresentation.classbased.hogm.parsing.HOGMProblemError) ListView(javafx.scene.control.ListView) HOGMCodeArea(com.sri.ai.praise.other.application.praise.app.editor.HOGMCodeArea) Tab(javafx.scene.control.Tab) Node(javafx.scene.Node)

Aggregations

TitledPane (javafx.scene.control.TitledPane)11 Node (javafx.scene.Node)6 Tab (javafx.scene.control.Tab)6 BorderPane (javafx.scene.layout.BorderPane)5 TabPane (javafx.scene.control.TabPane)4 Scene (javafx.scene.Scene)3 HOGMCodeArea (com.sri.ai.praise.other.application.praise.app.editor.HOGMCodeArea)2 HOGMCodeArea (com.sri.ai.praise.sgsolver.demo.editor.HOGMCodeArea)2 IOException (java.io.IOException)2 Insets (javafx.geometry.Insets)2 Parent (javafx.scene.Parent)2 Button (javafx.scene.control.Button)2 HBox (javafx.scene.layout.HBox)2 Pane (javafx.scene.layout.Pane)2 CatalogAction (com.cas.sim.tis.action.CatalogAction)1 Catalog (com.cas.sim.tis.entity.Catalog)1 FileWrapper (com.kyj.fx.voeditor.visual.component.FileWrapper)1 ImageViewPane (com.kyj.fx.voeditor.visual.component.ImageViewPane)1 JavaProjectFileTreeItem (com.kyj.fx.voeditor.visual.component.JavaProjectFileTreeItem)1 JavaProjectMemberFileTreeItem (com.kyj.fx.voeditor.visual.component.JavaProjectMemberFileTreeItem)1