<?xml version="1.0" encoding="UTF-8"?>

<!--
/*
 * Copyright (C) 2021, 2023 Andrew Gegg
 *
 *	This file is part of the Garden Notebook application
 *
 * The Garden Notebook application is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/gpl.html>.
 */

/*
    Change log
    3.1.0	Use SafeDatePicker.
 */

-->

<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<!--<?import javafx.scene.control.DatePicker?>-->
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<!--<?import javafx.scene.control.TextArea?>-->
<?import javafx.scene.web.HTMLEditor?>
<?import javafx.scene.control.SplitPane?>
<!--<?import javafx.scene.layout.VBox?>-->

<!--<?import javafx.scene.layout.AnchorPane?>-->
<!--<?import javafx.scene.layout.BorderPane?>-->
<?import uk.co.gardennotebook.SafeDatePicker?>

<fx:root type="javafx.scene.layout.GridPane" hgap="5.0" vgap="5.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="404.0"
         prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
    <stylesheets>
        <URL value="@notebook.css"/>
    </stylesheets>

    <columnConstraints>
        <ColumnConstraints hgrow="NEVER" minWidth="10.0"/>
        <ColumnConstraints hgrow="NEVER" minWidth="10.0"/>
        <ColumnConstraints hgrow="NEVER" minWidth="10.0"/>
        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/>
    </columnConstraints>

    <rowConstraints>
        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="ALWAYS"/>
        <!-- <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="ALWAYS"/> -->
        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
    </rowConstraints>

    <padding>
        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/>
    </padding>

    <Label text="%lbl.date" alignment="CENTER_RIGHT" prefHeight="17.0" GridPane.halignment="RIGHT" GridPane.rowIndex="0" GridPane.columnIndex="0"/>
<!--    <DatePicker id="dtpDate" fx:id="dtpDate" editable="true" prefWidth="150.0" styleClass="notebook-mandatory-field" GridPane.rowIndex="0"-->
    <SafeDatePicker id="dtpDate" fx:id="dtpDate" editable="true" prefWidth="150.0" styleClass="notebook-mandatory-field" GridPane.rowIndex="0"
                    GridPane.columnIndex="1"/>

    <Label text="%lbl.review.year" alignment="CENTER_RIGHT" prefHeight="17.0" GridPane.halignment="RIGHT" GridPane.rowIndex="1" GridPane.columnIndex="0"/>
    <Spinner id="numYearInReview" fx:id="numYearInReview" editable="false" prefWidth="150.0" styleClass="notebook-mandatory-field" GridPane.rowIndex="1"
             GridPane.columnIndex="1">
        <tooltip>
            <Tooltip text="%tip.review.yearinreview"/>
        </tooltip>
    </Spinner>

    <Label text="%lbl.review.coverfrom" alignment="CENTER_RIGHT" prefHeight="17.0" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.columnIndex="0"/>
<!--    <DatePicker id="dtpCoverFrom" fx:id="dtpCoverFrom" editable="true" prefWidth="150.0" GridPane.rowIndex="2"-->
    <SafeDatePicker id="dtpCoverFrom" fx:id="dtpCoverFrom" editable="true" prefWidth="150.0" GridPane.rowIndex="2"
                GridPane.columnIndex="1">
        <tooltip>
            <Tooltip text="%tip.review.coverfrom"/>
        </tooltip>
    </SafeDatePicker>


    <Label text="%lbl.review.coverto" alignment="CENTER_RIGHT" prefHeight="17.0" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.columnIndex="2"/>
<!--    <DatePicker id="dtpCoverTo" fx:id="dtpCoverTo" editable="true" prefWidth="150.0" GridPane.rowIndex="2"-->
    <SafeDatePicker id="dtpCoverTo" fx:id="dtpCoverTo" editable="true" prefWidth="150.0" GridPane.rowIndex="2"
                GridPane.columnIndex="3">
        <tooltip>
            <Tooltip text="%tip.review.coverto"/>
        </tooltip>
    </SafeDatePicker>

    <Label text="%lbl.journal.title" alignment="CENTER_RIGHT" prefHeight="17.0" GridPane.halignment="RIGHT" GridPane.rowIndex="3" GridPane.columnIndex="0"/>
    <TextField id="fldTitle" fx:id="fldTitle" editable="true" prefWidth="150.0" styleClass="notebook-mandatory-field" GridPane.rowIndex="3"
               GridPane.columnIndex="1" GridPane.columnSpan="3"/>

    <SplitPane prefHeight="160.0" prefWidth="200.0" GridPane.rowIndex="4" GridPane.columnIndex="0" GridPane.columnSpan="4" orientation="VERTICAL"
               dividerPositions="0.85">
        <GridPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
            <columnConstraints>
                <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0"/>
            </columnConstraints>
            <rowConstraints>
                <RowConstraints minHeight="10.0" vgrow="NEVER"/>
                <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="ALWAYS"/>
            </rowConstraints>
            <padding>
                <Insets bottom="5.0"/>
            </padding>
            <Label text="%lbl.journal.description" prefHeight="17.0" GridPane.halignment="LEFT" GridPane.rowIndex="0" GridPane.valignment="TOP"/>
            <!--<TextArea id="fldDescription" fx:id="fldDescription" editable="true" prefWidth="150.0" GridPane.rowIndex="4" GridPane.columnIndex="1" GridPane.columnSpan="3" />-->
            <HTMLEditor id="fldDescription" fx:id="fldDescription" prefWidth="150.0" GridPane.rowIndex="1"/>
        </GridPane>

        <GridPane maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="633.0" prefWidth="783.0">
            <columnConstraints>
                <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0"/>
            </columnConstraints>
            <rowConstraints>
                <RowConstraints minHeight="10.0" vgrow="NEVER"/>
                <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="ALWAYS"/>
            </rowConstraints>
            <padding>
                <Insets bottom="5.0"/>
            </padding>
            <Label text="%lbl.comments" prefHeight="17.0" GridPane.halignment="LEFT" GridPane.rowIndex="0" GridPane.valignment="TOP"/>
            <TableView fx:id="tbvComment" id="tbvComment" editable="true" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
                <columns>
                    <TableColumn fx:id="tbvCommentDate" minWidth="50.0" prefWidth="-1.0" text="%col.comment.date"/>
                    <TableColumn fx:id="tbvCommentText" minWidth="50.0" prefWidth="-1.0" text="%col.comment.text"/>
                </columns>
            </TableView>
        </GridPane>
    </SplitPane>

    <ButtonBar prefHeight="40.0" prefWidth="200.0" GridPane.columnSpan="4" GridPane.rowIndex="5">
        <buttons>
            <Button id="btnCancel" cancelButton="true" mnemonicParsing="false" text="%btn.cancel" onAction="#btnCancelOnAction"
                    styleClass="notebook-cmd-button"/>
            <Button id="btnSave" fx:id="btnSave" mnemonicParsing="false" text="%btn.save" onAction="#btnSaveOnAction"
                    styleClass="notebook-cmd-button"/>   <!-- defaultButton="true" -->
            <Button id="btnDelete" fx:id="btnDelete" mnemonicParsing="false" text="%btn.delete" onAction="#btnDeleteOnAction" styleClass="notebook-cmd-button"/>
        </buttons>
    </ButtonBar>

</fx:root>
