From d01db9dd1a9ccd3ef53ae51016a23bcfd7549872 Mon Sep 17 00:00:00 2001
From: julipits <jussi.e.lipitsainen@student.jyu.fi>
Date: Thu, 20 Feb 2025 14:17:40 +0200
Subject: [PATCH] Toisen vaiheen viimeistely

---
 .../KohtaushallintaGUIController.java         |  47 +++++-
 .../KohtaushallintaGUIView.fxml               |   4 +-
 src/fxKohtaushallinta/NaytaKohtaus.fxml       |  93 ++++++-----
 src/fxKohtaushallinta/UusiTietue.fxml         |  27 +--
 src/fxKohtaushallinta/UusiTietue2.fxml        | 156 ------------------
 5 files changed, 114 insertions(+), 213 deletions(-)
 delete mode 100644 src/fxKohtaushallinta/UusiTietue2.fxml

diff --git a/src/fxKohtaushallinta/KohtaushallintaGUIController.java b/src/fxKohtaushallinta/KohtaushallintaGUIController.java
index fab86fe..5bc91ae 100644
--- a/src/fxKohtaushallinta/KohtaushallintaGUIController.java
+++ b/src/fxKohtaushallinta/KohtaushallintaGUIController.java
@@ -1,10 +1,55 @@
 package fxKohtaushallinta;
 
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import fi.jyu.mit.fxgui.Dialogs;
+
 /**
  * @author jlipi
  * @version 26.1.2025
  *
  */
 public class KohtaushallintaGUIController {
-      // TODO
+    private String kohtauslista = "kohtaus";
+    private String hahmolista = "hahmo";
+    private String asialista = "asia/esine";
+    
+    @FXML private Button btnUusiLista;
+    
+    
+    public void handleUusiLista() {
+        uusiLista();
+    }
+    
+    public void handleAvaaLista() {
+        //
+    }
+    
+    public void handlePoistaHahmo() {
+        poistaTietue(hahmolista, 0);
+    }
+    
+    public void handlePoistaKohtaus() {
+        poistaTietue(kohtauslista, 0);
+    }
+    
+    
+    //====================================
+    
+    private void uusiLista() {
+        Dialogs.showQuestionDialog("Uusi lista", "Luodaan uusi kohtauslista, oletko varma?", "Kyllä", "En ole");
+        //Dialogs.showMessageDialog("Ei vielä käytössä");
+    }
+    
+    
+    /**
+     * Poistaa tietueen halutusta taulusta
+     * @param taulu tietueen sisältävä taulu
+     * @param indeksi poistettavan tietueen indeksi
+     */
+    private void poistaTietue(String taulu, int indeksi) {
+        String poistettava = "valittu_tietue";
+        Dialogs.showQuestionDialog("Poistetaan valinta", "Poistetaan " + poistettava + ". Oletko varma?" , "Kyllä", "En ole");
+    }
+      
 }
\ No newline at end of file
diff --git a/src/fxKohtaushallinta/KohtaushallintaGUIView.fxml b/src/fxKohtaushallinta/KohtaushallintaGUIView.fxml
index 54eed37..c04e5e9 100644
--- a/src/fxKohtaushallinta/KohtaushallintaGUIView.fxml
+++ b/src/fxKohtaushallinta/KohtaushallintaGUIView.fxml
@@ -75,11 +75,11 @@
          <right>
             <VBox alignment="CENTER" minHeight="500.0" minWidth="130.0" prefWidth="130.0" spacing="20.0" BorderPane.alignment="CENTER">
                <children>
-                  <Button id="btnUusiLista" minHeight="40.0" minWidth="120.0" mnemonicParsing="false" text="UUSI LISTA" />
+                  <Button id="btnUusiLista" fx:id="btnUusiLista" minHeight="40.0" minWidth="120.0" mnemonicParsing="false" onAction="#handleUusiLista" text="UUSI LISTA" />
                   <Button id="btnLataaLista" minHeight="40.0" minWidth="120.0" mnemonicParsing="false" text="LATAA LISTA" />
                   <Pane prefHeight="40.0" />
                   <Button id="btnUusiKohtaus" minHeight="40.0" minWidth="120.0" mnemonicParsing="false" text="UUSI KOHTAUS" />
