Docs: translate client side components to english. This includes comments and javaDoc

This commit is contained in:
Jona Walpert
2026-04-01 13:48:24 +02:00
parent 20e8491cff
commit 56ba5b81ae
5 changed files with 62 additions and 50 deletions
@@ -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.
*
* <p>Standardkonstruktor für die Anwendung.
* <p>
* 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
}
/**
@@ -6,13 +6,14 @@ import javafx.application.Application;
/**
* Launcher for the Casono main UI.
*
* <p>Standardkonstruktor für die Anwendung.
* <p>
* Default constructor for the application.
*/
public class Launcher {
/** Standardkonstruktor. */
/** Default constructor. */
public Launcher() {
// Standardkonstruktor
// Default constructor
}
/**
@@ -10,13 +10,14 @@ import javafx.stage.Stage;
/**
* JavaFX Application class for the Casono main UI.
*
* <p>Standardkonstruktor für die Anwendung.
* <p>
* 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,12 +31,10 @@ 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(
javafx.scene.image.Image icon = new javafx.scene.image.Image(
getClass().getResource("/images/logoinverted.png").toExternalForm());
stage.getIcons().add(icon);
stage.setScene(scene);
@@ -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());
}
}
}
@@ -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<Integer, Integer> 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<Integer, Integer> getButtonIdToLobbyId() {
return buttonIdToLobbyId;