From 56ba5b81aee5a0281aff76c5e85ebb49ab998af4 Mon Sep 17 00:00:00 2001 From: Jona Walpert Date: Wed, 1 Apr 2026 13:48:24 +0200 Subject: [PATCH] Docs: translate client side components to english. This includes comments and javaDoc --- .../dbis/cs108/casono/client/ClientApp.java | 10 ++-- .../dbis/cs108/casono/client/ui/Launcher.java | 7 +-- .../client/ui/lobbyui/Casinomainui.java | 15 +++--- .../ui/lobbyui/CasinomainuiController.java | 33 ++++++++----- .../LobbyButtonTranslationManager.java | 47 ++++++++++--------- 5 files changed, 62 insertions(+), 50 deletions(-) diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java index 7fa4291..fc216d7 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ClientApp.java @@ -8,17 +8,19 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** - * Entry point for the Casono client application. Handles client startup and connection parameters. + * Entry point for the Casono client application. Handles client startup and + * connection parameters. * - *

Standardkonstruktor für die Anwendung. + *

+ * Default constructor for the application. */ public class ClientApp { private static final Logger LOGGER = LogManager.getLogger(ClientApp.class); - /** Standardkonstruktor. */ + /** Default constructor. */ public ClientApp() { - // Standardkonstruktor + // Default constructor } /** diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/Launcher.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/Launcher.java index f4d4069..a5f74de 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/Launcher.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/Launcher.java @@ -6,13 +6,14 @@ import javafx.application.Application; /** * Launcher for the Casono main UI. * - *

Standardkonstruktor für die Anwendung. + *

+ * Default constructor for the application. */ public class Launcher { - /** Standardkonstruktor. */ + /** Default constructor. */ public Launcher() { - // Standardkonstruktor + // Default constructor } /** diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/Casinomainui.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/Casinomainui.java index 959c8d3..a87a3df 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/Casinomainui.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/Casinomainui.java @@ -10,13 +10,14 @@ import javafx.stage.Stage; /** * JavaFX Application class for the Casono main UI. * - *

Standardkonstruktor für die Anwendung. + *

+ * Default constructor for the application. */ public class Casinomainui extends Application { - /** Standardkonstruktor. */ + /** Default constructor. */ public Casinomainui() { - // Standardkonstruktor + // Default constructor } private static final int SCENE_WIDTH = 1200; @@ -30,13 +31,11 @@ public class Casinomainui extends Application { * @throws IOException If loading the FXML fails. */ public void start(Stage stage) throws IOException { - FXMLLoader fxmlLoader = - new FXMLLoader(getClass().getResource("/ui-structure/Casinomainui.fxml")); + FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/ui-structure/Casinomainui.fxml")); Scene scene = new Scene(fxmlLoader.load(), SCENE_WIDTH, SCENE_HEIGHT); stage.setTitle("Casono"); - javafx.scene.image.Image icon = - new javafx.scene.image.Image( - getClass().getResource("/images/logoinverted.png").toExternalForm()); + javafx.scene.image.Image icon = new javafx.scene.image.Image( + getClass().getResource("/images/logoinverted.png").toExternalForm()); stage.getIcons().add(icon); stage.setScene(scene); stage.setFullScreen(true); diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/CasinomainuiController.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/CasinomainuiController.java index 48ccce7..88bb5aa 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/CasinomainuiController.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/CasinomainuiController.java @@ -12,17 +12,27 @@ import javafx.scene.shape.Rectangle; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -/** Controller for the Casono main UI lobby. Handles UI initialization and user actions. */ +/** + * Controller for the Casono main UI lobby. Handles UI initialization and user + * actions. + */ public class CasinomainuiController { private static final Logger LOGGER = LogManager.getLogger(CasinomainuiController.class); - @FXML private AnchorPane rootPane; - @FXML private Label titleLabel; - @FXML private Label subtitleLabel; - @FXML private ImageView logoView; - @FXML private Rectangle greenBox; - @FXML private Button exitbutton; - @FXML private VBox casinoTable; + @FXML + private AnchorPane rootPane; + @FXML + private Label titleLabel; + @FXML + private Label subtitleLabel; + @FXML + private ImageView logoView; + @FXML + private Rectangle greenBox; + @FXML + private Button exitbutton; + @FXML + private VBox casinoTable; private LobbyButtonTranslationManager translationManager; private LobbyButtonGridManager gridManager; @@ -41,8 +51,7 @@ public class CasinomainuiController { logoView.setImage(new Image(getClass().getResource("/images/logo.png").toExternalForm())); translationManager = LobbyButtonTranslationManager.getInstance(); - gridManager = - new LobbyButtonGridManager(new javafx.scene.layout.GridPane(), translationManager); + gridManager = new LobbyButtonGridManager(new javafx.scene.layout.GridPane(), translationManager); casinoTable.getChildren().clear(); casinoTable.getChildren().add(gridManager.getGridPane()); gridManager.renderLobbyButtons(); @@ -58,7 +67,7 @@ public class CasinomainuiController { @FXML public void handleCreateLobbyButton() { if (translationManager.isFull()) { - LOGGER.warn("Grid voll! Keine weiteren Lobbys moeglich."); + LOGGER.warn("Grid is full! No more lobbies available."); return; } int buttonId = nextButtonId++; @@ -68,7 +77,7 @@ public class CasinomainuiController { LOGGER.info("ButtonID: {}, LobbyID: {}", buttonId, lobbyId); gridManager.renderLobbyButtons(); } catch (Exception e) { - LOGGER.error("Fehler beim Hinzufügen: {}", e.getMessage()); + LOGGER.error("Error while adding lobby button: {}", e.getMessage()); } } } diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/LobbyButtonTranslationManager.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/LobbyButtonTranslationManager.java index 0aea7e4..40e018f 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/LobbyButtonTranslationManager.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/ui/lobbyui/LobbyButtonTranslationManager.java @@ -4,19 +4,20 @@ import java.util.HashMap; import java.util.Map; /** - * Verwaltet das Mapping zwischen Button-IDs und Lobby-IDs rein im Speicher. Keine Dateioperationen, - * nur Laufzeitdatenstruktur. + * Manages the mapping between Button IDs and Lobby IDs in memory only. No file + * operations, + * runtime-only data structure. */ public class LobbyButtonTranslationManager { - // Singleton-Instanz + // Singleton instance private static LobbyButtonTranslationManager instance; - // Singleton-Zugriff + // Singleton access /** - * Liefert die Singleton-Instanz des Managers. + * Returns the singleton instance of the manager. * - * @return die einzige Instanz von {@code LobbyButtonTranslationManager} + * @return the single instance of {@code LobbyButtonTranslationManager} */ public static LobbyButtonTranslationManager getInstance() { if (instance == null) { @@ -25,32 +26,32 @@ public class LobbyButtonTranslationManager { return instance; } - /** Maximale Anzahl an Buttons/Lobbys */ + /** Maximum number of buttons/lobbies */ private static final int MAX_BUTTONS = 8; - /** Zuordnung ButtonID → LobbyID */ + /** Mapping ButtonID → LobbyID */ private final Map buttonIdToLobbyId = new HashMap<>(); - /** Privater Konstruktor für Singleton-Pattern */ + /** Private constructor for the singleton pattern */ private LobbyButtonTranslationManager() { - // Zuordnung bleibt leer beim Start + // Mapping is empty at startup } /** - * Prüft, ob das Grid voll ist (MAX_BUTTONS erreicht). + * Checks whether the grid is full (MAX_BUTTONS reached). * - * @return true, wenn Grid voll; sonst false + * @return true if the grid is full; otherwise false */ public boolean isFull() { return buttonIdToLobbyId.size() >= MAX_BUTTONS; } /** - * Fügt eine Zuordnung ButtonID → LobbyID hinzu. + * Adds a mapping ButtonID → LobbyID. * - * @param buttonId Die ID des Buttons - * @param lobbyId Die ID der Lobby - * @throws Exception wenn das Grid voll ist + * @param buttonId the ID of the button + * @param lobbyId the ID of the lobby + * @throws Exception when the grid is full */ public void addLobbyButton(int buttonId, int lobbyId) throws Exception { if (isFull()) { @@ -60,28 +61,28 @@ public class LobbyButtonTranslationManager { } /** - * Entfernt eine Zuordnung für die gegebene ButtonID. + * Removes the mapping for the given ButtonID. * - * @param buttonId Die ID des zu entfernenden Buttons + * @param buttonId the ID of the button to remove */ public void removeLobbyButton(int buttonId) { buttonIdToLobbyId.remove(buttonId); } /** - * Gibt die LobbyID für eine gegebene ButtonID zurück. + * Returns the LobbyID for a given ButtonID. * - * @param buttonId Die ButtonID - * @return Die zugehoerige LobbyID oder null, falls nicht vorhanden + * @param buttonId the ButtonID + * @return the associated LobbyID or null if not present */ public Integer getLobbyIdForButton(int buttonId) { return buttonIdToLobbyId.get(buttonId); } /** - * Gibt die gesamte Zuordnung ButtonID → LobbyID zurück. + * Returns the full mapping ButtonID → LobbyID. * - * @return Map aller Zuordnungen + * @return Map of all mappings */ public Map getButtonIdToLobbyId() { return buttonIdToLobbyId; -- 2.52.0