-                  <Button id="btnPoistaKohtaus" minHeight="40.0" minWidth="120.0" mnemonicParsing="false" text="POISTA KOHTAUS" />
+                  <Button id="btnPoistaKohtaus" minHeight="40.0" minWidth="120.0" mnemonicParsing="false" text="POISTA KOHTAUS" onAction="#handlePoistaKohtaus" />
                   <Pane prefHeight="40.0" />
                   <Button id="btnSuljeOhjelma" minHeight="40.0" minWidth="120.0" mnemonicParsing="false" text="SULJE OHJELMA" />
                </children>
diff --git a/src/fxKohtaushallinta/NaytaKohtaus.fxml b/src/fxKohtaushallinta/NaytaKohtaus.fxml
index 42177f8..ecf7d3e 100644
--- a/src/fxKohtaushallinta/NaytaKohtaus.fxml
+++ b/src/fxKohtaushallinta/NaytaKohtaus.fxml
@@ -3,6 +3,7 @@
 <?import fi.jyu.mit.fxgui.ListChooser?>
 <?import javafx.geometry.Insets?>
 <?import javafx.scene.control.Button?>
+<?import javafx.scene.control.ComboBox?>
 <?import javafx.scene.control.Label?>
 <?import javafx.scene.control.Menu?>
 <?import javafx.scene.control.MenuBar?>
@@ -12,8 +13,9 @@
 <?import javafx.scene.layout.BorderPane?>
 <?import javafx.scene.layout.HBox?>
 <?import javafx.scene.layout.VBox?>
+<?import javafx.scene.text.Font?>
 
-<BorderPane minWidth="500.0" prefHeight="680.0" prefWidth="840.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxKohtaushallinta.KohtaushallintaGUIController">
+<BorderPane minWidth="500.0" prefHeight="700.0" prefWidth="850.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxKohtaushallinta.KohtaushallintaGUIController">
    <top>
       <MenuBar prefWidth="800.0" BorderPane.alignment="CENTER">
         <menus>
@@ -39,26 +41,24 @@
    <center>
       <VBox alignment="CENTER_LEFT" prefHeight="200.0" prefWidth="100.0" spacing="10.0" BorderPane.alignment="CENTER_LEFT">
          <children>
-            <HBox alignment="CENTER_LEFT" minWidth="30.0" prefHeight="35.0" prefWidth="200.0" spacing="10.0">
+            <HBox alignment="CENTER_LEFT" minWidth="30.0" prefHeight="35.0" spacing="10.0">
                <children>
                   <Label minWidth="50.0" text="Kohtaus" />
-                  <TextField prefHeight="25.0" prefWidth="500.0" />
+                  <TextField id="txtKohtauksenOtsikko" prefHeight="25.0" prefWidth="550.0" />
+                  <Button id="btnSuljeIkkuna" mnemonicParsing="false" prefHeight="25.0" prefWidth="181.0" text="Sulje ikkuna" />
                </children>
             </HBox>
-            <Label text="Kuvaus" />
-            <TextArea minWidth="200.0" prefHeight="200.0" prefWidth="500.0" />
-            <HBox alignment="CENTER_LEFT" minHeight="40.0" minWidth="30.0" prefHeight="35.0" prefWidth="200.0" spacing="10.0" VBox.vgrow="NEVER">
+            <TextArea id="txtAreaKohtauksenKuvaus" minWidth="200.0" prefHeight="200.0" prefWidth="500.0" />
+            <VBox prefHeight="170.0" prefWidth="820.0">
                <children>
-                  <Label minWidth="50.0" text="Valinta" />
-                  <TextField minHeight="25.0" prefHeight="25.0" prefWidth="500.0" />
+                  <Label text="Muistiinpanot" />
+                  <TextArea id="txtAreaMuistiinpanot" prefHeight="200.0" prefWidth="200.0">
+                     <VBox.margin>
+                        <Insets top="10.0" />
+                     </VBox.margin>
+                  </TextArea>
                </children>
-               <padding>
-                  <Insets top="20.0" />
-               </padding>
-            </HBox>
-            <Label maxHeight="15.0" minHeight="15.0" prefHeight="15.0" text="Kuvaus" />
-            <TextArea prefHeight="200.0" prefWidth="200.0" />
-            <HBox prefHeight="100.0" prefWidth="200.0" />
+            </VBox>
          </children>
          <BorderPane.margin>
             <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
@@ -66,40 +66,45 @@
       </VBox>
    </center>
    <bottom>
-      <VBox prefHeight="150.0" prefWidth="100.0" BorderPane.alignment="CENTER">
+      <VBox spacing="10.0" BorderPane.alignment="CENTER">
          <children>
