Chore: fix long line class paths in fxml files by using imports #297

Merged
jona.walpert merged 3 commits from chore/122-fix-long-file-imports into main 2026-04-22 14:30:49 +02:00
4 changed files with 17 additions and 21 deletions
Showing only changes of commit a629136fcb - Show all commits
@@ -1,5 +1,6 @@
package ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui;
import ch.unibas.dmi.dbis.cs108.casono.client.ClientApp;
import ch.unibas.dmi.dbis.cs108.casono.client.game.GameService;
import ch.unibas.dmi.dbis.cs108.casono.client.game.PlayerId;
import ch.unibas.dmi.dbis.cs108.casono.client.network.ClientService;
@@ -77,8 +78,7 @@ public class CasinoGameUI extends Application {
public void start(Stage stage) throws IOException {
if (clientService == null) {
clientService =
ch.unibas.dmi.dbis.cs108.casono.client.ClientApp.getSharedClientService();
clientService = ClientApp.getSharedClientService();
}
if (clientService == null) {
throw new IllegalStateException(
@@ -90,8 +90,7 @@ public class CasinoGameUI extends Application {
String effectiveUsername = normalize(username);
if (effectiveUsername == null) {
effectiveUsername =
normalize(ch.unibas.dmi.dbis.cs108.casono.client.ClientApp.getSharedUsername());
effectiveUsername = normalize(ClientApp.getSharedUsername());
}
if (effectiveUsername == null) {
@@ -105,7 +104,7 @@ public class CasinoGameUI extends Application {
+ "', injectedUsername='"
+ username
+ "', sharedUsername='"
+ ch.unibas.dmi.dbis.cs108.casono.client.ClientApp.getSharedUsername()
+ ClientApp.getSharedUsername()
+ "', hasClientService="
+ (clientService != null));
@@ -55,9 +55,9 @@ public class CasinomainuiController {
}
/**
* Initializes the UI components and sets default values. If a shared {@link
* ch.unibas.dmi.dbis.cs108.casono.client.network.ClientService} exists (created at application
* start), the controller reuses it so the connection remains open and already-logged-in.
* Initializes the UI components and sets default values. If a shared {@link ClientService}
* exists (created at application start), the controller reuses it so the connection remains
* open and already-logged-in.
*/
@FXML
public void initialize() {
@@ -1,7 +1,9 @@
package ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui;
import ch.unibas.dmi.dbis.cs108.casono.client.ClientApp;
import ch.unibas.dmi.dbis.cs108.casono.client.network.ClientService;
import ch.unibas.dmi.dbis.cs108.casono.client.network.LobbyClient;
import ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.CasinoGameUI;
import ch.unibas.dmi.dbis.cs108.casono.server.network.command.parsing.RequestParameter;
import java.util.ArrayList;
import java.util.Collections;
@@ -553,14 +555,10 @@ public class LobbyButtonGridManager {
try {
var cs = lobbyClient.getClientService();
ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.CasinoGameUI
.setClientService(cs);
ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.CasinoGameUI.setLobbyId(
lobbyId);
CasinoGameUI.setClientService(cs);
CasinoGameUI.setLobbyId(lobbyId);
String username =
ch.unibas.dmi.dbis.cs108.casono.client.ClientApp
.getSharedUsername();
String username = ClientApp.getSharedUsername();
if (username == null || username.isBlank()) {
username =
"Guest-"
@@ -570,11 +568,9 @@ public class LobbyButtonGridManager {
.toString()
.substring(0, GUEST_ID_LENGTH);
}
ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.CasinoGameUI.setUsername(
username);
CasinoGameUI.setUsername(username);
new ch.unibas.dmi.dbis.cs108.casono.client.ui.gameui.CasinoGameUI()
.start(gameStage);
new CasinoGameUI().start(gameStage);
} catch (Exception e) {
LOGGER.error("Game UI failed: {}", e.getMessage());
@@ -1,6 +1,7 @@
package ch.unibas.dmi.dbis.cs108.casono.client.ui.lobbyui;
import ch.unibas.dmi.dbis.cs108.casono.client.network.ClientService;
import ch.unibas.dmi.dbis.cs108.casono.client.network.TestServer;
import javafx.scene.layout.GridPane;
import org.junit.jupiter.api.*;
@@ -8,7 +9,7 @@ class LobbyButtonGridManagerTest {
LobbyButtonGridManager gridManager;
LobbyButtonTranslationManager translationManager;
GridPane gridPane;
ch.unibas.dmi.dbis.cs108.casono.client.network.TestServer testServer;
TestServer testServer;
@BeforeEach
void setUp() throws Exception {
@@ -16,7 +17,7 @@ class LobbyButtonGridManagerTest {
translationManager = LobbyButtonTranslationManager.getInstance();
translationManager.getButtonIdToLobbyId().clear();
// Start an in-process test server and connect a real ClientService to it.
testServer = new ch.unibas.dmi.dbis.cs108.casono.client.network.TestServer();
testServer = new TestServer();
String host = "127.0.0.1";
int port = testServer.getPort();
ClientService clientService = new ClientService(host, port);