Skip to content

Commit

Permalink
fixes #118 (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-claw authored Sep 3, 2023
1 parent 4163f2a commit a362a3f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import me.mnlr.vripper.event.EventBus
import me.mnlr.vripper.model.LogModel
import tornadofx.*

class LogTableView : View("Log") {
class LogTableView : View() {

private val logController: LogController by inject()
private val eventBus: EventBus by di()
Expand All @@ -20,6 +20,13 @@ class LogTableView : View("Log") {
var items: ObservableList<LogModel> = FXCollections.observableArrayList()

init {
titleProperty.bind(items.sizeProperty.map {
if (it.toLong() > 0) {
"Log (${it.toLong()})"
} else {
"Log"
}
})
items.addAll(logController.findAll())

eventBus.flux()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import me.mnlr.vripper.utils.Shell32
import tornadofx.*


class PostsTableView : View("Download") {
class PostsTableView : View() {

private val postController: PostController by inject()
private val eventBus: EventBus by di()
Expand All @@ -23,6 +23,13 @@ class PostsTableView : View("Download") {
private var items: ObservableList<PostModel> = FXCollections.observableArrayList()

init {
titleProperty.bind(items.sizeProperty.map {
if (it.toLong() > 0) {
"Download (${it.toLong()})"
} else {
"Download"
}
})
items.addAll(postController.findAllPosts())

eventBus.flux().filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import me.mnlr.vripper.controller.ThreadController
import me.mnlr.vripper.event.Event
import me.mnlr.vripper.event.EventBus
import me.mnlr.vripper.model.ThreadModel
import me.mnlr.vripper.view.main.MainView
import tornadofx.*

class ThreadTableView : View("Threads") {
class ThreadTableView : View() {

private val threadController: ThreadController by inject()
private val eventBus: EventBus by di()
Expand All @@ -21,6 +20,13 @@ class ThreadTableView : View("Threads") {
private var items: ObservableList<ThreadModel> = FXCollections.observableArrayList()

init {
titleProperty.bind(items.sizeProperty.map {
if (it.toLong() > 0) {
"Threads (${it.toLong()})"
} else {
"Threads"
}
})
items.addAll(threadController.findAll())

eventBus.flux()
Expand All @@ -38,11 +44,6 @@ class ThreadTableView : View("Threads") {
}
} else {
items.add(it)
runLater {
find<MainView>().root.selectionModel.select(1)
tableView.selectionModel.clearSelection()
tableView.selectionModel.select(it)
}
}
}
}
Expand All @@ -54,6 +55,7 @@ class ThreadTableView : View("Threads") {
Event.Kind.THREAD_CLEAR -> {
tableView.items.clear()
}

else -> {}
}
}
Expand Down Expand Up @@ -96,7 +98,7 @@ class ThreadTableView : View("Threads") {

contextMenu.items.addAll(selectItem, SeparatorMenuItem(), deleteItem)
tableRow.contextMenuProperty().bind(tableRow.emptyProperty()
.map { empty -> if (empty) null else contextMenu })
.map { empty -> if (empty) null else contextMenu })
tableRow
}
column("URL", ThreadModel::linkProperty) {
Expand Down

0 comments on commit a362a3f

Please sign in to comment.