-            <Label text="Muistiinpanot" />
-            <TextArea prefHeight="200.0" prefWidth="200.0">
-               <VBox.margin>
-                  <Insets top="10.0" />
-               </VBox.margin>
-            </TextArea>
+            <Label text="Kohtaukseen liitetyt">
+               <font>
+                  <Font size="14.0" />
+               </font></Label>
+            <HBox prefWidth="850.0" spacing="10.0" style="-fx-border-color: black;">
+               <children>
+                  <VBox prefHeight="250.0" spacing="10.0">
+                     <children>
+                        <Label id="lblHahmot" text="Hahmot" />
+                        <ComboBox id="cmbHahmoAvainsanat" prefHeight="25.0" prefWidth="200.0" />
+                        <ListChooser id="lstcHahmot" prefWidth="116.0" />
+                        <Button id="btnUusiHahmo" mnemonicParsing="false" prefHeight="25.0" prefWidth="194.0" text="Lisää uusi hahmo" />
+                     </children>
+                  </VBox>
+                  <VBox prefHeight="250.0" prefWidth="200.0" spacing="10.0">
+                     <children>
+                        <Label text="Asiat ja esineet" />
+                        <ComboBox id="cmbAsiaAvainsanat" prefHeight="25.0" prefWidth="200.0" />
+                        <ListChooser id="lstcAsiat" minWidth="100.0" prefWidth="200.0" />
+                        <Button id="btnUusiAsia" mnemonicParsing="false" prefHeight="25.0" prefWidth="191.0" text="Lisää uusi asia / esine" />
+                     </children>
+                  </VBox>
+                  <VBox prefHeight="250.0" spacing="10.0">
+                     <children>
+                        <Label maxHeight="15.0" minHeight="15.0" prefHeight="15.0" text="Kuvaus" />
+                        <TextArea id="txtAreaValinnanKuvaus" />
+                     </children>
+                  </VBox>
+               </children>
+               <padding>
+                  <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
+               </padding>
+            </HBox>
          </children>
          <BorderPane.margin>
             <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
          </BorderPane.margin>
       </VBox>
    </bottom>
-   <right>
-      <VBox maxWidth="200.0" minWidth="200.0" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
-         <children>
-            <HBox prefHeight="100.0" prefWidth="200.0" />
-            <ListChooser />
-            <HBox prefHeight="100.0" prefWidth="200.0">
-               <children>
-                  <Button mnemonicParsing="false" text="Lisää hahmo" />
-                  <Button mnemonicParsing="false" text="Poista valittu" />
-               </children>
-            </HBox>
-            <HBox prefHeight="100.0" prefWidth="200.0" />
-            <ListChooser />
-            <HBox prefHeight="100.0" prefWidth="200.0">
-               <children>
-                  <Button mnemonicParsing="false" text="Lisää asia/esine" />
-                  <Button mnemonicParsing="false" text="Poista valittu" />
-               </children>
-            </HBox>
-         </children>
-      </VBox>
-   </right>
 </BorderPane>
diff --git a/src/fxKohtaushallinta/UusiTietue.fxml b/src/fxKohtaushallinta/UusiTietue.fxml
index ab2f209..033af0c 100644
--- a/src/fxKohtaushallinta/UusiTietue.fxml
+++ b/src/fxKohtaushallinta/UusiTietue.fxml
@@ -48,11 +48,15 @@
                </VBox.margin>
             </HBox>
             <ListChooser rivit="&#10;Osanna Windandus&#10;Erich Stahlhaken&#10;Ankerias&#10;Josef Specht&#10;Johanna Karstedt&#10;Hanno" />
-            <Button id="btnPoistaTietue" mnemonicParsing="false" text="Poista hahmo">
-               <VBox.margin>
-                  <Insets top="10.0" />
-               </VBox.margin>
-            </Button>
+            <HBox prefHeight="100.0" spacing="10.0">
+               <children>
+                  <Button id="btnMuokkaaTietuetta" minWidth="110.0" mnemonicParsing="false" prefHeight="25.0" text="Muokkaa" />
+                  <Button id="btnPoistaTietue" minWidth="110.0" mnemonicParsing="false" prefHeight="25.0" text="Poista" />
+               </children>
+               <padding>
+                  <Insets top="5.0" />
+               </padding>
+            </HBox>
          </children>
          <padding>
             <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
@@ -102,16 +106,17 @@
                      </VBox.margin>
                   </Label>
                   <TextArea prefHeight="200.0" prefWidth="200.0" />
-                  <HBox alignment="TOP_CENTER" prefWidth="500.0" spacing="20.0">
+                  <HBox alignment="TOP_CENTER" prefWidth="500.0" spacing="10.0">
                      <children>
