hook up cancel button

This commit is contained in:
Zlatin Balevsky
2019-06-01 17:44:52 +01:00
parent bd2368e23a
commit 82377aa9df
3 changed files with 23 additions and 2 deletions

View File

@@ -54,6 +54,11 @@ class MainFrameController {
group.model.results[row]
}
private def selectedDownload() {
def selected = builder.getVariable("downloads-table").getSelectedRow()
model.downloads[selected].downloader
}
@ControllerAction
void download() {
def result = selectedResult()
@@ -79,6 +84,12 @@ class MainFrameController {
core.eventBus.publish( new TrustEvent(destination : result.sender.destination, level : TrustLevel.DISTRUSTED))
}
@ControllerAction
void cancel() {
def downloader = selectedDownload()
downloader.cancel()
}
void mvcGroupInit(Map<String, String> args) {
application.addPropertyChangeListener("core", {e->
core = e.getNewValue()

View File

@@ -98,7 +98,7 @@ class MainFrameView {
}
}
panel (constraints : BorderLayout.SOUTH) {
button("Cancel", enabled : bind {model.cancelButtonEnabled } )
button(text: "Cancel", enabled : bind {model.cancelButtonEnabled }, cancelAction )
button("Retry", enabled : bind {model.retryButtonEnabled})
}
}