forked from spbu-coding-2022/trees-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the functionality of switching between views for different …
…trees
- Loading branch information
1 parent
f83512f
commit c52816b
Showing
6 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
package app.view | ||
|
||
import app.view.treeView.BinarySearchTreeView | ||
import tornadofx.* | ||
|
||
class MainView: View("Trees") { | ||
override val root = vbox { | ||
button("Hello, World!") | ||
label("Waiting") | ||
class MainView: View(){ | ||
private val tree = BinarySearchTreeView() | ||
override val root = borderpane { | ||
center{ | ||
add(tree) | ||
} | ||
left{ | ||
button("reset") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package app.view.treeView | ||
import tornadofx.* | ||
class AVLTreeView: View() { | ||
override val root = vbox { | ||
button("Binary Search Tree") { | ||
action { | ||
replaceWith<BinarySearchTreeView>() | ||
} | ||
} | ||
button("Red Black Tree") { | ||
action { | ||
replaceWith<RedBlackTreeView>() | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/kotlin/app/view/treeView/BinarySearchTreeView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package app.view.treeView | ||
import tornadofx.* | ||
|
||
class BinarySearchTreeView: View() { | ||
override val root = vbox { | ||
button("AVL Tree") { | ||
action { | ||
replaceWith<AVLTreeView>() | ||
} | ||
} | ||
button("Red Black Tree") { | ||
action { | ||
replaceWith<RedBlackTreeView>() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package app.view.treeView | ||
import app.view.treeView.AVLTreeView | ||
import app.view.treeView.BinarySearchTreeView | ||
import tornadofx.View | ||
import tornadofx.action | ||
import tornadofx.button | ||
import tornadofx.vbox | ||
|
||
class RedBlackTreeView: View() { | ||
override val root = vbox { | ||
button("AVL Tree") { | ||
action { | ||
replaceWith<AVLTreeView>() | ||
} | ||
} | ||
|
||
button("Binary Search Tree") { | ||
action { | ||
replaceWith<BinarySearchTreeView>() | ||
} | ||
} | ||
} | ||
} |