-                        <Button id="btnUusiTietue" mnemonicParsing="false" prefHeight="25.0" prefWidth="140.0" text="Uusi hahmo" />
-                        <Button id="btnMuokkaaValittua" mnemonicParsing="false" prefHeight="25.0" prefWidth="138.0" text="Muokkaa hahmoa" />
+                        <Button id="btnUusiTietue" mnemonicParsing="false" prefHeight="25.0" prefWidth="90.0" text="Luo uusi" />
+                        <Button id="btnMuokkaaValittua" mnemonicParsing="false" prefHeight="25.0" prefWidth="120.0" text="Tallenna" />
+                        <Button id="btnUusiTietue" mnemonicParsing="false" prefHeight="25.0" prefWidth="120.0" text="Peruuta muutokset" />
                      </children>
                      <VBox.margin>
                         <Insets top="10.0" />
                      </VBox.margin>
                   </HBox>
-                  <Button mnemonicParsing="false" prefHeight="40.0" prefWidth="348.0" text="Lisää kohtaukseen">
+                  <Button mnemonicParsing="false" prefHeight="40.0" prefWidth="348.0" text="Sulje">
                      <VBox.margin>
                         <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
                      </VBox.margin>
@@ -129,12 +134,14 @@
         <menus>
           <Menu mnemonicParsing="false" text="Tiedosto">
             <items>
+              <MenuItem mnemonicParsing="false" text="Luo uusi" />
+                  <MenuItem mnemonicParsing="false" text="Tallenna" />
                   <MenuItem mnemonicParsing="false" text="Sulje" />
             </items>
           </Menu>
           <Menu mnemonicParsing="false" text="Muokkaa">
             <items>
-              <MenuItem mnemonicParsing="false" text="Uusi hahmo" />
+                  <MenuItem mnemonicParsing="false" text="Peruuta muutokset" />
                   <MenuItem mnemonicParsing="false" text="Tyhjennä kentät" />
             </items>
           </Menu>
