From afdd403b3f841db24a957f9ec7f33c17976654e2 Mon Sep 17 00:00:00 2001 From: Arpad Magosanyi Date: Sat, 18 Oct 2025 23:04:46 +0200 Subject: [PATCH 1/7] UI wireframe --- .gitignore | 1 + README | 3 - inez.model/.classpath | 1 - inez.model/pom.xml | 7 +- .../GetBridiElementRepresentationService.java | 3 +- .../org.eclipse.core.resources.prefs | 1 + inez.parser/pom.xml | 6 +- inez.ui/.classpath | 40 +++ inez.ui/.eclipse-pmd | 8 + inez.ui/.project | 34 ++ inez.ui/README | 3 + inez.ui/pom.xml | 335 ++++++++++++++++++ .../magwas/inez/ui/BridiCellFactory.java | 31 ++ .../magwas/inez/ui/BridiElementTreeItem.java | 43 +++ .../io/github/magwas/inez/ui/UIConfig.java | 10 + .../java/io/github/magwas/inez/ui/UIMain.java | 310 ++++++++++++++++ inez.ui/src/main/java/module-info.java | 18 + .../io/github/magwas/inez/ui/EmpptyTest.java | 13 + inez.ui/tools/javaRun | 2 + pom.xml | 6 +- 20 files changed, 858 insertions(+), 17 deletions(-) create mode 100644 inez.ui/.classpath create mode 100644 inez.ui/.eclipse-pmd create mode 100644 inez.ui/.project create mode 100644 inez.ui/README create mode 100644 inez.ui/pom.xml create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/BridiCellFactory.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/BridiElementTreeItem.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/UIConfig.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java create mode 100644 inez.ui/src/main/java/module-info.java create mode 100644 inez.ui/src/test/java/io/github/magwas/inez/ui/EmpptyTest.java create mode 100755 inez.ui/tools/javaRun diff --git a/.gitignore b/.gitignore index 1d81046..4f57eeb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ xslt .idea .konveyor pom.xml.versionsBackup +.settings diff --git a/README b/README index 3d8aad6..61c4610 100644 --- a/README +++ b/README @@ -1,8 +1,5 @@ Knowledge representation based on experiences of metamodel-based architecture modeling and nadural language dictionaries. -(No point to look at the code. This project is long abandoned, if the folowing gets implemented that will probably be done in another project. -I am just using this README to write up my thoughts.) - Dictionaries for natural languages are hard to implement for the following reasons: 1. A word usually have different meanings 2. How do you describe the meaning of a word? The best approach so far is that of wordnet: you basically define relationships between words. diff --git a/inez.model/.classpath b/inez.model/.classpath index b2e532c..81b3dab 100644 --- a/inez.model/.classpath +++ b/inez.model/.classpath @@ -22,6 +22,5 @@ - diff --git a/inez.model/pom.xml b/inez.model/pom.xml index 04fd2b5..c165569 100644 --- a/inez.model/pom.xml +++ b/inez.model/pom.xml @@ -9,7 +9,7 @@ io.github.magwas inez.model - ${project.version} + 0.0.1 ${project.artifactId} model layer for Inez https://github.com/kode-konveyor/inez-server.git @@ -53,7 +53,7 @@ io.github.magwas konveyor.base ${version.konveyor} - testing + test-jar test @@ -65,13 +65,12 @@ io.github.magwas inez.parser ${project.version} - testing + test-jar test org.springframework.data spring-data-keyvalue - ${version.spring-data} diff --git a/inez.model/src/main/java/io/github/magwas/inez/element/GetBridiElementRepresentationService.java b/inez.model/src/main/java/io/github/magwas/inez/element/GetBridiElementRepresentationService.java index 17dcf8c..665dbca 100644 --- a/inez.model/src/main/java/io/github/magwas/inez/element/GetBridiElementRepresentationService.java +++ b/inez.model/src/main/java/io/github/magwas/inez/element/GetBridiElementRepresentationService.java @@ -16,8 +16,7 @@ public class GetBridiElementRepresentationService { public String apply(final String id) throws Error { Optional sumtiP = sumtiRepository.findById(id); if (sumtiP.isEmpty()) { - sumtiRepository.findAll().forEach(x -> System.err.println("s:" + x)); - throw new Error("no representation for: " + id); + return "(" + id + ")"; } return sumtiP.get().representation(); } diff --git a/inez.parser/.settings/org.eclipse.core.resources.prefs b/inez.parser/.settings/org.eclipse.core.resources.prefs index cdfe4f1..5754f3e 100644 --- a/inez.parser/.settings/org.eclipse.core.resources.prefs +++ b/inez.parser/.settings/org.eclipse.core.resources.prefs @@ -2,4 +2,5 @@ eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/test/java=UTF-8 encoding//src/test/resources=UTF-8 +encoding//target/generated-sources/main=UTF-8 encoding/=UTF-8 diff --git a/inez.parser/pom.xml b/inez.parser/pom.xml index d2add96..a6a8687 100644 --- a/inez.parser/pom.xml +++ b/inez.parser/pom.xml @@ -7,9 +7,7 @@ 0.0.1 ../pom.xml - io.github.magwas inez.parser - ${project.version} ${project.artifactId} Parser for Inez https://github.com/kode-konveyor/inez-server.git @@ -50,7 +48,6 @@ org.antlr antlr4-runtime - ${version.antlr4} org.springframework.boot @@ -67,7 +64,7 @@ io.github.magwas konveyor.base ${version.konveyor} - testing + test-jar test @@ -91,6 +88,7 @@ org.antlr antlr4-maven-plugin + ${version.antlr4} diff --git a/inez.ui/.classpath b/inez.ui/.classpath new file mode 100644 index 0000000..e9af037 --- /dev/null +++ b/inez.ui/.classpath @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inez.ui/.eclipse-pmd b/inez.ui/.eclipse-pmd new file mode 100644 index 0000000..5324655 --- /dev/null +++ b/inez.ui/.eclipse-pmd @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/inez.ui/.project b/inez.ui/.project new file mode 100644 index 0000000..b1212d0 --- /dev/null +++ b/inez.ui/.project @@ -0,0 +1,34 @@ + + + inez.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + ch.acanda.eclipse.pmd.builder.PMDBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + ch.acanda.eclipse.pmd.builder.PMDNature + + diff --git a/inez.ui/README b/inez.ui/README new file mode 100644 index 0000000..f40f100 --- /dev/null +++ b/inez.ui/README @@ -0,0 +1,3 @@ +UI of Inez + + diff --git a/inez.ui/pom.xml b/inez.ui/pom.xml new file mode 100644 index 0000000..81b86a9 --- /dev/null +++ b/inez.ui/pom.xml @@ -0,0 +1,335 @@ + + + 4.0.0 + + io.github.magwas + inez + 0.0.1 + ../pom.xml + + inez.ui + ${project.artifactId} + ui for Inez + https://github.com/kode-konveyor/inez-server.git + + + GPL affero + https://www.gnu.org/licenses/agpl-3.0.en.html + GNU Affero General Public License + + + + + Árpád Magosányi + m4gw4s@gmail.com + + + + scm:git:https://github.com/kode-konveyor/inez-server.git + scm:git:https://github.com/kode-konveyor/inez-server.git + https://github.com/kode-konveyor/inez-server.git + + + github + https://github.com/kode-konveyor/inez-server/issues + + + + website + Project site + https://repo.kodekonveyor.com/${project.artifactId} + + + + 1.0.27 + ${project.build.directory}/jpackage-input + 2024.4.0 + io.github.magwas.testfx.HelloWorldButton + io.github.magwas.testfx/HelloWorldButton + UTF-8 + + + + io.github.magwas + konveyor.base + ${version.konveyor} + + + io.github.magwas + konveyor.base + ${version.konveyor} + test-jar + test + + + io.github.magwas + inez.model + ${project.version} + + + io.github.magwas + inez.parser + ${project.version} + + + io.github.magwas + inez.model + ${project.version} + test-jar + test + + + org.openjfx + javafx-controls + ${java.version} + + + org.openjfx + javafx-fxml + ${java.version} + + + org.springframework.data + spring-data-keyvalue + + + org.antlr + antlr4-runtime + + + + + jpro-sandec-repository + https://sandec.jfrog.io/artifactory/repo + + + gluon-releases + https://nexus.gluonhq.com/nexus/content/repositories/releases + + + + + jpro-sandec-repository + https://sandec.jfrog.io/artifactory/repo + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + org.apache.maven.plugins + maven-jar-plugin + + ${jpackageInputDirectory} + + + + org.apache.maven.plugins + maven-dependency-plugin + + + + copy-dependencies + + package + + ${jpackageInputDirectory}/lib + runtime + + + + + + + one.jpro + jpro-maven-plugin + ${jpro.version} + + ${mainclass} + + + + + + + linux + + + will-be-linux + + + + + + com.github.akman + jpackage-maven-plugin + 0.1.5 + + + org.ow2.asm + asm + 9.5 + + + + + + jpackage + + verify + + ${project.artifactId} + ${project.version} + ${project.licenses} + ${project.description} + LICENSE + + + + false + true + + glob:**/javafx-*-linux.jar + + + + + + target + + **/* + + + **/*Test + + true + + + + + javafx.controls + + testfx-${project.version}.jar + ${mainclass} + ${jpackageInputDirectory} + true + --enable-preview + + + + + + com.gluonhq + gluonfx-maven-plugin + ${gluonfx.plugin.version} + + ${mainclass} + android + + display + lifecycle + statusbar + storage + + + + + + + + windows + + + windows + + + + + + com.github.akman + jpackage-maven-plugin + 0.1.5 + + + org.ow2.asm + asm + 9.5 + + + + + + jpackage + + verify + + ${project.artifactId} + ${project.version} + ${project.licenses} + ${project.description} + LICENSE + + + + false + true + + + glob:**/javafx-*-win.jar + + + + + + target + + **/* + + + **/*Test + + true + + + + + javafx.controls + + testfx-${project.version}.jar + ${mainclass} + ${jpackageInputDirectory} + true + --enable-preview + + + + + + + + + diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/BridiCellFactory.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/BridiCellFactory.java new file mode 100644 index 0000000..9c7115b --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/BridiCellFactory.java @@ -0,0 +1,31 @@ +package io.github.magwas.inez.ui; + +import javafx.scene.control.TreeCell; +import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeView; +import javafx.util.Callback; + +import io.github.magwas.inez.element.BridiElement; + +public class BridiCellFactory implements Callback, TreeCell> { + + @Override + public TreeCell call(TreeView param) { + return new TreeCell<>() { + @Override + protected void updateItem(final BridiElement item, final boolean empty) { + super.updateItem(item, empty); + if (empty || item == null) { + setText(null); + setGraphic(null); + } else { + setText(item.getRepresentation()); + TreeItem treeItem = getTreeItem(); + if (treeItem != null) { + setGraphic(treeItem.getGraphic()); + } + } + } + }; + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/BridiElementTreeItem.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/BridiElementTreeItem.java new file mode 100644 index 0000000..6797276 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/BridiElementTreeItem.java @@ -0,0 +1,43 @@ +package io.github.magwas.inez.ui; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.scene.control.TreeItem; + +import io.github.magwas.inez.element.BridiElement; + +public class BridiElementTreeItem extends TreeItem { + + private boolean isFirstTimeChildren = true; + private boolean isFirstTimeLeaf = true; + private boolean isLeaf; + + public BridiElementTreeItem(BridiElement rootElement) { + super(rootElement); + } + + @Override + public ObservableList getChildren() { + if (isFirstTimeChildren) { + isFirstTimeChildren = false; + // First call: load children dynamically + super.getChildren().setAll(buildChildren(this)); + } + return super.getChildren(); + } + + @Override + public boolean isLeaf() { + if (isFirstTimeLeaf) { + isFirstTimeLeaf = false; + isLeaf = 0 == getValue().getChildren().count(); + } + return isLeaf; + } + + private ObservableList buildChildren(BridiElementTreeItem treeItem) { + ObservableList children = FXCollections.observableArrayList(); + treeItem.getValue().getChildren().forEach(x -> children.add(new BridiElementTreeItem(x))); + return children; + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConfig.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConfig.java new file mode 100644 index 0000000..6e5ca62 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConfig.java @@ -0,0 +1,10 @@ +package io.github.magwas.inez.ui; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.map.repository.config.EnableMapRepositories; + +@Configuration +@ComponentScan("io.github.magwas") +@EnableMapRepositories("io.github.magwas.inez") +public class UIConfig {} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java new file mode 100644 index 0000000..7cf181c --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java @@ -0,0 +1,310 @@ +package io.github.magwas.inez.ui; + +import java.io.IOException; +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.geometry.Orientation; +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.control.ComboBox; +import javafx.scene.control.Label; +import javafx.scene.control.Menu; +import javafx.scene.control.MenuBar; +import javafx.scene.control.MenuItem; +import javafx.scene.control.ProgressBar; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.Separator; +import javafx.scene.control.SeparatorMenuItem; +import javafx.scene.control.Slider; +import javafx.scene.control.SplitPane; +import javafx.scene.control.Tab; +import javafx.scene.control.TabPane; +import javafx.scene.control.TableView; +import javafx.scene.control.TextArea; +import javafx.scene.control.ToolBar; +import javafx.scene.control.TreeCell; +import javafx.scene.control.TreeView; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Region; +import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; +import javafx.stage.Stage; +import javafx.util.Callback; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +import io.github.magwas.inez.Inez; +import io.github.magwas.inez.InezImpl; +import io.github.magwas.inez.element.BridiElement; + +public class UIMain extends Application { + + private StackPane fullScreenedParent; + private Node fullScreened; + private Stage primaryStage; + private Scene mainScene; + private Scene fullscreenScene; + private boolean isFullscreen = false; + + @SuppressWarnings("unchecked") + @Override + public void start(final Stage primaryStage) throws IOException { + this.primaryStage = primaryStage; + TreeView treeView = createTreeView(); + + // Create scene and stage + BorderPane borderPane = new BorderPane(); + borderPane.setPadding(new Insets(10)); + VBox leftSidebar = createLeftSidebar(); + VBox topContainer = createTopSection(); + VBox rightPanel = createRightPanel(); + HBox statusBar = createStatusBar(); + TabPane mainContent = createMainContent(); + + // Create a central SplitPane for Left, Center, and Right + SplitPane horizontalSplit = new SplitPane(); + horizontalSplit.getItems().addAll(leftSidebar, mainContent, rightPanel); + // Set the initial position of the dividers (adjust percentages as needed) + horizontalSplit.setDividerPositions(0.2, 0.8); + + // Create a vertical SplitPane for Top, central area, and Bottom + SplitPane verticalSplit = new SplitPane(); + verticalSplit.setOrientation(Orientation.VERTICAL); + verticalSplit.getItems().addAll(topContainer, horizontalSplit, statusBar); + verticalSplit.setDividerPositions(0.1, 0.9); + + mainScene = new Scene(verticalSplit, 800, 600); + + // Create fullscreen scene (initially empty, will be populated on demand) + fullscreenScene = new Scene(new StackPane(), 800, 600); + + primaryStage.setTitle("Inez in Not Even Zenta"); + primaryStage.setScene(mainScene); + primaryStage.show(); + } + + private TreeView createTreeView() throws IOException { + ApplicationContext ctx = new AnnotationConfigApplicationContext(UIConfig.class); + InezImpl inez = (InezImpl) ctx.getBean(Inez.class); + inez.initialize(); + BridiElement rootElement = inez.root(); + // Create root item + BridiElementTreeItem rootItem = new BridiElementTreeItem(rootElement); + TreeView treeView = new TreeView<>(rootItem); + + // Make items editable (optional) + treeView.setEditable(true); + Callback, TreeCell> callback = new BridiCellFactory(); + treeView.setCellFactory(callback); + + // Handle selection changes + treeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + System.out.println("Selected: " + newValue.getValue()); + System.out.println( + "children: " + newValue.getValue().getChildren().toList()); + } + }); + return treeView; + } + + public static void main(final String[] args) { + launch(args); + } + + private VBox createTopSection() { + // Create menu bar + MenuBar menuBar = new MenuBar(); + Menu fileMenu = new Menu("File"); + fileMenu.getItems() + .addAll(new MenuItem("New"), new MenuItem("Open"), new SeparatorMenuItem(), new MenuItem("Exit")); + + Menu editMenu = new Menu("Edit"); + editMenu.getItems().addAll(new MenuItem("Cut"), new MenuItem("Copy"), new MenuItem("Paste")); + + menuBar.getMenus().addAll(fileMenu, editMenu); + + // Create toolbar + ToolBar toolBar = new ToolBar( + new Button("New"), new Button("Open"), new Separator(), new Button("Save"), new Button("Print")); + + // Combine menu and toolbar in VBox + VBox topContainer = new VBox(menuBar, toolBar); + return topContainer; + } + + private VBox createLeftSidebar() throws IOException { + VBox sidebar = new VBox(10); + sidebar.setPadding(new Insets(10)); + sidebar.setStyle("-fx-background-color: #f0f0f0; -fx-border-color: #cccccc; -fx-border-width: 0 1 0 0;"); + + Label sidebarLabel = new Label("Navigation"); + sidebarLabel.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + + TreeView treeView = createTreeView(); + + treeView.setPrefWidth(150); + + sidebar.getChildren().addAll(sidebarLabel, treeView); + return sidebar; + } + + private VBox createRightPanel() { + VBox rightPanel = new VBox(10); + rightPanel.setPadding(new Insets(10)); + rightPanel.setPrefWidth(200); + rightPanel.setStyle("-fx-background-color: #f8f8f8; -fx-border-color: #cccccc; -fx-border-width: 0 0 0 1;"); + + Label propertiesLabel = new Label("Properties"); + propertiesLabel.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + + // Property controls + CheckBox checkBox1 = new CheckBox("Option 1"); + CheckBox checkBox2 = new CheckBox("Option 2"); + Slider slider = new Slider(0, 100, 50); + + VBox propertiesBox = new VBox(8, checkBox1, checkBox2, new Label("Volume:"), slider); + + rightPanel.getChildren().addAll(propertiesLabel, propertiesBox); + return rightPanel; + } + + private HBox createStatusBar() { + HBox statusBar = new HBox(10); + statusBar.setPadding(new Insets(5, 10, 5, 10)); + statusBar.setStyle("-fx-background-color: #e0e0e0; -fx-border-color: #cccccc; -fx-border-width: 1 0 0 0;"); + + Label statusLabel = new Label("Ready"); + ProgressBar progressBar = new ProgressBar(0); + progressBar.setPrefWidth(100); + + // Add spacer to push elements to edges + Region spacer = new Region(); + HBox.setHgrow(spacer, javafx.scene.layout.Priority.ALWAYS); + + statusBar.getChildren().addAll(statusLabel, spacer, progressBar); + return statusBar; + } + + private TabPane createMainContent() { + TabPane tabPane = new TabPane(); + + Tab tab1 = new Tab("Dashboard"); + ScrollPane dashboardContent = createDashboardContent(); + tab1.setContent(dashboardContent); + tab1.setClosable(false); + tabPane.setOnMouseClicked(event -> { + System.out.println("clicked"); + if (event.getClickCount() == 2) { + System.out.println("doubleclicked"); + // Get the tab that was clicked + Node target = (Node) event.getTarget(); + System.out.println("target: " + target); + toggleFullscreen(tabPane); + } + }); + Tab tab2 = new Tab("Documents"); + tab2.setContent(createDocumentsContent()); + tab2.setClosable(false); + + Tab tab3 = new Tab("Settings"); + tab3.setContent(createSettingsContent()); + tab3.setClosable(false); + + tabPane.getTabs().addAll(tab1, tab2, tab3); + return tabPane; + } + + private void toggleFullscreen(TabPane tabPane) { + if (!isFullscreen) { + // Enter fullscreen - create a new scene with the dashboard content + enterFullscreen(tabPane); + } else { + // Exit fullscreen - return to main scene + exitFullscreen(); + } + } + + private void enterFullscreen(TabPane tabPane) { + // Create a copy of the dashboard content for fullscreen (or use the original) + // Set up the fullscreen scene + fullScreened = tabPane; + fullScreenedParent = (StackPane) tabPane.getParent(); + StackPane fullscreenRoot = (StackPane) fullscreenScene.getRoot(); + fullscreenRoot.getChildren().setAll(tabPane); + fullscreenRoot.setStyle("-fx-background-color: #2c3e50;"); + + // Add double-click handler to exit fullscreen + fullscreenRoot.setOnMouseClicked(event -> { + if (event.getClickCount() == 2) { + exitFullscreen(); + } + }); + + // Switch to fullscreen scene + primaryStage.setScene(fullscreenScene); + + // Optional: Make stage fullscreen + // primaryStage.setMaximized(true); + + isFullscreen = true; + } + + private void exitFullscreen() { + // Switch back to main scene + primaryStage.setScene(mainScene); + fullScreenedParent.getChildren().add(fullScreened); + + // Optional: Restore window size if you made it fullscreen + // primaryStage.setMaximized(false); + + isFullscreen = false; + } + + private ScrollPane createDashboardContent() { + VBox content = new VBox(10); + content.setPadding(new Insets(10)); + + Label welcomeLabel = new Label("Welcome to the Application"); + welcomeLabel.setFont(Font.font("Arial", FontWeight.BOLD, 16)); + + TextArea textArea = new TextArea(); + textArea.setPromptText("Enter your notes here..."); + textArea.setPrefRowCount(10); + + Button actionButton = new Button("Perform Action"); + + content.getChildren().addAll(welcomeLabel, textArea, actionButton); + + ScrollPane scrollPane = new ScrollPane(content); + scrollPane.setFitToWidth(true); + return scrollPane; + } + + private ScrollPane createDocumentsContent() { + TableView tableView = new TableView<>(); + // Simplified table for example + return new ScrollPane(tableView); + } + + private VBox createSettingsContent() { + VBox settings = new VBox(10); + settings.setPadding(new Insets(10)); + + settings.getChildren() + .addAll( + new Label("Application Settings"), + new Separator(), + new CheckBox("Enable auto-save"), + new CheckBox("Show notifications"), + new ComboBox()); + + return settings; + } +} diff --git a/inez.ui/src/main/java/module-info.java b/inez.ui/src/main/java/module-info.java new file mode 100644 index 0000000..e15f108 --- /dev/null +++ b/inez.ui/src/main/java/module-info.java @@ -0,0 +1,18 @@ +module io.github.magwas.inez.ui { + requires javafx.controls; + requires javafx.fxml; + requires inez.model; + requires spring.context; + requires spring.beans; + requires spring.core; + requires spring.data.keyvalue; + requires spring.data.commons; + requires konveyor.base; + requires javafx.base; + requires javafx.graphics; + + opens io.github.magwas.inez.ui to + javafx.fxml, + javafx.graphics, + spring.beans; +} diff --git a/inez.ui/src/test/java/io/github/magwas/inez/ui/EmpptyTest.java b/inez.ui/src/test/java/io/github/magwas/inez/ui/EmpptyTest.java new file mode 100644 index 0000000..1f2ebd9 --- /dev/null +++ b/inez.ui/src/test/java/io/github/magwas/inez/ui/EmpptyTest.java @@ -0,0 +1,13 @@ +package io.github.magwas.inez.ui; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +public class EmpptyTest { + + @Test + void test() { + assertTrue(true); + } +} diff --git a/inez.ui/tools/javaRun b/inez.ui/tools/javaRun new file mode 100755 index 0000000..26fa5d0 --- /dev/null +++ b/inez.ui/tools/javaRun @@ -0,0 +1,2 @@ +rm target/jpackage-input/inez.ui-0.0.1-* +java --module-path /usr/local/lib/javafx-sdk-21.0.8/lib:target/jpackage-input:target/jpackage-input/lib/ -cp target/jpackage-input/lib:../inez.parser/target/inez.parser-0.0.1.jar --add-modules javafx.controls,javafx.fxml -m io.github.magwas.inez.ui/io.github.magwas.inez.ui.UIMain diff --git a/pom.xml b/pom.xml index 8777ea7..cf3e662 100644 --- a/pom.xml +++ b/pom.xml @@ -4,9 +4,8 @@ io.github.magwas konveyor.parent - 0.5.2 + 0.5.3 - io.github.magwas inez 0.0.1 pom @@ -31,6 +30,7 @@ inez.parser inez.model + inez.ui scm:git:https://github.com/kode-konveyor/inez-server.git @@ -50,6 +50,6 @@ true - 0.5.2 + 0.5.3 From 9c1e0cc0243393560d5078e69e60ebc3c5489ccc Mon Sep 17 00:00:00 2001 From: Arpad Magosanyi Date: Sun, 19 Oct 2025 23:27:18 +0200 Subject: [PATCH 2/7] restructured to better show what is settled and what is example --- inez.model/pom.xml | 2 +- .../main/java/io/github/magwas/inez/Inez.java | 3 + .../java/io/github/magwas/inez/InezImpl.java | 1 + inez.parser/pom.xml | 2 +- inez.ui/pom.xml | 3 +- .../inez/ui/CreateExampleContentUtil.java | 143 +++++++++ .../inez/ui/CreateMainSceneService.java | 64 ++++ .../magwas/inez/ui/CreateTreeViewService.java | 38 +++ .../inez/ui/CreateTreeViewTabService.java | 32 ++ .../magwas/inez/ui/PopulateUIService.java | 24 ++ .../inez/ui/SetupPrimaryStageService.java | 43 +++ .../inez/ui/ToggleFullscreenService.java | 45 +++ .../io/github/magwas/inez/ui/UIConstants.java | 23 ++ .../java/io/github/magwas/inez/ui/UIMain.java | 295 +----------------- .../io/github/magwas/inez/ui/UIState.java | 28 ++ .../java/io/github/magwas/inez/ui/UIUtil.java | 9 + inez.ui/src/main/java/module-info.java | 3 +- inez.ui/tools/javaRun | 3 +- pom.xml | 2 +- 19 files changed, 466 insertions(+), 297 deletions(-) create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/CreateMainSceneService.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewService.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewTabService.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/UIUtil.java diff --git a/inez.model/pom.xml b/inez.model/pom.xml index c165569..5e573bb 100644 --- a/inez.model/pom.xml +++ b/inez.model/pom.xml @@ -39,7 +39,7 @@ website Project site - https://repo.kodekonveyor.com/${project.artifactId} + https://repo.kdea.hu/${project.artifactId} diff --git a/inez.model/src/main/java/io/github/magwas/inez/Inez.java b/inez.model/src/main/java/io/github/magwas/inez/Inez.java index ce12206..512d39c 100644 --- a/inez.model/src/main/java/io/github/magwas/inez/Inez.java +++ b/inez.model/src/main/java/io/github/magwas/inez/Inez.java @@ -1,5 +1,6 @@ package io.github.magwas.inez; +import java.io.IOException; import java.util.Collection; import java.util.Optional; import java.util.Set; @@ -33,4 +34,6 @@ public interface Inez { BridiElement root(); BridiElement byId(String id); + + void initialize() throws IOException; } diff --git a/inez.model/src/main/java/io/github/magwas/inez/InezImpl.java b/inez.model/src/main/java/io/github/magwas/inez/InezImpl.java index 5fa3a3b..a593bda 100644 --- a/inez.model/src/main/java/io/github/magwas/inez/InezImpl.java +++ b/inez.model/src/main/java/io/github/magwas/inez/InezImpl.java @@ -87,6 +87,7 @@ public final class InezImpl implements Inez { private InezImpl() {} + @Override public void initialize() throws IOException { bridiElementSystemInitialization.apply(); } diff --git a/inez.parser/pom.xml b/inez.parser/pom.xml index a6a8687..409c621 100644 --- a/inez.parser/pom.xml +++ b/inez.parser/pom.xml @@ -37,7 +37,7 @@ website Project site - https://repo.kodekonveyor.com/${project.artifactId} + https://repo.kdea.hu/${project.artifactId} diff --git a/inez.ui/pom.xml b/inez.ui/pom.xml index 81b86a9..4fea14c 100644 --- a/inez.ui/pom.xml +++ b/inez.ui/pom.xml @@ -37,7 +37,7 @@ website Project site - https://repo.kodekonveyor.com/${project.artifactId} + https://repo.kdea.hu/${project.artifactId} @@ -53,6 +53,7 @@ io.github.magwas konveyor.base ${version.konveyor} + runtime io.github.magwas diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java new file mode 100644 index 0000000..ef16b00 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java @@ -0,0 +1,143 @@ +package io.github.magwas.inez.ui; + +import javafx.geometry.Insets; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.control.ComboBox; +import javafx.scene.control.Label; +import javafx.scene.control.Menu; +import javafx.scene.control.MenuBar; +import javafx.scene.control.MenuItem; +import javafx.scene.control.ProgressBar; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.Separator; +import javafx.scene.control.SeparatorMenuItem; +import javafx.scene.control.Slider; +import javafx.scene.control.Tab; +import javafx.scene.control.TabPane; +import javafx.scene.control.TableView; +import javafx.scene.control.TextArea; +import javafx.scene.control.ToolBar; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Region; +import javafx.scene.layout.VBox; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; + +public class CreateExampleContentUtil implements UIConstants { + + public static void createExampleContent(final UIState uiState) { + createTabPaneContent((TabPane) uiState.mainArea.getItems().get(1)); + createMenus(uiState.menuBar); + createToolButtons(uiState.toolBar); + createRightPanelContents((TabPane) uiState.mainArea.getItems().get(2)); + createStatusBarContents(uiState.statusBar); + } + + public static ScrollPane createDashboardContent() { + VBox content = new VBox(PADDING); + content.setPadding(new Insets(PADDING)); + + Label welcomeLabel = new Label("Welcome to the Application"); + welcomeLabel.setFont(Font.font("Arial", FontWeight.BOLD, 16)); + + TextArea textArea = new TextArea(); + textArea.setPromptText("Enter your notes here..."); + textArea.setPrefRowCount(10); + + Button actionButton = new Button("Perform Action"); + + content.getChildren().addAll(welcomeLabel, textArea, actionButton); + + ScrollPane scrollPane = new ScrollPane(content); + scrollPane.setFitToWidth(true); + return scrollPane; + } + + public static ScrollPane createDocumentsContent() { + TableView tableView = new TableView<>(); + return new ScrollPane(tableView); + } + + public static VBox createSettingsContent() { + VBox settings = new VBox(PADDING); + settings.setPadding(new Insets(PADDING)); + + settings.getChildren() + .addAll( + new Label("Application Settings"), + new Separator(), + new CheckBox("Enable auto-save"), + new CheckBox("Show notifications"), + new ComboBox<>()); + + return settings; + } + + public static void createTabPaneContent(TabPane tabPane) { + Tab dashboardTab = new Tab("Dashboard"); + ScrollPane dashboardContent = createDashboardContent(); + dashboardTab.setContent(dashboardContent); + dashboardTab.setClosable(false); + Tab documentsTab = new Tab("Documents"); + documentsTab.setContent(createDocumentsContent()); + documentsTab.setClosable(false); + + Tab settingsTab = new Tab("Settings"); + settingsTab.setContent(createSettingsContent()); + settingsTab.setClosable(false); + + tabPane.getTabs().addAll(dashboardTab, documentsTab, settingsTab); + } + + public static void createToolButtons(ToolBar toolBar) { + toolBar.getItems() + .addAll( + new Button("New"), + new Button("Open"), + new Separator(), + new Button("Save"), + new Button("Print")); + } + + public static void createMenus(MenuBar menuBar) { + Menu fileMenu = new Menu("File"); + fileMenu.getItems() + .addAll(new MenuItem("New"), new MenuItem("Open"), new SeparatorMenuItem(), new MenuItem("Exit")); + + Menu editMenu = new Menu("Edit"); + editMenu.getItems().addAll(new MenuItem("Cut"), new MenuItem("Copy"), new MenuItem("Paste")); + + menuBar.getMenus().addAll(fileMenu, editMenu); + } + + public static void createRightPanelContents(final TabPane rightPanel) { + Tab propertiesTab = new Tab("Properties"); + + CheckBox checkBox1 = new CheckBox("Option 1"); + CheckBox checkBox2 = new CheckBox("Option 2"); + Slider slider = new Slider(0, 100, 50); + + VBox propertiesBox = new VBox( + PADDING, new Label("checks and balances:"), checkBox1, checkBox2, new Label("Volume:"), slider); + propertiesBox.setStyle(RIGHT_PANEL_STYLE); + propertiesTab.setContent(propertiesBox); + ScrollPane scrollPane = new ScrollPane(propertiesBox); + scrollPane.setFitToWidth(true); + + propertiesTab.setContent(scrollPane); + + rightPanel.getTabs().add(propertiesTab); + } + + public static void createStatusBarContents(final HBox statusBar) { + Label statusLabel = new Label("Ready"); + ProgressBar progressBar = new ProgressBar(0); + progressBar.setPrefWidth(PROGRESS_BAR_PREFERRED_WIDTH); + + Region spacer = new Region(); + HBox.setHgrow(spacer, javafx.scene.layout.Priority.ALWAYS); + + statusBar.getChildren().addAll(statusLabel, spacer, progressBar); + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateMainSceneService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateMainSceneService.java new file mode 100644 index 0000000..67b5f9f --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateMainSceneService.java @@ -0,0 +1,64 @@ +package io.github.magwas.inez.ui; + +import java.io.IOException; +import javafx.geometry.Insets; +import javafx.geometry.Orientation; +import javafx.scene.control.MenuBar; +import javafx.scene.control.SplitPane; +import javafx.scene.control.TabPane; +import javafx.scene.control.ToolBar; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Priority; +import javafx.scene.layout.VBox; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class CreateMainSceneService implements UIConstants { + + @Autowired + UIState uiState; + + @Autowired + ToggleFullscreenService toggleFullscreen; + + VBox apply() throws IOException { + + uiState.menuBar = new MenuBar(); + uiState.toolBar = new ToolBar(); + uiState.mainArea = createMainArea(); + uiState.statusBar = createStatusBar(); + + VBox topContainer = new VBox(uiState.menuBar, uiState.toolBar); + VBox content = new VBox(); + content.getChildren().addAll(topContainer, uiState.mainArea, uiState.statusBar); + VBox.setVgrow(uiState.mainArea, Priority.ALWAYS); + return content; + } + + private SplitPane createMainArea() { + SplitPane horizontalSplit = new SplitPane(); + horizontalSplit.setOrientation(Orientation.HORIZONTAL); + horizontalSplit.getItems().addAll(createTabPane(), createTabPane(), createTabPane()); + horizontalSplit.setDividerPositions(LEFT_PANE_RATIO, RIGHT_PANE_RATIO); + return horizontalSplit; + } + + private HBox createStatusBar() { + HBox statusBar = new HBox(PADDING); + statusBar.setPadding(new Insets(SMALL_PADDING, PADDING, SMALL_PADDING, PADDING)); + statusBar.setStyle(STATUSBAR_STYLE); + return statusBar; + } + + private TabPane createTabPane() { + TabPane tabPane = new TabPane(); + tabPane.setOnMouseClicked(event -> { + if (UIUtil.isDoubleClick(event)) { + toggleFullscreen.apply(tabPane); + } + }); + return tabPane; + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewService.java new file mode 100644 index 0000000..fcec130 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewService.java @@ -0,0 +1,38 @@ +package io.github.magwas.inez.ui; + +import java.io.IOException; +import javafx.scene.control.TreeCell; +import javafx.scene.control.TreeView; +import javafx.util.Callback; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import io.github.magwas.inez.Inez; +import io.github.magwas.inez.element.BridiElement; + +@Service +public class CreateTreeViewService { + + @Autowired + Inez inez; + + TreeView apply() throws IOException { + + BridiElement rootElement = inez.root(); + + BridiElementTreeItem rootItem = new BridiElementTreeItem(rootElement); + TreeView treeView = new TreeView<>(rootItem); + + treeView.setEditable(true); + Callback, TreeCell> callback = new BridiCellFactory(); + treeView.setCellFactory(callback); + + treeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { + if (newValue != null) { + System.out.println("Selected: " + newValue.getValue()); + } + }); + return treeView; + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewTabService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewTabService.java new file mode 100644 index 0000000..9f8c2c4 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateTreeViewTabService.java @@ -0,0 +1,32 @@ +package io.github.magwas.inez.ui; + +import java.io.IOException; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.Tab; +import javafx.scene.control.TreeView; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import io.github.magwas.inez.element.BridiElement; + +@Service +public class CreateTreeViewTabService implements UIConstants { + + @Autowired + CreateTreeViewService createTreeView; + + Tab apply() throws IOException { + Tab treeviewTab = new Tab(TREEVIEW_LABEL_TEXT); + TreeView treeView = createTreeView.apply(); + + treeView.setPrefWidth(TREEVIEW_PREFERRED_WIDTH); + ScrollPane scrollPane = new ScrollPane(treeView); + scrollPane.setFitToWidth(true); + scrollPane.setFitToHeight(true); + + treeviewTab.setContent(scrollPane); + treeviewTab.setClosable(true); + return treeviewTab; + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java new file mode 100644 index 0000000..26728fd --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java @@ -0,0 +1,24 @@ +package io.github.magwas.inez.ui; + +import java.io.IOException; +import javafx.scene.control.Tab; +import javafx.scene.control.TabPane; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class PopulateUIService { + + @Autowired + UIState uiState; + + @Autowired + CreateTreeViewTabService createTreeViewTab; + + void apply() throws IOException { + Tab treeviewTab = createTreeViewTab.apply(); + ((TabPane) uiState.mainArea.getItems().get(0)).getTabs().add(treeviewTab); + CreateExampleContentUtil.createExampleContent(uiState); + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java new file mode 100644 index 0000000..e54f0ea --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java @@ -0,0 +1,43 @@ +package io.github.magwas.inez.ui; + +import java.io.IOException; +import javafx.scene.Scene; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import io.github.magwas.inez.Inez; + +@Service +public class SetupPrimaryStageService implements UIConstants { + + @Autowired + CreateMainSceneService createMainScene; + + @Autowired + UIState uiState; + + @Autowired + Inez inez; + + @Autowired + PopulateUIService populateUI; + + void apply(final Stage primaryStage) throws IOException { + uiState.primaryStage = primaryStage; + + inez.initialize(); + + uiState.mainScene = new Scene(createMainScene.apply(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); + + uiState.fullscreenScene = new Scene(new StackPane(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); + + populateUI.apply(); + + primaryStage.setTitle(STAGE_TITLE); + primaryStage.setScene(uiState.mainScene); + primaryStage.show(); + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java new file mode 100644 index 0000000..6e54f17 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java @@ -0,0 +1,45 @@ +package io.github.magwas.inez.ui; + +import javafx.scene.control.TabPane; +import javafx.scene.layout.StackPane; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ToggleFullscreenService implements UIConstants { + + @Autowired + UIState uiState; + + public void apply(final TabPane tabPane) { + if (uiState.isFullscreen) { + exitFullscreen(); + } else { + enterFullscreen(tabPane); + } + } + + private void enterFullscreen(final TabPane tabPane) { + uiState.fullScreened = tabPane; + uiState.fullScreenedParent = (StackPane) tabPane.getParent(); + StackPane fullscreenRoot = (StackPane) uiState.fullscreenScene.getRoot(); + fullscreenRoot.getChildren().setAll(tabPane); + fullscreenRoot.setStyle(FULL_SCREEN_ROOT_STYLE); + + fullscreenRoot.setOnMouseClicked(event -> { + if (UIUtil.isDoubleClick(event)) { + exitFullscreen(); + } + }); + + uiState.primaryStage.setScene(uiState.fullscreenScene); + uiState.isFullscreen = true; + } + + private void exitFullscreen() { + uiState.primaryStage.setScene(uiState.mainScene); + uiState.fullScreenedParent.getChildren().add(uiState.fullScreened); + uiState.isFullscreen = false; + } +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java new file mode 100644 index 0000000..c6c8040 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java @@ -0,0 +1,23 @@ +package io.github.magwas.inez.ui; + +public interface UIConstants { + String STAGE_TITLE = "Inez in Not Even Zenta"; + int SMALL_PADDING = 5; + String FULL_SCREEN_ROOT_STYLE = "-fx-background-color: #2c3e50;"; + int PROGRESS_BAR_PREFERRED_WIDTH = 100; + String STATUSBAR_STYLE = "-fx-background-color: #e0e0e0; -fx-border-color: #cccccc; -fx-border-width: 1 0 0 0;"; + String RIGHT_PANEL_STYLE = + "-fx-background-color: #f8f8f8; -fx-border-color: #cccccc; -fx-border-width: 0 0 0 1; -fx-padding: 5;"; + int TREEVIEW_PREFERRED_WIDTH = 150; + String SIDEBAR_STYLE = "-fx-background-color: #f0f0f0; -fx-border-color: #cccccc; -fx-border-width: 0 1 0 0;"; + int SIDEBAR_LABEL_FONT_SIZE = 14; + String TREEVIEW_LABEL_TEXT = "Navigation"; + String SIDEBAR_LABEL_FONT_FAMILY = "Arial"; + int MAIN_WINDOW_SIZE_Y = 600; + int MAIN_WINDOW_SIZE_X = 800; + double BOTTOM_PANE_RATIO = 0.9; + double TOP_PANE_RATIO = 0.1; + double RIGHT_PANE_RATIO = 0.8; + double LEFT_PANE_RATIO = 0.2; + int PADDING = 10; +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java index 7cf181c..e26a5ec 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java @@ -2,309 +2,22 @@ import java.io.IOException; import javafx.application.Application; -import javafx.geometry.Insets; -import javafx.geometry.Orientation; -import javafx.scene.Node; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.CheckBox; -import javafx.scene.control.ComboBox; -import javafx.scene.control.Label; -import javafx.scene.control.Menu; -import javafx.scene.control.MenuBar; -import javafx.scene.control.MenuItem; -import javafx.scene.control.ProgressBar; -import javafx.scene.control.ScrollPane; -import javafx.scene.control.Separator; -import javafx.scene.control.SeparatorMenuItem; -import javafx.scene.control.Slider; -import javafx.scene.control.SplitPane; -import javafx.scene.control.Tab; -import javafx.scene.control.TabPane; -import javafx.scene.control.TableView; -import javafx.scene.control.TextArea; -import javafx.scene.control.ToolBar; -import javafx.scene.control.TreeCell; -import javafx.scene.control.TreeView; -import javafx.scene.layout.BorderPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Region; -import javafx.scene.layout.StackPane; -import javafx.scene.layout.VBox; -import javafx.scene.text.Font; -import javafx.scene.text.FontWeight; import javafx.stage.Stage; -import javafx.util.Callback; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import io.github.magwas.inez.Inez; -import io.github.magwas.inez.InezImpl; -import io.github.magwas.inez.element.BridiElement; +public class UIMain extends Application implements UIConstants { -public class UIMain extends Application { - - private StackPane fullScreenedParent; - private Node fullScreened; - private Stage primaryStage; - private Scene mainScene; - private Scene fullscreenScene; - private boolean isFullscreen = false; - - @SuppressWarnings("unchecked") @Override public void start(final Stage primaryStage) throws IOException { - this.primaryStage = primaryStage; - TreeView treeView = createTreeView(); - - // Create scene and stage - BorderPane borderPane = new BorderPane(); - borderPane.setPadding(new Insets(10)); - VBox leftSidebar = createLeftSidebar(); - VBox topContainer = createTopSection(); - VBox rightPanel = createRightPanel(); - HBox statusBar = createStatusBar(); - TabPane mainContent = createMainContent(); - - // Create a central SplitPane for Left, Center, and Right - SplitPane horizontalSplit = new SplitPane(); - horizontalSplit.getItems().addAll(leftSidebar, mainContent, rightPanel); - // Set the initial position of the dividers (adjust percentages as needed) - horizontalSplit.setDividerPositions(0.2, 0.8); - - // Create a vertical SplitPane for Top, central area, and Bottom - SplitPane verticalSplit = new SplitPane(); - verticalSplit.setOrientation(Orientation.VERTICAL); - verticalSplit.getItems().addAll(topContainer, horizontalSplit, statusBar); - verticalSplit.setDividerPositions(0.1, 0.9); - - mainScene = new Scene(verticalSplit, 800, 600); - - // Create fullscreen scene (initially empty, will be populated on demand) - fullscreenScene = new Scene(new StackPane(), 800, 600); - - primaryStage.setTitle("Inez in Not Even Zenta"); - primaryStage.setScene(mainScene); - primaryStage.show(); - } - - private TreeView createTreeView() throws IOException { - ApplicationContext ctx = new AnnotationConfigApplicationContext(UIConfig.class); - InezImpl inez = (InezImpl) ctx.getBean(Inez.class); - inez.initialize(); - BridiElement rootElement = inez.root(); - // Create root item - BridiElementTreeItem rootItem = new BridiElementTreeItem(rootElement); - TreeView treeView = new TreeView<>(rootItem); + ApplicationContext springContext = new AnnotationConfigApplicationContext(UIConfig.class); + SetupPrimaryStageService setupPrimaryStage = springContext.getBean(SetupPrimaryStageService.class); - // Make items editable (optional) - treeView.setEditable(true); - Callback, TreeCell> callback = new BridiCellFactory(); - treeView.setCellFactory(callback); - - // Handle selection changes - treeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { - if (newValue != null) { - System.out.println("Selected: " + newValue.getValue()); - System.out.println( - "children: " + newValue.getValue().getChildren().toList()); - } - }); - return treeView; + setupPrimaryStage.apply(primaryStage); } public static void main(final String[] args) { launch(args); } - - private VBox createTopSection() { - // Create menu bar - MenuBar menuBar = new MenuBar(); - Menu fileMenu = new Menu("File"); - fileMenu.getItems() - .addAll(new MenuItem("New"), new MenuItem("Open"), new SeparatorMenuItem(), new MenuItem("Exit")); - - Menu editMenu = new Menu("Edit"); - editMenu.getItems().addAll(new MenuItem("Cut"), new MenuItem("Copy"), new MenuItem("Paste")); - - menuBar.getMenus().addAll(fileMenu, editMenu); - - // Create toolbar - ToolBar toolBar = new ToolBar( - new Button("New"), new Button("Open"), new Separator(), new Button("Save"), new Button("Print")); - - // Combine menu and toolbar in VBox - VBox topContainer = new VBox(menuBar, toolBar); - return topContainer; - } - - private VBox createLeftSidebar() throws IOException { - VBox sidebar = new VBox(10); - sidebar.setPadding(new Insets(10)); - sidebar.setStyle("-fx-background-color: #f0f0f0; -fx-border-color: #cccccc; -fx-border-width: 0 1 0 0;"); - - Label sidebarLabel = new Label("Navigation"); - sidebarLabel.setFont(Font.font("Arial", FontWeight.BOLD, 14)); - - TreeView treeView = createTreeView(); - - treeView.setPrefWidth(150); - - sidebar.getChildren().addAll(sidebarLabel, treeView); - return sidebar; - } - - private VBox createRightPanel() { - VBox rightPanel = new VBox(10); - rightPanel.setPadding(new Insets(10)); - rightPanel.setPrefWidth(200); - rightPanel.setStyle("-fx-background-color: #f8f8f8; -fx-border-color: #cccccc; -fx-border-width: 0 0 0 1;"); - - Label propertiesLabel = new Label("Properties"); - propertiesLabel.setFont(Font.font("Arial", FontWeight.BOLD, 14)); - - // Property controls - CheckBox checkBox1 = new CheckBox("Option 1"); - CheckBox checkBox2 = new CheckBox("Option 2"); - Slider slider = new Slider(0, 100, 50); - - VBox propertiesBox = new VBox(8, checkBox1, checkBox2, new Label("Volume:"), slider); - - rightPanel.getChildren().addAll(propertiesLabel, propertiesBox); - return rightPanel; - } - - private HBox createStatusBar() { - HBox statusBar = new HBox(10); - statusBar.setPadding(new Insets(5, 10, 5, 10)); - statusBar.setStyle("-fx-background-color: #e0e0e0; -fx-border-color: #cccccc; -fx-border-width: 1 0 0 0;"); - - Label statusLabel = new Label("Ready"); - ProgressBar progressBar = new ProgressBar(0); - progressBar.setPrefWidth(100); - - // Add spacer to push elements to edges - Region spacer = new Region(); - HBox.setHgrow(spacer, javafx.scene.layout.Priority.ALWAYS); - - statusBar.getChildren().addAll(statusLabel, spacer, progressBar); - return statusBar; - } - - private TabPane createMainContent() { - TabPane tabPane = new TabPane(); - - Tab tab1 = new Tab("Dashboard"); - ScrollPane dashboardContent = createDashboardContent(); - tab1.setContent(dashboardContent); - tab1.setClosable(false); - tabPane.setOnMouseClicked(event -> { - System.out.println("clicked"); - if (event.getClickCount() == 2) { - System.out.println("doubleclicked"); - // Get the tab that was clicked - Node target = (Node) event.getTarget(); - System.out.println("target: " + target); - toggleFullscreen(tabPane); - } - }); - Tab tab2 = new Tab("Documents"); - tab2.setContent(createDocumentsContent()); - tab2.setClosable(false); - - Tab tab3 = new Tab("Settings"); - tab3.setContent(createSettingsContent()); - tab3.setClosable(false); - - tabPane.getTabs().addAll(tab1, tab2, tab3); - return tabPane; - } - - private void toggleFullscreen(TabPane tabPane) { - if (!isFullscreen) { - // Enter fullscreen - create a new scene with the dashboard content - enterFullscreen(tabPane); - } else { - // Exit fullscreen - return to main scene - exitFullscreen(); - } - } - - private void enterFullscreen(TabPane tabPane) { - // Create a copy of the dashboard content for fullscreen (or use the original) - // Set up the fullscreen scene - fullScreened = tabPane; - fullScreenedParent = (StackPane) tabPane.getParent(); - StackPane fullscreenRoot = (StackPane) fullscreenScene.getRoot(); - fullscreenRoot.getChildren().setAll(tabPane); - fullscreenRoot.setStyle("-fx-background-color: #2c3e50;"); - - // Add double-click handler to exit fullscreen - fullscreenRoot.setOnMouseClicked(event -> { - if (event.getClickCount() == 2) { - exitFullscreen(); - } - }); - - // Switch to fullscreen scene - primaryStage.setScene(fullscreenScene); - - // Optional: Make stage fullscreen - // primaryStage.setMaximized(true); - - isFullscreen = true; - } - - private void exitFullscreen() { - // Switch back to main scene - primaryStage.setScene(mainScene); - fullScreenedParent.getChildren().add(fullScreened); - - // Optional: Restore window size if you made it fullscreen - // primaryStage.setMaximized(false); - - isFullscreen = false; - } - - private ScrollPane createDashboardContent() { - VBox content = new VBox(10); - content.setPadding(new Insets(10)); - - Label welcomeLabel = new Label("Welcome to the Application"); - welcomeLabel.setFont(Font.font("Arial", FontWeight.BOLD, 16)); - - TextArea textArea = new TextArea(); - textArea.setPromptText("Enter your notes here..."); - textArea.setPrefRowCount(10); - - Button actionButton = new Button("Perform Action"); - - content.getChildren().addAll(welcomeLabel, textArea, actionButton); - - ScrollPane scrollPane = new ScrollPane(content); - scrollPane.setFitToWidth(true); - return scrollPane; - } - - private ScrollPane createDocumentsContent() { - TableView tableView = new TableView<>(); - // Simplified table for example - return new ScrollPane(tableView); - } - - private VBox createSettingsContent() { - VBox settings = new VBox(10); - settings.setPadding(new Insets(10)); - - settings.getChildren() - .addAll( - new Label("Application Settings"), - new Separator(), - new CheckBox("Enable auto-save"), - new CheckBox("Show notifications"), - new ComboBox()); - - return settings; - } } diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java new file mode 100644 index 0000000..a1956b6 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java @@ -0,0 +1,28 @@ +package io.github.magwas.inez.ui; + +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.control.MenuBar; +import javafx.scene.control.SplitPane; +import javafx.scene.control.ToolBar; +import javafx.scene.layout.HBox; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +import org.springframework.stereotype.Component; + +@Component +public class UIState { + + Scene mainScene; + Scene fullscreenScene; + StackPane fullScreenedParent; + Node fullScreened; + Stage primaryStage; + Boolean isFullscreen = false; + + public MenuBar menuBar; + public ToolBar toolBar; + public HBox statusBar; + public SplitPane mainArea; +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIUtil.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIUtil.java new file mode 100644 index 0000000..736f4a6 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIUtil.java @@ -0,0 +1,9 @@ +package io.github.magwas.inez.ui; + +import javafx.scene.input.MouseEvent; + +public class UIUtil { + public static boolean isDoubleClick(final MouseEvent event) { + return event.getClickCount() == 2; + } +} diff --git a/inez.ui/src/main/java/module-info.java b/inez.ui/src/main/java/module-info.java index e15f108..f62a88d 100644 --- a/inez.ui/src/main/java/module-info.java +++ b/inez.ui/src/main/java/module-info.java @@ -14,5 +14,6 @@ opens io.github.magwas.inez.ui to javafx.fxml, javafx.graphics, - spring.beans; + spring.beans, + spring.core; } diff --git a/inez.ui/tools/javaRun b/inez.ui/tools/javaRun index 26fa5d0..4247f78 100755 --- a/inez.ui/tools/javaRun +++ b/inez.ui/tools/javaRun @@ -1,2 +1,3 @@ rm target/jpackage-input/inez.ui-0.0.1-* -java --module-path /usr/local/lib/javafx-sdk-21.0.8/lib:target/jpackage-input:target/jpackage-input/lib/ -cp target/jpackage-input/lib:../inez.parser/target/inez.parser-0.0.1.jar --add-modules javafx.controls,javafx.fxml -m io.github.magwas.inez.ui/io.github.magwas.inez.ui.UIMain +mv target/jpackage-input/lib/konveyor.base-runtime.jar target/jpackage-input/lib/konveyor.base.jar +java --module-path /usr/local/lib/javafx-sdk-21.0.8/lib:target/classes:target/jpackage-input/lib/ -cp target/jpackage-input/lib:../inez.parser/target/inez.parser-0.0.1.jar --add-modules javafx.controls,javafx.fxml -m io.github.magwas.inez.ui/io.github.magwas.inez.ui.UIMain diff --git a/pom.xml b/pom.xml index cf3e662..d5b1c28 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ website Project site - https://repo.kodekonveyor.com/${project.artifactId} + https://repo.kdea.hu/${project.artifactId} From c727b1b1f5b97b95a25ca094e75909fb116182d1 Mon Sep 17 00:00:00 2001 From: Arpad Magosanyi Date: Sun, 19 Oct 2025 23:59:24 +0200 Subject: [PATCH 3/7] addressed some review comments --- .eclipse-pmd | 3 ++- inez.model/.eclipse-pmd | 3 ++- .../io/github/magwas/inez/element/IsOfTypeService.java | 9 +++++---- inez.parser/.eclipse-pmd | 3 ++- inez.ui/.eclipse-pmd | 3 ++- inez.ui/.project | 8 -------- inez.ui/README | 1 - .../github/magwas/inez/ui/CreateExampleContentUtil.java | 3 ++- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.eclipse-pmd b/.eclipse-pmd index 6433c88..32c13b9 100644 --- a/.eclipse-pmd +++ b/.eclipse-pmd @@ -4,4 +4,5 @@ - \ No newline at end of file + + diff --git a/inez.model/.eclipse-pmd b/inez.model/.eclipse-pmd index 5324655..0756a47 100644 --- a/inez.model/.eclipse-pmd +++ b/inez.model/.eclipse-pmd @@ -5,4 +5,5 @@ - \ No newline at end of file + + diff --git a/inez.model/src/main/java/io/github/magwas/inez/element/IsOfTypeService.java b/inez.model/src/main/java/io/github/magwas/inez/element/IsOfTypeService.java index ace3dec..c806c98 100644 --- a/inez.model/src/main/java/io/github/magwas/inez/element/IsOfTypeService.java +++ b/inez.model/src/main/java/io/github/magwas/inez/element/IsOfTypeService.java @@ -13,11 +13,12 @@ public class IsOfTypeService implements ElementConstants { boolean apply(String id, final String typeId) { LogUtil.debug("IsOfTypeService", id, typeId); + String theId = id; for (int i = 0; i < MAX_TYPE_DEPTH; i++) { - if (id.equals(typeId)) return true; - if (THING_ID.equals(id)) return false; - id = getBridiElementTypeId.apply(id); - LogUtil.debug("id:", id); + if (theId.equals(typeId)) return true; + if (THING_ID.equals(theId)) return false; + theId = getBridiElementTypeId.apply(theId); + LogUtil.debug("id:", theId); } throw new Error("Probable type loop"); } diff --git a/inez.parser/.eclipse-pmd b/inez.parser/.eclipse-pmd index 5324655..0756a47 100644 --- a/inez.parser/.eclipse-pmd +++ b/inez.parser/.eclipse-pmd @@ -5,4 +5,5 @@ - \ No newline at end of file + + diff --git a/inez.ui/.eclipse-pmd b/inez.ui/.eclipse-pmd index 5324655..0756a47 100644 --- a/inez.ui/.eclipse-pmd +++ b/inez.ui/.eclipse-pmd @@ -5,4 +5,5 @@ - \ No newline at end of file + + diff --git a/inez.ui/.project b/inez.ui/.project index b1212d0..b555f68 100644 --- a/inez.ui/.project +++ b/inez.ui/.project @@ -7,23 +7,15 @@ org.eclipse.jdt.core.javabuilder - - ch.acanda.eclipse.pmd.builder.PMDBuilder - - org.eclipse.pde.SchemaBuilder - - org.eclipse.m2e.core.maven2Builder - - diff --git a/inez.ui/README b/inez.ui/README index f40f100..33da82d 100644 --- a/inez.ui/README +++ b/inez.ui/README @@ -1,3 +1,2 @@ UI of Inez - diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java index ef16b00..3906590 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java @@ -19,6 +19,7 @@ import javafx.scene.control.TextArea; import javafx.scene.control.ToolBar; import javafx.scene.layout.HBox; +import javafx.scene.layout.Priority; import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import javafx.scene.text.Font; @@ -136,7 +137,7 @@ public static void createStatusBarContents(final HBox statusBar) { progressBar.setPrefWidth(PROGRESS_BAR_PREFERRED_WIDTH); Region spacer = new Region(); - HBox.setHgrow(spacer, javafx.scene.layout.Priority.ALWAYS); + HBox.setHgrow(spacer, Priority.ALWAYS); statusBar.getChildren().addAll(statusLabel, spacer, progressBar); } From bdc62be9f8e7da8a452fe9b7c1e72d0f56200f1e Mon Sep 17 00:00:00 2001 From: Arpad Magosanyi Date: Mon, 20 Oct 2025 07:23:44 +0200 Subject: [PATCH 4/7] not including not-yet-working packaging to native os packages --- inez.ui/pom.xml | 177 ------------------------------------------------ 1 file changed, 177 deletions(-) diff --git a/inez.ui/pom.xml b/inez.ui/pom.xml index 4fea14c..8adfed2 100644 --- a/inez.ui/pom.xml +++ b/inez.ui/pom.xml @@ -146,23 +146,6 @@ - one.jpro jpro-maven-plugin @@ -173,164 +156,4 @@ - - - linux - - - will-be-linux - - - - - - com.github.akman - jpackage-maven-plugin - 0.1.5 - - - org.ow2.asm - asm - 9.5 - - - - - - jpackage - - verify - - ${project.artifactId} - ${project.version} - ${project.licenses} - ${project.description} - LICENSE - - - - false - true - - glob:**/javafx-*-linux.jar - - - - - - target - - **/* - - - **/*Test - - true - - - - - javafx.controls - - testfx-${project.version}.jar - ${mainclass} - ${jpackageInputDirectory} - true - --enable-preview - - - - - - com.gluonhq - gluonfx-maven-plugin - ${gluonfx.plugin.version} - - ${mainclass} - android - - display - lifecycle - statusbar - storage - - - - - - - - windows - - - windows - - - - - - com.github.akman - jpackage-maven-plugin - 0.1.5 - - - org.ow2.asm - asm - 9.5 - - - - - - jpackage - - verify - - ${project.artifactId} - ${project.version} - ${project.licenses} - ${project.description} - LICENSE - - - - false - true - - - glob:**/javafx-*-win.jar - - - - - - target - - **/* - - - **/*Test - - true - - - - - javafx.controls - - testfx-${project.version}.jar - ${mainclass} - ${jpackageInputDirectory} - true - --enable-preview - - - - - - - - From 1db522124c6b4d2679bfff2cf269c0d731883fc2 Mon Sep 17 00:00:00 2001 From: Arpad Magosanyi Date: Mon, 20 Oct 2025 18:59:08 +0200 Subject: [PATCH 5/7] got rid of example code --- .../inez/ui/CreateExampleContentUtil.java | 144 ------------------ .../magwas/inez/ui/PopulateUIService.java | 1 - 2 files changed, 145 deletions(-) delete mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java deleted file mode 100644 index 3906590..0000000 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/CreateExampleContentUtil.java +++ /dev/null @@ -1,144 +0,0 @@ -package io.github.magwas.inez.ui; - -import javafx.geometry.Insets; -import javafx.scene.control.Button; -import javafx.scene.control.CheckBox; -import javafx.scene.control.ComboBox; -import javafx.scene.control.Label; -import javafx.scene.control.Menu; -import javafx.scene.control.MenuBar; -import javafx.scene.control.MenuItem; -import javafx.scene.control.ProgressBar; -import javafx.scene.control.ScrollPane; -import javafx.scene.control.Separator; -import javafx.scene.control.SeparatorMenuItem; -import javafx.scene.control.Slider; -import javafx.scene.control.Tab; -import javafx.scene.control.TabPane; -import javafx.scene.control.TableView; -import javafx.scene.control.TextArea; -import javafx.scene.control.ToolBar; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Priority; -import javafx.scene.layout.Region; -import javafx.scene.layout.VBox; -import javafx.scene.text.Font; -import javafx.scene.text.FontWeight; - -public class CreateExampleContentUtil implements UIConstants { - - public static void createExampleContent(final UIState uiState) { - createTabPaneContent((TabPane) uiState.mainArea.getItems().get(1)); - createMenus(uiState.menuBar); - createToolButtons(uiState.toolBar); - createRightPanelContents((TabPane) uiState.mainArea.getItems().get(2)); - createStatusBarContents(uiState.statusBar); - } - - public static ScrollPane createDashboardContent() { - VBox content = new VBox(PADDING); - content.setPadding(new Insets(PADDING)); - - Label welcomeLabel = new Label("Welcome to the Application"); - welcomeLabel.setFont(Font.font("Arial", FontWeight.BOLD, 16)); - - TextArea textArea = new TextArea(); - textArea.setPromptText("Enter your notes here..."); - textArea.setPrefRowCount(10); - - Button actionButton = new Button("Perform Action"); - - content.getChildren().addAll(welcomeLabel, textArea, actionButton); - - ScrollPane scrollPane = new ScrollPane(content); - scrollPane.setFitToWidth(true); - return scrollPane; - } - - public static ScrollPane createDocumentsContent() { - TableView tableView = new TableView<>(); - return new ScrollPane(tableView); - } - - public static VBox createSettingsContent() { - VBox settings = new VBox(PADDING); - settings.setPadding(new Insets(PADDING)); - - settings.getChildren() - .addAll( - new Label("Application Settings"), - new Separator(), - new CheckBox("Enable auto-save"), - new CheckBox("Show notifications"), - new ComboBox<>()); - - return settings; - } - - public static void createTabPaneContent(TabPane tabPane) { - Tab dashboardTab = new Tab("Dashboard"); - ScrollPane dashboardContent = createDashboardContent(); - dashboardTab.setContent(dashboardContent); - dashboardTab.setClosable(false); - Tab documentsTab = new Tab("Documents"); - documentsTab.setContent(createDocumentsContent()); - documentsTab.setClosable(false); - - Tab settingsTab = new Tab("Settings"); - settingsTab.setContent(createSettingsContent()); - settingsTab.setClosable(false); - - tabPane.getTabs().addAll(dashboardTab, documentsTab, settingsTab); - } - - public static void createToolButtons(ToolBar toolBar) { - toolBar.getItems() - .addAll( - new Button("New"), - new Button("Open"), - new Separator(), - new Button("Save"), - new Button("Print")); - } - - public static void createMenus(MenuBar menuBar) { - Menu fileMenu = new Menu("File"); - fileMenu.getItems() - .addAll(new MenuItem("New"), new MenuItem("Open"), new SeparatorMenuItem(), new MenuItem("Exit")); - - Menu editMenu = new Menu("Edit"); - editMenu.getItems().addAll(new MenuItem("Cut"), new MenuItem("Copy"), new MenuItem("Paste")); - - menuBar.getMenus().addAll(fileMenu, editMenu); - } - - public static void createRightPanelContents(final TabPane rightPanel) { - Tab propertiesTab = new Tab("Properties"); - - CheckBox checkBox1 = new CheckBox("Option 1"); - CheckBox checkBox2 = new CheckBox("Option 2"); - Slider slider = new Slider(0, 100, 50); - - VBox propertiesBox = new VBox( - PADDING, new Label("checks and balances:"), checkBox1, checkBox2, new Label("Volume:"), slider); - propertiesBox.setStyle(RIGHT_PANEL_STYLE); - propertiesTab.setContent(propertiesBox); - ScrollPane scrollPane = new ScrollPane(propertiesBox); - scrollPane.setFitToWidth(true); - - propertiesTab.setContent(scrollPane); - - rightPanel.getTabs().add(propertiesTab); - } - - public static void createStatusBarContents(final HBox statusBar) { - Label statusLabel = new Label("Ready"); - ProgressBar progressBar = new ProgressBar(0); - progressBar.setPrefWidth(PROGRESS_BAR_PREFERRED_WIDTH); - - Region spacer = new Region(); - HBox.setHgrow(spacer, Priority.ALWAYS); - - statusBar.getChildren().addAll(statusLabel, spacer, progressBar); - } -} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java index 26728fd..e7ac255 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java @@ -19,6 +19,5 @@ public class PopulateUIService { void apply() throws IOException { Tab treeviewTab = createTreeViewTab.apply(); ((TabPane) uiState.mainArea.getItems().get(0)).getTabs().add(treeviewTab); - CreateExampleContentUtil.createExampleContent(uiState); } } From 418eebd3adf1e88783180250ff317ca43aee7b56 Mon Sep 17 00:00:00 2001 From: Arpad Magosanyi Date: Mon, 20 Oct 2025 19:41:26 +0200 Subject: [PATCH 6/7] split ui state to API (UIState) and internal (FullScreenRelatedState) --- .../inez/ui/FullScreenRelatedState.java | 18 +++++++++++++++++ .../inez/ui/SetupPrimaryStageService.java | 14 ++++++------- .../inez/ui/ToggleFullscreenService.java | 20 +++++++++---------- .../io/github/magwas/inez/ui/UIState.java | 11 ---------- 4 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 inez.ui/src/main/java/io/github/magwas/inez/ui/FullScreenRelatedState.java diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/FullScreenRelatedState.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/FullScreenRelatedState.java new file mode 100644 index 0000000..a201ab4 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/FullScreenRelatedState.java @@ -0,0 +1,18 @@ +package io.github.magwas.inez.ui; + +import javafx.scene.Node; +import javafx.scene.Scene; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +import org.springframework.stereotype.Component; + +@Component +class FullScreenRelatedState { + Scene mainScene; + Scene fullscreenScene; + StackPane fullScreenedParent; + Node fullScreened; + Stage primaryStage; + Boolean isFullscreen = false; +} diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java index e54f0ea..98ca3e0 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java @@ -16,28 +16,28 @@ public class SetupPrimaryStageService implements UIConstants { @Autowired CreateMainSceneService createMainScene; - @Autowired - UIState uiState; - @Autowired Inez inez; @Autowired PopulateUIService populateUI; + @Autowired + FullScreenRelatedState fullScreenRelatedState; + void apply(final Stage primaryStage) throws IOException { - uiState.primaryStage = primaryStage; + fullScreenRelatedState.primaryStage = primaryStage; inez.initialize(); - uiState.mainScene = new Scene(createMainScene.apply(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); + fullScreenRelatedState.mainScene = new Scene(createMainScene.apply(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); - uiState.fullscreenScene = new Scene(new StackPane(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); + fullScreenRelatedState.fullscreenScene = new Scene(new StackPane(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); populateUI.apply(); primaryStage.setTitle(STAGE_TITLE); - primaryStage.setScene(uiState.mainScene); + primaryStage.setScene(fullScreenRelatedState.mainScene); primaryStage.show(); } } diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java index 6e54f17..ba35c7a 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/ToggleFullscreenService.java @@ -10,10 +10,10 @@ public class ToggleFullscreenService implements UIConstants { @Autowired - UIState uiState; + FullScreenRelatedState fullScreenRelatedState; public void apply(final TabPane tabPane) { - if (uiState.isFullscreen) { + if (fullScreenRelatedState.isFullscreen) { exitFullscreen(); } else { enterFullscreen(tabPane); @@ -21,9 +21,9 @@ public void apply(final TabPane tabPane) { } private void enterFullscreen(final TabPane tabPane) { - uiState.fullScreened = tabPane; - uiState.fullScreenedParent = (StackPane) tabPane.getParent(); - StackPane fullscreenRoot = (StackPane) uiState.fullscreenScene.getRoot(); + fullScreenRelatedState.fullScreened = tabPane; + fullScreenRelatedState.fullScreenedParent = (StackPane) tabPane.getParent(); + StackPane fullscreenRoot = (StackPane) fullScreenRelatedState.fullscreenScene.getRoot(); fullscreenRoot.getChildren().setAll(tabPane); fullscreenRoot.setStyle(FULL_SCREEN_ROOT_STYLE); @@ -33,13 +33,13 @@ private void enterFullscreen(final TabPane tabPane) { } }); - uiState.primaryStage.setScene(uiState.fullscreenScene); - uiState.isFullscreen = true; + fullScreenRelatedState.primaryStage.setScene(fullScreenRelatedState.fullscreenScene); + fullScreenRelatedState.isFullscreen = true; } private void exitFullscreen() { - uiState.primaryStage.setScene(uiState.mainScene); - uiState.fullScreenedParent.getChildren().add(uiState.fullScreened); - uiState.isFullscreen = false; + fullScreenRelatedState.primaryStage.setScene(fullScreenRelatedState.mainScene); + fullScreenRelatedState.fullScreenedParent.getChildren().add(fullScreenRelatedState.fullScreened); + fullScreenRelatedState.isFullscreen = false; } } diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java index a1956b6..55d811b 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java @@ -1,26 +1,15 @@ package io.github.magwas.inez.ui; -import javafx.scene.Node; -import javafx.scene.Scene; import javafx.scene.control.MenuBar; import javafx.scene.control.SplitPane; import javafx.scene.control.ToolBar; import javafx.scene.layout.HBox; -import javafx.scene.layout.StackPane; -import javafx.stage.Stage; import org.springframework.stereotype.Component; @Component public class UIState { - Scene mainScene; - Scene fullscreenScene; - StackPane fullScreenedParent; - Node fullScreened; - Stage primaryStage; - Boolean isFullscreen = false; - public MenuBar menuBar; public ToolBar toolBar; public HBox statusBar; From eb5be2dd280f0d11500224c981b62e9d455444b8 Mon Sep 17 00:00:00 2001 From: Arpad Magosanyi Date: Mon, 20 Oct 2025 23:22:48 +0200 Subject: [PATCH 7/7] main window have height and width, not size x and y + removed unused constants + removed plugins which would needed for only packaging --- inez.ui/pom.xml | 47 ------------------- .../inez/ui/SetupPrimaryStageService.java | 4 +- .../io/github/magwas/inez/ui/UIConstants.java | 11 +---- inez.ui/tools/javaRun | 6 +-- 4 files changed, 7 insertions(+), 61 deletions(-) diff --git a/inez.ui/pom.xml b/inez.ui/pom.xml index 8adfed2..fb00f4a 100644 --- a/inez.ui/pom.xml +++ b/inez.ui/pom.xml @@ -98,22 +98,6 @@ antlr4-runtime - - - jpro-sandec-repository - https://sandec.jfrog.io/artifactory/repo - - - gluon-releases - https://nexus.gluonhq.com/nexus/content/repositories/releases - - - - - jpro-sandec-repository - https://sandec.jfrog.io/artifactory/repo - - @@ -123,37 +107,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - ${jpackageInputDirectory} - - - - org.apache.maven.plugins - maven-dependency-plugin - - - - copy-dependencies - - package - - ${jpackageInputDirectory}/lib - runtime - - - - - - one.jpro - jpro-maven-plugin - ${jpro.version} - - ${mainclass} - - diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java index 98ca3e0..c7054f9 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/SetupPrimaryStageService.java @@ -30,9 +30,9 @@ void apply(final Stage primaryStage) throws IOException { inez.initialize(); - fullScreenRelatedState.mainScene = new Scene(createMainScene.apply(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); + fullScreenRelatedState.mainScene = new Scene(createMainScene.apply(), MAIN_WINDOW_HEIGHT, MAIN_WINDOW_WIDTH); - fullScreenRelatedState.fullscreenScene = new Scene(new StackPane(), MAIN_WINDOW_SIZE_X, MAIN_WINDOW_SIZE_Y); + fullScreenRelatedState.fullscreenScene = new Scene(new StackPane(), MAIN_WINDOW_HEIGHT, MAIN_WINDOW_WIDTH); populateUI.apply(); diff --git a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java index c6c8040..67aef49 100644 --- a/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java @@ -6,17 +6,10 @@ public interface UIConstants { String FULL_SCREEN_ROOT_STYLE = "-fx-background-color: #2c3e50;"; int PROGRESS_BAR_PREFERRED_WIDTH = 100; String STATUSBAR_STYLE = "-fx-background-color: #e0e0e0; -fx-border-color: #cccccc; -fx-border-width: 1 0 0 0;"; - String RIGHT_PANEL_STYLE = - "-fx-background-color: #f8f8f8; -fx-border-color: #cccccc; -fx-border-width: 0 0 0 1; -fx-padding: 5;"; int TREEVIEW_PREFERRED_WIDTH = 150; - String SIDEBAR_STYLE = "-fx-background-color: #f0f0f0; -fx-border-color: #cccccc; -fx-border-width: 0 1 0 0;"; - int SIDEBAR_LABEL_FONT_SIZE = 14; String TREEVIEW_LABEL_TEXT = "Navigation"; - String SIDEBAR_LABEL_FONT_FAMILY = "Arial"; - int MAIN_WINDOW_SIZE_Y = 600; - int MAIN_WINDOW_SIZE_X = 800; - double BOTTOM_PANE_RATIO = 0.9; - double TOP_PANE_RATIO = 0.1; + int MAIN_WINDOW_WIDTH = 600; + int MAIN_WINDOW_HEIGHT = 800; double RIGHT_PANE_RATIO = 0.8; double LEFT_PANE_RATIO = 0.2; int PADDING = 10; diff --git a/inez.ui/tools/javaRun b/inez.ui/tools/javaRun index 4247f78..f3d50a6 100755 --- a/inez.ui/tools/javaRun +++ b/inez.ui/tools/javaRun @@ -1,3 +1,3 @@ -rm target/jpackage-input/inez.ui-0.0.1-* -mv target/jpackage-input/lib/konveyor.base-runtime.jar target/jpackage-input/lib/konveyor.base.jar -java --module-path /usr/local/lib/javafx-sdk-21.0.8/lib:target/classes:target/jpackage-input/lib/ -cp target/jpackage-input/lib:../inez.parser/target/inez.parser-0.0.1.jar --add-modules javafx.controls,javafx.fxml -m io.github.magwas.inez.ui/io.github.magwas.inez.ui.UIMain +mv -f target/dependency/konveyor.base-runtime.jar target/dependency/konveyor.base.jar +rm -f target/dependency/inez.model-tests.jar target/dependency/konveyor.base-tests.jar target/dependency/asm.jar +java --module-path /usr/local/lib/javafx-sdk-21.0.8/lib:target/classes:target/dependency/ -cp target/dependency:../inez.parser/target/inez.parser-0.0.1.jar --add-modules javafx.controls,javafx.fxml -m io.github.magwas.inez.ui/io.github.magwas.inez.ui.UIMain