diff --git a/README.md b/README.md index 8db51439e..7b4d36a50 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ instructions provided in "_**Fork the Repository**_" section in [GitHub document 5. Run the Komet application with the following command: ```bash - ./mvnw -f application javafx:run + ./mvnw -f dev javafx:run ``` 6. You can open Komet code using your favorite IDE like _Eclipse_ or _IntelliJ Idea_ and try running it from there. @@ -80,7 +80,7 @@ instructions provided in "_**Fork the Repository**_" section in [GitHub document After building Komet, you can run it with JPro on your local machine by following these steps: 1. Execute the following command to run the Komet application in your web browser: ```bash - ./mvnw -f application -Pjpro jpro:run + ./mvnw -f dev -Pjpro jpro:run ``` The default web browser should open automatically, displaying the Komet application. If it doesn't, navigate to `http://localhost:8080` in your browser. diff --git a/application/pom.xml b/application/pom.xml index 6c70ecdf6..b6dc9cf8f 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -7,28 +7,7 @@ 1.56.0-SNAPSHOT application - - - - - - de.jangassen nsmenufx @@ -222,9 +201,9 @@ default-cli package - + launchKomet kometRuntimeImage @@ -242,61 +221,6 @@ - - - debug - package - - - jlink - - - debugKomet - kometDebugRuntimeImage - true - kometDebugJlink - - - - - - - - - - - - - profile - package - - - jlink - - - profileKomet - kometProfileRuntimeImage - true - kometProfileJlink - - - - - - - - - - - - @@ -338,29 +262,6 @@ - - scenic-view - - false - - - - - net.raumzeitfalle.fx - scenic-view - - - - org.openjfx - javafx-web - - - - org.openjfx - javafx-swing - - - create-installer @@ -571,6 +472,7 @@ komet + current linux linux-aarch64 diff --git a/application/src/main/java/dev/ikm/komet/app/App.java b/application/src/main/java/dev/ikm/komet/app/App.java index c8b253aae..41057a6f9 100644 --- a/application/src/main/java/dev/ikm/komet/app/App.java +++ b/application/src/main/java/dev/ikm/komet/app/App.java @@ -61,7 +61,6 @@ import java.util.prefs.BackingStoreException; import static dev.ikm.komet.app.AppState.*; -import static dev.ikm.komet.app.LoginFeatureFlag.ENABLED_WEB_ONLY; import static dev.ikm.komet.app.util.CssFile.KOMET_CSS; import static dev.ikm.komet.app.util.CssFile.KVIEW_CSS; import static dev.ikm.komet.app.util.CssUtils.addStylesheets; @@ -112,6 +111,7 @@ public class App extends Application { static final boolean IS_DESKTOP = !IS_BROWSER && PlatformUtils.isDesktop(); static final boolean IS_MAC = !IS_BROWSER && PlatformUtils.isMac(); static final boolean IS_MAC_AND_NOT_TESTFX_TEST = IS_MAC && !isTestFXTest(); + public static boolean REQUIRE_LOGIN = WebAPI.isBrowser(); final StackPane rootPane = createRootPane(); Image appIcon; LandingPageController landingPageController; @@ -276,7 +276,11 @@ public void start(Stage stage) { stage.setScene(scene); // Handle the login feature based on the platform and the provided feature flag - handleLoginFeature(ENABLED_WEB_ONLY, stage); + if(REQUIRE_LOGIN) { + startLogin(stage); + } else { + startSelectDataSource(stage); + } addEventFilters(stage); @@ -291,33 +295,6 @@ public void start(Stage stage) { } } - /** - * Handles the login feature based on the provided {@link LoginFeatureFlag} and platform. - * - * @param loginFeatureFlag the current state of the login feature - * @param stage the current application stage - */ - public void handleLoginFeature(LoginFeatureFlag loginFeatureFlag, Stage stage) { - switch (loginFeatureFlag) { - case ENABLED_WEB_ONLY -> { - if (IS_BROWSER) { - startLogin(stage); - } else { - startSelectDataSource(stage); - } - } - case ENABLED_DESKTOP_ONLY -> { - if (IS_DESKTOP) { - startLogin(stage); - } else { - startSelectDataSource(stage); - } - } - case ENABLED -> startLogin(stage); - case DISABLED -> startSelectDataSource(stage); - } - } - /** * Initiates the login process by setting the application state to {@link AppState#LOGIN} * and launching the login page. diff --git a/application/src/main/java/dev/ikm/komet/app/AppMenu.java b/application/src/main/java/dev/ikm/komet/app/AppMenu.java index 0489247b0..56a10b3b3 100644 --- a/application/src/main/java/dev/ikm/komet/app/AppMenu.java +++ b/application/src/main/java/dev/ikm/komet/app/AppMenu.java @@ -41,6 +41,8 @@ import java.io.IOException; import java.lang.management.ManagementFactory; +import java.util.function.Function; +import java.util.function.Supplier; import java.util.prefs.BackingStoreException; import static dev.ikm.komet.app.App.*; @@ -66,6 +68,8 @@ public AppMenu(App app) { this.app = app; } + public static Function devMenuFactory = null; + /** * create the menu for windows used on a journal window (ie no vbox at the top of a border pane) * @param borderPane border pane for the journal @@ -128,7 +132,10 @@ void generateMsWindowsMenu(BorderPane kometRoot, Stage stage, VBox topBarVBox) { menuBar.getMenus().add(fileMenu); menuBar.getMenus().add(editMenu); menuBar.getMenus().add(windowMenu); - //menuBar.getMenus().add(createDevMenu(kometRoot)); + if (devMenuFactory != null) { + menuBar.getMenus().add(devMenuFactory.apply(kometRoot)); + } + if (topBarVBox != null) { // add MS Windows menu to the classic komet menu Platform.runLater(() -> topBarVBox.getChildren().addFirst(menuBar)); @@ -152,28 +159,6 @@ Menu createExchangeMenu() { return exchangeMenu; } - /* - // This can be used to add a developer menu with Scenic View - // This is very useful for debugging JavaFX applications. - // Therefore this comment shouldn't be deleted - Menu createDevMenu(Parent node) { - Menu devMenu = new Menu("Dev"); - - MenuItem reloadMenuItem = new MenuItem("Scenic View"); - reloadMenuItem.setOnAction(actionEvent -> { - var stage2 = new Stage(); - if(WebAPI.isBrowser()) { - WebAPI.getWebAPI(node.getScene()).openStageAsPopup(stage2); - } - ScenicView.show(node, stage2); - }); - // Add shortcut Ctrl+Shift+S to open Scenic View - KeyCombination scenicViewKeyCombo = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN); - reloadMenuItem.setAccelerator(scenicViewKeyCombo); - devMenu.getItems().add(reloadMenuItem); - return devMenu; - }*/ - public void showAboutDialog() { AboutDialog aboutDialog = new AboutDialog(); aboutDialog.showAndWait(); @@ -215,7 +200,9 @@ public void createMenuOptions(BorderPane landingPageRoot) { menuBar.getMenus().add(viewMenu); menuBar.getMenus().add(windowMenu); menuBar.getMenus().add(exchangeMenu); - //menuBar.getMenus().add(createDevMenu(landingPageRoot)); + if(devMenuFactory!=null){ + menuBar.getMenus().add(devMenuFactory.apply(landingPageRoot)); + } landingPageRoot.setTop(menuBar); } @@ -290,7 +277,9 @@ void setupMenus(Parent parent) { Menu helpMenu = createHelpMenu(); menuBar.getMenus().add(helpMenu); - // menuBar.getMenus().add(createDevMenu(parent)); + if (devMenuFactory != null) { + menuBar.getMenus().add(devMenuFactory.apply(parent)); + } } private Menu createFileMenu() { diff --git a/application/src/main/java/dev/ikm/komet/app/LoginFeatureFlag.java b/application/src/main/java/dev/ikm/komet/app/LoginFeatureFlag.java deleted file mode 100644 index 90f28daba..000000000 --- a/application/src/main/java/dev/ikm/komet/app/LoginFeatureFlag.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2015 Integrated Knowledge Management (support@ikm.dev) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package dev.ikm.komet.app; - -/** - * Enum representing the different states of the login feature in the application. - */ -public enum LoginFeatureFlag { - - /** - * Login is enabled only on web platforms. - */ - ENABLED_WEB_ONLY, - - /** - * Login is enabled only on desktop platforms. - */ - ENABLED_DESKTOP_ONLY, - - /** - * Login is enabled on both desktop and web platforms. - */ - ENABLED, - - /** - * Login feature is disabled on all platforms. - */ - DISABLED -} diff --git a/dev/pom.xml b/dev/pom.xml new file mode 100644 index 000000000..60c0f0bdb --- /dev/null +++ b/dev/pom.xml @@ -0,0 +1,127 @@ + + + 4.0.0 + + dev.ikm.komet + komet-parent + 1.56.0-SNAPSHOT + + dev + + + + + jpro-repository + https://sandec.jfrog.io/artifactory/repo + + + + + + dev.ikm.komet + application + + + + one.jpro + jpro-webapi + + + + org.apache.logging.log4j + log4j-slf4j2-impl + + + + + + org.scenic-view + scenic-view + 11.0.3-SNAPSHOT-FORK + + + + + org.openjfx + javafx-graphics + + + org.openjfx + javafx-web + + + org.openjfx + javafx-swing + + + + + + + org.openjfx + javafx-maven-plugin + + dev.ikm.komet.dev/dev.ikm.komet.dev.Starter + false + 2 + true + true + true + true + + + + + + + + + + + + + + + + + + jpro + + false + + + + + jpro-repository + https://sandec.jfrog.io/artifactory/repo + + + + + + one.jpro + jpro-maven-plugin + ${jpro.version} + + dev.ikm.komet.app.App + true + + -Djpro.isbrowser=true + -Djpro.onJVMStartup=dev.ikm.komet.dev.Starter + -Xmx16g + --add-opens + javafx.graphics/javafx.scene=org.controlsfx.controls + --add-exports + javafx.controls/com.sun.javafx.scene.control.behavior=dev.ikm.komet.navigator + --add-exports + javafx.base/com.sun.javafx.event=one.jpro.platform.file + -Djava.util.concurrent.ForkJoinPool.common.exceptionHandler=dev.ikm.tinkar.common.alert.UncaughtExceptionAlertStreamer + + + + + + + + + diff --git a/dev/src/main/java/dev/ikm/komet/dev/Starter.java b/dev/src/main/java/dev/ikm/komet/dev/Starter.java new file mode 100644 index 000000000..62f8cad48 --- /dev/null +++ b/dev/src/main/java/dev/ikm/komet/dev/Starter.java @@ -0,0 +1,46 @@ +package dev.ikm.komet.dev; + +import com.jpro.webapi.WebAPI; +import dev.ikm.komet.app.App; +import dev.ikm.komet.app.AppMenu; +import javafx.scene.Parent; +import javafx.scene.control.Menu; +import javafx.scene.control.MenuItem; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyCodeCombination; +import javafx.scene.input.KeyCombination; +import javafx.stage.Stage; +import org.scenicview.ScenicView; + +class Starter { + public static void main(String[] args) { + + System.out.println("Hello, Komet Dev!"); + + System.setProperty("dev_author", "KOMET user"); + + AppMenu.devMenuFactory = Starter::createDevMenu; + + if(!Boolean.getBoolean("jpro.isbrowser")) { + App.main(args); + } + } + + static Menu createDevMenu(Parent node) { + Menu devMenu = new Menu("Dev"); + + MenuItem reloadMenuItem = new MenuItem("Scenic View"); + reloadMenuItem.setOnAction(actionEvent -> { + var stage2 = new Stage(); + if(WebAPI.isBrowser()) { + WebAPI.getWebAPI(node.getScene()).openStageAsPopup(stage2); + } + ScenicView.show(node, stage2); + }); + // Add shortcut Ctrl+Shift+S to open Scenic View + KeyCombination scenicViewKeyCombo = new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN); + reloadMenuItem.setAccelerator(scenicViewKeyCombo); + devMenu.getItems().add(reloadMenuItem); + return devMenu; + } +} \ No newline at end of file diff --git a/dev/src/main/java/module-info.java b/dev/src/main/java/module-info.java new file mode 100644 index 000000000..fd7752440 --- /dev/null +++ b/dev/src/main/java/module-info.java @@ -0,0 +1,5 @@ +open module dev.ikm.komet.dev { + requires dev.ikm.komet.application; + requires jpro.webapi; + requires org.scenicview.scenicview; +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index c219a64c9..d040fe942 100644 --- a/pom.xml +++ b/pom.xml @@ -59,6 +59,7 @@ kview sync application + dev UTF-8 @@ -80,7 +81,7 @@ 3.0.2-r7 - 2025.2.0 + 2025.3.1 0.5.7 @@ -219,6 +220,11 @@ sync ${project.version} + + ${project.groupId} + application + ${project.version} +