From cb229d17edba09ae62f506d3abf8018ca701f07c Mon Sep 17 00:00:00 2001 From: Rajdeep Roy Chowdhury Date: Sun, 19 Jul 2026 21:59:01 +0530 Subject: [PATCH] feat: rebranding phase 2 Signed-off-by: Rajdeep Roy Chowdhury --- .../openconsignment/common/Constants.java | 1 + .../java/openconsignment/common/Utils.java | 16 ++++++++ .../controller/WelcomeScreenController.java | 38 +++++++++++++------ src/main/resources/fxml/WelcomeScreen.fxml | 13 +++---- src/main/resources/fxml/welcomescreen.css | 12 ------ 5 files changed, 49 insertions(+), 31 deletions(-) delete mode 100644 src/main/resources/fxml/welcomescreen.css diff --git a/src/main/java/openconsignment/common/Constants.java b/src/main/java/openconsignment/common/Constants.java index 759b3e7..a476945 100644 --- a/src/main/java/openconsignment/common/Constants.java +++ b/src/main/java/openconsignment/common/Constants.java @@ -1,6 +1,7 @@ package openconsignment.common; public class Constants { + public static final String ORGANIZATION_NAME = "SATYAM AGENCIES"; public static final String REPORT_FILE_NAME = "report.pdf"; public static final String DATE_TIME_FORMAT = "dd-MM-yyyy"; public static final String DATABASE_FILE_NAME = "database.db"; diff --git a/src/main/java/openconsignment/common/Utils.java b/src/main/java/openconsignment/common/Utils.java index 7f0b283..c249bcd 100644 --- a/src/main/java/openconsignment/common/Utils.java +++ b/src/main/java/openconsignment/common/Utils.java @@ -3,6 +3,8 @@ import java.awt.*; import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -67,6 +69,20 @@ public static void launchPdf(String filename) throws IOException { }); } + public static void launchBrowser(String url) throws IOException { + if (!Desktop.isDesktopSupported()) { + throw new IOException("Desktop is not supported on this platform."); + } + + CompletableFuture.runAsync(() -> { + try { + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException | URISyntaxException e) { + logger.log(Level.WARNING, "Error opening browser link " + url, e); + } + }); + } + public static String formatDate(String dateString) { DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT); diff --git a/src/main/java/openconsignment/controller/WelcomeScreenController.java b/src/main/java/openconsignment/controller/WelcomeScreenController.java index 7c18198..01ffcf0 100644 --- a/src/main/java/openconsignment/controller/WelcomeScreenController.java +++ b/src/main/java/openconsignment/controller/WelcomeScreenController.java @@ -1,24 +1,38 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ package openconsignment.controller; +import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; import javafx.fxml.Initializable; +import javafx.scene.control.Hyperlink; +import javafx.scene.text.Text; +import openconsignment.common.Constants; +import openconsignment.common.Utils; -/** - * FXML Controller class - * - * @author ADMIN - */ public class WelcomeScreenController implements Initializable { - /** Initializes the controller class. */ + @FXML + private Text organization_name; + + @FXML + private void handleOpenGithub(ActionEvent event) { + Hyperlink link = (Hyperlink) event.getSource(); + String url = link.getText(); + + try { + Utils.launchBrowser(url); + } catch (IOException ex) { + Utils.showAlert(ex.toString()); + Logger.getLogger(WelcomeScreenController.class.getName()).log(Level.SEVERE, ex.toString(), ex); + } + } + @Override public void initialize(URL url, ResourceBundle rb) { - // TODO + organization_name.setText(Constants.ORGANIZATION_NAME); } } diff --git a/src/main/resources/fxml/WelcomeScreen.fxml b/src/main/resources/fxml/WelcomeScreen.fxml index 643cd62..645c681 100644 --- a/src/main/resources/fxml/WelcomeScreen.fxml +++ b/src/main/resources/fxml/WelcomeScreen.fxml @@ -1,6 +1,5 @@ - @@ -8,12 +7,10 @@ + - - - @@ -26,7 +23,7 @@ - + @@ -44,11 +41,13 @@ - + - + diff --git a/src/main/resources/fxml/welcomescreen.css b/src/main/resources/fxml/welcomescreen.css deleted file mode 100644 index 0ed554e..0000000 --- a/src/main/resources/fxml/welcomescreen.css +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Empty Stylesheet file. - */ - -.mainFxmlClass { - -} - -Box { - -fx-background-color: linear-gradient(#14E9BE, #14E9BE); - -fx-background-radius: 15; -} \ No newline at end of file