Skip to content

Commit f21fec0

Browse files
Updated SimpleFX and Scala version (#80)
* Updated SimpleFX and Scala version * Refactor context management and remove old dependencies * added workaround
1 parent 9ae71de commit f21fec0

11 files changed

Lines changed: 61 additions & 8 deletions

File tree

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ JPRO_PLATFORM_VERSION = 0.6.0-SNAPSHOT
33
JPRO_VERSION = 2025.3.1
44
JAVAFX_BUILD_VERSION = 17.0.18
55
JAVAFX_EXAMPLES_VERSION = 23.0.2
6-
SIMPLEFX_VERSION = 3.2.40
6+
SIMPLEFX_VERSION = 3.3.0
77
JMEMORYBUDDY_VERSION = 0.5.6
8-
JNODES_VERSION = 0.8.3
98
SCENIC_VIEW_VERSION = 11.0.3-SNAPSHOT-FORK
109

1110
JAVAFX_PLUGIN_VERSION = 0.1.0

jpro-routing/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ configure([project(':jpro-routing:core'), project(':jpro-routing:dev'), project(
2222
configure([project(':jpro-routing:core'), project(':jpro-routing:dev'), project(':jpro-routing:popup')]) {
2323
dependencies {
2424
api "one.jpro:jpro-webapi:$JPRO_VERSION"
25-
api "SANDEC:jnodes:$JNODES_VERSION"
2625
api "one.jpro:jmemorybuddy:$JMEMORYBUDDY_VERSION"
2726
api "org.slf4j:slf4j-api:$SLF4J_API_VERSION"
2827
}
@@ -32,7 +31,8 @@ configure([project(':jpro-routing:core')]) {
3231
dependencies {
3332
api project(":jpro-utils")
3433
api project(":jpro-scenegraph")
35-
api "SANDEC:simplefx_2.12:$SIMPLEFX_VERSION"
34+
api "SANDEC:simplefx_2.13:$SIMPLEFX_VERSION"
35+
api "org.scala-lang:scala-library:2.13.18"
3636
}
3737

3838
publishing {

jpro-routing/core-test/src/test/scala/one/jpro/platform/routing/TestRouteApp.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ package one.jpro.platform.routing
22

33
import javafx.scene.layout.StackPane
44
import javafx.stage.Stage
5-
import org.junit.jupiter.api.Test
5+
import org.junit.jupiter.api.{BeforeAll, Test}
66
import simplefx.core._
77

8+
import scala.concurrent.Await
9+
10+
object TestRouteApp {
11+
@BeforeAll
12+
def setup(): Unit = {
13+
Await.result(simplefx.cores.initializeCore(), (second))
14+
}
15+
}
816
class TestRouteApp {
917

1018
@Test

jpro-routing/core/src/main/java/module-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
requires transitive javafx.controls;
33
requires transitive org.slf4j;
44

5-
requires transitive de.sandec.jnodes;
65
requires transitive one.jpro.jmemorybuddy;
76
requires transitive one.jpro.platform.utils;
87
requires transitive jpro.webapi;
@@ -13,6 +12,7 @@
1312
requires transitive scala.library;
1413

1514
exports one.jpro.platform.routing;
15+
exports one.jpro.platform.routing.context;
1616
exports one.jpro.platform.routing.crawl;
1717
exports one.jpro.platform.routing.performance;
1818
exports one.jpro.platform.routing.filter.container;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package one.jpro.platform.routing.context;
2+
3+
class IgnoreMe {}

jpro-routing/core/src/main/scala/one/jpro/platform/routing/RouteUtils.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package one.jpro.platform.routing
22

33
import one.jpro.platform.routing.filter.container.ContainerFactory
4+
import scala.language.postfixOps
45
import simplefx.all
56
import simplefx.all._
67
import simplefx.core._

jpro-routing/core/src/main/scala/one/jpro/platform/routing/SessionManagerContext.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package one.jpro.platform.routing
22

33
import one.jpro.platform.routing.sessionmanager.SessionManager
44

5-
object SessionManagerContext extends de.sandec.jnodes.context.ContextManager[SessionManager]
5+
object SessionManagerContext extends one.jpro.platform.routing.context.ContextManager[SessionManager]
66

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package one.jpro.platform.routing.context
2+
3+
import simplefx.core._
4+
import simplefx.all._
5+
import simplefx.util.Predef.extension
6+
import javafx.css.Styleable
7+
8+
class ContextManager[A] {
9+
10+
@extension class ExtWithSession(x: Node) {
11+
@Bind private[context] var context: A = null
12+
13+
private def printDebugInfo(): Unit = {
14+
println(" - ")
15+
println(s"getContext for node: $x")
16+
println(s"getParent: ${x.getParent}")
17+
println(s"getStyleableParent: ${x.getStyleableParent}")
18+
}
19+
20+
private[context] def getContext: A = {
21+
//printDebugInfo()
22+
if(context != null) context
23+
else getStyleableParentContext(x).getOrElse(throw new Exception("Couldn't find SessionManager!"))
24+
}
25+
26+
private def getStyleableParentContext(styleable: Styleable): Option[A] = {
27+
styleable.getStyleableParent match {
28+
case null => None
29+
case node: Node =>
30+
val nodeContext = node.getContext
31+
if(nodeContext != null) Some(nodeContext)
32+
else getStyleableParentContext(node)
33+
case _ => getStyleableParentContext(styleable.getStyleableParent)
34+
}
35+
}
36+
}
37+
38+
def setContext(x: Node, y: A): Unit = x.context = y
39+
40+
def getContext(x: Node): A = x.getContext
41+
}

jpro-routing/dev/src/main/scala/one/jpro/platform/routing/dev/DevFilter.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import one.jpro.platform.routing.{Filter, LinkUtil, RouteUtils}
88
import org.kordamp.ikonli.javafx.FontIcon
99
import org.scenicview.ScenicView
1010
import org.slf4j.{Logger, LoggerFactory}
11+
import scala.language.postfixOps
1112
import simplefx.all._
1213
import simplefx.core._
1314
import simplefx.experimental._

jpro-routing/dev/src/main/scala/one/jpro/platform/routing/dev/StatisticsFilter.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import one.jpro.platform.routing.{Filter, LinkUtil, RouteUtils}
77
import org.kordamp.ikonli.javafx.FontIcon
88
import org.scenicview.ScenicView
99
import org.slf4j.{Logger, LoggerFactory}
10+
import scala.language.postfixOps
1011
import simplefx.all._
1112
import simplefx.core._
1213
import simplefx.experimental._

0 commit comments

Comments
 (0)