diff --git a/src/fxKohtaushallinta/UusiTietue2.fxml b/src/fxKohtaushallinta/UusiTietue2.fxml
deleted file mode 100644
index 033af0c..0000000
--- a/src/fxKohtaushallinta/UusiTietue2.fxml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import fi.jyu.mit.fxgui.ListChooser?>
-<?import javafx.geometry.Insets?>
-<?import javafx.scene.control.Button?>
-<?import javafx.scene.control.ComboBox?>
-<?import javafx.scene.control.Label?>
-<?import javafx.scene.control.Menu?>
-<?import javafx.scene.control.MenuBar?>
-<?import javafx.scene.control.MenuItem?>
-<?import javafx.scene.control.TextArea?>
-<?import javafx.scene.control.TextField?>
-<?import javafx.scene.layout.BorderPane?>
-<?import javafx.scene.layout.HBox?>
-<?import javafx.scene.layout.VBox?>
-
-<BorderPane minWidth="500.0" prefHeight="402.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxKohtaushallinta.KohtaushallintaGUIController">
-   <right>
-      <VBox maxWidth="150.0" minWidth="250.0" prefHeight="200.0" prefWidth="250.0" BorderPane.alignment="CENTER">
-         <children>
-            <HBox fillHeight="false" prefHeight="30.0">
-               <children>
-                  <TextField id="txtHahmotSuodatin" promptText="Suodatin">
-                     <HBox.margin>
-                        <Insets right="5.0" />
-                     </HBox.margin>
-                  </TextField>
-                  <Button id="btnHahmotTyhjenna" mnemonicParsing="false" text="Tyhjennä" />
-               </children>
-               <VBox.margin>
-                  <Insets top="5.0" />
-               </VBox.margin>
-            </HBox>
-            <HBox fillHeight="false" prefHeight="30.0">
-               <children>
-                  <ComboBox id="cmbHahmotAvain1" prefWidth="150.0" promptText="Avainsana">
-                     <padding>
-                        <Insets right="5.0" />
-                     </padding>
-                     <HBox.margin>
-                        <Insets right="5.0" />
-                     </HBox.margin>
-                  </ComboBox>
-                  <ComboBox id="cmbHahmotAvain2" prefWidth="150.0" promptText="Avainsana" />
-               </children>
-               <VBox.margin>
-                  <Insets bottom="5.0" top="5.0" />
-               </VBox.margin>
-            </HBox>
-            <ListChooser rivit="&#10;Osanna Windandus&#10;Erich Stahlhaken&#10;Ankerias&#10;Josef Specht&#10;Johanna Karstedt&#10;Hanno" />
-            <HBox prefHeight="100.0" spacing="10.0">
-               <children>
-                  <Button id="btnMuokkaaTietuetta" minWidth="110.0" mnemonicParsing="false" prefHeight="25.0" text="Muokkaa" />
-                  <Button id="btnPoistaTietue" minWidth="110.0" mnemonicParsing="false" prefHeight="25.0" text="Poista" />
-               </children>
-               <padding>
-                  <Insets top="5.0" />
-               </padding>
-            </HBox>
-         </children>
-         <padding>
-            <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
-         </padding>
-      </VBox>
-   </right>
-   <center>
-      <BorderPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
-         <right>
-            <VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
-               <children>
-                  <Label text="Avainsanat" />
-                  <TextField text="Uusi avainsana">
-                     <VBox.margin>
-                        <Insets bottom="10.0" top="10.0" />
-                     </VBox.margin>
-                  </TextField>
-                  <Button minWidth="150.0" mnemonicParsing="false" prefWidth="150.0" text="Lisää avainsana">
-                     <VBox.margin>
-                        <Insets bottom="10.0" />
-                     </VBox.margin>
-                  </Button>
-                  <ListChooser id="listAvainsanat" minWidth="150.0" prefHeight="379.0" prefWidth="150.0" rivit="&#10;Rikollinen&#10;Satama&#10;Paroni&#10;Liittolainen" />
-                  <Button id="btnPoistaAvainsana" minWidth="150.0" mnemonicParsing="false" prefWidth="150.0" text="Poista valittu">
-                     <VBox.margin>
-                        <Insets top="10.0" />
-                     </VBox.margin>
-                  </Button>
-               </children>
-               <BorderPane.margin>
-                  <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
-               </BorderPane.margin>
-            </VBox>
-         </right>
-         <center>
-            <VBox minHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
-               <children>
-                  <HBox prefWidth="200.0">
-                     <children>
-                        <Label minWidth="50.0" text="Nimi" />
-                        <TextField prefWidth="500.0" />
-                     </children>
-                  </HBox>
-                  <Label text="Kuvaus">
-                     <VBox.margin>
-                        <Insets bottom="10.0" top="10.0" />
-                     </VBox.margin>
-                  </Label>
-                  <TextArea prefHeight="200.0" prefWidth="200.0" />
-                  <HBox alignment="TOP_CENTER" prefWidth="500.0" spacing="10.0">
-                     <children>
-                        <Button id="btnUusiTietue" mnemonicParsing="false" prefHeight="25.0" prefWidth="90.0" text="Luo uusi" />
-                        <Button id="btnMuokkaaValittua" mnemonicParsing="false" prefHeight="25.0" prefWidth="120.0" text="Tallenna" />
-                        <Button id="btnUusiTietue" mnemonicParsing="false" prefHeight="25.0" prefWidth="120.0" text="Peruuta muutokset" />
-                     </children>
-                     <VBox.margin>
-                        <Insets top="10.0" />
-                     </VBox.margin>
-                  </HBox>
-                  <Button mnemonicParsing="false" prefHeight="40.0" prefWidth="348.0" text="Sulje">
-                     <VBox.margin>
-                        <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
-                     </VBox.margin>
-                  </Button>
-               </children>
-               <BorderPane.margin>
-                  <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
-               </BorderPane.margin>
-            </VBox>
-         </center>
-      </BorderPane>
-   </center>
-   <top>
-      <MenuBar BorderPane.alignment="CENTER">
-        <menus>
-          <Menu mnemonicParsing="false" text="Tiedosto">
-            <items>
-              <MenuItem mnemonicParsing="false" text="Luo uusi" />
-                  <MenuItem mnemonicParsing="false" text="Tallenna" />
-                  <MenuItem mnemonicParsing="false" text="Sulje" />
-            </items>
-          </Menu>
-          <Menu mnemonicParsing="false" text="Muokkaa">
-            <items>
-                  <MenuItem mnemonicParsing="false" text="Peruuta muutokset" />
-                  <MenuItem mnemonicParsing="false" text="Tyhjennä kentät" />
-            </items>
-          </Menu>
-          <Menu mnemonicParsing="false" text="Apua">
-            <items>
-              <MenuItem mnemonicParsing="false" text="Tietoja" />
-            </items>
-          </Menu>
-        </menus>
-      </MenuBar>
-   </top>
-</BorderPane>
-- 
GitLab