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

<!--
/*
 * Copyright (C) 2018, 2019 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
    2.5.0   Support Sales
    2.6.0   Allow leaf items to be disconnected from ancestors
 */

-->

<?import java.net.URL?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuButton?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>

<fx:root id="AnchorPane" maxHeight="1.7976931348623157E308" prefHeight="404.0" prefWidth="600.0"
         styleClass="mainFxmlClass" type="javafx.scene.layout.AnchorPane" xmlns="http://javafx.com/javafx/8.0.60"
         xmlns:fx="http://javafx.com/fxml/1">
    <stylesheets>
        <URL value="@notebook.css"/>
    </stylesheets>
    <BorderPane prefHeight="404.0" prefWidth="600.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0"
                AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
        <center>
            <TableView id="diaryTable" fx:id="diaryTable" editable="true" maxHeight="1.7976931348623157E308"
                       prefHeight="515.0" prefWidth="600.0" BorderPane.alignment="CENTER">
                <columns>
                    <TableColumn id="diaryColDate" fx:id="diaryColDate" prefWidth="75.0" sortable="false"
                                 editable="false" text="%col.date"/>
                    <TableColumn id="colMainTitle" fx:id="colMainTitle" prefWidth="75.0" sortable="false"
                                 text="%col.event"/>
                    <TableColumn id="colSubTitle" fx:id="colSubTitle" prefWidth="75.0" sortable="false"/>
                    <TableColumn id="colVariety" fx:id="colVariety" prefWidth="75.0" sortable="false"/>
                    <TableColumn id="colDetail" fx:id="colDetail" prefWidth="75.0" sortable="false"/>
                    <TableColumn id="colComment" fx:id="colComment" prefWidth="75.0" sortable="false"
                                 text="%col.comment"/>
                </columns>
                <contextMenu>
                    <ContextMenu onShowing="#ctxmnuTopOnAction">
                        <items>
                            <MenuItem id="ctxmnuChange" onAction="#ctxmnuChangeOnAction" text="%menu.change"/>
                            <MenuItem id="ctxmnuDelete" fx:id="ctxmnuDelete" onAction="#ctxmnuDeleteOnAction"
                                      text="%menu.delete"/>
                            <Menu id="ctxmnuTopHistory" fx:id="ctxmnuTopHistory" mnemonicParsing="false"
                                  text="%menu.history">
                                <MenuItem id="ctxmnuAncestors" fx:id="ctxmnuAncestors"
                                          onAction="#ctxmnuAncestorsOnAction" text="%menu.ancestors"/>
                                <MenuItem id="ctxmnuDescendants" fx:id="ctxmnuDescendants"
                                          onAction="#ctxmnuDescendantsOnAction" text="%menu.descendants"/>
                                <Menu id="ctxmnuNewDescendant" fx:id="ctxmnuNewDescendant"
                                      mnemonicParsing="false" text="%menu.newdescendant">
                                    <MenuItem id="ctxmnuNewHusbandry" fx:id="ctxmnuNewHusbandry"
                                              mnemonicParsing="true"
                                              onAction="#ctxmnuDescendantHusbandryOnAction"
                                              text="%menu.newhusbandry"/>
                                    <MenuItem id="ctxmnuNewGroundwork" fx:id="ctxmnuNewGroundwork"
                                              mnemonicParsing="true"
                                              onAction="#ctxmnuDescendantGroundworkOnAction"
                                              text="%menu.newgroundwork"/>
                                    <MenuItem id="ctxmnuNewAffliction" fx:id="ctxmnuNewAffliction"
                                              mnemonicParsing="true"
                                              onAction="#ctxmnuDescendantAfflictionOnAction"
                                              text="%menu.newaffliction"/>
                                    <MenuItem id="ctxmnuNewSale" fx:id="ctxmnuNewSale" mnemonicParsing="true"
                                              onAction="#ctxmnuDescendantSaleOnAction" text="%menu.newsale"/>
                                </Menu>
                                <MenuItem id="ctxmnuDropLeaf" fx:id="ctxmnuDropLeaf"
                                          onAction="#ctxmnuDropLeafOnAction" text="%menu.dropleaf"/>
                            </Menu>
                        </items>
                    </ContextMenu>
                </contextMenu>
            </TableView>
        </center>
        <bottom>
            <ButtonBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
                <buttons>
                    <MenuButton id="btnAdd" fx:id="btnAdd" mnemonicParsing="false" text="%btn.add">
                        <items>
                            <MenuItem id="mnuHusbandry" fx:id="mnuHusbandry" mnemonicParsing="true"
                                      onAction="#mnubtnAddHusbandryOnAction" text="%menu.newhusbandry"/>
                            <MenuItem id="mnuPurchase" fx:id="mnuPurchase" mnemonicParsing="true"
                                      onAction="#mnubtnAddPurchaseOnAction" text="%menu.newpurchase"/>
                            <MenuItem id="mnuGroundwork" fx:id="mnuGroundwork" mnemonicParsing="true"
                                      onAction="#mnubtnAddGroundworkOnAction" text="%menu.newgroundwork"/>
                            <MenuItem id="mnuAffliction" fx:id="mnuAffliction" mnemonicParsing="true"
                                      onAction="#mnubtnAddAfflictionOnAction" text="%menu.newaffliction"/>
                            <MenuItem id="mnuWeather" fx:id="mnuWeather" mnemonicParsing="true"
                                      onAction="#mnubtnAddWeatherOnAction" text="%menu.newweather"/>
                            <MenuItem id="mnuWildlife" fx:id="mnuWildlife" mnemonicParsing="true"
                                      onAction="#mnubtnAddWildlifeOnAction" text="%menu.newwildlife"/>
                            <MenuItem id="mnuSale" fx:id="mnuSale" mnemonicParsing="true"
                                      onAction="#mnubtnAddSaleOnAction" text="%menu.newsale"/>
                            <MenuItem id="mnuJournal" fx:id="mnuJournal" mnemonicParsing="true"
                                      onAction="#mnubtnAddJournalOnAction" text="%menu.newjournal"/>
                        </items>
                    </MenuButton>
                    <Button id="btnChange" fx:id="btnChange" mnemonicParsing="false" onAction="#btnChangeOnAction"
                            text="%btn.change"/>
                    <Button id="btnDelete" fx:id="btnDelete" mnemonicParsing="false" onAction="#btnDeleteOnAction"
                            text="%btn.delete"/>
                </buttons>
            </ButtonBar>
        </bottom>
    </BorderPane>
</fx:root>
