Skip to content

Commit

Permalink
feat(app): update editor command manager
Browse files Browse the repository at this point in the history
  • Loading branch information
DaiYuANg committed Jan 9, 2025
1 parent 433fea5 commit aad23d1
Show file tree
Hide file tree
Showing 54 changed files with 1,622 additions and 623 deletions.
21 changes: 11 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[versions]
jdk = "21"
javafx = "23"
ikonliJavafx = "12.3.1"
slf4j = "2.0.16"
ikonli = "12.3.1"
junit = "5.11.4"
testcontainers = "1.20.4"
mockito = "5.14.2"
mockito = "5.15.2"
gestalt = "0.35.1"
eclipseCollections = "12.0.0.M3"
jackson = "2.18.2"
Expand All @@ -17,10 +18,10 @@ fury = "0.9.0"
avajeValidaor = "2.4"
h2 = "2.3.232"
asciidoctor = "4.0.4"
avajeInject = "11.1-RC1"
avajeInject = "11.1"
record-builder = "44"
mutinyVertx = "3.17.1"
schemacrawler = "16.24.2"
schemacrawler = "16.25.1"
polyglot = "24.1.1"
ebean = "15.8.1"
immutables = "2.10.1"
Expand All @@ -34,11 +35,10 @@ maniftest = { id = "com.coditory.manifest", version = "1.1.0" }
shadow = { id = "com.gradleup.shadow", version = "9.0.0-beta4" }
jlink = { id = "org.beryx.jlink", version = "3.1.1" }
graalvm = { id = "org.graalvm.buildtools.native", version = "0.10.4" }
spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA4" }
spotless = { id = "com.diffplug.spotless", version = "7.0.1" }
sass = { id = "io.miret.etienne.sass", version = "1.5.1" }
ebean = { id = "io.ebean", version.ref = "ebean" }
semver = { id = "com.xenoterracide.gradle.semver", version = "0.11.5" }
frontend = { id = "org.siouan.frontend-jdk21", version = "10.0.0" }
docker = { id = "com.bmuschko.docker-java-application", version = "9.4.0" }
javamodularity = { id = "org.javamodularity.moduleplugin", version = "1.8.15" }
asciidoctorJvm = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" }
Expand All @@ -63,7 +63,7 @@ slf4jJdkPlatform = { group = "org.slf4j", name = "slf4j-jdk-platform-logging", v
slf4jJulBridage = { group = "org.slf4j", name = "jul-to-slf4j", version.ref = "slf4j" }

oshi = { group = "com.github.oshi", name = "oshi-core-java11", version = "6.6.5" }
logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.15" }
logback = { group = "ch.qos.logback", name = "logback-classic", version = "1.5.16" }

#UI
simpleicon = { group = "org.kordamp.ikonli", name = "ikonli-simpleicons-pack", version.ref = "ikonli" }
Expand All @@ -81,7 +81,7 @@ junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit" }
junit-juiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" }
junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" }
junit-platform-suite = { group = "org.junit.platform", name = "junit-platform-suite", version = "1.11.3" }
junit-platform-suite = { group = "org.junit.platform", name = "junit-platform-suite", version = "1.11.4" }
junit-perf = { group = "com.github.noconnor", name = "junitperf-junit5", version = "1.37.0" }
testcontainers-bom = { group = "org.testcontainers", name = "testcontainers-bom", version.ref = "testcontainers" }
testcontainers = { group = "org.testcontainers", name = "testcontainers", version.ref = "testcontainers" }
Expand All @@ -101,7 +101,7 @@ guava = { group = "com.google.guava", name = "guava", version = "33.4.0-jre" }
mysql = { group = "com.mysql", name = "mysql-connector-j", version = "9.1.0" }
postgres = { group = "org.postgresql", name = "postgresql", version = "42.7.4" }
h2 = { group = "com.h2database", name = "h2", version.ref = "h2" }
sqlite = { group = "org.xerial", name = "sqlite-jdbc", version = "3.47.1.0" }
sqlite = { group = "org.xerial", name = "sqlite-jdbc", version = "3.47.2.0" }

eclipse-collections-api = { group = "org.eclipse.collections", name = "eclipse-collections-api", version.ref = "eclipseCollections" }
eclipse-collections = { group = "org.eclipse.collections", name = "eclipse-collections", version.ref = "eclipseCollections" }
Expand Down Expand Up @@ -148,7 +148,7 @@ jgit-lfs = { group = "org.eclipse.jgit", name = "org.eclipse.jgit.lfs", version.
jgit-ssh = { group = "org.eclipse.jgit", name = "org.eclipse.jgit.ssh.apache", version.ref = "jgit" }
jgit-http = { group = "org.eclipse.jgit", name = "org.eclipse.jgit.http.apache", version.ref = "jgit" }

jsh = { group = "com.github.mwiede", name = "jsch", version = "0.2.21" }
jsh = { group = "com.github.mwiede", name = "jsch", version = "0.2.22" }

vertx-core = { group = "io.vertx", name = "vertx-core", version.ref = "vertx" }
vertx-junit5 = { group = "io.vertx", name = "vertx-junit5", version.ref = "vertx" }
Expand Down Expand Up @@ -211,4 +211,5 @@ theme-detector = { group = "com.github.Dansoftowner", name = "jSystemThemeDetect
lombok-plugin = { group = "name.remal.gradle-plugins.lombok", name = "lombok", version = "2.2.14" }

bootstrap = { group = "org.webjars", name = "bootstrap", version = "5.3.3" }
tailwindcss = { group = "org.webjars.npm", name = "tailwindcss", version = "4.0.0-beta.3" }
tailwindcss = { group = "org.webjars.npm", name = "tailwindcss", version = "4.0.0-beta.3" }
auto-factory = {group="com.google.auto.factory",name="auto-factory",version="1.1.0"}
2 changes: 1 addition & 1 deletion visual-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dependencies {

javafx {
modules(*javafxModules.toTypedArray())
version = "23"
version = libs.versions.javafx.get()
configurations =
arrayOf(
IMPLEMENTATION,
Expand Down
2 changes: 1 addition & 1 deletion visual-app/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
requires io.avaje.validation;
requires com.github.benmanes.caffeine;
requires jdk.management;

requires org.visual.editor;
requires io.smallrye.mutiny.vertx.core;

requires com.jthemedetector;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import jakarta.inject.Singleton;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.visual.data.structure.diagram.VisualDiagram;
import org.visual.data.structure.diagram.VDiagram;

import java.util.List;

Expand All @@ -13,9 +13,9 @@
@RequiredArgsConstructor
public class DiagramContext {

private final List<VisualDiagram> diagrams = new ObjectArrayList<>();
private final List<VDiagram> diagrams = new ObjectArrayList<>();

public void add(VisualDiagram diagram) {
public void add(VDiagram diagram) {
diagrams.add(diagram);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import lombok.val;
import org.visual.app.component.NavigationPane;
import org.visual.app.context.DiagramContext;
import org.visual.app.util.CreateDiagram;

import java.io.File;
import java.net.URL;
Expand Down Expand Up @@ -71,15 +70,15 @@ public void handleCreateNewWorkspace(ActionEvent actionEvent) {
}

public void handleCreateNewDiagram() {
Uni.createFrom().item(CreateDiagram.createDefaultDiagram())
.log()
.invoke(diagramContext::add)
.subscribe().with(t -> {
Platform.runLater(() -> {
val stage = (Stage) root.getScene().getWindow();
stage.close();
});
});
// Uni.createFrom().item(CreateDiagram.createDefaultDiagram())
// .log()
// .invoke(diagramContext::add)
// .subscribe().with(t -> {
// Platform.runLater(() -> {
// val stage = (Stage) root.getScene().getWindow();
// stage.close();
// });
// });
}

public void handleExit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@
import jakarta.inject.Singleton;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.Background;
import javafx.scene.paint.Color;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.visual.app.component.DataContent;
import org.visual.app.component.DraggableStackPane;
import org.visual.app.component.EditorContainer;
import org.visual.app.model.DatabaseObjBuilder;
import org.visual.editor.core.VisualEditor;
import org.visual.editor.view.EditorContainer;
import org.visual.editor.view.model.EditorProperties;

import java.net.URL;
import java.util.ResourceBundle;
Expand All @@ -22,22 +17,20 @@ public class EditorController implements Initializable {

@FXML
private EditorContainer container;
@FXML
private ScrollPane root;

private final EditorProperties properties = new EditorProperties();

private final VisualEditor visualEditor = new VisualEditor(properties);

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
val stackPane = new DraggableStackPane();
stackPane.setBackground(Background.fill(Color.ALICEBLUE));
val dc = new DataContent(DatabaseObjBuilder.builder()
.name("test")
.type("test")
.build());
container.setOnMouseDragged(event -> {
System.err.println(container.getWidth());
System.err.println(container.getHeight());
});
stackPane.getChildren().add(dc);
container.getChildren().add(stackPane);
// val model = VModel.builder()
// .version("1.0")
// .type("graph")
// .contentWidth(1000.0)
// .contentHeight(1000.0)
// .build();
// visualEditor.setModel(model);
// container.setVisualEditor(visualEditor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class SetupThemeLifecycle implements ViewLifecycle {
@Override
public void onInit() {
setUserAgentStylesheet(detectTheme());
detector.registerListener(isDark -> setUserAgentStylesheet(isDark ? new PrimerDark().getUserAgentStylesheet() : new PrimerLight().getUserAgentStylesheet()));
}

private @NotNull String detectTheme() {
Expand Down
44 changes: 18 additions & 26 deletions visual-app/src/main/java/org/visual/app/util/CreateDiagram.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
package org.visual.app.util;

import lombok.experimental.UtilityClass;
import lombok.val;
import org.visual.data.structure.diagram.VisualDiagram;
import org.visual.data.structure.diagram.VisualDiagramMetadata;
import org.visual.data.structure.graph.VisualGraphicalObject;
import org.visual.data.structure.graph.VisualProperties;

import java.util.Date;
import java.util.UUID;

@UtilityClass
public class CreateDiagram {

public VisualDiagram createDefaultDiagram() {
val meta = VisualDiagramMetadata.builder().createAt(new Date())
.lastModifiedAt(new Date())
.title("untitled")
.build();
val prop = VisualProperties
.builder()
.color("red")
.borderWidth(1)
.borderColor("non")
.width(20.0)
.height(20.0)
.build();
VisualGraphicalObject.builder().id(UUID.randomUUID().toString()).type("rec").x(20).y(20).properties(prop).build();
return VisualDiagram.builder().version("0.1")
.metadata(meta)
.build();
}
// public VisualDiagram createDefaultDiagram() {
// val meta = VisualDiagramMetadata.builder().createAt(new Date())
// .lastModifiedAt(new Date())
// .title("untitled")
// .build();
// val prop = VisualProperties
// .builder()
// .color("red")
// .borderWidth(1)
// .borderColor("non")
// .width(20.0)
// .height(20.0)
// .build();
// VisualGraphicalObject.builder().id(UUID.randomUUID().toString()).type("rec").x(20).y(20).properties(prop).build();
// return VisualDiagram.builder().version("0.1")
// .metadata(meta)
// .build();
// }
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.StackPane?>
<?import org.visual.app.component.GridBackground?>
<?import org.visual.app.component.EditorContainer?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.Group?>
<?import org.visual.editor.view.EditorContainer?>
<StackPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="org.visual.app.controller.workspace.EditorController"
style="-fx-background-color: white;"
>
<ScrollPane fx:id="root" fitToHeight="true" fitToWidth="true" vbarPolicy="ALWAYS" hbarPolicy="ALWAYS">
<Group>
<EditorContainer fx:id="container"/>
</Group>
</ScrollPane>
<Button text="floating" StackPane.alignment="TOP_RIGHT" fx:id="floatingButton"/>

<EditorContainer fx:id="container" minWidth="0" minHeight="0" maxWidth="+Infinity" maxHeight="+Infinity"/>
</StackPane>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.HBox?>
<?import org.visual.app.component.GridBackground?>
<?import org.visual.editor.view.GridBackground?>
<TabPane fx:id="root" xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="org.visual.app.controller.workspace.TabController"
Expand Down
2 changes: 2 additions & 0 deletions visual-data-structure/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ dependencies {
implementation(libs.jgrapht)
compileOnly(libs.immutables.value)
annotationProcessor(libs.immutables.value)
implementation(libs.eclipse.collections.api)
implementation(libs.eclipse.collections)
}
2 changes: 2 additions & 0 deletions visual-data-structure/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
requires static lombok;
requires static org.jetbrains.annotations;
requires static org.immutables.value;
requires org.eclipse.collections.api;

requires org.jgrapht.core;
requires org.slf4j;
Expand All @@ -13,4 +14,5 @@
exports org.visual.data.structure.constant;
exports org.visual.data.structure.graph;
exports org.visual.data.structure.diagram;
exports org.visual.data.structure.impl;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.visual.data.structure.graph;

public interface Classifiable {
String type();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.visual.data.structure.graph;

import org.immutables.value.Value;
import org.visual.data.structure.style.VisualDataStructureStyle;

import java.util.List;

@Value.Immutable
@VisualDataStructureStyle
public interface Connection extends Identifiable, Classifiable {
Connector source();

Connector target();

List<Joint> joints();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.visual.data.structure.graph;

import java.util.List;

public interface Connector extends GraphicalObject {

Node parent();

List<Connection> connections();

void addConnection(Connection connection);

void removeConnection(Connection connection);

Boolean isConnectionDetachedOnDrag();
}
Loading

0 comments on commit aad23d1

Please sign in to comment.