From fd7ebfe0ae3e9d94cd48f0991588a9ff1e6dc59c Mon Sep 17 00:00:00 2001
From: thmustap <tuomas.mustaparta@gmail.com>
Date: Thu, 11 Apr 2024 13:53:51 +0300
Subject: [PATCH] =?UTF-8?q?Tietojen=20sy=C3=B6tt=C3=B6=20mainiin=20ja=20uu?=
 =?UTF-8?q?distettu=20otteluikkuna.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/HT/fx/OtteluIkkunaGUIController.java |  10 +-
 src/HT/fx/OtteluIkkunaGUIView.fxml       | 156 +++++++++--------------
 src/HT/fx/PadelMainGUIController.java    |  67 +++++++---
 3 files changed, 116 insertions(+), 117 deletions(-)

diff --git a/src/HT/fx/OtteluIkkunaGUIController.java b/src/HT/fx/OtteluIkkunaGUIController.java
index e105c98..7e3ef25 100644
--- a/src/HT/fx/OtteluIkkunaGUIController.java
+++ b/src/HT/fx/OtteluIkkunaGUIController.java
@@ -7,6 +7,7 @@ import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
 import javafx.scene.control.TextField;
 import javafx.scene.input.MouseEvent;
+import javafx.scene.layout.VBox;
 import javafx.stage.Stage;
 
 /**
@@ -16,14 +17,13 @@ import javafx.stage.Stage;
  */
 public class OtteluIkkunaGUIController implements ModalControllerInterface<String> {
     
-    
-    @FXML private TextField joukkue1;
+    @FXML private VBox Joukkue1VBox;
 
-    @FXML private TextField joukkue2;
+    @FXML private VBox Joukkue2VBox;
 
-    @FXML private TextField lopputulos;
+    @FXML private VBox MuokkaaVBox;
 
-    @FXML private TextField paivamaara;
+    @FXML private VBox TulosVBox;
 
     
     @FXML  void handleLisaaOttelu() {
diff --git a/src/HT/fx/OtteluIkkunaGUIView.fxml b/src/HT/fx/OtteluIkkunaGUIView.fxml
index 12229cc..a6cb9bd 100644
--- a/src/HT/fx/OtteluIkkunaGUIView.fxml
+++ b/src/HT/fx/OtteluIkkunaGUIView.fxml
@@ -1,103 +1,65 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <?import javafx.scene.control.Button?>
+<?import javafx.scene.control.ButtonBar?>
 <?import javafx.scene.control.Label?>
-<?import javafx.scene.control.TextField?>
-<?import javafx.scene.layout.BorderPane?>
-<?import javafx.scene.layout.ColumnConstraints?>
-<?import javafx.scene.layout.GridPane?>
-<?import javafx.scene.layout.Pane?>
-<?import javafx.scene.layout.RowConstraints?>
+<?import javafx.scene.control.ScrollPane?>
+<?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.layout.HBox?>
+<?import javafx.scene.layout.VBox?>
 <?import javafx.scene.text.Font?>
 
-<BorderPane xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="HT.fx.OtteluIkkunaGUIController">
-   <top>
-      <GridPane gridLinesVisible="true" BorderPane.alignment="CENTER">
-        <columnConstraints>
-          <ColumnConstraints hgrow="SOMETIMES" maxWidth="186.0" minWidth="10.0" prefWidth="111.0" />
-          <ColumnConstraints hgrow="SOMETIMES" maxWidth="150.0" minWidth="10.0" prefWidth="150.0" />
-            <ColumnConstraints hgrow="SOMETIMES" maxWidth="120.0" minWidth="10.0" prefWidth="120.0" />
-            <ColumnConstraints hgrow="SOMETIMES" maxWidth="150.0" minWidth="10.0" prefWidth="150.0" />
-            <ColumnConstraints hgrow="SOMETIMES" maxWidth="132.0" minWidth="10.0" prefWidth="79.0" />
-        </columnConstraints>
-        <rowConstraints>
-          <RowConstraints maxHeight="36.0" minHeight="10.0" prefHeight="27.0" vgrow="SOMETIMES" />
-          <RowConstraints maxHeight="36.0" minHeight="10.0" prefHeight="33.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 minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
-            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
-        </rowConstraints>
-         <children>
-            <Label alignment="CENTER" prefHeight="32.0" prefWidth="173.0" text="Ottelut">
-               <font>
-                  <Font size="20.0" />
-               </font>
-            </Label>
-            <Label alignment="CENTER" prefHeight="0.0" prefWidth="111.0" text="Päivämäärä" GridPane.rowIndex="1">
-               <font>
-                  <Font size="16.0" />
-               </font>
-            </Label>
-            <Label alignment="CENTER" prefHeight="25.0" prefWidth="136.0" text="Joukkue 1" GridPane.columnIndex="1" GridPane.rowIndex="1">
-               <font>
-                  <Font size="16.0" />
-               </font>
-            </Label>
-            <Label alignment="CENTER" prefHeight="17.0" prefWidth="80.0" text="Tulos" GridPane.columnIndex="2" GridPane.rowIndex="1">
-               <font>
-                  <Font size="16.0" />
-               </font>
-            </Label>
-            <Label alignment="CENTER" prefHeight="17.0" prefWidth="88.0" text="Muokkaa" GridPane.columnIndex="4" GridPane.rowIndex="1">
-               <font>
-                  <Font size="16.0" />
-               </font>
-            </Label>
-            <TextField GridPane.rowIndex="2" />
-            <TextField prefHeight="25.0" prefWidth="118.0" text="31.1.2024" GridPane.rowIndex="2" />
-            <TextField fx:id="paivamaara" GridPane.rowIndex="3" />
-            <TextField GridPane.rowIndex="4" />
-            <TextField GridPane.rowIndex="5" />
-            <TextField text="Aku Ankka, Teppo Tulppu" GridPane.columnIndex="1" GridPane.rowIndex="2">
-               <font>
-                  <Font size="10.0" />
-               </font></TextField>
-            <TextField fx:id="joukkue1" GridPane.columnIndex="1" GridPane.rowIndex="3" />
-            <TextField GridPane.columnIndex="1" GridPane.rowIndex="4" />
-            <TextField GridPane.columnIndex="1" GridPane.rowIndex="5" />
-            <TextField alignment="CENTER" text="2 - 6, 6 - 3, 1 - 6" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="2" />
-            <TextField fx:id="lopputulos" GridPane.columnIndex="2" GridPane.rowIndex="3" />
-            <TextField GridPane.columnIndex="2" GridPane.rowIndex="4" />
-            <TextField GridPane.columnIndex="2" GridPane.rowIndex="5" />
-            <Button alignment="CENTER" minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="2" />
-            <Button alignment="CENTER" minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="3" />
-            <Button alignment="CENTER" minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
-            <Button alignment="CENTER" minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="5" />
-            <Button alignment="CENTER" minWidth="50.0" mnemonicParsing="false" text="X" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="6" />
-            <TextField GridPane.rowIndex="6" />
-            <TextField GridPane.columnIndex="1" GridPane.rowIndex="6" />
-            <TextField GridPane.columnIndex="2" GridPane.rowIndex="6" />
-            <Label alignment="CENTER" prefHeight="25.0" prefWidth="136.0" text="Joukkue 2" GridPane.columnIndex="3" GridPane.rowIndex="1">
-               <font>
-                  <Font size="16.0" />
-               </font>
-            </Label>
-            <TextField text="Repe Sorsa, Hannu Hanhi" GridPane.columnIndex="3" GridPane.rowIndex="2">
-               <font>
-                  <Font size="10.0" />
-               </font>
-            </TextField>
-            <TextField fx:id="joukkue2" GridPane.columnIndex="3" GridPane.rowIndex="3" />
-         </children>
-      </GridPane>
-   </top>
-   <center>
-      <Pane prefHeight="30.0" prefWidth="560.0" BorderPane.alignment="CENTER">
-         <children>
-            <Button layoutX="432.0" layoutY="3.0" mnemonicParsing="false" onMouseClicked="#handleLisaaOttelu" prefHeight="25.0" prefWidth="120.0" text="Lisää ottelu" />
-         </children>
-      </Pane>
-   </center>
-</BorderPane>
+<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="HT.fx.OtteluIkkunaGUIController">
+   <children>
+      <ButtonBar layoutX="200.0" layoutY="366.0" prefHeight="40.0" prefWidth="200.0" AnchorPane.bottomAnchor="-3.0" AnchorPane.leftAnchor="2.5" AnchorPane.rightAnchor="2.5">
+        <buttons>
+          <Button mnemonicParsing="false" onMouseClicked="#handleLisaaOttelu" text="Lisää ottelu" />
+        </buttons>
+      </ButtonBar>
+      <Label layoutX="14.0" layoutY="6.0" text="Ottelut" AnchorPane.leftAnchor="2.5" AnchorPane.topAnchor="2.5">
+         <font>
+            <Font name="System Bold" size="24.0" />
+         </font>
+      </Label>
+      <ScrollPane layoutX="3.0" layoutY="30.0" AnchorPane.bottomAnchor="35.0" AnchorPane.leftAnchor="3.0" AnchorPane.rightAnchor="3.0" AnchorPane.topAnchor="30.0">
+         <content>
+            <HBox prefHeight="335.0" prefWidth="378.0">
+               <children>
+                  <VBox fx:id="Joukkue1VBox" prefHeight="100.0" prefWidth="150.0">
+                     <children>
+                        <Label text="Joukkue 1">
+                           <font>
+                              <Font size="14.0" />
+                           </font>
+                        </Label>
+                     </children>
+                  </VBox>
+                  <VBox fx:id="TulosVBox" prefHeight="100.0" prefWidth="100.0">
+                     <children>
+                        <Label text="Tulos">
+                           <font>
+                              <Font size="14.0" />
+                           </font>
+                        </Label>
+                     </children>
+                  </VBox>
+                  <VBox fx:id="Joukkue2VBox" prefHeight="100.0" prefWidth="150.0">
+                     <children>
+                        <Label text="Joukkue 2">
+                           <font>
+                              <Font size="14.0" />
+                           </font>
+                        </Label>
+                     </children>
+                  </VBox>
+                  <VBox fx:id="MuokkaaVBox" prefHeight="100.0" prefWidth="80.0">
+                     <children>
+                        <Label text="Muokkaa" />
+                     </children>
+                  </VBox>
+               </children>
+            </HBox>
+         </content>
+      </ScrollPane>
+   </children>
+</AnchorPane>
diff --git a/src/HT/fx/PadelMainGUIController.java b/src/HT/fx/PadelMainGUIController.java
index fce5cb2..bde82ad 100644
--- a/src/HT/fx/PadelMainGUIController.java
+++ b/src/HT/fx/PadelMainGUIController.java
@@ -103,28 +103,65 @@ public class PadelMainGUIController {
         lisaatekstikentta(AutoVbox);
     }
     
+    /**
+     * Syöttää tiedot tekstikenttiin
+     */
     public void syotatiedot() {
         int i = 0;
-        for (Node child : NimiVbox.getChildren()) {
-            TextField tf = (TextField) child;
+        int j = 0;
+        int k = 0;
+        int m = 0;
+        int n = 0;
+        for (Node lapsi : NimiVbox.getChildren()) {
+            if (lapsi instanceof TextField) {
+                TextField tf = (TextField) lapsi;
             
-            tf.setText(karkelo.annaPelaaja(i).getNimi());
-            i++;
+                tf.setText(karkelo.annaPelaaja(i).getNimi());
+                i++;
+            }
+        }
+        
+        for (Node lapsi : IkaVbox.getChildren()) {
+            if (lapsi instanceof TextField) {
+                TextField tf = (TextField) lapsi;
+                tf.setText(String.valueOf(karkelo.annaPelaaja(j).getIka()));
+                j++;
+            }
+        }
+        /*
+        for (Node lapsi : RatingVbox.getChildren()) {
+            if (lapsi instanceof TextField) {
+                TextField tf = (TextField) lapsi;
+            
+                tf.setText(karkelo.annaPelaaja(n).getRating());
+                n++;
+            }
+        }
+        */
+        for (Node lapsi : SapoVbox.getChildren()) {
+            if (lapsi instanceof TextField) {
+                TextField tf = (TextField) lapsi;
+            
+                tf.setText(karkelo.annaPelaaja(k).getSahkoposti());
+                k++;
+            }
         }
-    }
-    
-    /**
-     * Syöttää pelaajan tiedot tekstikenttään, tällä hetkellä vain yhteen
-     */
-    private void Syotatiedot() {
-       // Pelaaja pelaaja = karkelo.annaPelaaja(0);
         
-        testi.setText(karkelo.annaPelaaja(0).getNimi());
-        ika1.setText(String.valueOf(karkelo.annaPelaaja(0).getIka()));
-        sapo1.setText(karkelo.annaPelaaja(0).getSahkoposti());
-        auto1.setSelected(karkelo.annaPelaaja(0).getAuto());   
+        for (Node lapsi : AutoVbox.getChildren()) {
+            if (lapsi instanceof TextField) {
+                TextField tf = (TextField) lapsi;
+                if(karkelo.annaPelaaja(m).getAuto()) {
+                    tf.setText("Kyllä");
+                    m++;
+                }else {
+                    tf.setText("Ei");
+                    m++;
+                }
+            }
+        }
     }
     
+    
     /**
      * @param karkelo karkelo jota käytetään tässä käyttöliittymässä
      */
-- 
GitLab