/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.jfoenix.controls;

import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;

import java.util.List;

/**
 * Default dialog layout according to material design guidelines.
 *
 * @author Shadi Shaheen
 * @version 1.0
 * @since 2016-03-09
 */
public class JFXDialogLayout extends StackPane {
    private StackPane heading = new StackPane();
    private StackPane body = new StackPane();
    private FlowPane actions = new FlowPane();

    /**
     * creates empty dialog layout
     */
    public JFXDialogLayout() {
        initialize();
        final VBox layout = new VBox();
        layout.getChildren().add(heading);
        heading.getStyleClass().add("jfx-layout-heading");
        heading.getStyleClass().add("title");
        layout.getChildren().add(body);
        body.getStyleClass().add("jfx-layout-body");
        layout.getChildren().add(actions);
        actions.getStyleClass().add("jfx-layout-actions");
        this.getChildren().add(layout);
    }

    /***************************************************************************
     *                                                                         *
     * Setters / Getters                                                       *
     *                                                                         *
     **************************************************************************/

    public ObservableList<Node> getHeading() {
        return heading.getChildren();
    }

    /**
     * set header node
     *
     * @param titleContent
     */
    public void setHeading(Node... titleContent) {
        this.heading.getChildren().setAll(titleContent);
    }

    public ObservableList<Node> getBody() {
        return body.getChildren();
    }

    /**
     * set body node
     *
     * @param body
     */
    public void setBody(Node... body) {
        this.body.getChildren().setAll(body);
    }

    public ObservableList<Node> getActions() {
        return actions.getChildren();
    }

    /**
     * set actions of the dialog (Accept, Cancel,...)
     *
     * @param actions
     */
    public void setActions(Node... actions) {
        this.actions.getChildren().setAll(actions);
    }

    public void setActions(List<? extends Node> actions) {
        this.actions.getChildren().setAll(actions);
    }

    /***************************************************************************
     *                                                                         *
     * Stylesheet Handling                                                     *
     *                                                                         *
     **************************************************************************/
    /**
     * Initialize the style class to 'jfx-dialog-layout'.
     * <p>
     * This is the selector class from which CSS can be used to style
     * this control.
     */
    private static final String DEFAULT_STYLE_CLASS = "jfx-dialog-layout";

    /**
     * {@inheritDoc}
     */
    @Override
    public String getUserAgentStylesheet() {
        return getClass().getResource("/css/controls/jfx-dialog-layout.css").toExternalForm();
    }

    private void initialize() {
        this.getStyleClass().add(DEFAULT_STYLE_CLASS);
    }
}

@@ -965,24 +965,61 @@
 t.FlowPane;%0A
+import javafx.scene.layout.Priority;%0A
 import javaf
@@ -1761,24 +1761,70 @@
 .add(body);%0A
+        VBox.setVgrow(body, Priority.ALWAYS);%0A
         body

update dialog body vgrow priority