refresh downloads every second

This commit is contained in:
Zlatin Balevsky
2019-05-31 04:59:21 +01:00
parent 44735d96ce
commit 7e4bf5d85d
2 changed files with 7 additions and 1 deletions

View File

@@ -32,6 +32,12 @@ class MainFrameModel {
core = e.getNewValue() core = e.getNewValue()
core.eventBus.register(UIResultEvent.class, this) core.eventBus.register(UIResultEvent.class, this)
}) })
Timer timer = new Timer("download-pumper", true)
timer.schedule({
runInsideUIAsync {
builder.getVariable("downloads-table").model.fireTableDataChanged()
}
}, 1000, 1000)
} }
void onUIResultEvent(UIResultEvent e) { void onUIResultEvent(UIResultEvent e) {

View File

@@ -81,7 +81,7 @@ class MainFrameView {
panel (constraints : JSplitPane.BOTTOM) { panel (constraints : JSplitPane.BOTTOM) {
borderLayout() borderLayout()
scrollPane (constraints : BorderLayout.CENTER) { scrollPane (constraints : BorderLayout.CENTER) {
table() { table(id : "downloads-table") {
tableModel(list: model.downloads) { tableModel(list: model.downloads) {
closureColumn(header: "Name", type: String, read : {row -> row.downloader.file.getName()}) closureColumn(header: "Name", type: String, read : {row -> row.downloader.file.getName()})
closureColumn(header: "Status", type: String, read : {row -> row.downloader.getCurrentState()}) closureColumn(header: "Status", type: String, read : {row -> row.downloader.getCurrentState()})