diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..8d0fef2 --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/team/elrant/bubbles/gui/ChatViewApplication.java b/src/main/java/team/elrant/bubbles/gui/ChatViewApplication.java index d8d5894..06bb3a2 100644 --- a/src/main/java/team/elrant/bubbles/gui/ChatViewApplication.java +++ b/src/main/java/team/elrant/bubbles/gui/ChatViewApplication.java @@ -1,84 +1,84 @@ -package team.elrant.bubbles.gui; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Scene; -import javafx.scene.layout.AnchorPane; -import javafx.stage.Stage; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jxmpp.jid.BareJid; -import org.jxmpp.jid.impl.JidCreate; -import team.elrant.bubbles.xmpp.ConnectedUser; - -import java.util.Objects; - -/** - * The ChatViewApplication class is responsible for launching the chat application GUI. - * It initializes the primary stage with the ChatView.fxml layout and sets up the ChatViewController. - */ -public class ChatViewApplication extends Application { - private static final Logger logger = LogManager.getLogger(ChatViewApplication.class); - - private final @NotNull ConnectedUser connectedUser; - private final @NotNull String contactJid; - - /** - * Constructs a ChatViewApplication with the specified connected user and contact JID. - * - * @param connectedUser The connected user object. - * @param contactJid The JID of the contact to chat with. - */ - public ChatViewApplication(@NotNull ConnectedUser connectedUser, @NotNull String contactJid) { - this.connectedUser = connectedUser; - this.contactJid = contactJid; - } - - /** - * The main method launches the JavaFX application. - * - * @param args The command-line arguments. - */ - public static void main(String[] args) { - launch(args); - } - - /** - * The start method initializes the primary stage of the chat application. - * It loads the ChatView.fxml layout, sets up the ChatViewController, and displays the stage. - * - * @param primaryStage The primary stage of the application. - * @throws Exception If an error occurs during the initialization. - */ - @Override - public void start(@NotNull Stage primaryStage) throws Exception { - try { - @NotNull FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("views/ChatView.fxml")); - - // Set custom controller factory - fxmlLoader.setControllerFactory(param -> { - try { - // Instantiate the controller with the required properties - BareJid bareContactJid = JidCreate.bareFrom(contactJid); - return new ChatViewController(connectedUser, bareContactJid); - } catch (Exception e) { - logger.error("Error creating ChatViewController: {}", e.getMessage()); - throw new RuntimeException(e); - } - }); - - AnchorPane root = fxmlLoader.load(); - @NotNull Scene scene = new Scene(root, 800, 700); - scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styling/fluent-light.css")).toExternalForm()); - primaryStage.setTitle("Chat"); - primaryStage.setScene(scene); - primaryStage.centerOnScreen(); - primaryStage.setResizable(false); - primaryStage.show(); - } catch (Exception e) { - logger.error("Error starting ChatViewApplication: {}", e.getMessage()); - throw e; - } - } -} +package team.elrant.bubbles.gui; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.layout.AnchorPane; +import javafx.stage.Stage; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jxmpp.jid.BareJid; +import org.jxmpp.jid.impl.JidCreate; +import team.elrant.bubbles.xmpp.ConnectedUser; + +import java.util.Objects; + +/** + * The ChatViewApplication class is responsible for launching the chat application GUI. + * It initializes the primary stage with the ChatView.fxml layout and sets up the ChatViewController. + */ +public class ChatViewApplication extends Application { + private static final Logger logger = LogManager.getLogger(ChatViewApplication.class); + + private final @NotNull ConnectedUser connectedUser; + private final @NotNull String contactJid; + + /** + * Constructs a ChatViewApplication with the specified connected user and contact JID. + * + * @param connectedUser The connected user object. + * @param contactJid The JID of the contact to chat with. + */ + public ChatViewApplication(@NotNull ConnectedUser connectedUser, @NotNull String contactJid) { + this.connectedUser = connectedUser; + this.contactJid = contactJid; + } + + /** + * The main method launches the JavaFX application. + * + * @param args The command-line arguments. + */ + public static void main(String[] args) { + launch(args); + } + + /** + * The start method initializes the primary stage of the chat application. + * It loads the ChatView.fxml layout, sets up the ChatViewController, and displays the stage. + * + * @param stage The primary stage of the application. + * @throws Exception If an error occurs during the initialization. + */ + @Override + public void start(@NotNull Stage stage) throws Exception { + try { + @NotNull FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("views/ChatView.fxml")); + + // Set custom controller factory + fxmlLoader.setControllerFactory(param -> { + try { + // Instantiate the controller with the required properties + BareJid bareContactJid = JidCreate.bareFrom(contactJid); + return new ChatViewController(connectedUser, bareContactJid); + } catch (Exception e) { + logger.error("Error creating ChatViewController: {}", e.getMessage()); + throw new RuntimeException(e); + } + }); + + AnchorPane root = fxmlLoader.load(); + @NotNull Scene scene = new Scene(root, 800, 700); + scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styling/fluent-light.css")).toExternalForm()); + primaryStage.setTitle("Chat"); + primaryStage.setScene(scene); + primaryStage.centerOnScreen(); + primaryStage.setResizable(false); + primaryStage.show(); + } catch (Exception e) { + logger.error("Error starting ChatViewApplication: {}", e.getMessage()); + throw e; + } + } +} diff --git a/src/main/java/team/elrant/bubbles/gui/SideViewApplication.java b/src/main/java/team/elrant/bubbles/gui/SideViewApplication.java index b8e6392..57ca47b 100644 --- a/src/main/java/team/elrant/bubbles/gui/SideViewApplication.java +++ b/src/main/java/team/elrant/bubbles/gui/SideViewApplication.java @@ -1,46 +1,48 @@ -package team.elrant.bubbles.gui; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Scene; -import javafx.scene.layout.AnchorPane; -import javafx.stage.Stage; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -import java.util.Objects; - -public class SideViewApplication extends Application { - - private static final Logger logger = LogManager.getLogger(SideViewApplication.class); - - public static void main(String[] args) { - launch(args); - } - - /** - * The start method initializes the primary stage of the chat application. - * It loads the SideView.fxml layout and displays the stage. - * - * @param primaryStage The primary stage of the application. - * @throws Exception If an error occurs during the initialization. - */ - @Override - public void start(@NotNull Stage primaryStage) throws Exception { - try { - @NotNull FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("views/SideView.fxml")); - AnchorPane root = fxmlLoader.load(); - @NotNull Scene scene = new Scene(root, 320, 720); - scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styling/fluent-light.css")).toExternalForm()); - primaryStage.setTitle("Chat"); - primaryStage.setScene(scene); - primaryStage.centerOnScreen(); - primaryStage.setResizable(false); - primaryStage.show(); - } catch (Exception e) { - logger.error("Error starting SideViewApplication: {}", e.getMessage()); - throw e; - } - } -} +package team.elrant.bubbles.gui; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.layout.AnchorPane; +import javafx.stage.Stage; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public class SideViewApplication extends Application { + + private static final Logger logger = LogManager.getLogger(SideViewApplication.class); + + public static void main(String[] args) { + launch(args); + } + + /** + * The start method initializes the primary stage of the chat application. + * It loads the SideView.fxml layout and displays the stage. + * + * @param stage The primary stage of the application. + * @throws Exception If an error occurs during the initialization. + */ + @Override + public void start(@NotNull Stage stage) throws Exception { + try { + @NotNull FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("views/SideView.fxml")); + AnchorPane root = fxmlLoader.load(); + @NotNull Scene scene = new Scene(root, 320, 720); + scene.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styling/fluent-light.css")).toExternalForm()); + primaryStage.setTitle("Chat"); + primaryStage.setScene(scene); + primaryStage.centerOnScreen(); + primaryStage.setResizable(false); + primaryStage.show(); + } catch (Exception e) { + logger.error("Error starting SideViewApplication: {}", e.getMessage()); + throw e; + } + } +} + + \ No newline at end of file diff --git a/src/main/java/team/elrant/bubbles/gui/SideViewController.java b/src/main/java/team/elrant/bubbles/gui/SideViewController.java index 9d69084..613e338 100644 --- a/src/main/java/team/elrant/bubbles/gui/SideViewController.java +++ b/src/main/java/team/elrant/bubbles/gui/SideViewController.java @@ -1,5 +1,15 @@ -package team.elrant.bubbles.gui; - -public class SideViewController { - -} +package team.elrant.bubbles.gui; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +/** + * The SideViewController class controls the login functionality in the GUI. + * It handles ... + */ +public class SideViewController { + private static final Logger logger = LogManager.getLogger(SideViewController.class); + + +} \ No newline at end of file diff --git a/src/main/resources/team/elrant/bubbles/gui/SideView.fxml b/src/main/resources/team/elrant/bubbles/gui/SideView.fxml new file mode 100644 index 0000000..f7e2bf2 --- /dev/null +++ b/src/main/resources/team/elrant/bubbles/gui/SideView.fxml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +