diff --git a/pom.xml b/pom.xml
index bf5bbf3..d2d1563 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,32 +1,60 @@
-
+
+
4.0.0
no.tornado
- tornadofx2
- 2.0.0-SNAPSHOT
- jar
- TornadoFX2
+ tornadofx
+ 2.1.0-SNAPSHOT
+ pom
+
+ tornadofx
JavaFX Framework for Kotlin
https://github.com/edvin/tornadofx2
+
+ tornadofx-core
+ tornadofx-json
+ tornadofx-http
+
+
+
+
+ UTF-8
+
+
+ 3.8.0
+ 11
+ 11
+ 3.0.1
+
+
+ 1.3.72
+ official
+
+
+ 4.12
+
+
+ 13
+
+
+ 1.1.2
+
+
+ 4.5.3
+
+
+ 6.0.1
+
+
+ 3.0.2
+
+
+ 1.4
+
+
-
- org.glassfish
- javax.json
- ${org.glassfish.javax.json.version}
-
-
- org.apache.httpcomponents
- httpclient
- ${org.apache.httpcomponents.httpclient.version}
- provided
-
-
- org.apache.felix
- org.apache.felix.framework
- ${org.apache.felix.framework.version}
- provided
-
+
org.jetbrains.kotlin
kotlin-stdlib-jdk8
@@ -37,41 +65,16 @@
kotlin-reflect
${kotlin.version}
-
- de.jensd
- fontawesomefx-fontawesome
- ${de.jensd.fontawesomefx.version}
-
+
+
junit
junit
${junit.version}
test
-
- org.jetbrains.kotlin
- kotlin-test-junit
- ${kotlin.version}
- test
-
-
- org.testfx
- testfx-core
- ${org.testfx.testfx-core.version}
- test
-
-
- org.testfx
- testfx-junit
- ${org.testfx.testfx-junit.version}
- test
-
-
- org.hamcrest
- hamcrest-library
- 1.3
- test
-
+
+
org.openjfx
javafx-controls
@@ -84,100 +87,67 @@
org.openjfx
- javafx-web
+ javafx-media
${javafx.version}
org.openjfx
- javafx-media
+ javafx-swing
${javafx.version}
org.openjfx
- javafx-swing
+ javafx-web
${javafx.version}
-
-
-
- sonatype-nexus
- Nexus Release Repository
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
- sonatype-nexus
- https://oss.sonatype.org/content/repositories/snapshots
-
-
+
+
+ org.glassfish
+ javax.json
+ ${org.glassfish.javax.json.version}
+
-
- SYSE
- https://www.syse.no/
-
+
+
+ org.apache.httpcomponents
+ httpclient
+ ${org.apache.httpcomponents.httpclient.version}
+ provided
+
-
-
- The Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0.txt
-
-
+
+
+ org.apache.felix
+ org.apache.felix.framework
+ ${org.apache.felix.framework.version}
+ provided
+
-
-
- Edvin Syse
- es@syse.no
- SYSE AS
- https://www.syse.no
-
-
- Thomas Nield
- thomasnield@live.com
- Southwest Airlines
- https://www.southwest.com/
-
-
- Matthew Turnblom
- uberawesomeemailaddressofdoom@gmail.com
- Xactware
- https://www.xactware.com/
-
-
- Craig Tadlock
- craig.tadlock@gototags.com
- GoToTags
- https://gototags.com/
-
-
+
+
+ org.jetbrains.kotlin
+ kotlin-test-junit
+ ${kotlin.version}
+ test
+
-
- scm:git:git@github.com:edvin/tornadofx2.git
- scm:git:git@github.com:edvin/tornadofx2.git
- git@github.com:edvin/tornadofx2.git
-
+
-
- ${project.basedir}/src/test/kotlin
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- ${maven.release.version}
-
- forked-path
- false
- -Psonatype-oss-release
-
-
-
-
+
+
+ jcenter
+ JCenter
+ https://jcenter.bintray.com/
+
+
+
+
- kotlin-maven-plugin
org.jetbrains.kotlin
+ kotlin-maven-plugin
${kotlin.version}
1.8
@@ -185,19 +155,34 @@
compile
- process-sources
+ compile
compile
+
+
+ ${project.basedir}/src/main/kotlin
+ ${project.basedir}/src/main/java
+
+
test-compile
+ test-compile
test-compile
+
+
+ ${project.basedir}/src/test/kotlin
+ ${project.basedir}/src/test/java
+
+
+
+
maven-compiler-plugin
${maven.compiler.version}
@@ -207,73 +192,38 @@
11
UTF-8
-
-
- org.jetbrains.dokka
- dokka-maven-plugin
- ${dokka.version}
+
- pre-site
-
- javadocJar
-
+ default-compile
+ none
+
+
+
+ default-testCompile
+ none
-
-
- false
- true
- 8
-
- JVM
-
- true
- true
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- ${maven.source.version}
-
+ java-compile
compile
-
- aggregate
- jar
-
+ compile
+
+
+ java-test-compile
+ test-compile
+ testCompile
+
+
+ org.apache.maven.plugins
maven-jar-plugin
${maven.jar.version}
-
-
- ${project.build.outputDirectory}/META-INF/MANIFEST.MF
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- ${maven.bundle.version}
-
-
- bundle-manifest
- process-classes
-
- manifest
-
-
-
-
-
- tornadofx.osgi.impl.Activator
- no.tornado.tornadofx
-
-
+
+
org.apache.maven.plugins
maven-gpg-plugin
@@ -288,56 +238,48 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven.surefire.version}
-
-
- --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
- --add-exports tornadofx/tornadofx.tests=kotlin.reflect
- --add-opens tornadofx/tornadofx.tests=javafx.base
- --add-reads tornadofx=jdk.httpserver
-
-
-
+
-
-
-
- jcenter
- JCenter
- https://jcenter.bintray.com/
-
-
-
- 13
- 1.3.61
- 0.10.0
+
+
+ The Apache License, Version 2.0
+ https://www.apache.org/licenses/LICENSE-2.0.txt
+
+
- 1.1.2
- 4.5.3
- 6.0.1
- 4.12
- 4.0.15-alpha
- 4.0.15-alpha
- 4.7.0-9.1.2
+
+
+ Edvin Syse
+ es@syse.no
+ SYSE AS
+ https://www.syse.no
+
+
+ Craig Tadlock
+ craig.tadlock@gototags.com
+ GoToTags
+ https://gototags.com
+
+
- 2.1
- 3.8.0
- 3.0.1
- 3.0.2
- 3.5.1
- 1.4
- 3.0.0-M3
+
+ scm:git:git@github.com:edvin/tornadofx2.git
+ scm:git:git@github.com:edvin/tornadofx2.git
+ git@github.com:edvin/tornadofx2.git
+
- UTF-8
- 11
- 11
-
-
\ No newline at end of file
+
+
+ sonatype-nexus
+ Nexus Release Repository
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+ sonatype-nexus
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+
+
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
deleted file mode 100644
index ef03604..0000000
--- a/src/main/java/module-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-import tornadofx.ChildInterceptor;
-import tornadofx.Stylesheet;
-
-module tornadofx {
- requires transitive javafx.controls;
- requires javafx.fxml;
- requires javafx.swing;
- requires javafx.web;
- requires javafx.media;
-
- requires kotlin.stdlib;
- requires kotlin.reflect;
-
- requires static httpcore;
- requires static httpclient;
- requires static org.apache.felix.framework;
-
- requires transitive java.json;
- requires transitive java.prefs;
- requires transitive java.logging;
-
- opens tornadofx to javafx.fxml;
-
- exports tornadofx;
-
- uses ChildInterceptor;
- uses Stylesheet;
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/AccelTest.kt b/src/test/kotlin/tornadofx/testapps/AccelTest.kt
deleted file mode 100644
index b281ac4..0000000
--- a/src/test/kotlin/tornadofx/testapps/AccelTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.control.Alert
-import javafx.scene.input.KeyCode
-import javafx.scene.input.KeyCodeCombination
-import javafx.scene.input.KeyCombination
-import tornadofx.*
-
-class AccelTestApp : App(AccelTest::class)
-
-class AccelTest : View() {
- override val root = stackpane {
- add()
- }
-}
-
-class AccelView : View() {
- override val root = button("Click me") {
- shortcut(KeyCodeCombination(KeyCode.A, KeyCombination.SHORTCUT_ANY, KeyCombination.SHIFT_ANY))
- action {
- alert(Alert.AlertType.INFORMATION, "Fire!", "You clicked.")
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/AnimationHelperTest.kt b/src/test/kotlin/tornadofx/testapps/AnimationHelperTest.kt
deleted file mode 100644
index 15b9532..0000000
--- a/src/test/kotlin/tornadofx/testapps/AnimationHelperTest.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-package tornadofx.testapps
-
-import javafx.animation.Animation
-import javafx.animation.Interpolator
-import javafx.scene.paint.Color
-import tornadofx.*
-
-class ShapeTransitionTest : App(Main::class) {
- class Main : View("Shape Transition Test") {
- var switch = true
- val nextFill get() = if (switch) c(1.0, 0.0, 0.0) else c(0.0, 0.0, 1.0)
- val nextStroke get() = if (switch) c(0.0, 0.0, 1.0) else c(1.0, 0.0, 0.0)
- override val root = stackpane {
- background = Color.BLACK.asBackground()
- val round = circle(radius = 100.0) {
- fill = nextFill
- stroke = nextStroke
- switch = !switch
- strokeWidth = 20.0
- }
- val orbit = circle(0.0, 0.0, 10.0) {
- animateFill(0.33.seconds, Color.ORANGE, Color.YELLOW) {
- isAutoReverse = true
- cycleCount = Animation.INDEFINITE
- }
- }.follow(3.seconds, round, Interpolator.LINEAR) { cycleCount = Animation.INDEFINITE }
- button("Click Me") {
- action {
- isDisable = true
- val startFill = round.fill as? Color ?: Color.BLACK
- val endFill = nextFill
- val startStroke = round.stroke as? Color ?: Color.BLACK
- val endStroke = nextStroke
- switch = !switch
- listOf(
- pause(0.75.seconds, play = false) { setOnFinished { orbit.rate = -orbit.rate } },
- listOf(
- round.animateFill(0.25.seconds, startFill, endFill, play = false),
- round.animateStroke(0.25.seconds, startStroke, endStroke, play = false)
- ).playParallel(false)
- ).playSequential { setOnFinished { isDisable = false } }
- }
- }
- }
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/AsyncProgressApp.kt b/src/test/kotlin/tornadofx/testapps/AsyncProgressApp.kt
deleted file mode 100644
index 1e03b61..0000000
--- a/src/test/kotlin/tornadofx/testapps/AsyncProgressApp.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.paint.Color
-import javafx.scene.text.FontWeight
-import tornadofx.*
-
-class AsyncProgressApp : App(AsyncProgressView::class)
-
-class AsyncProgressView : View("Async Progress") {
- override val root = borderpane {
- setPrefSize(400.0, 300.0)
-
- center {
- button("Start") {
- action {
- runAsync {
- updateTitle("Doing some work")
- for (i in 1..10) {
- updateMessage("Working $i...")
- if (i == 5)
- updateTitle("Dome something else")
- Thread.sleep(200)
- updateProgress(i.toLong(), 10)
- }
- }
- }
- }
- }
- bottom {
- add()
- }
- }
-}
-
-class ProgressView : View() {
- val status: TaskStatus by inject()
-
- override val root = vbox(4) {
- visibleWhen { status.running }
- style { borderColor += box(Color.LIGHTGREY, Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT) }
- label(status.title).style { fontWeight = FontWeight.BOLD }
- hbox(4) {
- label(status.message)
- progressbar(status.progress)
- visibleWhen { status.running }
- }
- }
-}
-
-class AsyncProgressButtonView : View() {
- override val root = stackpane {
- setPrefSize(400.0, 400.0)
- button("Click me") {
- action {
- runAsyncWithProgress {
- Thread.sleep(2000)
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/AwaitUntilTest.kt b/src/test/kotlin/tornadofx/testapps/AwaitUntilTest.kt
deleted file mode 100644
index 27739ef..0000000
--- a/src/test/kotlin/tornadofx/testapps/AwaitUntilTest.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleBooleanProperty
-import javafx.beans.property.SimpleObjectProperty
-import javafx.beans.property.SimpleStringProperty
-import javafx.util.converter.IntegerStringConverter
-import tornadofx.*
-import java.time.LocalDateTime
-
-class AwaitUntilTest : View("Await Until Test") {
- val number = SimpleObjectProperty()
- val flag = SimpleBooleanProperty(false)
- val output = SimpleStringProperty("")
-
- override val root = borderpane {
- top {
- toolbar {
- label("Number:")
- textfield(number, IntegerStringConverter())
- button("Wait until 42").action {
- number.awaitUntil { it == 42 }
- output.value += "Number is now 42\n"
- }
- button("Wait until true").action {
- runLater(2.seconds) {
- flag.set(true)
- }
- flag.awaitUntil()
- output.value += "Flag is true\n"
- }
- button("Look alive").action {
- output.value += "Alive at ${LocalDateTime.now()}\n"
- }
- }
- }
- center {
- textarea(output)
- }
- }
-}
-
-class AwaitUntilApp : App(AwaitUntilTest::class)
diff --git a/src/test/kotlin/tornadofx/testapps/BorderPaneTest.kt b/src/test/kotlin/tornadofx/testapps/BorderPaneTest.kt
deleted file mode 100644
index 22fbd7e..0000000
--- a/src/test/kotlin/tornadofx/testapps/BorderPaneTest.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-
-class BorderPaneTestApp : App(BorderPaneTest::class)
-
-class BorderPaneTest : View("Border Pane Builder Test") {
- override val root = borderpane {
- // Direct access
- top = label("Top")
- // Builder target
- center {
- hbox {
- label("Center")
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/BrokenLineTest.kt b/src/test/kotlin/tornadofx/testapps/BrokenLineTest.kt
deleted file mode 100644
index 47ac62e..0000000
--- a/src/test/kotlin/tornadofx/testapps/BrokenLineTest.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.layout.BorderStrokeStyle
-import javafx.scene.shape.StrokeLineCap
-import javafx.scene.shape.StrokeLineJoin
-import javafx.scene.shape.StrokeType
-import tornadofx.*
-
-class BrokenLineApp : App(BrokenLineView::class, BrokenStyles::class)
-class BrokenLineView : View("Broken Line Test") {
- override val root = stackpane {
- line {
- addClass(BrokenStyles.blue)
- endXProperty().bind(this@stackpane.widthProperty())
- endYProperty().bind(this@stackpane.heightProperty())
- }
- line {
- addClass(BrokenStyles.blue)
- endXProperty().bind(this@stackpane.widthProperty())
- startYProperty().bind(this@stackpane.heightProperty())
- }
- label("This is a label with a border").addClass(BrokenStyles.red)
- }
-}
-
-class BrokenStyles : Stylesheet() {
- companion object {
- val red by cssclass()
- val blue by cssclass()
- }
-
- init {
- root {
- padding = box(25.px)
- backgroundColor += c("white")
- }
- red {
- val radius = box(50.px)
- backgroundColor += c("white", 0.9)
- backgroundRadius += radius
- borderColor += box(c("red"))
- borderWidth += box(5.px)
- borderRadius += radius
- borderStyle += BorderStrokeStyle(
- StrokeType.CENTERED,
- StrokeLineJoin.MITER,
- StrokeLineCap.SQUARE,
- 10.0,
- 0.0,
- listOf(5.0, 15.0, 0.0, 15.0)
- )
- padding = box(50.px)
- }
- blue {
- stroke = c("dodgerblue")
- strokeWidth = 5.px
- strokeType = StrokeType.CENTERED
- strokeLineCap = StrokeLineCap.SQUARE
- strokeDashArray = listOf(25.px, 15.px, 0.px, 15.px)
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/BuilderWindowTest.kt b/src/test/kotlin/tornadofx/testapps/BuilderWindowTest.kt
deleted file mode 100644
index 28ced08..0000000
--- a/src/test/kotlin/tornadofx/testapps/BuilderWindowTest.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-package tornadofx.testapps
-
-import javafx.application.Platform
-import javafx.scene.paint.Color
-import javafx.scene.text.FontWeight
-import javafx.stage.StageStyle.DECORATED
-import javafx.stage.StageStyle.UNDECORATED
-import tornadofx.*
-
-class BuilderWindowTestApp : App(DangerButtonView::class)
-
-class DangerButtonView : View("Do not click the button!") {
- override val root = stackpane {
- setPrefSize(400.0, 150.0)
- hbox {
- button("Don't click me") {
- style {
- fontSize = 20.px
- fontWeight = FontWeight.BOLD
- textFill = Color.RED
- }
- action {
- builderWindow("What do you want?", stageStyle = UNDECORATED, owner = primaryStage) {
- vbox(10) {
- style {
- padding = box(20.px)
- borderColor += box(Color.ORANGE)
- borderWidth += box(2.px)
- }
-
- label("So, you clicked it anyway.. What do you want?") {
- style {
- fontWeight = FontWeight.BOLD
- }
- }
-
- hbox(10) {
- button("Tell them you clicked").action {
- this@DangerButtonView.title = "It's not dangerous to click the button :)"
- close()
- }
- button("Close app").action {
- Platform.exit()
- }
- button("Cancel").action {
- close()
- }
- }
- }
- }
- }
- }
- button("the same in internalWindow").action {
- openInternalBuilderWindow("Internal window", modal = true, overlayPaint = Color.DARKRED) {
- vbox(20) {
- label("opened in an internalwindow")
- button("close").action { close() }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ChartTestApp.kt b/src/test/kotlin/tornadofx/testapps/ChartTestApp.kt
deleted file mode 100644
index 602d21d..0000000
--- a/src/test/kotlin/tornadofx/testapps/ChartTestApp.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.chart.CategoryAxis
-import javafx.scene.chart.NumberAxis
-import javafx.scene.paint.Color
-import tornadofx.*
-
-class BarChartTestApp : App(BarChartTest::class, BarChartStyles::class)
-
-class BarChartTest : View() {
- override val root = barchart("Stock Monitoring, 2010", CategoryAxis(), NumberAxis()) {
- series("Portfolio 1") {
- data("Jan", 23)
- data("Feb", 14)
- data("Mar", 15)
- }
- series("Portfolio 2") {
- data("Jan", 11)
- data("Feb", 19)
- data("Mar", 27)
- }
- }
-}
-
-class BarChartStyles : Stylesheet() {
- val chartBar by cssclass()
-
- init {
- defaultColor0 and chartBar {
- barFill = Color.VIOLET
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ComboBoxTest.kt b/src/test/kotlin/tornadofx/testapps/ComboBoxTest.kt
deleted file mode 100644
index e0c1ee5..0000000
--- a/src/test/kotlin/tornadofx/testapps/ComboBoxTest.kt
+++ /dev/null
@@ -1,196 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleObjectProperty
-import javafx.beans.property.SimpleStringProperty
-import javafx.util.StringConverter
-import tornadofx.*
-import java.util.*
-
-class ComboBoxTestApp : App(ComboboxTest::class)
-
-class ComboboxTest : View("Combobox test") {
- val items = listOf("Item 1", "Item 2", "Item 3")
- val selectedItem = SimpleStringProperty(items.first())
-
- override val root = stackpane {
- setPrefSize(400.0, 400.0)
- combobox(selectedItem, items) {
- cellFormat {
- text = it
- }
- }
- }
-}
-
-class AutoCompleteComboBoxExtensionTestApp : App(AutoCompleteComboBoxExtensionTest::class)
-
-class AutoCompleteComboBoxExtensionTest : View("AutoComplete comboBox extension test") {
- val itemsGlobalObject = Locale.getISOCountries().map { Locale("", it) }
- val itemsGlobal = itemsGlobalObject.mapEach { displayCountry }
- val selectedItem = SimpleStringProperty(itemsGlobal.first())
- val selectedItem2 = SimpleStringProperty(itemsGlobal.first())
- val selectedItem3 = SimpleStringProperty(itemsGlobal.first())
- val selectedItemObject = SimpleObjectProperty(itemsGlobalObject.first())
- val selectedItemObject2 = SimpleObjectProperty(itemsGlobalObject.first())
- val selectedItemObject3 = SimpleObjectProperty(itemsGlobalObject.first())
-
- val selectedItemE = SimpleStringProperty(itemsGlobal.first())
- val selectedItem2E = SimpleStringProperty(itemsGlobal.first())
- val selectedItemObjectE = SimpleObjectProperty(itemsGlobalObject.first())
- val selectedItemObject2E = SimpleObjectProperty(itemsGlobalObject.first())
- val selectedItemObject3E = SimpleObjectProperty(itemsGlobalObject.first())
-
- override val root = form {
- setPrefSize(400.0, 400.0)
- fieldset {
- field("Default") {
- combobox(selectedItem, itemsGlobal) {
- makeAutocompletable()
- }
- textfield(selectedItem)
- useMaxSize = true
- }
- /**
- * Example using automatic popup width
- */
- field("With automatic popup width") {
- combobox(selectedItem2, itemsGlobal) {
- makeAutocompletable(automaticPopupWidth = true)
- }
- textfield(selectedItem2)
- useMaxSize = true
- }
- /**
- * Example using custom filter using startswith instead of contains
- */
- field("With custom Filter") {
- combobox(selectedItem3, itemsGlobal) {
- makeAutocompletable {
- itemsGlobal.filter { current -> converter.toString(current).startsWith(it, true) }
- }
- }
- textfield(selectedItem3)
- useMaxSize = true
- }
- /**
- * Example using converter
- */
- field("Default with custom converter") {
- combobox(selectedItemObject, itemsGlobalObject) {
- converter = LocaleStringConverter()
- makeAutocompletable()
- }
- label(selectedItemObject)
- useMaxSize = true
- }
- /**
- * Example using converter and custom filter
- */
- field("With custom converter and filter") {
- combobox(selectedItemObject2, itemsGlobalObject) {
- converter = LocaleStringConverter()
- makeAutocompletable {
- itemsGlobalObject.asObservable().filtered { current -> current.displayCountry.contains(it, true) || current.isO3Country.contains(it, true) || current.country.contains(it, true) }
- }
- }
- label(selectedItemObject2)
- useMaxSize = true
- }
- /**
- * Example using custom cell factory
- */
- field("With custom cell factory") {
- combobox(selectedItemObject3, itemsGlobalObject) {
- converter = LocaleStringConverter()
- cellFormat {
- text = "Locale: " + converter.toString(it)
- }
- makeAutocompletable {
- itemsGlobalObject.asObservable().filtered { current -> current.displayCountry.contains(it, true) || current.isO3Country.contains(it, true) || current.country.contains(it, true) }
- }
- }
- label(selectedItemObject3)
- }
- field("Editable Default") {
- combobox(selectedItemE, itemsGlobal) {
- val tmpValue = value
- isEditable = true
- value = tmpValue
- makeAutocompletable()
- }
- textfield(selectedItemE)
- }
- /**
- * Example using custom filter using startswith instead of contains
- */
- field("Editable With custom Filter") {
- combobox(selectedItem2E, itemsGlobal) {
- val tmpValue = value
- isEditable = true
- value = tmpValue
- makeAutocompletable {
- itemsGlobal.filter { current -> converter.toString(current).startsWith(it, true) }
- }
- }
- textfield(selectedItem2E)
- }
- /**
- * Example using converter
- */
- field("Editable Default with custom converter") {
- combobox(selectedItemObjectE, itemsGlobalObject) {
- val tmpValue = value
- isEditable = true
- value = tmpValue
- converter = LocaleStringConverter()
- makeAutocompletable()
- }
- label(selectedItemObjectE)
- }
- /**
- * Example using converter and custom filter
- */
- field("Editable With custom converter and filter") {
- combobox(selectedItemObject2E, itemsGlobalObject) {
- val tmpValue = value
- isEditable = true
- value = tmpValue
- converter = LocaleStringConverter()
- makeAutocompletable {
- itemsGlobalObject.asObservable().filtered { current -> current.displayCountry.contains(it, true) || current.isO3Country.contains(it, true) || current.country.contains(it, true) }
- }
- }
- label(selectedItemObject2E)
- }
- /**
- * Example using custom cell factory
- */
- field("Editable With custom cell factory") {
- combobox(selectedItemObject3E, itemsGlobalObject) {
- val tmpValue = value
- isEditable = true
- value = tmpValue
- converter = LocaleStringConverter()
- cellFormat {
- text = "Locale: " + converter.toString(it)
- }
- makeAutocompletable {
- itemsGlobalObject.asObservable().filtered { current -> current.displayCountry.contains(it, true) || current.isO3Country.contains(it, true) || current.country.contains(it, true) }
- }
- }
- label(selectedItemObject3E)
- }
- }
- }
-}
-
-class LocaleStringConverter : StringConverter() {
- val mapLocale = mutableMapOf()
- override fun fromString(string: String?): Locale? = string?.let { mapLocale[it] }
-
- override fun toString(locale: Locale?): String? {
- val output = locale?.displayCountry + ", " + locale?.isO3Country
- if (locale != null && !mapLocale.containsKey(output)) mapLocale[output] = locale
- return output
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/CommandTest.kt b/src/test/kotlin/tornadofx/testapps/CommandTest.kt
deleted file mode 100644
index 74e49b1..0000000
--- a/src/test/kotlin/tornadofx/testapps/CommandTest.kt
+++ /dev/null
@@ -1,102 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleDoubleProperty
-import javafx.beans.property.SimpleIntegerProperty
-import javafx.beans.property.SimpleStringProperty
-import javafx.geometry.Pos
-import javafx.scene.control.Alert
-import javafx.scene.control.Alert.AlertType.INFORMATION
-import tornadofx.*
-
-class CommandTestApp : App(CommandTest::class)
-
-class CommandTest : View("Command test") {
- val ctrl: CommandController by inject()
- val nameProperty = SimpleStringProperty()
- val numberProperty = SimpleDoubleProperty()
-
- override val root = borderpane {
- top {
- menubar {
- menu("Talk") {
- item("Say hello").command = ctrl.helloCommand
- customitem {
- vbox {
- text("I'm custom!")
- }
- action {
- println("Custom item clicked!")
- }
- }
- }
- }
- }
- center {
- vbox(20) {
- minWidth = 600.0
- paddingAll = 50
-
- hbox(10) {
- alignment = Pos.CENTER
- label("Name:")
- textfield(nameProperty)
-
- button("Say hello") {
- command = ctrl.helloCommand with nameProperty
- }
-
- button("Call action off of UI thread").action {
- runAsync {
- ctrl.helloCommand.execute("Some Name")
- }
- }
- }
- hbox(10) {
- alignment = Pos.CENTER
- label("Enter number:")
- textfield(numberProperty)
- hyperlink("Calculate square root") {
- command = ctrl.squareRootCommand with numberProperty
- }
- label("Square root:")
- label(ctrl.squareRootResult)
- }
- vbox(10) {
- alignment = Pos.CENTER
- button("Download file") {
- command = ctrl.downloadCommand
- }
- progressbar(ctrl.downloadProgress) {
- visibleWhen { progressProperty().greaterThan(0) }
- }
- }
- }
- }
- }
-}
-
-class CommandController : Controller() {
- val helloCommand = command(this::hello, ui = true, nullable = true)
- val squareRootCommand = command(this::squareRoot)
- val downloadCommand = command(this::download, async = true)
-
- val squareRootResult = SimpleIntegerProperty()
- val downloadProgress = SimpleDoubleProperty()
-
- private fun hello(name: String?) {
- Alert(INFORMATION, "Hello, ${name ?: "there"}").showAndWait()
- }
-
- private fun squareRoot(value: Double) {
- squareRootResult.value = Math.sqrt(value).toInt()
- }
-
- private fun download() {
- for (i in 1..100) {
- downloadProgress.value = i / 100.0
- Thread.sleep(50)
- }
- Thread.sleep(1000)
- downloadProgress.value = 0.0
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/DataGridTest.kt b/src/test/kotlin/tornadofx/testapps/DataGridTest.kt
deleted file mode 100644
index 6cd45a1..0000000
--- a/src/test/kotlin/tornadofx/testapps/DataGridTest.kt
+++ /dev/null
@@ -1,91 +0,0 @@
-package tornadofx.testapps
-
-import javafx.collections.FXCollections
-import javafx.scene.Parent
-import javafx.scene.control.SelectionMode
-import tornadofx.*
-import tornadofx.testapps.DataGridTestApp.Companion.images
-
-class DataGridTestApp : App(DataGridTest::class, DataGridStyles::class) {
- companion object {
- val images = mapOf(
- "kittens" to listOf(
- "http://i.imgur.com/DuFZ6PQb.jpg",
- "http://i.imgur.com/o2QoeNnb.jpg",
- "http://i.imgur.com/P8wpBvub.jpg",
- "http://i.imgur.com/a2NDDglb.jpg",
- "http://i.imgur.com/79C37Scb.jpg",
- "http://i.imgur.com/N0fPCU2b.jpg",
- "http://i.imgur.com/qRfWC9wb.jpg",
- "http://i.imgur.com/i3crLYcb.jpg"),
-
- "puppies" to listOf(
- "http://i.imgur.com/37hCL2Pb.jpg",
- "http://i.imgur.com/v9vBE67b.jpg",
- "http://i.imgur.com/koQoEExb.jpg",
- "http://i.imgur.com/qRfWC9wb.jpg",
- "http://i.imgur.com/ftDV8oJb.jpg")
-
- )
- }
-}
-
-class DataGridTest : View("DataGrid") {
- var datagrid: DataGrid by singleAssign()
- val list = FXCollections.observableArrayList()
- var paginator = DataGridPaginator(list, itemsPerPage = 5)
-
- override val root = borderpane {
- left {
- vbox {
- combobox(values = images.keys.toList()) {
- promptText = "Select images"
- valueProperty().onChange {
- list.setAll(images[it])
- }
- shortcut("k") { value = "kittens" }
- shortcut("p") { value = "puppies" }
- }
- button("Add").action {
- list.add("http://i.imgur.com/bvqTBT0b.jpg")
- }
- }
- }
- center {
- datagrid = datagrid(paginator.items) {
- setPrefSize(550.0, 550.0)
-
- selectionModel.selectionMode = SelectionMode.SINGLE
- cellWidth = 164.0
- cellHeight = 164.0
-
- cellCache {
- imageview(it, true)
- }
-
- onUserSelect(1) {
- println("Selected $it")
- }
- }
- }
- bottom {
- vbox {
- add(paginator)
- hbox {
- label(stringBinding(datagrid.selectionModel.selectedItems) { joinToString(", ") })
- button("Remove from index 2").action {
- if (list.size > 2) list.removeAt(2)
- }
- }
- }
- }
- }
-}
-
-class DataGridStyles : Stylesheet() {
- init {
- datagridCell and selected {
- opacity = 0.7
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/DrawerTest.kt b/src/test/kotlin/tornadofx/testapps/DrawerTest.kt
deleted file mode 100644
index edcbb8d..0000000
--- a/src/test/kotlin/tornadofx/testapps/DrawerTest.kt
+++ /dev/null
@@ -1,122 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleStringProperty
-import javafx.scene.paint.Color
-import tornadofx.*
-
-class DrawerTestApp : App(DrawerWorkspace::class) {
- override fun onBeforeShow(view: UIComponent) {
- workspace.root.setPrefSize(600.0, 400.0)
- workspace.dock()
- }
-}
-
-class JustAView : View("Just A View") {
- override val root = vbox {
- label("I'm just a view - I do nothing")
- button("Load another View").action {
- workspace.dock()
- }
- }
-}
-
-class AnotherView : View("Another") {
- override val root = stackpane {
- label(title)
- }
-}
-
-class YetAnotherView : View("Yet Another") {
- override val root = stackpane {
- label(title)
- }
-}
-
-class TestDrawerContributor : View("Test View with dynamic drawer item") {
- override val root = stackpane {
- vbox {
- label("I add something to the drawer when I'm docked")
- button("Load another View").action {
- workspace.dock()
- }
- button("Load yet another View").action {
- workspace.dock()
- }
- }
- }
-
- override fun onDock() {
- workspace.leftDrawer.item("Temp Drawer") {
- stackpane {
- label("I'm only guest starring!")
- }
- }
- }
-}
-
-class DrawerWorkspace : Workspace("Drawer Workspace", Workspace.NavigationMode.Stack) {
- init {
- menubar {
- menu("Options") {
- checkmenuitem("Toggle Navigation Mode").action {
- navigationMode = if (navigationMode == NavigationMode.Stack) NavigationMode.Tabs else NavigationMode.Stack
- }
- }
- }
- with(bottomDrawer) {
- item("Console") {
- style {
- backgroundColor += Color.BLACK
- }
- label("""Connected to the target VM, address: '127.0.0.1:64653', transport: 'socket'
-Disconnected from the target VM, address: '127.0.0.1:64653', transport: 'socket'
-
-Process finished with exit code 0
-""") {
- style {
- backgroundColor += Color.BLACK
- textFill = Color.LIGHTGREY
- fontFamily = "Consolas"
- }
- }
- }
-
- item("Events") {
-
- }
- }
- with(leftDrawer) {
- item()
- item("Form item") {
- form {
- fieldset("Customer Details") {
- field("Name") { textfield() }
- field("Password") { textfield() }
- }
- }
- }
- item("SqueezeBox Item", showHeader = false) {
- squeezebox(multiselect = false, fillHeight = true) {
- fold("Customer Editor") {
- form {
- fieldset("Customer Details") {
- field("Name") { textfield() }
- field("Password") { textfield() }
- }
- }
- }
- fold("Some other editor") {
- stackpane {
- label("Nothing here")
- }
- }
- fold("A Table") {
- tableview(observableListOf("One", "Two", "Three")) {
- column("Value") { SimpleStringProperty(it.value) }
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/EventBusTest.kt b/src/test/kotlin/tornadofx/testapps/EventBusTest.kt
deleted file mode 100644
index 9f961a1..0000000
--- a/src/test/kotlin/tornadofx/testapps/EventBusTest.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleObjectProperty
-import javafx.beans.property.SimpleStringProperty
-import tornadofx.*
-import tornadofx.EventBus.RunOn.BackgroundThread
-import java.time.LocalDateTime
-import kotlin.concurrent.timer
-
-class EventBusTestApp : App(EventBusTestView::class) {
- init {
- find()
- }
-}
-
-class MyDataEvent(val data: List) : FXEvent()
-object GiveMeData : FXEvent(BackgroundThread)
-
-data class MyEvent(val text: String) : FXEvent()
-
-class EventBusTestView : View("Data Event Table") {
- val labelText = SimpleStringProperty("")
- val regProperty = SimpleObjectProperty()
- var reg by regProperty
-
-
- override val root = borderpane {
- top {
- hbox(10) {
- button("Load data").action {
- fire(GiveMeData)
- }
- button("Subscribe label") {
- setOnAction {
- reg = subscribe {
- labelText.value = it.text
- }
- }
- enableWhen { regProperty.isNull }
- }
- button("Unsubscribe label") {
- setOnAction {
- reg!!.unsubscribe()
- reg = null
- }
- enableWhen { regProperty.isNotNull }
- }
- }
- }
- center {
- tableview {
- column("Value", String::class) {
- value { it.value }
- }
- subscribe {
- items.setAll(it.data)
- selectionModel.select(0)
- requestFocus()
- }
- }
- }
- bottom {
- label(labelText)
- }
- }
-
- init {
- timer(daemon = true, period = 1000) {
- fire(MyEvent(LocalDateTime.now().toString()))
- }
- }
-}
-
-class MyController : Controller() {
- init {
- subscribe {
- fire(MyDataEvent(listOf("Simulate", "Data", "Loaded", "From", "The", "Database")))
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ExpandableTableTest.kt b/src/test/kotlin/tornadofx/testapps/ExpandableTableTest.kt
deleted file mode 100644
index 17ce4ba..0000000
--- a/src/test/kotlin/tornadofx/testapps/ExpandableTableTest.kt
+++ /dev/null
@@ -1,70 +0,0 @@
-package tornadofx.testapps
-
-import javafx.collections.ObservableList
-import javafx.scene.layout.Background.EMPTY
-import tornadofx.*
-import java.time.LocalDate
-import kotlin.random.Random
-
-class ExpandableTableTest : View("Smart Resize Demo") {
- class Room(val id: Int, val number: String, val type: String, val bed: String, val occupancy: ObservableList)
- class Occupancy(val id: Int, val date: LocalDate, val customer: Int)
-
- val rooms = observableListOf(
- Room(1, "104", "Bedroom", "Queen", makeOccupancy(5)),
- Room(2, "105", "Bedroom", "King", makeOccupancy(5)),
- Room(3, "106", "Bedroom", "King", makeOccupancy(5)),
- Room(4, "107", "Suite", "Queen", makeOccupancy(5)),
- Room(4, "108", "Bedroom", "King", makeOccupancy(5)),
- Room(4, "109", "Conference Room", "Queen", makeOccupancy(5)),
- Room(4, "110", "Bedroom", "Queen", makeOccupancy(5)),
- Room(4, "111", "Playroom", "King", makeOccupancy(5)),
- Room(4, "112", "Bedroom", "Queen", makeOccupancy(5))
- )
-
- override val root = tableview(rooms) {
- prefWidth = 600.0
-
- readonlyColumn("#", Room::id).contentWidth(10.0, true, true)
- readonlyColumn("Number", Room::number).weightedWidth(1.0)
- readonlyColumn("Bed", Room::bed).apply {
- weightedWidth(2.0)
- cellFormat {
- graphic = cache {
- textfield(itemProperty()) {
- isEditable = false
- paddingAll = 0
- background = EMPTY
- }
- }
- }
- }
- readonlyColumn("Type", Room::type).weightedWidth(2.0)
-
- smartResize()
-
- rowExpander {
- tableview(it.occupancy) {
- readonlyColumn("Occupancy", Occupancy::id)
- readonlyColumn("Date", Occupancy::date)
- readonlyColumn("Customer", Occupancy::customer)
- prefHeight = 100.0
- }
- }
- }
-
- init {
- runAsync {
- Thread.sleep(5000)
- } ui {
- root.items.add(Room(4, "113", "Suite", "King size long description", makeOccupancy(5)))
- SmartResize.POLICY.requestResize(root)
- }
- }
-
-}
-
-
-private fun makeOccupancy(count: Int) = (0..count).map {
- ExpandableTableTest.Occupancy(Random.nextInt(100), LocalDate.now().minusDays(it.toLong()), Random.nextInt(100000))
-}.asObservable()
diff --git a/src/test/kotlin/tornadofx/testapps/ExternalStylesheetTest.kt b/src/test/kotlin/tornadofx/testapps/ExternalStylesheetTest.kt
deleted file mode 100644
index 521d2e7..0000000
--- a/src/test/kotlin/tornadofx/testapps/ExternalStylesheetTest.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.text.FontWeight
-import javafx.stage.Stage
-import tornadofx.*
-
-class ExternalStylesheetTestApp : App(ExternalStylesheetTestView::class) {
- override fun start(stage: Stage) {
- importStylesheet("https://raw.githubusercontent.com/edvin/tornadofx/master/src/test/resources/teststyles.css")
- super.start(stage)
- }
-}
-
-class ExternalStylesheetTestView: View("External Stylesheet") {
- override val root = label(title).addClass("testclass")
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/FormTest.kt b/src/test/kotlin/tornadofx/testapps/FormTest.kt
deleted file mode 100644
index b0e9f77..0000000
--- a/src/test/kotlin/tornadofx/testapps/FormTest.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package tornadofx.testapps
-
-import javafx.geometry.Orientation
-import tornadofx.*
-
-class FormApp : App(FormView::class)
-
-class FormView : View("My Form") {
- override val root = form {
- fieldset(title) {
- field("Name") {
- textfield()
- }
- field("Date Of _Birth") {
- textfield {
- mnemonicTarget()
- }
- }
- field("Height") {
- textfield()
- }
- field("Weight") {
- textfield()
- }
- buttonbar {
- button("Save")
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/GotoViewApp.kt b/src/test/kotlin/tornadofx/testapps/GotoViewApp.kt
deleted file mode 100644
index 9b00107..0000000
--- a/src/test/kotlin/tornadofx/testapps/GotoViewApp.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-
-class SwitchViewApp : App(ContainerView::class)
-
-class ContainerView : View("ContainerView") {
- val subView1: SubView1 by inject()
- val subView2: SubView2 by inject()
-
- override val root = borderpane {
- top {
- hbox(10) {
- button("Switch view").action {
- if (center.lookup("#view1") != null)
- subView1.replaceWith(subView2, ViewTransition.Slide(0.2.seconds))
- else
- subView2.replaceWith(subView1, ViewTransition.Slide(0.2.seconds, ViewTransition.Direction.RIGHT))
- }
- button("Fire event").action { fire(MySwitchViewEvent) }
- }
- }
- center {
- add(subView1)
- }
- }
-}
-
-class SubView1 : View("SubView1") {
- override val root = hbox {
- id = "view1"
- label("I'm subview 1")
- }
- init {
- subscribe {
- println("SubView1 received event")
- }
- }
-}
-
-class SubView2 : View("SubView2") {
- override val root = hbox {
- label("I'm subview 2")
- }
- init {
- subscribe {
- println("SubView2 received event")
- }
- }
-}
-
-object MySwitchViewEvent : FXEvent()
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ImportStyles.kt b/src/test/kotlin/tornadofx/testapps/ImportStyles.kt
deleted file mode 100644
index 5594e38..0000000
--- a/src/test/kotlin/tornadofx/testapps/ImportStyles.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.paint.Color
-import javafx.scene.text.FontWeight
-import tornadofx.*
-
-/**
- * @author I58695 (2016-08-18)
- */
-class ImportStyles : App(MainView::class, Styles::class) {
- init {
- dumpStylesheets()
- }
-
- class MainView : View() {
- override val root = vbox {
- addClass(box)
- label("Test").addClass(test)
- }
- }
-
- companion object {
- val box by cssclass()
- val test by cssclass()
- }
-
- class Styles : Stylesheet(ParentStyles::class) {
- init {
- test {
- fontSize = 36.px
- fontWeight = FontWeight.BOLD
- textFill = Color.WHITE
- }
- }
- }
-
- class ParentStyles : Stylesheet() {
- init {
- box {
- backgroundColor += Color.GRAY
- padding = box(10.px, 100.px)
- }
- }
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/InternalWindowTest.kt b/src/test/kotlin/tornadofx/testapps/InternalWindowTest.kt
deleted file mode 100644
index cb14d38..0000000
--- a/src/test/kotlin/tornadofx/testapps/InternalWindowTest.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-
-class InternalWindowTestApp : App(InternalWindowTest::class)
-
-class InternalWindowTest : View("Internal Window") {
- override val root = stackpane {
- setPrefSize(600.0, 400.0)
- button("Open editor").action {
- openInternalWindow(modal = false, icon = FX.icon)
- }
-
- }
-}
-
-class Editor : View("Editor") {
- override val root = form {
- prefWidth = 300.0
-
- fieldset("Editor") {
- field("First field") {
- textfield()
- }
- field("Second field") {
- textfield()
- }
- button("Save") {
- shortcut("Alt+S")
- action {
- save()
- }
- }
- }
- }
-
- private fun save() {
- close()
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/KeyboardTestView.kt b/src/test/kotlin/tornadofx/testapps/KeyboardTestView.kt
deleted file mode 100644
index ee3c492..0000000
--- a/src/test/kotlin/tornadofx/testapps/KeyboardTestView.kt
+++ /dev/null
@@ -1,93 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-
-class KeyboardTestApp : App(KeyboardTestView::class)
-
-class KeyboardTestView : View("TornadoFX Keyboard Layout") {
- override val root = vbox(30) {
- paddingAll = 40
- // Loaded with JSON
- keyboard {
- load(resources.json("/tornadofx/tests/TornadoKeyboard.json"))
- println(toKeyboardLayoutEditorFormat())
- }
- // Generated with builders
- keyboard {
- row {
- key("", width = 1.25)
- key("")
- key("")
- key("")
- key("")
- key("")
- key("Del", height = 2)
- key("")
- key("")
- key("")
- key("")
- key("")
- key("")
- key("")
- }
- row {
- key("", width = 1.25)
- key("")
- key("Ctrl+W")
- key("Esc")
- key("")
- key("")
- spacer()
- key("")
- key("PgUp")
- key("▲")
- key("PgDn")
- key("")
- key("")
- key("")
- }
- row {
- key("", width = 1.25)
- key("")
- key("")
- key("")
- key("")
- key("")
- key("", height = 2)
- key("Home")
- key("◀")
- key("▼")
- key("▶")
- key("Ins")
- key("Del")
- key("")
- }
- row {
- key("", width = 1.25)
- key("Ctrl+Z")
- key("Ctrl+X")
- key("Ctrl+C")
- key("Ctrl+V")
- key("")
- spacer()
- key("End")
- key("")
- key("")
- key("")
- key("")
- key("", width = 2)
- }
- row {
- key("", width = 1.25)
- key("", width = 1.25)
- key("", width = 1.25)
- key("FN (Pressed)", width = 2.75)
- key("", width = 2.75)
- key("", width = 1.25)
- key("", width = 1.25)
- key("", width = 1.25)
- key("", width = 1.25)
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ListMenuTest.kt b/src/test/kotlin/tornadofx/testapps/ListMenuTest.kt
deleted file mode 100644
index 0d953f7..0000000
--- a/src/test/kotlin/tornadofx/testapps/ListMenuTest.kt
+++ /dev/null
@@ -1,73 +0,0 @@
-import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon
-import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon.*
-import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView
-import javafx.geometry.Orientation
-import javafx.geometry.Pos
-import javafx.geometry.Side
-import javafx.scene.paint.Color
-import tornadofx.*
-
-class ListMenuTestApp : App(ListMenuTest::class)
-
-class ListMenuTest : View("ListMenu Test") {
- val listmenu = listmenu(theme = "blue") {
- addMenuItems()
- activeItem = items.first()
- maxHeight = Double.MAX_VALUE
- }
-
- override val root = borderpane {
- setPrefSize(650.0, 500.0)
- top {
- vbox(10) {
- label(title).style { fontSize = 3.em }
- hbox(10) {
- alignment = Pos.CENTER
- label("Orientation")
- combobox(listmenu.orientationProperty, Orientation.values().toList())
- label("Icon Position")
- combobox(listmenu.iconPositionProperty, values = Side.values().toList())
- label("Theme")
- combobox(listmenu.themeProperty, values = listOf("none", "blue"))
- checkbox("Icons Only") {
- selectedProperty().onChange {
- with(listmenu) {
- items.clear()
- if (it) {
- iconOnlyMenuItems()
- } else {
- addMenuItems()
- }
- }
- }
- }
- }
- label(stringBinding(listmenu.activeItemProperty) { "Currently selected: ${value?.text}" }) {
- style { textFill = Color.RED }
- }
- style {
- alignment = Pos.CENTER
- }
- }
- }
- center = listmenu
- style {
- backgroundColor += Color.WHITE
- }
- paddingAll = 20
- }
-
- private fun ListMenu.iconOnlyMenuItems() {
- item(graphic = icon(USER))
- item(graphic = icon(SUITCASE))
- item(graphic = icon(COG))
- }
-
- private fun ListMenu.addMenuItems() {
- item("Contacts", icon(USER))
- item("Projects", icon(SUITCASE))
- item("Settings", icon(COG))
- }
-
- private fun icon(icon: FontAwesomeIcon) = FontAwesomeIconView(icon).apply { glyphSize = 20 }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/MultipleLifecycleAsyncApp.kt b/src/test/kotlin/tornadofx/testapps/MultipleLifecycleAsyncApp.kt
deleted file mode 100644
index e107cec..0000000
--- a/src/test/kotlin/tornadofx/testapps/MultipleLifecycleAsyncApp.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleIntegerProperty
-import tornadofx.*
-
-class MultipleLifecycleAsyncView : View("Multiple Lifecycle Async") {
- val counterProperty = SimpleIntegerProperty()
- var counter by counterProperty
- override val root = pane {
- button("Increment on background thread and main thread") {
- action {
- runAsync {
- counter++
- } success {
- counter++
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/NestedTableColumns.kt b/src/test/kotlin/tornadofx/testapps/NestedTableColumns.kt
deleted file mode 100644
index 9f34cc0..0000000
--- a/src/test/kotlin/tornadofx/testapps/NestedTableColumns.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package tornadofx.testapps
-
-import javafx.collections.FXCollections
-import tornadofx.*
-
-class NestedTableColumnsApp : App(NestedTableColumns::class)
-
-class NestedTableColumns : View("Nested Table Columns") {
- data class Person(val name: String, val primaryEmail: String, val secondaryEmail: String)
-
- val people = FXCollections.observableArrayList(
- Person("John Doe", "john@doe.com", "john.doe@gmail.com"),
- Person("Jane Doe", "jane@doe.com", "jane.doe@gmail.com")
- )
-
- override val root = tableview(people) {
- readonlyColumn("Name", Person::name)
- nestedColumn("Email addresses") {
- readonlyColumn("Primary Email", Person::primaryEmail)
- readonlyColumn("Secondary Email", Person::secondaryEmail)
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/NewViewTransition.kt b/src/test/kotlin/tornadofx/testapps/NewViewTransition.kt
deleted file mode 100644
index c399331..0000000
--- a/src/test/kotlin/tornadofx/testapps/NewViewTransition.kt
+++ /dev/null
@@ -1,243 +0,0 @@
-package tornadofx.testapps
-
-import javafx.animation.Animation
-import javafx.animation.Interpolator
-import javafx.beans.property.SimpleStringProperty
-import javafx.geometry.Pos
-import javafx.scene.Node
-import javafx.scene.layout.StackPane
-import javafx.scene.paint.*
-import javafx.scene.text.FontWeight
-import javafx.util.Duration
-import tornadofx.*
-
-/**
- * Run the demo as the root of the scene
- */
-class NewViewTransitionRoot : App(NewViewTransitionMain::class, NewViewTransitionStyles::class)
-
-/**
- * Run the demo in a VBox
- *
- * Notice the z-ordering is based on the index withing the VBox
- */
-class NewViewTransitionVBox : App(VBoxRootView::class, NewViewTransitionStyles::class) {
- class VBoxRootView : View("Switching Sub Views In VBox") {
- override val root = vbox {
- label("Top").addClass(NewViewTransitionStyles.darkLabel)
- add()
- label("Bottom").addClass(NewViewTransitionStyles.lightLabel)
- }
- }
-}
-
-/**
- * Run the demo in a BorderPane
- *
- * Notice the z-ordering is based on when the node was added to the scene graph
- */
-class NewViewTransitionBorderPane : App(BorderPaneRootView::class, NewViewTransitionStyles::class) {
- class BorderPaneRootView : View("Switching Sub Views In BorderPane") {
- override val root = borderpane {
- top = label("Top") { addClass(NewViewTransitionStyles.darkLabel) }
- right = label("Right") { addClass(NewViewTransitionStyles.greenLabel) }
- bottom = label("Bottom") { addClass(NewViewTransitionStyles.lightLabel) }
- left = label("Left") { addClass(NewViewTransitionStyles.greenLabel) }
- center()
- }
- }
-}
-
-abstract class NewViewTransitionSwapView(name: String, cssClass: CssRule) : View("Switching Views On Scene Root") {
- val controller: NewViewTransitionController by inject()
- val nextTransition = SimpleStringProperty(controller.firstTransition)
- val nameLabel = label(name)
- val surpriseLabel = label("Surprise!")
-
- override val root = stackpane {
- vbox {
- addClass(NewViewTransitionStyles.box, cssClass)
- this += nameLabel
- button {
- textProperty().bind(nextTransition)
- action { swap() }
- }
- }
- }
-
- init {
- val surprise = ViewTransition.Flip(.1.seconds, true)
- nameLabel.setOnMouseClicked { nameLabel.replaceWith(surpriseLabel, surprise) }
- surpriseLabel.setOnMouseClicked { surpriseLabel.replaceWith(nameLabel, surprise) }
- }
-
- abstract fun swap()
-}
-
-class NewViewTransitionMain : NewViewTransitionSwapView("Main", NewViewTransitionStyles.red) {
- val alt: NewViewTransitionAlternate by inject()
- override fun swap() {
- controller.swap(this, alt)
- }
-}
-
-class NewViewTransitionAlternate : NewViewTransitionSwapView("Alternate", NewViewTransitionStyles.blue) {
- val main: NewViewTransitionMain by inject()
- override fun swap() {
- controller.swap(this, main)
- }
-}
-
-class NewViewTransitionController : Controller() {
- private val time = .25.seconds
- private val doubleTime = time.multiply(2.0)
- private val fades = listOf(
- "Black" to Color.BLACK,
- "White" to Color.WHITE,
- "Orange" to Color.ORANGE,
- "Fade" to LinearGradient(0.0, 0.0, 0.0, 1.0, true, CycleMethod.NO_CYCLE, Stop(0.0, Color.BLACK), Stop(1.0, Color.WHITE)),
- "Crazy" to RadialGradient(0.0, 0.0, 150.0, 100.0, 75.0, false, CycleMethod.REPEAT,
- Stop(0.0, NewViewTransitionStyles.nukeRed), Stop(0.33, NewViewTransitionStyles.nukeRed),
- Stop(0.33, NewViewTransitionStyles.nukeGreen), Stop(0.66, NewViewTransitionStyles.nukeGreen),
- Stop(0.66, NewViewTransitionStyles.nukeBlue), Stop(1.0, NewViewTransitionStyles.nukeBlue)
- )
- )
-
- private inline infix fun String.eachWay(constructor: (ViewTransition.Direction) -> ViewTransition): Array> {
- return ViewTransition.Direction.values().map { "$this $it" to constructor(it) }.toTypedArray()
- }
-
- private val transitions = listOf(
- "None" to null,
- "Fade" to ViewTransition.Fade(time),
- *fades.map { "${it.first} Fade" to ViewTransition.FadeThrough(doubleTime, it.second) }.toTypedArray(),
- *"Slide" eachWay { ViewTransition.Slide(time, it) },
- *"Cover" eachWay { ViewTransition.Cover(time, it) },
- *"Reveal" eachWay { ViewTransition.Reveal(time, it) },
- *"Metro" eachWay { ViewTransition.Metro(time, it) },
- *"Swap" eachWay { ViewTransition.Swap(doubleTime, it) },
- *"Wipe" eachWay { ViewTransition.Wipe(time, it) },
- *"Custom" eachWay { CustomViewTransition(doubleTime, it) },
- "Flip Horizontal" to ViewTransition.Flip(time, false),
- "Flip Vertical" to ViewTransition.Flip(time, true),
- "Explode" to ViewTransition.Explode(time),
- "Implode" to ViewTransition.Implode(time),
- "NewsFlash" to ViewTransition.NewsFlash(doubleTime, 2.0),
- "Dissolve" to ViewTransition.Dissolve(doubleTime)
- )
- val firstTransition = transitions[0].first
- private var currentTransition = 0
- fun swap(current: NewViewTransitionSwapView, replacement: NewViewTransitionSwapView) {
- val t = transitions[currentTransition].second
- currentTransition = (currentTransition + 1) % transitions.size
- replacement.nextTransition.value = transitions[currentTransition].first
- current.replaceWith(replacement, t)
- }
-}
-
-class NewViewTransitionStyles : Stylesheet() {
- companion object {
- val box by cssclass()
- val red by cssclass()
- val blue by cssclass()
- val bg by cssproperty("-fx-background-color")
- val nuke by cssproperty()
- val darkLabel by cssclass()
- val lightLabel by cssclass()
- val greenLabel by cssclass()
-
- val nukeRed = c(0.75, 0.5, 0.5)
- val nukeGreen = c(0.5, 0.75, 0.5)
- val nukeBlue = c(0.5, 0.5, 0.75)
-
- val boxMix = mixin {
- bg force nuke
- button {
- bg force raw("derive(${nuke.name}, -10%)")
- and(hover) {
- bg force raw("derive(${nuke.name}, -15%)")
- }
- }
- }
-
- val labelMix = mixin {
- maxWidth = infinity
- maxHeight = infinity
- alignment = Pos.BASELINE_CENTER
- padding = box(12.px)
- fontSize = 24.px
- }
- }
-
- init {
- box {
- prefWidth = 400.px
- prefHeight = 300.px
- spacing = 12.px
- alignment = Pos.CENTER
- s(label, button) {
- textFill = Color.WHITE
- fontSize = 36.px
- fontWeight = FontWeight.BOLD
- alignment = Pos.BASELINE_CENTER
- }
- and(red) {
- nuke.value = nukeRed
- +boxMix
- }
- and(blue) {
- nuke.value = nukeBlue
- +boxMix
- }
- }
- darkLabel {
- +labelMix
- backgroundColor += Color.BLACK
- textFill = Color.WHITE
- }
- lightLabel {
- +labelMix
- backgroundColor += Color.WHITE
- textFill = Color.BLACK
- }
- greenLabel {
- +labelMix
- backgroundColor += nukeGreen
- textFill = Color.WHITE
- }
- }
-}
-
-class CustomViewTransition(val duration: Duration, val direction: Direction = ViewTransition.Direction.LEFT) : ViewTransition.ReversibleViewTransition() {
- val halfSpeed = duration.divide(2.0)!!
- val scale = when (direction) {
- Direction.UP, Direction.DOWN -> point(1, 0)
- Direction.LEFT, Direction.RIGHT -> point(0, 1)
- }
-
- override fun create(current: Node, replacement: Node, stack: StackPane): Animation {
- val bounds = current.boundsInLocal
- val destination = when (direction) {
- Direction.UP -> point(0, -bounds.height / 2)
- Direction.RIGHT -> point(bounds.width / 2, 0)
- Direction.DOWN -> point(0, bounds.height / 2)
- Direction.LEFT -> point(-bounds.width / 2, 0)
- }
- return replacement.transform(
- halfSpeed, destination.multiply(-1.0), 0.0, scale, 1.0,
- easing = Interpolator.LINEAR, reversed = true, play = false
- ) and current.transform(
- halfSpeed, destination, 0.0, scale, 1.0,
- easing = Interpolator.LINEAR, play = false
- )
- }
-
- override fun reversed() = CustomViewTransition(duration, direction.reversed())
-
- override fun onComplete(removed: Node, replacement: Node) {
- removed.translateX = 0.0
- removed.translateY = 0.0
- removed.scaleX = 1.0
- removed.scaleY = 1.0
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/PaddingPropertyTest.kt b/src/test/kotlin/tornadofx/testapps/PaddingPropertyTest.kt
deleted file mode 100644
index 52a3d77..0000000
--- a/src/test/kotlin/tornadofx/testapps/PaddingPropertyTest.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.paint.Color
-import tornadofx.*
-
-class PaddingPropertyTestApp : App(PaddingPropertyTest::class)
-
-class PaddingPropertyTest : View("Slide Padding") {
- override val root = vbox {
- setPrefSize(400.0, 150.0)
- style { backgroundColor += Color.CADETBLUE }
- slider(0.0, 100.0, 20.0) {
- this@vbox.paddingAllProperty.bind(valueProperty())
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/PaintBackgroundTest.kt b/src/test/kotlin/tornadofx/testapps/PaintBackgroundTest.kt
deleted file mode 100644
index 2775aa3..0000000
--- a/src/test/kotlin/tornadofx/testapps/PaintBackgroundTest.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.paint.Color
-import tornadofx.*
-
-class PaintBackgroundTestApp : App(PaintBackgroundTest::class)
-
-class PaintBackgroundTest : View() {
- override val root = hbox {
- label("Hello Background Color") {
- background = Color.LIGHTBLUE.asBackground()
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ParamTest.kt b/src/test/kotlin/tornadofx/testapps/ParamTest.kt
deleted file mode 100644
index 5261f77..0000000
--- a/src/test/kotlin/tornadofx/testapps/ParamTest.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-import java.time.LocalDateTime
-
-class ParamTestApp : App(ParamCallerView::class)
-
-class ParamCallerView : View() {
- override val root = vbox {
- button("Open modal with paramMap"){
- action {
- find(mapOf("name" to "Param ${LocalDateTime.now()}")).openModal()
- }
- }
- button("Open modal with paramVararg"){
- action {
- find("name" to "Param ${LocalDateTime.now()}").openModal()
- }
- }
- }
-}
-
-class ParamReceiverView : View() {
- val name: String by param()
-
- override val root = vbox()
-
- override fun onDock() {
- with(root) {
- label(name)
- }
- currentStage?.sizeToScene()
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/PojoTableColumns.kt b/src/test/kotlin/tornadofx/testapps/PojoTableColumns.kt
deleted file mode 100644
index 13073ba..0000000
--- a/src/test/kotlin/tornadofx/testapps/PojoTableColumns.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package tornadofx.testapps
-
-import javafx.collections.FXCollections
-import tornadofx.*
-import tornadofx.tests.JavaPerson
-
-class PojoTableColumnsApp : App(PojoTableColumns::class)
-
-class PojoTableColumns : View("Pojo Table Columns") {
- val people = FXCollections.observableArrayList(
- JavaPerson().apply { name = "John Doe"; primaryEmail = "john@doe.com"; secondaryEmail = "john.doe@gmail.com"},
- JavaPerson().apply { name = "Jane Doe"; primaryEmail = "jane@doe.com"; secondaryEmail = "jane.doe@gmail.com"}
- )
-
- override val root = tableview(people) {
- column("Name", JavaPerson::getName )
- nestedColumn("Email addresses") {
- column("Primary Email", JavaPerson::getPrimaryEmail )
- column("Secondary Email", JavaPerson::getSecondaryEmail )
- }
- resizeColumnsToFitContent()
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/PojoTreeTableColumns.kt b/src/test/kotlin/tornadofx/testapps/PojoTreeTableColumns.kt
deleted file mode 100644
index 8f78084..0000000
--- a/src/test/kotlin/tornadofx/testapps/PojoTreeTableColumns.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.control.TreeItem
-import tornadofx.*
-import tornadofx.tests.JavaPerson
-
-class PojoTreeTableColumnsApp : App(PojoTreeTableColumns::class)
-
-class PojoTreeTableColumns : View("Pojo Tree Table Columns") {
-
- val people = observableListOf(
- JavaPerson("Mary Hanes", "IT Administration", "mary.hanes@contoso.com", "mary2.hanes@contoso.com", listOf(
- JavaPerson("Jacob Mays", "IT Help Desk", "jacob.mays@contoso.com", "jacob2.mays@contoso.com"),
- JavaPerson("John Ramsy", "IT Help Desk", "john.ramsy@contoso.com", "john2.ramsy@contoso.com"))),
- JavaPerson("Erin James", "Human Resources", "erin.james@contoso.com", "erin2.james@contoso.com", listOf(
- JavaPerson("Erlick Foyes", "Customer Service", "erlick.foyes@contoso.com", "erlick2.foyes@contoso.com"),
- JavaPerson("Steve Folley", "Customer Service", "steve.folley@contoso.com", "erlick2.foyes@contoso.com"),
- JavaPerson("Larry Cable", "Customer Service", "larry.cable@contoso.com", "larry2.cable@contoso.com")))
- )
-
- // Create the root item that holds all top level employees
- val rootItem = TreeItem(JavaPerson().apply { name = "Employees by Manager"; employees = people })
-
- override val root = treetableview(rootItem) {
- prefWidth = 800.0
-
- column("Name", "name").contentWidth(50) // non type safe
- column("Department", JavaPerson::getDepartment).remainingWidth()
- nestedColumn("Email addresses") {
- column("Primary Email", JavaPerson::getPrimaryEmail)
- column("Secondary Email", JavaPerson::getSecondaryEmail)
- }
-
- // Always return employees under the current person
- populate { it.value.employees }
-
- // Expand the two first levels
- root.isExpanded = true
- root.children.withEach { isExpanded = true }
- smartResize()
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ReloadStylesInModal.kt b/src/test/kotlin/tornadofx/testapps/ReloadStylesInModal.kt
deleted file mode 100644
index 347ba3a..0000000
--- a/src/test/kotlin/tornadofx/testapps/ReloadStylesInModal.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-
-class ReloadStylesInModal : App(MainView::class, Styles::class) {
- class MainView : View() {
- override val root = hbox {
- button("Open").action {
- find().openModal()
- }
- }
- }
-
- class MyModal : Fragment() {
- override val root = vbox {
- label("My label")
- button("Close").action {
- close()
- }
- }
- }
-
- class Styles : Stylesheet(Base::class)
-
- class Base : Stylesheet() {
- init {
- button {
- fontSize = 30.px
- }
- label {
- fontSize = 30.px
- }
- }
- }
-}
-
diff --git a/src/test/kotlin/tornadofx/testapps/RemoveTest.kt b/src/test/kotlin/tornadofx/testapps/RemoveTest.kt
deleted file mode 100644
index 5a402fc..0000000
--- a/src/test/kotlin/tornadofx/testapps/RemoveTest.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleBooleanProperty
-import javafx.scene.paint.Color
-import javafx.scene.text.FontWeight
-import tornadofx.*
-
-class RemoveTestApp : App(RemoveTest::class)
-
-class RemoveTest : View("Remove Test") {
- val remove = SimpleBooleanProperty(false)
-
- override val root = vbox {
- setPrefSize(400.0, 200.0)
- form {
- label("I'm above the removable element (which might be removed of course)")
- label("Remove me!") {
- removeWhen { remove }
- style {
- fontWeight = FontWeight.BOLD
- textFill = Color.RED
- }
- }
- label("I'm below the removable element (which might be removed of course)")
- fieldset {
- field("Remove") {
- combobox(remove, values = listOf(true, false))
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/ShortLongPressTest.kt b/src/test/kotlin/tornadofx/testapps/ShortLongPressTest.kt
deleted file mode 100644
index e637974..0000000
--- a/src/test/kotlin/tornadofx/testapps/ShortLongPressTest.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package tornadofx.testapps
-
-import javafx.collections.FXCollections
-import tornadofx.*
-import java.time.LocalDateTime
-
-class ShortLongPressTestApp : App(ShortLongPressTest::class)
-
-class ShortLongPressTest : View("Short or long press") {
- val actuations = FXCollections.observableArrayList()
-
- override val root = borderpane {
- top {
- stackpane {
- paddingAll = 20
- button("Short or longpress me") {
- longpress { actuations.add("Long at ${LocalDateTime.now()}") }
- shortpress { actuations.add("Short at ${LocalDateTime.now()}") }
- }
- }
- }
- center {
- listview(actuations)
- }
- bottom {
- label("Hold for 700ms to actuate long action, or less to actuate short action") {
- paddingAll = 20
- }
- }
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/SlideshowTest.kt b/src/test/kotlin/tornadofx/testapps/SlideshowTest.kt
deleted file mode 100644
index cf3baa4..0000000
--- a/src/test/kotlin/tornadofx/testapps/SlideshowTest.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-
-class SlideshowTestApp : App(SlideshowTest::class, NewViewTransitionStyles::class)
-
-class SlideshowTest : View("Slideshow") {
- override val root = slideshow {
- slide()
- slide(ViewTransition.Fade(0.3.seconds))
- slide()
- }
-}
-
-class Slide1 : View("Slide 1") {
- override val root = stackpane {
- label(titleProperty)
- addClass(NewViewTransitionStyles.box, NewViewTransitionStyles.blue)
- }
-}
-
-class Slide2 : View("Slide 2") {
- override val root = stackpane {
- label(titleProperty)
- addClass(NewViewTransitionStyles.box, NewViewTransitionStyles.red)
- }
-}
-
-class Slide3 : View("Slide 3") {
- override val root = stackpane {
- label(titleProperty)
- addClass(NewViewTransitionStyles.box, NewViewTransitionStyles.blue)
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/SqueezeBoxTest.kt b/src/test/kotlin/tornadofx/testapps/SqueezeBoxTest.kt
deleted file mode 100644
index c9e7c93..0000000
--- a/src/test/kotlin/tornadofx/testapps/SqueezeBoxTest.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package tornadofx.testapps
-
-import javafx.geometry.Pos
-import javafx.scene.input.KeyCombination
-import tornadofx.*
-
-class SqueezeBoxTestApp : App(SqueezeBoxTestView::class)
-
-object AddFoldEvent : FXEvent()
-
-class SqueezeBoxTestView : View("SqueezeBox Multiple Open Folds") {
- override val root = vbox(5.0) {
- setPrefSize(300.0, 600.0)
-
- button("Add node") {
- action {
- fire(AddFoldEvent)
- }
- shortcut(KeyCombination.valueOf("Ctrl+A"))
- }
-
- scrollpane(fitToWidth = true) {
- squeezebox {
- fold("Pane 1", expanded = true, closeable = true) {
- stackpane {
- vbox {
- alignment = Pos.CENTER
- label("I'm inside 1")
- label("Me too!")
- }
- }
- }
- fold("Pane 2", expanded = true, closeable = true) {
- label("I'm inside 2")
- }
- fold("Pane 3", closeable = true) {
- label("I'm inside 3")
- }
- fold("Pane 4", expanded = true, closeable = true) {
- label("I'm inside 4")
- }
- fold("Pane 5", closeable = true) {
- label("I'm inside 5")
- }
- subscribe {
- fold("Another fold by subscription", closeable = true) {
- stackpane {
- label("Yo!")
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/StylesheetErrorTest.kt b/src/test/kotlin/tornadofx/testapps/StylesheetErrorTest.kt
deleted file mode 100644
index 1939abd..0000000
--- a/src/test/kotlin/tornadofx/testapps/StylesheetErrorTest.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.App
-import tornadofx.Stylesheet
-import tornadofx.View
-import tornadofx.addClass
-import tornadofx.button
-import tornadofx.stackpane
-
-class StylesheetErrorTest : App(StylesheetErrorView::class, Styles::class)
-
-class StylesheetErrorView : View() {
- override val root = stackpane {
- button("Click here").addClass("my-button")
- }
-}
-
-class Styles : Stylesheet() {
- init {
- text {
- // cannot refer to unset property
- stroke = baseColor
- }
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/SwitchViewApp.kt b/src/test/kotlin/tornadofx/testapps/SwitchViewApp.kt
deleted file mode 100644
index 72dd9b4..0000000
--- a/src/test/kotlin/tornadofx/testapps/SwitchViewApp.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.control.Alert.AlertType.ERROR
-import tornadofx.*
-
-class GotoViewApp : App(GotoContainerView::class)
-
-class GotoContainerView : View("ContainerView") {
- val gotoSubView1: GotoSubView1 by inject()
- val gotoSubView2: GotoSubView2 by inject()
-
- override val root = borderpane {
- top {
- button("Goto view").action {
- if (center.lookup("#view1") != null)
- gotoSubView1.goto(gotoSubView2)
- else
- gotoSubView2.goto(gotoSubView1)
- }
- }
- center {
- add(gotoSubView1)
- }
- }
-}
-
-class GotoSubView1 : View("GotoSubView2") {
- override val root = hbox {
- id = "view1"
- label("I'm subview 1")
- }
-
- override fun onGoto(source: UIComponent) {
- when (source) {
- is GotoSubView2 -> if (source.isDocked) source.replaceWith(this) else openModal()
- is GotoSubView1 -> source.replaceWith(this)
- else -> alert(ERROR, "I refuse!", "Not going to happen")
- }
- }
-}
-
-class GotoSubView2 : View("GotoSubView2") {
- override val root = hbox {
- label("I'm subview 2")
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/TabPaneTest.kt b/src/test/kotlin/tornadofx/testapps/TabPaneTest.kt
deleted file mode 100644
index 64534ad..0000000
--- a/src/test/kotlin/tornadofx/testapps/TabPaneTest.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleBooleanProperty
-import tornadofx.*
-
-class TabPaneTestApp : App(TabPaneTest::class)
-
-class TabPaneTest : View("TabPane Test") {
- override val root = tabpane {
- tab()
- tab()
- // This is not the typical use case for using index, but instead when tab is added programmatically,
- // ex.: duplicate the current tab
- tab(1, "Tab Three", TabThree().root)
- // Here we verify that the original implementation works correctly, i.e. adds the tab to the end of the list
- tab("Tab Four", TabFour().root)
- }
-}
-
-/**
- * Check that the tab title updates when the input changes.
- * The Tab should not be closeable as it binds to the closeable property.
- */
-class TabOne : View("Tab One") {
- override val root = textfield(titleProperty)
- override val closeable = SimpleBooleanProperty(false)
-}
-
-class TabTwo : View("Tab Two") {
- override val root = textfield(titleProperty)
- override val closeable = SimpleBooleanProperty(false)
-}
-
-class TabThree : View("Tab Three") {
- override val root = textfield(titleProperty)
- override val closeable = SimpleBooleanProperty(false)
-}
-
-class TabFour : View("Tab Four") {
- override val root = textfield(titleProperty)
- override val closeable = SimpleBooleanProperty(false)
-}
diff --git a/src/test/kotlin/tornadofx/testapps/TableViewCellCacheTest.kt b/src/test/kotlin/tornadofx/testapps/TableViewCellCacheTest.kt
deleted file mode 100644
index 0dd34a7..0000000
--- a/src/test/kotlin/tornadofx/testapps/TableViewCellCacheTest.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-
-class TableViewCellCacheTestApp : App(TableViewCellCacheTest::class)
-
-class TableViewCellCacheTest : View("TableView CellCache Test") {
- val kittens = DataGridTestApp.images["kittens"] as List
-
- override val root = tableview(kittens.asObservable()) {
- prefWidth = 300.0
-
- column("Filename", String::class) {
- value { it.value.substringAfterLast("/") }
- }
- column("Image", String::class) {
- value { it.value }
- cellCache { imageview(it, true) }
- cellFormat {
- prefHeight = 160.0
- prefWidth = 160.0
- }
- }
- }
-}
-
diff --git a/src/test/kotlin/tornadofx/testapps/TableViewDNDTest.kt b/src/test/kotlin/tornadofx/testapps/TableViewDNDTest.kt
deleted file mode 100644
index 668c2b7..0000000
--- a/src/test/kotlin/tornadofx/testapps/TableViewDNDTest.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.control.TableRow
-import javafx.scene.input.ClipboardContent
-import javafx.scene.input.TransferMode
-import javafx.scene.paint.Color
-import javafx.scene.text.FontWeight
-import tornadofx.*
-import tornadofx.tests.Person
-import tornadofx.tests.PersonRef
-
-class DNDReorderTableViewApp : App(DNDReorderTableView::class)
-
-class DNDReorderTableView : View() {
- val people = observableListOf(Person("Bob", 42), Person("Jane", 24), Person("John", 31))
-
- override val root = tableview(people) {
- column("Name", Person::nameProperty)
- column("Age", Person::ageProperty)
-
- setOnDragDetected { event ->
- val person = if (!selectionModel.isEmpty) selectedItem else null
- if (person != null) {
- val dragboard = startDragAndDrop(TransferMode.MOVE)
- dragboard.setContent(ClipboardContent().apply { put(Person.DATA_FORMAT, PersonRef(person.id)) })
- }
- event.consume()
- }
-
- // Handle DND per row
- setRowFactory {
- object : TableRow() {
- init {
- setOnDragOver {
- if (it.dragboard.hasContent(Person.DATA_FORMAT)) {
- it.acceptTransferModes(TransferMode.MOVE)
- it.consume()
- }
- }
- setOnDragEntered {
- if (it.dragboard.hasContent(Person.DATA_FORMAT)) {
- val ref = it.dragboard.getContent(Person.DATA_FORMAT) as PersonRef
- style {
- if (ref.id != item.id) {
- fontWeight = FontWeight.BOLD
- } else {
- textFill = Color.RED
- }
- }
- it.consume()
- }
- }
- setOnDragExited {
- style = null
- it.consume()
- }
- setOnDragDropped {
- if (it.dragboard.hasContent(Person.DATA_FORMAT)) {
- val draggedRef = it.dragboard.getContent(Person.DATA_FORMAT) as PersonRef
- val droppedPerson = item
- val targetIndex = items.indexOf(droppedPerson)
- val sourcePerson = items.find { it.id == draggedRef.id }
- items.move(sourcePerson, targetIndex)
- it.isDropCompleted = true
- } else {
- it.isDropCompleted = false
- }
- it.consume()
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/TableViewDirtyTest.kt b/src/test/kotlin/tornadofx/testapps/TableViewDirtyTest.kt
deleted file mode 100644
index 5dc27bb..0000000
--- a/src/test/kotlin/tornadofx/testapps/TableViewDirtyTest.kt
+++ /dev/null
@@ -1,106 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleObjectProperty
-import javafx.beans.property.SimpleStringProperty
-import javafx.collections.FXCollections
-import javafx.scene.control.SelectionMode
-import javafx.scene.control.TableView
-import javafx.scene.control.TableView.CONSTRAINED_RESIZE_POLICY
-import javafx.scene.text.FontWeight
-import tornadofx.*
-import java.util.*
-
-class TableViewDirtyTestApp : WorkspaceApp(TableViewDirtyTest::class)
-
-class TableViewDirtyTest : View("Dirty Tables") {
- val customers = FXCollections.observableArrayList(Customer("Thomas", "Nield"), Customer("Matthew", "Turnblom"), Customer("Edvin", "Syse"))
- var table: TableView by singleAssign()
-
- override val root = borderpane {
- center {
- tableview(customers) {
- table = this
- prefHeight = 200.0
-
- column("First Name", Customer::firstNameProperty) {
- makeEditable()
- cellDecorator {
- style {
- fontWeight = FontWeight.BOLD
- }
- }
- }
- column("Last Name", Customer::lastNameProperty).makeEditable()
- enableCellEditing()
- regainFocusAfterEdit()
- enableDirtyTracking()
- selectOnDrag()
- contextmenu {
- item(stringBinding(selectionModel.selectedCells) { "Rollback ${selectedColumn?.text}" }) {
- disableWhen { editModel.selectedItemDirty.not() }
- action { editModel.rollback(selectedItem, selectedColumn) }
- }
- item(stringBinding(selectionModel.selectedCells) { "Commit ${selectedColumn?.text}" }) {
- disableWhen { editModel.selectedItemDirty.not() }
- action { editModel.commit(selectedItem, selectedColumn) }
- }
- }
- selectionModel.selectionMode = SelectionMode.MULTIPLE
- columnResizePolicy = CONSTRAINED_RESIZE_POLICY
- }
- }
- bottom {
- hbox(10) {
- paddingAll = 4
- button("Commit row") {
- disableWhen { table.editModel.selectedItemDirty.not() }
- action { table.editModel.commitSelected() }
- }
- button("Rollback row") {
- disableWhen { table.editModel.selectedItemDirty.not() }
- action { table.editModel.rollbackSelected() }
- }
- }
- }
- }
-
- override fun onSave() {
- table.editModel.commit()
- }
-
- override fun onRefresh() {
- table.editModel.rollback()
- }
-
- init {
- icon = FX.icon
- }
-
- class Customer(firstName: String, lastName: String) {
- val idProperty = SimpleObjectProperty(UUID.randomUUID())
- var id by idProperty
-
- val firstNameProperty = SimpleStringProperty(firstName)
- var firstName by firstNameProperty
-
- val lastNameProperty = SimpleStringProperty(lastName)
- val lastName by lastNameProperty
-
- override fun toString() = "$firstName $lastName"
-
- override fun equals(other: Any?): Boolean {
- if (this === other) return true
- if (other?.javaClass != javaClass) return false
-
- other as Customer
-
- if (id != other.id) return false
-
- return true
- }
-
- override fun hashCode(): Int {
- return id.hashCode()
- }
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/TableViewSelectionTest.kt b/src/test/kotlin/tornadofx/testapps/TableViewSelectionTest.kt
deleted file mode 100644
index 4889366..0000000
--- a/src/test/kotlin/tornadofx/testapps/TableViewSelectionTest.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package tornadofx.testapps
-
-import javafx.scene.control.TabPane
-import javafx.scene.control.TreeItem
-import tornadofx.*
-import tornadofx.tests.JavaPerson
-
-class TableViewSelectionTestApp : App(TableViewSelectionTest::class)
-
-class TableViewSelectionTest : View("Table Selection Test") {
- val people = observableListOf(
- JavaPerson("Mary Hanes", "IT Administration", "mary.hanes@contoso.com", "mary2.hanes@contoso.com"),
- JavaPerson("Erin James", "Human Resources", "erin.james@contoso.com", "erin2.james@contoso.com")
- )
-
- override val root = tabpane {
- prefWidth = 800.0
- tabClosingPolicy = TabPane.TabClosingPolicy.UNAVAILABLE
-
- tab("Table") {
- tableview(people) {
- column("Name", JavaPerson::getName).contentWidth(50.0)
- column("Department", JavaPerson::getDepartment).remainingWidth()
- nestedColumn("Email addresses") {
- column("Primary Email", JavaPerson::getPrimaryEmail)
- column("Secondary Email", JavaPerson::getSecondaryEmail)
- }
-
- selectionModel.isCellSelectionEnabled = true
- smartResize()
-
- contextmenu {
- item("Print selected").action { println(selectedValue.toString()) }
- item("Print selected position").action { println("(${selectedCell!!.column}, ${selectedCell!!.row})") }
- item("Print selected column").action { println(selectedColumn!!.text) }
- separator()
- item("Print employee's name").action { println(selectedItem!!.name) }
- item("Print employee's department").action { println(selectedItem!!.department) }
- item("Print employee's primary email").action { println(selectedItem!!.primaryEmail) }
- item("Print employee's secondary email").action { println(selectedItem!!.secondaryEmail) }
- }
- }
- }
-
- tab("Tree Table") {
- val rootItem = TreeItem(JavaPerson().apply { name = "Employees"; employees = people })
-
- treetableview(rootItem) {
- column("Name", JavaPerson::getName).contentWidth(50.0)
- column("Department", JavaPerson::getDepartment).remainingWidth()
- nestedColumn("Email addresses") {
- column("Primary Email", JavaPerson::getPrimaryEmail)
- column("Secondary Email", JavaPerson::getSecondaryEmail)
- }
-
- populate { it.value.employees }
-
- selectionModel.isCellSelectionEnabled = true
- root.isExpanded = true
- root.children.withEach { isExpanded = true }
- smartResize()
-
- contextmenu {
- item("Print selected").action { println(selectedValue.toString()) }
- item("Print selected position").action { println("(${selectedCell!!.column}, ${selectedCell!!.row})") }
- item("Print selected column").action { println(selectedColumn!!.text) }
- separator()
- item("Print employee's name").action { println(selectedItem!!.name) }
- item("Print employee's department").action { println(selectedItem!!.department) }
- item("Print employee's primary email").action { println(selectedItem!!.primaryEmail) }
- item("Print employee's secondary email").action { println(selectedItem!!.secondaryEmail) }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/TableViewSortFilterTest.kt b/src/test/kotlin/tornadofx/testapps/TableViewSortFilterTest.kt
deleted file mode 100644
index e2388d9..0000000
--- a/src/test/kotlin/tornadofx/testapps/TableViewSortFilterTest.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package tornadofx.testapps
-
-import tornadofx.*
-import java.time.LocalDate
-
-
-class TableViewSortFilterTestApp : App(TableViewSortFilterTest::class)
-
-class TableViewSortFilterTest : View("Table Sort and Filter") {
- data class Person(val id: Int, var name: String, var birthday: LocalDate) {
- val age: Int
- get() = birthday.until(LocalDate.now()).years
- }
-
- private val persons = listOf(
- Person(1, "Samantha Stuart", LocalDate.of(1981, 12, 4)),
- Person(2, "Tom Marks", LocalDate.of(2001, 1, 23)),
- Person(3, "Stuart Gills", LocalDate.of(1989, 5, 23)),
- Person(3, "Nicole Williams", LocalDate.of(1998, 8, 11))
- )
-
- val data = SortedFilteredList()
-
- override val root = vbox {
- textfield {
- data.filterWhen(textProperty(), { query, item -> item.name.contains(query, true) })
- }
-
- tableview(data) {
- readonlyColumn("ID", Person::id)
- column("Name", Person::name)
- nestedColumn("DOB") {
- readonlyColumn("Birthday", Person::birthday)
- readonlyColumn("Age", Person::age).contentWidth()
- }
- smartResize()
- }
-
- hbox(5) {
- label("Filter count:")
- label(data.sizeProperty.stringBinding { "$it records matching filter"})
- }
- }
-
- init {
- // Simulate data access
- data.asyncItems { persons }
- }
-}
diff --git a/src/test/kotlin/tornadofx/testapps/TaskStatusTest.kt b/src/test/kotlin/tornadofx/testapps/TaskStatusTest.kt
deleted file mode 100644
index 5cc70f9..0000000
--- a/src/test/kotlin/tornadofx/testapps/TaskStatusTest.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleStringProperty
-import tornadofx.*
-
-class TaskStatusTest : View("Task Status Test") {
- val status = TaskStatus()
- val output = SimpleStringProperty("")
-
- override val root = borderpane {
- top {
- toolbar {
- button("Run Async").action {
- output.value += "\n"
- runAsync(status) {
- Thread.sleep(1000)
- "hello"
- } ui {
- output.value += "$it\n"
- }
- }
- button("Run Await").action {
- output.value += "\n"
- runAsync(status) {
- Thread.sleep(1000)
- "hello 2"
- } ui {
- output.value += "$it\n"
- }
- status.completed.awaitUntil()
- output.value += "Await exited\n"
- }
- enableWhen { status.running.not() }
- }
- }
- center {
- textarea(output)
- }
- bottom {
- label("Running...") {
- visibleWhen { status.running }
- }
- }
- }
-
- override fun onDock() {
- status.completed.onChange {
- output.value += "completed $it\n"
- }
- status.running.onChange {
- output.value += "running $it\n"
- }
- }
-}
-
-class TaskStatusApp : App(TaskStatusTest::class)
diff --git a/src/test/kotlin/tornadofx/testapps/TodoTestApp.kt b/src/test/kotlin/tornadofx/testapps/TodoTestApp.kt
deleted file mode 100644
index ba3529a..0000000
--- a/src/test/kotlin/tornadofx/testapps/TodoTestApp.kt
+++ /dev/null
@@ -1,83 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleBooleanProperty
-import javafx.beans.property.SimpleObjectProperty
-import javafx.beans.property.SimpleStringProperty
-import javafx.collections.FXCollections
-import javafx.geometry.Pos
-import javafx.scene.control.CheckBox
-import javafx.scene.control.RadioButton
-import javafx.scene.control.TableColumn
-import javafx.scene.control.ToggleGroup
-import tornadofx.*
-
-class TodoItem(text: String? = null, completed: Boolean = true) {
- val textProperty = SimpleStringProperty(text)
- var text by textProperty
-
- val completedProperty = SimpleBooleanProperty(completed)
- var completed by completedProperty
-
- override fun toString() = "[${if (completed) "X" else " "}] $text"
-}
-
-enum class TodoFilter { All, Completed, Active }
-
-class TodoList : View("Todo List") {
- val todos = SortedFilteredList(FXCollections.observableArrayList(TodoItem("Item 1"), TodoItem("Item 2"), TodoItem("Item 3", false), TodoItem("Item 4"), TodoItem("Item 5")))
- val todoFilter = SimpleObjectProperty(TodoFilter.All)
-
- override val root = borderpane {
- center {
- tableview(todos) {
- setPrefSize(300.0, 200.0)
- column("Completed", TodoItem::completedProperty) {
- sortType = TableColumn.SortType.DESCENDING
- sortOrder.add(this)
- cellFormat {
- graphic = cache {
- alignment = Pos.CENTER
- checkbox {
- selectedProperty().bindBidirectional(itemProperty())
-
- action {
- tableView.edit(index, tableColumn)
- commitEdit(!isSelected)
- sort()
- }
- }
- }
- }
- }
- column("Text", TodoItem::textProperty).makeEditable()
-
- }
- }
- bottom {
- hbox {
- togglegroup {
- TodoFilter.values().forEach {
- radiobutton(value = it)
- }
- bind(todoFilter)
- }
- }
- todoFilter.onChange {
- todos.refilter()
- }
- }
- }
-
- init {
- todos.predicate = {
- when (todoFilter.value) {
- TodoFilter.All -> true
- TodoFilter.Completed -> it.completed
- TodoFilter.Active -> !it.completed
- }
- }
- }
-}
-
-class TodoTestApp : WorkspaceApp(TodoList::class)
-
diff --git a/src/test/kotlin/tornadofx/testapps/ToggleButtonTestApp.kt b/src/test/kotlin/tornadofx/testapps/ToggleButtonTestApp.kt
deleted file mode 100644
index b5930b1..0000000
--- a/src/test/kotlin/tornadofx/testapps/ToggleButtonTestApp.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleStringProperty
-import javafx.geometry.Insets
-import tornadofx.*
-
-/**
- * Test case for #785
- *
- * Functions to bind both String and ObservableValue
- *
- * @author carl
- */
-
-class ToggleButtonTestView : View("Toggle Button Test") {
- override val root = vbox {
- togglebutton("String")
- togglebutton(SimpleStringProperty("Observable"))
- padding = Insets(10.0)
- spacing = 4.0
- }
-}
-
-class ToggleButtonTestApp : App(ToggleButtonTestView::class)
diff --git a/src/test/kotlin/tornadofx/testapps/TransitionsTest.kt b/src/test/kotlin/tornadofx/testapps/TransitionsTest.kt
deleted file mode 100644
index 19c2a38..0000000
--- a/src/test/kotlin/tornadofx/testapps/TransitionsTest.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package tornadofx.testapps
-
-import javafx.animation.Interpolator
-import javafx.scene.paint.Color
-import javafx.scene.shape.Rectangle
-import tornadofx.*
-
-class TransitionsTestApp : App(TransitionsTestView::class)
-
-class TransitionsTestView : View() {
- val r1 = Rectangle(20.0, 20.0, Color.RED)
- val r2 = Rectangle(20.0, 20.0, Color.YELLOW)
- val r3 = Rectangle(20.0, 20.0, Color.GREEN)
- val r4 = Rectangle(20.0, 20.0, Color.BLUE)
-
- override val root = vbox {
- button("Animate").action {
- sequentialTransition {
- timeline {
- keyframe(0.5.seconds) {
- keyvalue(r1.translateXProperty(), 50.0, interpolator = Interpolator.EASE_BOTH)
- }
- }
- timeline {
- keyframe(0.5.seconds) {
- keyvalue(r2.translateXProperty(), 100.0, interpolator = Interpolator.EASE_BOTH)
- }
- }
- timeline {
- keyframe(0.5.seconds) {
- keyvalue(r3.translateXProperty(), 150.0, interpolator = Interpolator.EASE_BOTH)
- }
- }
- timeline {
- keyframe(0.5.seconds) {
- keyvalue(r4.translateXProperty(), 200.0, interpolator = Interpolator.EASE_BOTH)
- }
- }
- }
- }
- pane {
- add(r1)
- add(r2)
- add(r3)
- add(r4)
- }
- }
-}
-
diff --git a/src/test/kotlin/tornadofx/testapps/ViewDockingApp.kt b/src/test/kotlin/tornadofx/testapps/ViewDockingApp.kt
deleted file mode 100644
index 6cd1afc..0000000
--- a/src/test/kotlin/tornadofx/testapps/ViewDockingApp.kt
+++ /dev/null
@@ -1,79 +0,0 @@
-package tornadofx.testapps
-
-import javafx.beans.property.SimpleIntegerProperty
-import javafx.scene.Scene
-import javafx.stage.Stage
-import tornadofx.*
-import java.util.concurrent.atomic.AtomicInteger
-
-class ViewDockingApp : App(PrimaryDockingView::class)
-
-open class PrimaryDockingView : View() {
-
- companion object {
- val instanceCounter = AtomicInteger()
- }
- val instanceId = instanceCounter.getAndIncrement()
- val dockCounterProperty = SimpleIntegerProperty()
- var dockCounter by dockCounterProperty
- val undockCounterProperty = SimpleIntegerProperty()
- var undockCounter by undockCounterProperty
-
- init {
- println("$tag.init()")
- }
-
- open val tag: String
- get() = "PrimaryDockingView"
-
- override val root = vbox {
- form {
- fieldset {
- field("Instance ID") {
- label(instanceId.toString())
- }
- field("Dock Counter") {
- label(dockCounterProperty) {
- style {
- fontSize = 48.pt
- }
- }
- }
- field("Undock Counter") {
- label(undockCounterProperty) {
- style {
- fontSize = 48.pt
- }
- }
- }
- }
- }
- }
-
- override fun onDock() {
- super.onDock()
- dockCounter++
- println("$tag.dockCounter: $dockCounter")
- }
-
- override fun onUndock() {
- super.onUndock()
- undockCounter++
- println("$tag.undockCounter: $undockCounter")
- }
-}
-
-class SecondaryDockingView : PrimaryDockingView() {
-
- override val tag: String
- get() = "SecondaryDockingView"
-}
-
-class NoPrimaryViewDockingApp : App() {
-
- override fun start(stage: Stage) {
- super.start(stage)
- stage.scene = Scene(find().root)
- stage.show()
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/testapps/WizardTestApp.kt b/src/test/kotlin/tornadofx/testapps/WizardTestApp.kt
deleted file mode 100644
index d6ce34d..0000000
--- a/src/test/kotlin/tornadofx/testapps/WizardTestApp.kt
+++ /dev/null
@@ -1,109 +0,0 @@
-package tornadofx.testapps
-
-import javafx.collections.FXCollections
-import javafx.geometry.Pos
-import javafx.scene.control.Button
-import javafx.scene.control.ButtonBar
-import javafx.scene.input.KeyCode
-import javafx.scene.input.KeyEvent
-import tornadofx.*
-import tornadofx.tests.Customer
-import tornadofx.tests.CustomerModel
-
-class WizardTestApp : WorkspaceApp(WizardCustomerList::class)
-
-class CustomerWizard : Wizard("Create customer", "Provide customer information") {
- val customer: CustomerModel by inject()
-
- override val canGoNext = currentPageComplete
- override val canFinish = allPagesComplete
-
- init {
- add()
- add()
- customer.item = Customer()
- graphic = resources.imageview("/tornadofx/tests/person.png")
- showSteps = true
- stepLinksCommits = true
- showHeader = true
- numberedSteps = true
- showStepsHeader = false
- enableStepLinks = true
- enterProgresses = true
- }
-
- override fun onCancel() {
- confirm("Confirm cancel", "Do you really want to loose your progress?") {
- cancel()
- }
- }
-}
-
-class WizardStep1 : View("Customer Data") {
- val customer: CustomerModel by inject()
- val wizard: CustomerWizard by inject()
-
- override val complete = customer.valid(customer.name)
-
- override val root = form {
- fieldset(title) {
- field("Type") {
- combobox(customer.type, Customer.Type.values().toList())
- }
- field("Name") {
- textfield(customer.name) {
- required()
- // Make sure we get focus instead of the type combo
- whenDocked { requestFocus() }
- }
- }
- hbox {
- alignment = Pos.BASELINE_RIGHT
- hyperlink("Skip") {
- action {
- wizard.currentPage = wizard.pages.last()
- }
- }
- }
- }
- }
-}
-
-class WizardStep2 : View("Address") {
- val customer: CustomerModel by inject()
- override val complete = customer.valid(customer.zip, customer.city)
-
- override val root = form {
- fieldset(title) {
- field("Zip/City") {
- textfield(customer.zip) {
- prefColumnCount = 5
- required()
- }
- textarea(customer.city) {
- required()
- }
- }
- }
- }
-}
-
-class WizardCustomerList : View() {
- val customers = FXCollections.observableArrayList()
-
- override val root = tableview(customers) {
- column("Name", Customer::nameProperty)
- columnResizePolicy = SmartResize.POLICY
- }
-
- override fun onDock() {
- with(workspace) {
- button("_Add").action {
- find {
- onComplete { customers.add(customer.item) }
- openModal()
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/tests/AsyncTest.kt b/src/test/kotlin/tornadofx/tests/AsyncTest.kt
deleted file mode 100644
index e1d4514..0000000
--- a/src/test/kotlin/tornadofx/tests/AsyncTest.kt
+++ /dev/null
@@ -1,101 +0,0 @@
-package tornadofx.tests
-
-import javafx.scene.control.Button
-import javafx.scene.layout.BorderPane
-import javafx.scene.layout.Pane
-import javafx.scene.layout.StackPane
-import javafx.stage.Stage
-import org.junit.Assert
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.*
-import java.util.concurrent.CountDownLatch
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotEquals
-import kotlin.test.assertTrue
-
-class AsyncTest {
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
-
- @Test
- fun runAsyncWithOverlay() {
- //Initially container has embedded node
- val container = BorderPane()
- val node = Pane()
- val mask = Pane()
-
- container.center = node
- assertEquals(container.center, node)
-
- //This latch will be used to control asynchronously executed task, it's a part of the test
- val latch = Latch()
- assertTrue(latch.locked)
-
- //This is a standard CountDownLatch and will be used to synchronize test thread with application thread
- val appThreadLatch = CountDownLatch(1)
-
- //ui is needed here because only after task is executed we can check if overlay is removed propertly
- //and it can only be used from within a UIComponent, so we need a temporary object
- val component = object : Controller() {
- fun run() = node.runAsyncWithOverlay(latch, null, mask) ui { appThreadLatch.countDown() }
- }
- component.run()
-
- //Until latch is released, a node is replaced with StackPane containing both the original component and the mask
- assertNotEquals(node, container.center)
- assertTrue(container.center is StackPane)
- assertTrue((container.center as StackPane).children.containsAll(setOf(node, mask)))
-
- //The working thread (test thread in this case) proceeds, which should result in removing overlay
- latch.release()
- assertFalse(latch.locked)
-
- //Waiting until we have confirmed post-task ui execution
- appThreadLatch.await()
-
- //At this point overlay should be removed and node should be again in its original place
- assertEquals(node, container.center)
- }
-
- @Test
- fun latch() {
- //Latch set for 5 concurrent tasks
- val count = 5
- val latch = Latch(count)
- val button = Button()
-
- assertFalse(button.disabledProperty().value)
-
- //Button should stay disabled until all tasks are over
- button.disableWhen(latch.lockedProperty())
-
- (1..count).forEach {
- assertTrue(button.disabledProperty().value)
- assertTrue(latch.locked)
- assertTrue(latch.lockedProperty().value)
- latch.countDown()
- //Latch count should decrease after each iteration
- Assert.assertEquals(count, (it + latch.count).toInt())
- }
-
- assertFalse(button.disabledProperty().value)
- assertFalse(latch.locked)
-
- //Should have no effect anyway
- latch.release()
- assertFalse(button.disabledProperty().value)
- assertFalse(latch.locked)
- }
-
- @Test
- fun runAsync() {
- tornadofx.runAsync(daemon = true) {
- assertTrue { Thread.currentThread().isDaemon }
- }
- tornadofx.runAsync {
- assertFalse { Thread.currentThread().isDaemon }
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/tests/BindingTest.kt b/src/test/kotlin/tornadofx/tests/BindingTest.kt
deleted file mode 100644
index 3312099..0000000
--- a/src/test/kotlin/tornadofx/tests/BindingTest.kt
+++ /dev/null
@@ -1,90 +0,0 @@
-package tornadofx.tests
-
-import javafx.beans.binding.BooleanExpression
-import javafx.beans.property.SimpleBooleanProperty
-import javafx.beans.property.SimpleDoubleProperty
-import javafx.collections.FXCollections
-import javafx.scene.control.Label
-import javafx.stage.Stage
-import org.junit.Assert
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.*
-import java.text.DecimalFormat
-import java.text.DecimalFormatSymbols
-import java.util.*
-
-class BindingTest {
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
-
- @Test
- fun testBindingFormat() {
- val property = SimpleDoubleProperty(Math.PI)
-
- val label = Label()
- label.bind(property, format = DecimalFormat("#0.0", DecimalFormatSymbols.getInstance(Locale.ENGLISH)))
-
- Assert.assertEquals("3.1", label.text)
- }
-
- @Test
- fun observableListBinding() {
- val elements = FXCollections.observableArrayList("Hello", "World")
- val binding = stringBinding(elements, elements) { this.joinToString(" ")}
- val uielement = Label().apply { bind(binding) }
- Assert.assertEquals("Hello World", uielement.text)
- elements.setAll("Hello", "Changed")
- Assert.assertEquals("Hello Changed", uielement.text)
- }
-
- @Test
- fun observableMapBinding() {
- val map = FXCollections.observableHashMap()
- val list = observableListOf()
- map["0123456"] = 3
- list.bind(map){k,v-> k[v]}
- Assert.assertEquals(list, listOf('3'))
- map["0123456"] = 4
- Assert.assertEquals(list, listOf('4'))
- map["abcdefg"] = 3
- Assert.assertTrue(
- "expected ['d', '4'] got ${list.joinToString() }}",
- list.containsAll(listOf('d', '4')) && list.size == 2
- )
- }
-
- @Test
- fun nestedBinding() {
- val father = Person("Mr Father", 50)
- val stepFather = Person("Mr Step Father", 40)
- val child = Person("Firstborn Child", 18)
- child.parent = father
-
- val fatherName = child.parentProperty().select(Person::nameProperty)
- Assert.assertEquals("Mr Father", fatherName.value)
- fatherName.value = "Mister Father"
- Assert.assertEquals("Mister Father", father.name)
- child.parent = stepFather
- Assert.assertEquals("Mr Step Father", fatherName.value)
- }
-
- @Test
- fun booleanBinding() {
- val mylist = FXCollections.observableArrayList()
- val complete = booleanBinding(mylist) { isNotEmpty() }
- Assert.assertFalse(complete.value)
- mylist.add("One")
- Assert.assertTrue(complete.value)
- }
-
- @Test
- fun booleanListBinding() {
- val mylist = FXCollections.observableArrayList()
- val complete = booleanListBinding(mylist) { this }
- Assert.assertFalse(complete.value)
- mylist.add(SimpleBooleanProperty(true))
- Assert.assertTrue(complete.value)
- mylist.add(SimpleBooleanProperty(false))
- Assert.assertFalse(complete.value)
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/tests/BuildersTest.kt b/src/test/kotlin/tornadofx/tests/BuildersTest.kt
deleted file mode 100644
index b351c54..0000000
--- a/src/test/kotlin/tornadofx/tests/BuildersTest.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package tornadofx.tests
-
-import javafx.scene.layout.StackPane
-import javafx.scene.text.Text
-import javafx.stage.Stage
-import org.hamcrest.Matchers
-import org.junit.Before
-import org.junit.Test
-import org.testfx.api.FxAssert.verifyThat
-import org.testfx.api.FxToolkit
-import org.testfx.matcher.control.TextMatchers
-import tornadofx.*
-
-class BuildersTest {
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
-
- lateinit var pane: StackPane
-
- @Before
- fun setup() {
- pane = StackPane()
- }
-
- @Test
- fun text_builder() {
- // expect:
- verifyThat(pane.text(), Matchers.instanceOf(Text::class.java))
- verifyThat(pane.text(), TextMatchers.hasText(""))
- verifyThat(pane.text("foo"), TextMatchers.hasText("foo"))
- verifyThat(pane.text() { text = "bar" }, TextMatchers.hasText("bar"))
- }
-
-}
diff --git a/src/test/kotlin/tornadofx/tests/ChildInterceptorTest.kt b/src/test/kotlin/tornadofx/tests/ChildInterceptorTest.kt
deleted file mode 100644
index 06217c0..0000000
--- a/src/test/kotlin/tornadofx/tests/ChildInterceptorTest.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-package tornadofx.tests
-
-import javafx.event.EventTarget
-import javafx.scene.Node
-import javafx.scene.layout.Pane
-import javafx.stage.Stage
-import org.junit.AfterClass
-import org.junit.BeforeClass
-import org.junit.Ignore
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.*
-import kotlin.test.assertEquals
-
-abstract class BaseInterceptor : ChildInterceptor {
- var intercepted: Boolean = false
-}
-
-class DummyPane : Pane()
-
-fun EventTarget.dummyPane(op: DummyPane.() -> Unit = {}) = DummyPane().attachTo(this, op)
-
-class FirstInterceptor : BaseInterceptor() {
- override fun invoke(parent: EventTarget, node: Node, index: Int?): Boolean = when (parent) {
- is DummyPane -> {
- intercepted = true
- true
- }
- else -> false
- }
-}
-
-class SecondInterceptor : BaseInterceptor() {
- override fun invoke(parent: EventTarget, node: Node, index: Int?): Boolean = when (parent) {
- is DummyPane -> {
- intercepted = true
- true
- }
- else -> false
- }
-}
-
-class MyTestView : View("TestView") {
- override val root = dummyPane {
- button {}
- }
-}
-
-class ChildInterceptorTest {
-
- companion object {
- val app = App(MyTestView::class)
-
- @JvmStatic
- @BeforeClass
- fun before() {
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
- FX.registerApplication(FxToolkit.setupApplication {
- app
- }, primaryStage)
- }
-
- @JvmStatic
- @AfterClass
- fun after() {
- FxToolkit.cleanupApplication(app)
- }
- }
-
- @Ignore // TODO: Verify behavior change w.r.t. JDK 8 version.
- @Test
- fun interceptorsLoaded() {
- assertEquals(FX.childInterceptors.size, 2)
- }
-
-
- @Ignore // TODO: Verify behavior change w.r.t. JDK 8 version.
- @Test
- fun onlyOneInterceptorShouldWork() {
- assertEquals(1, FX.childInterceptors.map { it as BaseInterceptor }.filter { it.intercepted }.size)
- }
-}
diff --git a/src/test/kotlin/tornadofx/tests/ClipboardTest.kt b/src/test/kotlin/tornadofx/tests/ClipboardTest.kt
deleted file mode 100644
index 492cc86..0000000
--- a/src/test/kotlin/tornadofx/tests/ClipboardTest.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package tornadofx.tests
-
-import javafx.scene.input.DataFormat
-import javafx.stage.Stage
-import org.junit.Assert
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.Controller
-import tornadofx.FX
-import tornadofx.putString
-import tornadofx.setContent
-
-class ClipboardTest {
-
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
-
- val CustomDataFormat = DataFormat("myFormat")
-
- @Test
- fun testClipboard() {
- val string1 = "TornadoFX Clipboard Test"
- val string2 = "TornadoFX Clipboard Test 2"
-
- FX.runAndWait {
- object : Controller() {
- init {
- clipboard.setContent {
- putString(string1)
- put(CustomDataFormat, 42)
- }
-
- Assert.assertEquals(string1, clipboard.string)
- Assert.assertEquals(42, clipboard.getContent(CustomDataFormat))
-
- clipboard.putString(string2)
- Assert.assertEquals(string2, clipboard.string)
- Assert.assertNull(clipboard.getContent(CustomDataFormat))
- }
- }
- }
-
- }
-}
diff --git a/src/test/kotlin/tornadofx/tests/CollectionsTest.kt b/src/test/kotlin/tornadofx/tests/CollectionsTest.kt
deleted file mode 100644
index a8d013f..0000000
--- a/src/test/kotlin/tornadofx/tests/CollectionsTest.kt
+++ /dev/null
@@ -1,172 +0,0 @@
-package tornadofx.tests
-
-import org.junit.Test
-import tornadofx.*
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertTrue
-
-class CollectionsTest {
-
- @Test
- fun testMoveWithValidIndex() {
- val list = mutableListOf(1, 2, 3, 4)
-
- list.move(2, 3)
-
- assertEquals(mutableListOf(1, 3, 4, 2), list)
- }
-
- @Test
- fun testMoveWithInvalidIndex() {
- val list = mutableListOf(1, 2, 3, 4)
-
- try {
- list.move(2, 102)
- } catch (e: Exception) {
- assert(e is IllegalStateException)
- }
- }
-
- @Test
- fun testMoveWithInvalidItem() {
- val list = mutableListOf(1, 2, 3, 4)
-
- list.move(10, 1)
-
- assertEquals(mutableListOf(1, 2, 3, 4), list)
- }
-
- @Test
- fun testMoveAtForward() {
- val list = mutableListOf(1, 2, 3, 4)
- val newIndex = 2
-
- list.moveAt(0, newIndex)
-
- assertEquals(1, list[newIndex])
- }
-
- @Test
- fun testMoveAtBackward() {
- val list = mutableListOf(1, 2, 3, 4)
- val newIndex = 0
-
- list.moveAt(2, newIndex)
-
- assertEquals(3, list[newIndex])
- }
-
- @Test
- fun testMoveAtWithInvalidNewIndex() {
- val list = mutableListOf(1, 2, 3, 4)
- val newIndex = 10
-
- try {
- list.moveAt(2, newIndex)
- } catch (e: Exception) {
- assert(e is IllegalStateException)
- }
- }
-
-
- @Test
- fun testMoveAllValidIndex() {
- val list = mutableListOf(1, 2, 3, 4, 5)
-
- list.moveAll(2, { it < 3 })
-
- assertEquals(mutableListOf(3, 4, 1, 2, 5), list)
- }
-
- @Test
- fun testMoveAllInvalidIndex() {
- val list = mutableListOf(1, 2, 3, 4, 5)
-
- try {
- list.moveAll(101, { it < 3 })
- } catch (e: Exception) {
- assert(e is IllegalStateException)
- }
- }
-
- @Test
- fun testMoveUpAtValidIndex() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- list.moveUpAt(2)
-
- assertEquals(listOf(0, 2, 1, 3, 4), list)
- }
-
- @Test
- fun testMoveUpAtInvalidIndex() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- try {
- list.moveUpAt(10)
- } catch (e: Exception) {
- assert(e is IllegalStateException)
- }
- }
-
- @Test
- fun testMoveDownAtValidIndex() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- list.moveDownAt(2)
-
- assertEquals(listOf(0, 1, 3, 2, 4), list)
- }
-
- @Test
- fun testMoveDownAtInvalidIndex() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- try {
- list.moveDownAt(10)
- } catch (e: Exception) {
- assert(e is IllegalStateException)
- }
- }
-
- @Test
- fun testMoveUpWithValidItem() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- val result = list.moveUp(2)
-
- assertTrue(result)
- assertEquals(listOf(0, 2, 1, 3, 4), list)
- }
-
- @Test
- fun testMoveUpWithInvalidItem() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- val result = list.moveUp(10)
-
- assertFalse(result)
- assertEquals(listOf(0, 1, 2, 3, 4), list)
- }
-
- @Test
- fun testMoveDownWithValidItem() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- val result = list.moveDown(2)
-
- assertTrue(result)
- assertEquals(listOf(0, 1, 3, 2, 4), list)
- }
-
- @Test
- fun testMoveDownWithInvalidItem() {
- val list = mutableListOf(0, 1, 2, 3, 4)
-
- val result = list.moveDown(10)
-
- assertFalse(result)
- assertEquals(listOf(0, 1, 2, 3, 4), list)
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/tests/ComponentTest.kt b/src/test/kotlin/tornadofx/tests/ComponentTest.kt
deleted file mode 100644
index 99cb609..0000000
--- a/src/test/kotlin/tornadofx/tests/ComponentTest.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-package tornadofx.tests
-
-import javafx.stage.Stage
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.Fragment
-import tornadofx.singleAssign
-import tornadofx.vbox
-//import tornadofx.*
-import kotlin.test.assertFalse
-import kotlin.test.assertNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-class ComponentTest {
-
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
-
- @Test
- fun testParam2() {
-
- val mainFragment = MainFragment()
-
- try {
- mainFragment.subFragmentNoParam.booleanParam
- fail("IllegalStateException should have been thrown")
- } catch (e: IllegalStateException) {
- // param not set
- }
-
- assertTrue(mainFragment.subFragmentNoParam.booleanParamWithDefault,
- "parameter value should match default value")
-
- assertFalse(mainFragment.subFragmentWithParam.booleanParam,
- "parameter value should match parameter passed in")
-
- assertNull(mainFragment.subFragmentWithParam.nullableBooleanParam,
- "nullable parameter value should match parameter passed in")
- }
-
- class MainFragment : Fragment() {
-
- var subFragmentNoParam: SubFragment by singleAssign()
-
- var subFragmentWithParam: SubFragment by singleAssign()
-
- override val root = vbox {
- add {
- subFragmentNoParam = this
- }
- add(
- SubFragment::booleanParam to false,
- SubFragment::nullableBooleanParam to null
- ){
- subFragmentWithParam = this
- }
- }
-
- }
-
- class SubFragment : Fragment() {
- val booleanParam: Boolean by param()
- val booleanParamWithDefault: Boolean by param(defaultValue = true)
- val nullableBooleanParam: Boolean? by param()
- override val root = vbox()
- }
-
-}
\ No newline at end of file
diff --git a/src/test/kotlin/tornadofx/tests/ControlsTest.kt b/src/test/kotlin/tornadofx/tests/ControlsTest.kt
deleted file mode 100644
index ccff450..0000000
--- a/src/test/kotlin/tornadofx/tests/ControlsTest.kt
+++ /dev/null
@@ -1,112 +0,0 @@
-package tornadofx.tests
-
-import javafx.beans.property.SimpleDoubleProperty
-import javafx.beans.property.SimpleIntegerProperty
-import javafx.beans.property.SimpleStringProperty
-import javafx.embed.swing.JFXPanel
-import javafx.scene.layout.VBox
-import javafx.util.StringConverter
-import javafx.util.converter.NumberStringConverter
-import org.junit.Assert
-import org.junit.Before
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.*
-import java.text.NumberFormat
-import java.util.*
-
-/**
- * @author carl
- */
-
-class TestView : View() {
- override val root = VBox()
-}
-
-class ControlsTest {
-
- @Before
- fun setupFX() {
- FxToolkit.registerPrimaryStage()
- }
-
- @Test
- fun testTextfield() {
-
- JFXPanel()
-
- val view = TestView()
-
- view.textfield(SimpleStringProperty("carl"))
-
- view.textfield(SimpleIntegerProperty(101), NumberStringConverter())
-
- view.textfield() {
- bind(SimpleIntegerProperty(102))
- }
-
- view.textfield(SimpleIntegerProperty(103)) // w. fix 184
-
- view.textfield(SimpleDoubleProperty(100.131)) // also fixed 184
- }
-
- @Test
- fun testImageview() {
-
- val view = TestView()
- val property = SimpleStringProperty(null)
- val imageView = view.imageview(property)
-
- Assert.assertNull(imageView.image)
-
- property.value = "/tornadofx/tests/person.png"
-
- Assert.assertNotNull(imageView.image)
- }
-
- @Test
- fun testLabelWithStringObservable() {
-
- val view = TestView()
- val property = SimpleStringProperty("Daan")
- val label = view.label(property)
- val labelWithConverter = view.label(property, converter = object : StringConverter() {
- override fun toString(string: String?) = string?.toUpperCase() ?: ""
- override fun fromString(string: String?) = throw NotImplementedError()
- })
-
- Assert.assertEquals("Daan", label.text)
- Assert.assertEquals("DAAN", labelWithConverter.text)
- }
-
- @Test
- fun testLabelWithIntegerObservable() {
-
- val view = TestView()
- val property = SimpleIntegerProperty(12718)
- val label = view.label(property)
- val labelWithConverter = view.label(property, converter = NumberStringConverter(Locale.US))
-
- Assert.assertEquals("12718", label.text)
- Assert.assertEquals(NumberFormat.getNumberInstance(Locale.US).format(12718), labelWithConverter.text)
- }
-
- @Test
- fun testSliderRange() {
- val view = TestView()
- val slider = view.slider(24..42)
- Assert.assertEquals(24.0, slider.min, 10e-5)
- Assert.assertEquals(42.0, slider.max, 10e-5)
- }
-
- @Test
- fun testSplitMenuButton() {
- val view = TestView()
- val button = view.splitmenubutton("Text") {
- item("Item Name")
- }
-
- Assert.assertEquals(button.text, "Text")
- Assert.assertEquals(button.items.first().text, "Item Name")
- }
-}
diff --git a/src/test/kotlin/tornadofx/tests/Customer.kt b/src/test/kotlin/tornadofx/tests/Customer.kt
deleted file mode 100644
index e0ad21d..0000000
--- a/src/test/kotlin/tornadofx/tests/Customer.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-package tornadofx.tests
-
-import javafx.beans.property.SimpleObjectProperty
-import javafx.beans.property.SimpleStringProperty
-import tornadofx.*
-import javax.json.JsonObject
-
-class Customer : JsonModel {
- enum class Type { Private, Company }
-
- val nameProperty = SimpleStringProperty()
- var name by nameProperty
-
- val zipProperty = SimpleStringProperty()
- var zip by zipProperty
-
- val cityProperty = SimpleStringProperty()
- var city by cityProperty
-
- val typeProperty = SimpleObjectProperty(Type.Private)
- var type by typeProperty
-
- override fun toString(): String {
- return "Customer(name=$name, zip=$zip, city=$city)"
- }
-
- override fun updateModel(json: JsonObject) {
- with(json) {
- name = string("name")
- }
- }
-
- override fun toJSON(json: JsonBuilder) {
- with(json) {
- add("name", name)
- }
- }
-
-}
-
-class CustomerModel : ItemViewModel() {
- val name = bind(Customer::nameProperty, autocommit = true)
- val zip = bind(Customer::zipProperty, autocommit = true)
- val city = bind(Customer::cityProperty, autocommit = true)
- val type = bind(Customer::typeProperty, autocommit = true)
-}
diff --git a/src/test/kotlin/tornadofx/tests/EventBusTest.kt b/src/test/kotlin/tornadofx/tests/EventBusTest.kt
deleted file mode 100644
index c3a1660..0000000
--- a/src/test/kotlin/tornadofx/tests/EventBusTest.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-package tornadofx.tests
-
-import javafx.application.Platform
-import javafx.stage.Stage
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.*
-import java.util.concurrent.atomic.AtomicBoolean
-import java.util.concurrent.atomic.AtomicInteger
-import kotlin.test.assertTrue
-
-class EventBusTest {
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
- private val success = AtomicBoolean(true)
- private val latch = Latch()
-
- init {
- FxToolkit.setupFixture {
- Thread.setDefaultUncaughtExceptionHandler { _, t ->
- t.printStackTrace()
- success.set(false)
- latch.countDown()
- }
- }
- }
-
- val iterations: Int = 100
- val count = AtomicInteger(0)
- val view = object : View() {
-
- init {
- for (i in 1..iterations) {
- subscribe(times = i) {
- callOnUndock()
- print(" ${count.getAndIncrement()} ")
- callOnDock()
- }
- }
- }
-
- override val root = vbox {}
- }
-
- @Test
- fun testUnsubscribe() {
- Platform.runLater {
- view.callOnDock()
- repeat(iterations / 2) {
- view.fire(FXEvent())
- view.fire(FXEvent(EventBus.RunOn.BackgroundThread))
- }
- latch.countDown()
- }
- latch.await()
- assertTrue(success.get())
- }
-}
-
diff --git a/src/test/kotlin/tornadofx/tests/FXMLTest.kt b/src/test/kotlin/tornadofx/tests/FXMLTest.kt
deleted file mode 100644
index 08befbb..0000000
--- a/src/test/kotlin/tornadofx/tests/FXMLTest.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package tornadofx.tests
-
-import javafx.scene.Parent
-import javafx.scene.control.Label
-import javafx.scene.control.ListView
-import javafx.scene.control.TextField
-import javafx.scene.layout.Pane
-import javafx.scene.layout.VBox
-import javafx.stage.Stage
-import org.junit.Assert
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.*
-
-class FXMLTest {
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
-
- @Test(expected = IllegalArgumentException::class)
- fun wrongFXId() {
- object : Fragment() {
- override val root: VBox by fxml("/tornadofx/tests/FXMLTest.fxml")
- val myLabelx : Label by fxid()
-
- init {
- myLabelx.text = "Expect log warning and RuntimeException"
- }
- }
- }
-
- @Test(expected = ClassCastException::class)
- fun wrongFXType() {
- object : Fragment() {
- override val root: VBox by fxml("/tornadofx/tests/FXMLTest.fxml")
- val myLabel : TextField by fxid()
-
- init {
- myLabel.text = "Expect ClassCastException"
- }
- }
- }
-
- @Test
- fun simpleFormFXML() {
- val simpleForm = find()
- Assert.assertNotNull(simpleForm.tfField1)
- Assert.assertNotNull(simpleForm.tfField2)
- Assert.assertNotNull(simpleForm.tfField3)
- }
-
- @Test
- fun composedFormFXML() {
-
- val composedForm = find()
-
- Assert.assertNotNull(composedForm.searchPane)
- Assert.assertNotNull(composedForm.listPane)
-
- // searchPane > HBox > tfSearch
- Assert.assertTrue(
- (composedForm.searchPane.children[0] as Parent).childrenUnmodifiable[1] is TextField )
-
- // listPane > AnchorPane > lvItems
- Assert.assertEquals(ListView::class.java,
- (composedForm.listPane.children[0] as Parent).childrenUnmodifiable[0].javaClass)
-
- }
-
-}
-
-class SimpleForm : View() {
- override val root: VBox by fxml("/tornadofx/tests/SimpleForm.fxml")
- val tfField1 : TextField by fxid()
- val tfField2 : TextField by fxid()
- val tfField3 : TextField by fxid()
- fun ok() {}
- fun cancel() {}
-}
-
-class ComposedForm : View() {
- override val root : VBox by fxml("/tornadofx/tests/ComposedForm.fxml")
- val searchPane : Pane by fxid()
- val listPane : Pane by fxid()
- fun ok() {}
- fun cancel() {}
-}
diff --git a/src/test/kotlin/tornadofx/tests/FormTest.kt b/src/test/kotlin/tornadofx/tests/FormTest.kt
deleted file mode 100644
index b688cce..0000000
--- a/src/test/kotlin/tornadofx/tests/FormTest.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package tornadofx.tests
-
-import javafx.stage.Stage
-import org.junit.Test
-import org.testfx.api.FxToolkit
-import tornadofx.*
-import kotlin.test.assertEquals
-import kotlin.test.assertTrue
-
-class FormTest {
- val primaryStage: Stage = FxToolkit.registerPrimaryStage()
-
- @Test fun formLegendVisible() {
- val form = Form().apply {
- fieldset("Hello world")
- }
- val fieldset = form.select