Style: fixing some linter warnings in chat ui classes

This commit is contained in:
Mathis Ginkel
2026-04-26 22:19:57 +02:00
parent efd91fbe5f
commit d8d6dbb34f
2 changed files with 7 additions and 23 deletions
@@ -21,7 +21,6 @@ import javafx.scene.control.MenuButton;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
@@ -31,16 +30,10 @@ public class ChatBoxController {
private final ChatController chatController;
@FXML private VBox chatBox;
@FXML private TabPane chatTabPane;
@FXML private MenuButton addWhisperChatButton;
@FXML private HBox menuBox;
private FXMLLoader fxmlLoader;
private final List<String> activeWhisperChats;
@FXML private final Map<String, Tab> usernameTabMap;
@@ -77,7 +70,7 @@ public class ChatBoxController {
ChatModel globalChatModel = new ChatModel(global, username, -1, null);
chatController.getChatModelMap().put(new ChatController.ChatKey(global), globalChatModel);
addChatTab("GLOBAL", globalChatModel, global);
addWhisperChatButton.setOnAction(event -> addWhisperChatButton.show());
addWhisperChatButton.setOnAction(_ -> addWhisperChatButton.show());
}
/**
@@ -97,7 +90,7 @@ public class ChatBoxController {
MenuItem menuItem = new MenuItem(targetUserName);
addWhisperChatButton.getItems().add(menuItem);
menuItem.setOnAction(
event ->
_ ->
addWhisperChat(
targetUserName,
new ChatModel(
@@ -131,7 +124,7 @@ public class ChatBoxController {
if (oldUsername.equals(item.getText())) {
item.setText(newUsername);
item.setOnAction(
event ->
_ ->
addWhisperChat(
newUsername,
new ChatModel(
@@ -203,7 +196,7 @@ public class ChatBoxController {
try {
ChatViewController chatViewController =
new ChatViewController(
this.chatController, chatModel, this.username, this);
this.chatController, chatModel, this);
ChatKey chatKey;
if (chatType.equals(ChatType.WHISPER)) {
@@ -218,7 +211,7 @@ public class ChatBoxController {
VBox vbox = new VBox();
VBox.setVgrow(vbox, Priority.ALWAYS);
vbox.getChildren().add(load);
chatModel.addListener((msg) -> chatViewController.showMessage(msg));
chatModel.addListener(chatViewController::showMessage);
Tab newChat = new Tab(title, vbox);
usernameTabMap.put(title, newChat);
chatTabPane.getTabs().add(newChat);
@@ -13,7 +13,6 @@ import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tab;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
/** Responsible for the presentation of the ChatModel to the Client */
@@ -24,10 +23,6 @@ public class ChatViewController implements Initializable {
@FXML private TextField inputField;
@FXML private VBox chatInterfaceVBox;
@FXML private HBox controlBar;
@FXML private ScrollPane scrollPane;
@FXML private VBox chat;
@@ -46,8 +41,6 @@ public class ChatViewController implements Initializable {
private final ChatModel chatModel;
private final String username;
private final ChatController controller;
private static final int CHAT_PADDING = 20;
@@ -55,10 +48,8 @@ public class ChatViewController implements Initializable {
public ChatViewController(
ChatController chatController,
ChatModel chatModel,
String username,
ChatBoxController chatBoxController) {
this.controller = chatController;
this.username = username;
this.chatModel = chatModel;
this.chatBoxController = chatBoxController;
tabIsOpen = true;
@@ -74,8 +65,8 @@ public class ChatViewController implements Initializable {
*/
@Override
public void initialize(URL location, ResourceBundle resourceBundle) {
inputField.setOnAction(event -> sendMessage());
sendButton.setOnAction(event -> sendMessage());
inputField.setOnAction(_ -> sendMessage());
sendButton.setOnAction(_ -> sendMessage());
scrollPane.vvalueProperty().bind(chat.heightProperty());
}