<commit_before>package lighthouse.controls

import javafx.scene.control.Label
import javafx.scene.layout.HBox
import javafx.geometry.Pos
import javafx.scene.shape.Rectangle
import javafx.animation.Timeline
import javafx.animation.KeyFrame
import javafx.util.Duration
import javafx.animation.KeyValue
import javafx.beans.value.WritableValue
import lighthouse.utils.easing.ElasticInterpolator
import javafx.animation.Interpolator
import javafx.scene.layout.Region
import javafx.application.Platform
import javafx.beans.InvalidationListener
import javafx.beans.Observable
import javafx.scene.layout.StackPane

/**
 * Control that wraps another control and hides most of it until the Read more ... link is clicked, when it animates
 * itself into the right size.
 */
[suppress("UNCHECKED_CAST")]    // Hack around Kotlin compiler bug
public class ReadMorePane() : StackPane() {
    {
        setMinHeight(50.0)
        getChildren().addListener(object : InvalidationListener {
            override fun invalidated(observable: Observable?) {
                getChildren().removeListener(this)

                // Wait for a layout pass to have happened so we can query the wrapped height.
                // This is ugly! We should really figure out how to do this without waiting.
                Platform.runLater {
                    val wrappedNode = getChildren()[0] as Region

                    if (wrappedNode.getHeight() < getPrefHeight()) {
                        setPrefHeight(wrappedNode.getHeight())
                    } else {
                        wrappedNode.setMinHeight(0.0)
                        val label = Label("Read more ...")
                        label.setStyle("-fx-text-fill: blue; -fx-cursor: hand")
                        val box = HBox(label)
                        box.setAlignment(Pos.BOTTOM_RIGHT)
                        box.setStyle("-fx-padding: 5px; -fx-background-color: linear-gradient(from 0% 0% to 0% 50%, #ffffff00, white)")
                        box.setMaxHeight(100.0)
                        StackPane.setAlignment(box, Pos.BOTTOM_RIGHT)
                        getChildren().add(box)
<commit_msg>Increase the min area of the read more pane a bit.<commit_after>package lighthouse.controls

import javafx.scene.control.Label
import javafx.scene.layout.HBox
import javafx.geometry.Pos
import javafx.scene.shape.Rectangle
import javafx.animation.Timeline
import javafx.animation.KeyFrame
import javafx.util.Duration
import javafx.animation.KeyValue
import javafx.beans.value.WritableValue
import lighthouse.utils.easing.ElasticInterpolator
import javafx.animation.Interpolator
import javafx.scene.layout.Region
import javafx.application.Platform
import javafx.beans.InvalidationListener
import javafx.beans.Observable
import javafx.scene.layout.StackPane

/**
 * Control that wraps another control and hides most of it until the Read more ... link is clicked, when it animates
 * itself into the right size.
 */
[suppress("UNCHECKED_CAST")]    // Hack around Kotlin compiler bug
public class ReadMorePane() : StackPane() {
    {
        setMinHeight(65.0)
        getChildren().addListener(object : InvalidationListener {
            override fun invalidated(observable: Observable?) {
                getChildren().removeListener(this)

                // Wait for a layout pass to have happened so we can query the wrapped height.
                // This is ugly! We should really figure out how to do this without waiting.
                Platform.runLater {
                    val wrappedNode = getChildren()[0] as Region

                    if (wrappedNode.getHeight() < getPrefHeight()) {
                        setPrefHeight(wrappedNode.getHeight())
                    } else {
                        wrappedNode.setMinHeight(0.0)
                        val label = Label("Read more ...")
                        label.setStyle("-fx-text-fill: blue; -fx-cursor: hand")
                        val box = HBox(label)
                        box.setAlignment(Pos.BOTTOM_RIGHT)
                        box.setStyle("-fx-padding: 5px; -fx-background-color: linear-gradient(from 0% 0% to 0% 50%, #ffffff00, white)")
                        box.setMaxHeight(100.0)
                        StackPane.setAlignment(box, Pos.BOTTOM_RIGHT)
                        getChildren().add(box)

{'fraction_non_alphanumeric': 0.08688637935008066, 'fraction_numerical': 0.00829684259045863, 'mean_word_length': 2.263157894736842, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5828110', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1095, 'n_words': 300}