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

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckMenuItem?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.input.KeyCodeCombination?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<BorderPane prefHeight="400.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.zhaw.prog2.fxmlcalculator.MainWindowController">
   <top>
      <MenuBar BorderPane.alignment="CENTER">
         <menus>
            <Menu mnemonicParsing="false" text="Clear">
               <items>
                  <CheckMenuItem fx:id="clearInitialAmount" mnemonicParsing="false" text="Initial amount" />
                  <CheckMenuItem fx:id="clearReturnInPercent" mnemonicParsing="false" text="Return in%" />
                  <CheckMenuItem fx:id="clearAnnualCosts" mnemonicParsing="false" text="Annual Cost" />
                  <CheckMenuItem fx:id="clearNumberOfYears" mnemonicParsing="false" text="Number of years" />
                  <SeparatorMenuItem mnemonicParsing="false" />
                  <MenuItem mnemonicParsing="false" onAction="#clearValues" text="Clear values" />
                  <SeparatorMenuItem mnemonicParsing="false" />
                  <MenuItem mnemonicParsing="false" onAction="#clearResults" text="Clear results" />
               </items>
            </Menu>
            <Menu mnemonicParsing="false" text="?">
               <items>
                  <MenuItem mnemonicParsing="false" onAction="#showHelp" text="Show help F1">
                     <accelerator>
                        <KeyCodeCombination alt="ANY" code="F1" control="ANY" meta="ANY" shift="ANY" shortcut="ANY" />
                     </accelerator></MenuItem>
               </items>
            </Menu>
         </menus>
      </MenuBar>
   </top>
   <center>
      <VBox prefHeight="0.0" prefWidth="0.0" BorderPane.alignment="CENTER">
         <children>
            <GridPane hgap="5.0" vgap="5.0">
              <columnConstraints>
                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
              </columnConstraints>
              <rowConstraints>
                <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                  <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
              </rowConstraints>
               <children>
                  <Label text="Initial amount" />
                  <Label text="Return in %" GridPane.rowIndex="1" />
                  <Label text="Annual cost" GridPane.rowIndex="2" />
                  <Label text="Number of years" GridPane.rowIndex="3" />
                  <TextField fx:id="initialAmount" GridPane.columnIndex="1" />
                  <TextField fx:id="returnInPercent" GridPane.columnIndex="1" GridPane.rowIndex="1" />
                  <TextField fx:id="annualCost" GridPane.columnIndex="1" GridPane.rowIndex="2" />
                  <TextField fx:id="numberOfYears" GridPane.columnIndex="1" GridPane.rowIndex="3" />
               </children>
               <opaqueInsets>
                  <Insets />
               </opaqueInsets>
            </GridPane>
            <Label text="Results:">
               <VBox.margin>
                  <Insets top="10.0" />
               </VBox.margin>
            </Label>
            <TextArea fx:id="results" prefHeight="200.0" prefWidth="380.0" />
         </children>
         <padding>
            <Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
         </padding>
      </VBox>
   </center>
   <bottom>
      <HBox alignment="BASELINE_CENTER" prefHeight="0.0" prefWidth="0.0" BorderPane.alignment="CENTER">
         <padding>
            <Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
         </padding>
         <children>
            <Button lineSpacing="10.0" mnemonicParsing="false" onAction="#calculate" text="Calculate">
               <HBox.margin>
                  <Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
               </HBox.margin>
            </Button>
            <Button mnemonicParsing="false" onAction="#close" text="Close">
               <HBox.margin>
                  <Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
               </HBox.margin>
            </Button>
            <Button mnemonicParsing="false" onAction="#openResultWindow" text="Open result window">
               <HBox.margin>
                  <Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
               </HBox.margin>
            </Button>
         </children>
         <BorderPane.margin>
            <Insets />
         </BorderPane.margin>
      </HBox>
   </bottom>
</BorderPane>
