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/.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/.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/pom.xml b/inez.model/pom.xml index 04fd2b5..5e573bb 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 @@ -39,7 +39,7 @@ website Project site - https://repo.kodekonveyor.com/${project.artifactId} + https://repo.kdea.hu/${project.artifactId} @@ -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/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.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.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.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..409c621 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 @@ -39,7 +37,7 @@ website Project site - https://repo.kodekonveyor.com/${project.artifactId} + https://repo.kdea.hu/${project.artifactId} @@ -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..0756a47 --- /dev/null +++ b/inez.ui/.eclipse-pmd @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/inez.ui/.project b/inez.ui/.project new file mode 100644 index 0000000..b555f68 --- /dev/null +++ b/inez.ui/.project @@ -0,0 +1,26 @@ + + + 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..33da82d --- /dev/null +++ b/inez.ui/README @@ -0,0 +1,2 @@ +UI of Inez + diff --git a/inez.ui/pom.xml b/inez.ui/pom.xml new file mode 100644 index 0000000..fb00f4a --- /dev/null +++ b/inez.ui/pom.xml @@ -0,0 +1,112 @@ + + + 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.kdea.hu/${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} + runtime + + + 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 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + 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/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/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/PopulateUIService.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java new file mode 100644 index 0000000..e7ac255 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/PopulateUIService.java @@ -0,0 +1,23 @@ +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); + } +} 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..c7054f9 --- /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 + Inez inez; + + @Autowired + PopulateUIService populateUI; + + @Autowired + FullScreenRelatedState fullScreenRelatedState; + + void apply(final Stage primaryStage) throws IOException { + fullScreenRelatedState.primaryStage = primaryStage; + + inez.initialize(); + + fullScreenRelatedState.mainScene = new Scene(createMainScene.apply(), MAIN_WINDOW_HEIGHT, MAIN_WINDOW_WIDTH); + + fullScreenRelatedState.fullscreenScene = new Scene(new StackPane(), MAIN_WINDOW_HEIGHT, MAIN_WINDOW_WIDTH); + + populateUI.apply(); + + primaryStage.setTitle(STAGE_TITLE); + 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 new file mode 100644 index 0000000..ba35c7a --- /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 + FullScreenRelatedState fullScreenRelatedState; + + public void apply(final TabPane tabPane) { + if (fullScreenRelatedState.isFullscreen) { + exitFullscreen(); + } else { + enterFullscreen(tabPane); + } + } + + private void enterFullscreen(final TabPane tabPane) { + fullScreenRelatedState.fullScreened = tabPane; + fullScreenRelatedState.fullScreenedParent = (StackPane) tabPane.getParent(); + StackPane fullscreenRoot = (StackPane) fullScreenRelatedState.fullscreenScene.getRoot(); + fullscreenRoot.getChildren().setAll(tabPane); + fullscreenRoot.setStyle(FULL_SCREEN_ROOT_STYLE); + + fullscreenRoot.setOnMouseClicked(event -> { + if (UIUtil.isDoubleClick(event)) { + exitFullscreen(); + } + }); + + fullScreenRelatedState.primaryStage.setScene(fullScreenRelatedState.fullscreenScene); + fullScreenRelatedState.isFullscreen = true; + } + + private void exitFullscreen() { + 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/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/UIConstants.java b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java new file mode 100644 index 0000000..67aef49 --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIConstants.java @@ -0,0 +1,16 @@ +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;"; + int TREEVIEW_PREFERRED_WIDTH = 150; + String TREEVIEW_LABEL_TEXT = "Navigation"; + 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/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..e26a5ec --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIMain.java @@ -0,0 +1,23 @@ +package io.github.magwas.inez.ui; + +import java.io.IOException; +import javafx.application.Application; +import javafx.stage.Stage; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class UIMain extends Application implements UIConstants { + + @Override + public void start(final Stage primaryStage) throws IOException { + ApplicationContext springContext = new AnnotationConfigApplicationContext(UIConfig.class); + SetupPrimaryStageService setupPrimaryStage = springContext.getBean(SetupPrimaryStageService.class); + + setupPrimaryStage.apply(primaryStage); + } + + public static void main(final String[] args) { + launch(args); + } +} 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..55d811b --- /dev/null +++ b/inez.ui/src/main/java/io/github/magwas/inez/ui/UIState.java @@ -0,0 +1,17 @@ +package io.github.magwas.inez.ui; + +import javafx.scene.control.MenuBar; +import javafx.scene.control.SplitPane; +import javafx.scene.control.ToolBar; +import javafx.scene.layout.HBox; + +import org.springframework.stereotype.Component; + +@Component +public class UIState { + + 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 new file mode 100644 index 0000000..f62a88d --- /dev/null +++ b/inez.ui/src/main/java/module-info.java @@ -0,0 +1,19 @@ +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, + spring.core; +} 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..f3d50a6 --- /dev/null +++ b/inez.ui/tools/javaRun @@ -0,0 +1,3 @@ +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 diff --git a/pom.xml b/pom.xml index 8777ea7..d5b1c28 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 @@ -45,11 +45,11 @@ website Project site - https://repo.kodekonveyor.com/${project.artifactId} + https://repo.kdea.hu/${project.artifactId} true - 0.5.2 + 0.5.3