/* Copyright 2016 Evan A. Thompson
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.alvanson.xltsearch;

import javafx.geometry.Pos;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;

class DetailedAlert extends Alert {
    DetailedAlert(Alert.AlertType alertType) {
        super(alertType);
    }

    DetailedAlert(Alert.AlertType alertType, String contentText, ButtonType... buttons) {
        super(alertType, contentText, buttons);
    }

    void setDetailsText(String details) {
        VBox content = new VBox();
        content.setAlignment(Pos.BASELINE_LEFT);
        content.setMaxWidth(Double.MAX_VALUE);
        content.setMaxHeight(Double.MAX_VALUE);

        Label label = new Label("Details:");
        TextArea textArea = new TextArea(details);
        textArea.setEditable(false);
        textArea.setMaxWidth(Double.MAX_VALUE);
        textArea.setMaxHeight(Double.MAX_VALUE);

        content.getChildren().addAll(label, textArea);
        content.setVgrow(textArea, Priority.ALWAYS);

        this.getDialogPane().setExpandableContent(content);
    }
}

@@ -648,20 +648,28 @@
 afx.
-geometry.Pos
+application.Platform
 ;%0Aim
@@ -845,49 +845,16 @@
 out.
-Priority;%0Aimport javafx.scene.layout.VBox
+GridPane
 ;%0A%0Ac
@@ -1163,20 +1163,24 @@
         
-VBox
+GridPane
  content
@@ -1190,109 +1190,17 @@
 new 
-VBox();%0A        content.setAlignment(Pos.BASELINE_LEFT);%0A        content.setMaxWidth(Double.MAX_VALUE
+GridPane(
 );%0A 
@@ -1498,44 +1498,23 @@
 ent.
-getChildren().addAll(label, textArea
+add(label, 0, 0
 );%0A 
@@ -1532,16 +1532,11 @@
 ent.
-setVgrow
+add
 (tex
@@ -1546,23 +1546,12 @@
 ea, 
-Priority.ALWAYS
+0, 1
 );%0A%0A
@@ -1610,16 +1610,365 @@
 ntent);%0A
+        // work around DialogPane expandable content resize bug%0A        this.getDialogPane().expandedProperty().addListener((ov, oldValue, newValue) -%3E %7B%0A            Platform.runLater(() -%3E %7B%0A                this.getDialogPane().requestLayout();%0A                this.getDialogPane().getScene().getWindow().sizeToScene();%0A            %7D);%0A        %7D);%0A
     %7D%0A%7D%0A

Work around DialogPane expandable content resize bug