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

<!--
/*
 * Copyright (C) 2018-2022 Andrew Gegg
 *
 * This file is part of the Garden Notebook application
 *
 * The Gardeners 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
 * 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
    2.8.0   Add Tooltips to the Start navigation buttons
            Top level menu options to add a single event
    2.9.0   Add Help button, improve appearance
    3.0.0   Add mnemonics to menu items.
            Warning - there is a problem with mnemonics on ContextMenus, https://github.com/javafxports/openjdk-jfx/issues/620.
            Support delaying ToDoList items by converting them (back) to Reminders.
    3.0.2   Add convenience features to ToDoList handling
    3.0.3   Add  SplitPane.resizableWithParent="false" to outer SplitPane to ensure it sets the divisions properly
            (see https://stackoverflow.com/questions/36290539/set-divider-position-of-splitpane for explanation and
            the answer by Florian)
 */

-->

<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Tooltip?>

<AnchorPane id="paneTop" fx:id="paneTop" prefHeight="794.0" prefWidth="959.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1"
            fx:controller="uk.co.gardennotebook.TopController">
    <stylesheets>
        <URL value="@notebook.css"/>
    </stylesheets>
    <MenuBar layoutY="2.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
        <Menu mnemonicParsing="true" text="%menu.file">
            <MenuItem mnemonicParsing="true" onAction="#mnuConfigOnAction" text="%menu.config" accelerator="Shortcut+Alt+S" />
            <MenuItem mnemonicParsing="true" onAction="#mnuJsonDumpOnAction" text="%menu.jsondump"/>
            <MenuItem fx:id="mnuJSONLoad" id="mnuJSONLoad" mnemonicParsing="true" onAction="#mnuJsonLoadOnAction" text="%menu.jsonload"/>
            <SeparatorMenuItem/>
            <Menu text="%menu.new" >
                <MenuItem mnemonicParsing="true" onAction="#mnuNewAfflictionOnAction" text="%menu.newaffliction"/>
                <MenuItem mnemonicParsing="true" onAction="#mnuNewGroundworkOnAction" text="%menu.newgroundwork"/>
                <MenuItem mnemonicParsing="true" onAction="#mnuNewHusbandryOnAction" text="%menu.newhusbandry"/>
                <MenuItem mnemonicParsing="true" onAction="#mnuNewPurchaseOnAction" text="%menu.newpurchase"/>
                <MenuItem mnemonicParsing="true" onAction="#mnuNewSaleOnAction" text="%menu.newsale"/>
                <MenuItem mnemonicParsing="true" onAction="#mnuNewWeatherOnAction" text="%menu.newweather"/>
                <MenuItem mnemonicParsing="true" onAction="#mnuNewWildlifeOnAction" text="%menu.newwildlife"/>
                <MenuItem mnemonicParsing="true" onAction="#mnuNewJournalOnAction" text="%menu.newjournal"/>
            </Menu>
            <SeparatorMenuItem/>
            <MenuItem mnemonicParsing="true" onAction="#mnuExitOnAction" text="%menu.close"/>
        </Menu>
        <Menu mnemonicParsing="true" text="%menu.help">
            <MenuItem mnemonicParsing="true" onAction="#mnuHelpAboutOnAction" text="%menu.about"/>
        </Menu>
    </MenuBar>
    <!--      <VBox layoutX="65.0" layoutY="39.0" prefHeight="669.0" prefWidth="1032.0" spacing="2.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="25.0">
             <children>
    -->
    <SplitPane fx:id="paneOuterSplit" layoutX="65.0" layoutY="39.0" prefHeight="700.0" prefWidth="1000.0" orientation="VERTICAL" dividerPositions="0.90"
               AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="25.0">
        <SplitPane id="paneTopSplit" fx:id="paneTopSplit" dividerPositions="0.1563106796116505" prefHeight="160.0" prefWidth="200.0" SplitPane.resizableWithParent="false" >
            <AnchorPane fx:id="topNavBox" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
                <TabPane id="tabPaneNav" fx:id="tabPaneNav" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
                         minWidth="-Infinity" prefHeight="633.0" prefWidth="100.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="0.0"
                         AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                    <Tab text="%nav.tab.start" id="startHereTab">
                        <VBox alignment="TOP_CENTER" layoutX="14.0" prefHeight="604.0" prefWidth="272.0" spacing="1.0"
                              AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
                              AnchorPane.topAnchor="0.0">
                            <padding>
                                <Insets top="1.0" right="3.0"/>
                            </padding>
                            <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btnTopDiaryOnAction"
                                    styleClass="notebook-nav-button" text="%btn.diary" wrapText="true">
                                <tooltip>
                                    <Tooltip text="%tip.top.diarybutton"/>
                                </tooltip>
                            </Button>
                            <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btnTopPlantCatalogueOnAction"
                                    styleClass="notebook-nav-button" text="%btn.plantcatalogue" wrapText="true">
                                <tooltip>
                                    <Tooltip text="%tip.top.plantcataloguebutton"/>
                                </tooltip>
                            </Button>
                            <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btnTopShoppingOnAction"
                                    styleClass="notebook-nav-button" text="%btn.shopping" wrapText="true">
                                <tooltip>
                                    <Tooltip text="%tip.top.shoppingbutton"/>
                                </tooltip>
                            </Button>
                            <Separator prefHeight="5.0" prefWidth="175.0" visible="false"/>
                            <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btnTopCataloguesOnAction"
                                    prefWidth="161.0" styleClass="notebook-nav-button" text="%btn.catalogues" wrapText="true">
                                <tooltip>
                                    <Tooltip text="%tip.top.topcataloguesbutton"/>
                                </tooltip>
                            </Button>
                            <Separator prefHeight="5.0" prefWidth="175.0" visible="false"/>
                            <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btnTopRemindersOnAction"
                                    prefWidth="161.0" styleClass="notebook-nav-button" text="%btn.reminders" wrapText="true">
                                <tooltip>
                                    <Tooltip text="%tip.top.remindersbutton"/>
                                </tooltip>
                            </Button>
                            <Separator prefHeight="5.0" prefWidth="175.0" visible="false"/>
                            <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btnTopReviewsOnAction"
                                    prefWidth="161.0" styleClass="notebook-nav-button" text="%btn.reviews" wrapText="true">
                                <tooltip>
                                    <Tooltip text="%tip.top.reviewsbutton"/>
                                </tooltip>
                            </Button>
                            <Separator prefHeight="5.0" prefWidth="175.0" visible="false"/>
                            <Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#btnTopPlanningOnAction"
                                    prefWidth="161.0" styleClass="notebook-nav-button" text="%btn.planning" wrapText="true">
                                <tooltip>
                                    <Tooltip text="%tip.top.planningbutton"/>
                                </tooltip>
                            </Button>
                        </VBox>
                    </Tab>
                </TabPane>
            </AnchorPane>
            <AnchorPane fx:id="paneTopSub1" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="633.0" prefWidth="783.0">
                <TabPane id="tabPaneTop" fx:id="tabPaneTop" prefHeight="633.0" prefWidth="752.0" AnchorPane.bottomAnchor="0.0"
                         AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
            </AnchorPane>
        </SplitPane>
        <GridPane hgap="0.0" SplitPane.resizableWithParent="false" >
            <columnConstraints>
                <ColumnConstraints hgrow="SOMETIMES" minWidth="0.0"/>
                <ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0"/>
                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/>
                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/>
                <ColumnConstraints hgrow="NEVER"
                                   minWidth="0.0"/> <!-- combined with the hgap property on the GridPane, this forces a 5px gap just right of the button -->
            </columnConstraints>
            <rowConstraints>
                <RowConstraints minHeight="30.0" prefHeight="75.0" vgrow="ALWAYS"/>
            </rowConstraints>
            <!--                  <uk.co.gardennotebook.SimpleWeatherForecast fx:id="weatherForecastDisplay" GridPane.columnIndex="0" /> -->
            <TableView id="todoList" fx:id="todoList" editable="false" GridPane.columnIndex="1">
                <columns>
                    <TableColumn id="todoHusbandryClass" fx:id="todoHusbandryClass" editable="false" prefWidth="75.0" text="%col.todo.husbandry"/>
                    <TableColumn id="todoGroundworkActivity" fx:id="todoGroundworkActivity" editable="false" prefWidth="75.0"
                                 text="%col.todo.groundwork"/>
                    <TableColumn id="todoPlantSpecies" fx:id="todoPlantSpecies" editable="false" prefWidth="75.0" text="%col.todo.plant"/>
                    <TableColumn id="todoPlantVariety" fx:id="todoPlantVariety" editable="false" prefWidth="75.0" text="%col.todo.variety"/>
                    <TableColumn id="todoDescription" fx:id="todoDescription" editable="false" prefWidth="75.0" text="%col.todo.description"/>
                </columns>

                <contextMenu>
                    <ContextMenu onShowing="#ctxmnuToDoTop">
                        <items>
                            <MenuItem id="ctxmnuToDoComplete" onAction="#ctxmnuToDoCompleteOnAction" text="%menu.todo.complete"/>
                            <MenuItem id="ctxmnuToDoDelay" onAction="#ctxmnuToDoDelayOnAction" text="%menu.todo.delay"/>
                            <MenuItem id="ctxmnuToDoDismiss" onAction="#ctxmnuToDoDismissOnAction" text="%menu.todo.dismiss"/>
                            <SeparatorMenuItem/>
                            <MenuItem id="ctxmnuToDoPriorHistory" fx:id="ctxmnuToDoPriorHistory" onAction="#ctxmnuToDoPriorHistory" text="%menu.todo.priorhistory"/>
                            <MenuItem id="ctxmnuToDoOrigin" fx:id="ctxmnuToDoOrigin" onAction="#ctxmnuToDoOrigin" text="%menu.todo.origin"/>
                            <SeparatorMenuItem/>
                            <MenuItem id="ctxmnuToDoRefresh" fx:id="ctxmnuToDoRefresh" onAction="#ctxmnuToDoRefresh" text="%menu.todo.refresh"/>
                        </items>
                    </ContextMenu>
                </contextMenu>

            </TableView>
            <ButtonBar GridPane.columnIndex="2" GridPane.columnSpan="2">
                <buttons>
                    <Button mnemonicParsing="false" onAction="#btnExitOnAction" text="%btn.close" styleClass="notebook-cmd-button"/>
                    <Button id="btnHelp" fx:id="btnHelp" disable="false" mnemonicParsing="false" onAction="#btnHelpOnAction" text="%btn.config.help"
                            styleClass="notebook-cmd-button"/>
                </buttons>
            </ButtonBar>
        </GridPane>
        <!--         </children>
            </VBox> -->
    </SplitPane>
</AnchorPane>
