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

<!--
/*
 * Copyright (C) 2018, 2021 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/>.
 */

/*
        Change log
        3.0.0   Added CropRotationGroup
 */

-->

<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import uk.co.gardennotebook.CropRotationGroupCombo?>

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

    <columnConstraints>
        <ColumnConstraints hgrow="NEVER" minWidth="10.0"/>
        <ColumnConstraints hgrow="SOMETIMES" 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="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="SOMETIMES" />
        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> -->
        <RowConstraints maxHeight="1.7976931348623157E308" 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 alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.commonname" GridPane.columnIndex="0" GridPane.halignment="RIGHT"/>
    <TextField id="fldCommonName" fx:id="fldCommonName" editable="true" prefWidth="150.0" styleClass="notebook-mandatory-field" GridPane.columnIndex="1" GridPane.columnSpan="3" >
        <tooltip>
            <Tooltip text="%tip.plantspecies.commonname"/>
        </tooltip>
    </TextField>
    <Label alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.latinname" GridPane.columnIndex="0" GridPane.halignment="RIGHT" GridPane.rowIndex="1"/>
    <TextField id="fldLatinName" fx:id="fldLatinName" editable="true" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.columnSpan="3" >
        <tooltip>
            <Tooltip text="%tip.plantspecies.latinname"/>
        </tooltip>
    </TextField>
    <Label alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.description" GridPane.columnIndex="0" GridPane.halignment="RIGHT" GridPane.rowIndex="2"/>
    <TextField id="fldDescription" fx:id="fldDescription" editable="true" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="2" GridPane.columnSpan="3" />

    <Label alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.utility" GridPane.columnIndex="0" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/>
    <TextField id="fldUtility" fx:id="fldUtility" editable="true" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="3">
        <tooltip>
            <Tooltip text="%tip.plantspecies.utility"/>
        </tooltip>
    </TextField>

    <Label alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.hardiness" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/>
    <TextField id="fldHardiness" fx:id="fldHardiness" editable="true" prefWidth="150.0" GridPane.columnIndex="3" GridPane.rowIndex="3">
        <tooltip>
            <Tooltip text="%tip.plantspecies.hardiness"/>
        </tooltip>
    </TextField>

    <Label alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.lifetype" GridPane.columnIndex="0" GridPane.halignment="RIGHT" GridPane.rowIndex="4"/>
    <TextField id="fldLifeType" fx:id="fldLifeType" editable="true" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="4">
        <tooltip>
            <Tooltip text="%tip.plantspecies.lifetype"/>
        </tooltip>
    </TextField>

    <Label alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.planttype" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="4"/>
    <TextField id="fldPlantType" fx:id="fldPlantType" editable="true" prefWidth="150.0" GridPane.columnIndex="3" GridPane.rowIndex="4">
        <tooltip>
            <Tooltip text="%tip.plantspecies.planttype"/>
        </tooltip>
    </TextField>

    <Label alignment="CENTER_RIGHT" prefHeight="17.0" text="%lbl.croprotationgroup" GridPane.columnIndex="0" GridPane.halignment="RIGHT" GridPane.rowIndex="5"/>
    <uk.co.gardennotebook.CropRotationGroupCombo id="parentCropRotationGroup" fx:id="parentCropRotationGroup" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="5"/>

    <SplitPane dividerPositions="0.33, 0.66" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity"
               orientation="VERTICAL" GridPane.columnIndex="0" GridPane.columnSpan="4" GridPane.hgrow="ALWAYS" GridPane.rowIndex="6"
               GridPane.vgrow="ALWAYS">
        <GridPane>
            <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 prefHeight="17.0" text="%lbl.comments" GridPane.columnIndex="0" GridPane.halignment="LEFT" GridPane.rowIndex="0"
                   GridPane.valignment="TOP"/>
            <TableView id="tbvComment" fx:id="tbvComment" editable="true" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="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>

        <GridPane vgap="2">
            <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 minHeight="10.0" vgrow="NEVER"/>
            </rowConstraints>
            <padding>
                <Insets top="5.0" bottom="5.0"/>
            </padding>
            <Label text="%lbl.plantnotes" GridPane.halignment="LEFT" GridPane.rowIndex="0" GridPane.valignment="TOP"/>
            <TabPane id="plantNotes" fx:id="plantNotes" GridPane.halignment="LEFT" tabClosingPolicy="UNAVAILABLE" GridPane.rowIndex="1"
                     GridPane.valignment="TOP"/>

            <ButtonBar prefHeight="10.0" prefWidth="200.0" GridPane.rowIndex="2">
                <buttons>
                    <Button id="btnAddNote" mnemonicParsing="false" onAction="#btnAddNoteOnAction" text="%btn.addnote"/>
                    <Button id="btnDeleteNote" fx:id="btnDeleteNote" mnemonicParsing="false" onAction="#btnDeleteNoteOnAction" text="%btn.deletenote"/>
                </buttons>
            </ButtonBar>
        </GridPane>

        <GridPane>
            <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 top="5.0"/>
            </padding>
            <Label text="%lbl.plantvarieties" GridPane.halignment="LEFT" GridPane.rowIndex="0" GridPane.valignment="TOP"/>
            <TableView id="tbvVarieties" fx:id="tbvVarieties" editable="true" prefHeight="91.0" prefWidth="483.0" GridPane.columnIndex="0"
                       GridPane.rowIndex="1">
                <columns>
                    <TableColumn id="tbvPVCommonName" fx:id="tbvPVCommonName" text="%col.commonname"/>
                    <TableColumn id="tbvPVLatinName" fx:id="tbvPVLatinName" text="%col.latinname"/>
                    <TableColumn id="tbvPVDesc" fx:id="tbvPVDesc" text="%col.description"/>
                    <TableColumn id="tbvPVComment" fx:id="tbvPVComment" prefWidth="75.0" text="%col.comment"/>
                </columns>
            </TableView>
        </GridPane>

    </SplitPane>

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