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

<!--
/*
 * Copyright (C) 2018 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
                (not implemented - the new status of 'no ancestor' is NOT picked up by a separate DiaryTab
                     which still shows Prior History available - and crashes)
 */

-->

<?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.MenuItem?>
<?import javafx.scene.control.TreeTableColumn?>
<?import javafx.scene.control.TreeTableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>

<fx:root id="AnchorPane" maxWidth="1.7976931348623157E308" prefHeight="150.0" prefWidth="250.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>
            <TreeTableView id="diaryTree" fx:id="diaryTree" editable="true" layoutX="0.0" layoutY="0.0" maxWidth="1.7976931348623157E308" prefHeight="100.0"
                           prefWidth="144.0" showRoot="false">
                <columns>
<!--                    <TreeTableColumn id="diaryColDate" fx:id="diaryColDate" prefWidth="75.0" sortable="true" styleClass="notebook-catalogue-treecell" -->
                    <TreeTableColumn id="diaryColDate" fx:id="diaryColDate" prefWidth="75.0" sortable="false" styleClass="notebook-catalogue-treecell"
                                     editable="false" text="%col.date"/>
                    <TreeTableColumn id="colMainTitle" fx:id="colMainTitle" prefWidth="75.0" sortable="false" styleClass="notebook-catalogue-treecell"
                                     text="%col.event"/>
                    <TreeTableColumn id="colSubTitle" fx:id="colSubTitle" prefWidth="75.0" sortable="false" styleClass="notebook-catalogue-treecell"/>
                    <TreeTableColumn id="colVariety" fx:id="colVariety" prefWidth="75.0" sortable="false" styleClass="notebook-catalogue-treecell"/>
                    <TreeTableColumn id="colDetail" fx:id="colDetail" prefWidth="75.0" sortable="false" styleClass="notebook-catalogue-treecell"/>
                    <TreeTableColumn id="colComment" fx:id="colComment" maxWidth="1.7976931348623157E308" minWidth="-1.0" prefWidth="-1.0" sortable="false"
                                     styleClass="notebook-catalogue-treecell" text="%col.comment"/>
                </columns>
                <contextMenu>
                    <ContextMenu onShowing="#ctxmnuTopOnAction">
                        <items>
                            <MenuItem id="ctxmnuChange" onAction="#ctxmnuChangeOnAction" text="%menu.change"/>
                            <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>
            </TreeTableView>
        </center>
        <bottom>
            <ButtonBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
                <buttons>
                    <Button id="btnChange" fx:id="btnChange" mnemonicParsing="false" onAction="#btnChangeOnAction" text="%btn.change"/>
                </buttons>
            </ButtonBar>
        </bottom>
    </BorderPane>
</fx:root>
