<commit_before>package codeOrchestra.colt.core.ui.dialog

import javafx.event.EventHandler
import javafx.fxml.FXML
import javafx.fxml.FXMLLoader
import javafx.geometry.Insets
import javafx.scene.Scene
import javafx.scene.control.Button
import javafx.scene.control.Label
import javafx.scene.control.TextArea
import javafx.scene.image.Image
import javafx.scene.image.ImageView
import javafx.scene.layout.AnchorPane
import javafx.scene.layout.Priority
import javafx.scene.layout.VBox
import javafx.stage.Modality
import javafx.stage.Stage
import javafx.stage.Window
import org.controlsfx.control.ButtonBar


/**
 * @author <NAME>
 */
class ExceptionDialog extends DialogWithImage {
    private static final String HIDE_STYLE = "btn-hide-dialog"
    private static final String SHOW_STYLE = "btn-show"

    TextArea textArea
    boolean showDetails

    Button details_btn

    ExceptionDialog(Window owner) {
        super(owner)
    }


    @Override
    protected void initView() {
        super.initView()

        title = "Error"
        image = new Image("/codeOrchestra/colt/core/ui/style/images/messages/error-48x48.png")

        setShowDetails(false)
    }

    @Override
    protected void initCenter() {
        textArea = new TextArea(prefHeight: 200,  wrapText: true)
        setMargin(textArea, new Insets(17, 0, 0, 0))
        setVgrow(textArea, Priority.ALWAYS)

        children.add(textArea)
    }

    @Override
    protected void initButtons() {
        super.initButtons()

        details_btn = new Button(focusTraversable: false)
        ButtonBar.setType(details_btn, ButtonBar.ButtonType.LEFT)
        buttonBar.buttons.add(details_btn)
        details_btn.onAction = {
            showDetails = !showDetails
        } as EventHandler
    }

    void initException(Throwable exception, String massage = null) {
        if (massage) {
            this.message = massage
            comment = exception.message
        } else {
            this.message = exception.message
        }

        StringWriter sw = new StringWriter()
        PrintWriter pw = new PrintWriter(sw)
        exception.printStackTrace(pw)
        textArea.text = sw.toString()
    }

    void setShowDetails(boolean showDetails) {
        this.showDetails = showDetails
        if (showDetails) {
            details_btn.styleClass.remove(SHOW_STYLE)
            details_btn.styleClass.add(HIDE_STYLE)
            details_btn.text = "Hide details"
        } else {
            details_btn.styleClass.remove(HIDE_STYLE)
            details_btn.styleClass.add(SHOW_STYLE)
            details_btn.text = "Show details"
        }
        textArea.visible = textArea.managed = showDetails
        stage.sizeToScene()
    }

}
<commit_msg>fix text-aria for exception dialog<commit_after>package codeOrchestra.colt.core.ui.dialog

import javafx.event.EventHandler
import javafx.fxml.FXML
import javafx.fxml.FXMLLoader
import javafx.geometry.Insets
import javafx.scene.Scene
import javafx.scene.control.Button
import javafx.scene.control.Label
import javafx.scene.control.TextArea
import javafx.scene.image.Image
import javafx.scene.image.ImageView
import javafx.scene.layout.AnchorPane
import javafx.scene.layout.Priority
import javafx.scene.layout.VBox
import javafx.stage.Modality
import javafx.stage.Stage
import javafx.stage.Window
import org.controlsfx.control.ButtonBar


/**
 * @author <NAME>
 */
class ExceptionDialog extends DialogWithImage {
    private static final String HIDE_STYLE = "btn-hide-dialog"
    private static final String SHOW_STYLE = "btn-show"

    TextArea textArea
    boolean showDetails

    Button details_btn

    ExceptionDialog(Window owner) {
        super(owner)
    }


    @Override
    protected void initView() {
        super.initView()

        title = "Error"
        image = new Image("/codeOrchestra/colt/core/ui/style/images/messages/error-48x48.png")

        setShowDetails(false)
    }

    @Override
    protected void initCenter() {
        textArea = new TextArea(prefHeight: 200,  wrapText: true)
        textArea.editable = false
        textArea.stylesheets.add("/codeOrchestra/colt/core/ui/style/main.css")
        setMargin(textArea, new Insets(17, 0, 0, 0))
        setVgrow(textArea, Priority.ALWAYS)

        children.add(textArea)
    }

    @Override
    protected void initButtons() {
        super.initButtons()

        details_btn = new Button(focusTraversable: false)
        ButtonBar.setType(details_btn, ButtonBar.ButtonType.LEFT)
        buttonBar.buttons.add(details_btn)
        details_btn.onAction = {
            showDetails = !showDetails
        } as EventHandler
    }

    void initException(Throwable exception, String massage = null) {
        if (massage) {
            this.message = massage
            comment = exception.message
        } else {
            this.message = exception.message
        }

        StringWriter sw = new StringWriter()
        PrintWriter pw = new PrintWriter(sw)
        exception.printStackTrace(pw)
        textArea.text = sw.toString()
    }

    void setShowDetails(boolean showDetails) {
        this.showDetails = showDetails
        if (showDetails) {
            details_btn.styleClass.remove(SHOW_STYLE)
            details_btn.styleClass.add(HIDE_STYLE)
            details_btn.text = "Hide details"
        } else {
            details_btn.styleClass.remove(HIDE_STYLE)
            details_btn.styleClass.add(SHOW_STYLE)
            details_btn.text = "Show details"
        }
        textArea.visible = textArea.managed = showDetails
        stage.sizeToScene()
    }

}

{'fraction_non_alphanumeric': 0.08664518438954529, 'fraction_numerical': 0.004296455424274973, 'mean_word_length': 2.6708278580814717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6612774', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1619, 'n_words': 323}