<commit_before>package com.jetbrains.edu.learning.editor

import com.intellij.openapi.editor.colors.EditorColorsManager
import com.jetbrains.edu.learning.courseFormat.Task
import javafx.application.Platform
import javafx.embed.swing.JFXPanel
import javafx.geometry.Insets
import javafx.scene.Group
import javafx.scene.Scene
import javafx.scene.control.CheckBox
import javafx.scene.control.RadioButton
import javafx.scene.control.ToggleGroup
import javafx.scene.layout.VBox
import javafx.scene.text.Font
import javax.swing.JScrollPane
import javax.swing.ScrollPaneConstants


class StudyChoiceVariantsPanel(task: Task) : JScrollPane() {

  private val LEFT_INSET = 15.0
  private val RIGHT_INSET = 10.0
  private val TOP_INSET = 15.0
  private val BOTTOM_INSET = 10.0

  init {
    val jfxPanel = JFXPanel()
    Platform.runLater {
      val group = Group()
      val scene = Scene(group)
      jfxPanel.scene = scene
      val vBox = VBox()
      vBox.spacing = 10.0
      vBox.padding = Insets(TOP_INSET, RIGHT_INSET, BOTTOM_INSET, LEFT_INSET)
      if (task.isMultipleChoice) {
        for ((index, variant) in task.choiceVariants.withIndex()) {
          val isSelected = task.selectedVariants.contains(index)
          val checkBox = CheckBox(variant)
          checkBox.isSelected = isSelected
          checkBox.isWrapText = true
          checkBox.maxWidthProperty().bind(scene.widthProperty().subtract(LEFT_INSET).subtract(RIGHT_INSET))
          checkBox.font = Font.font((EditorColorsManager.getInstance().globalScheme.editorFontSize + 2).toDouble())
          checkBox.stylesheets.add(String::class.java.getResource("/style/buttons.css").toExternalForm())
          checkBox.selectedProperty().addListener { observableValue, wasSelected, isSelected -><commit_msg>Fix EDU-801 Empty window instead of choice task: use proper class loader to get resource file<commit_after>package com.jetbrains.edu.learning.editor

import com.intellij.openapi.editor.colors.EditorColorsManager
import com.jetbrains.edu.learning.courseFormat.Task
import javafx.application.Platform
import javafx.embed.swing.JFXPanel
import javafx.geometry.Insets
import javafx.scene.Group
import javafx.scene.Scene
import javafx.scene.control.CheckBox
import javafx.scene.control.RadioButton
import javafx.scene.control.ToggleGroup
import javafx.scene.layout.VBox
import javafx.scene.text.Font
import javax.swing.JScrollPane
import javax.swing.ScrollPaneConstants


class StudyChoiceVariantsPanel(task: Task) : JScrollPane() {

  private val LEFT_INSET = 15.0
  private val RIGHT_INSET = 10.0
  private val TOP_INSET = 15.0
  private val BOTTOM_INSET = 10.0

  init {
    val jfxPanel = JFXPanel()
    Platform.runLater {
      val group = Group()
      val scene = Scene(group)
      jfxPanel.scene = scene
      val vBox = VBox()
      vBox.spacing = 10.0
      vBox.padding = Insets(TOP_INSET, RIGHT_INSET, BOTTOM_INSET, LEFT_INSET)
      if (task.isMultipleChoice) {
        for ((index, variant) in task.choiceVariants.withIndex()) {
          val isSelected = task.selectedVariants.contains(index)
          val checkBox = CheckBox(variant)
          checkBox.isSelected = isSelected
          checkBox.isWrapText = true
          checkBox.maxWidthProperty().bind(scene.widthProperty().subtract(LEFT_INSET).subtract(RIGHT_INSET))
          checkBox.font = Font.font((EditorColorsManager.getInstance().globalScheme.editorFontSize + 2).toDouble())
          checkBox.stylesheets.add(StudyChoiceVariantsPanel::class.java.getResource("/style/buttons.css").toExternalForm())
          checkBox.selectedProperty().addListener { observableValue, wasSelected, isSelected ->
{'fraction_non_alphanumeric': 0.09544706527701591, 'fraction_numerical': 0.009599561162918267, 'mean_word_length': 3.9754433833560707, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3878212', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1075, 'n_words': 213}