disable Configure button if no directory is selected

pull/53/head
Zlatin Balevsky 2020-09-18 18:35:10 +01:00
parent 944cb29901
commit f2531c80d5
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,7 @@ class AdvancedSharingModel {
Core core Core core
@Observable boolean syncActionEnabled @Observable boolean syncActionEnabled
@Observable boolean configureActionEnabled
void mvcGroupInit(Map<String,String> args) { void mvcGroupInit(Map<String,String> args) {
watchedDirectories.addAll(core.watchedDirectoryManager.watchedDirs.values()) watchedDirectories.addAll(core.watchedDirectoryManager.watchedDirs.values())

View File

@ -64,7 +64,7 @@ class AdvancedSharingView {
} }
} }
panel (constraints : BorderLayout.SOUTH) { panel (constraints : BorderLayout.SOUTH) {
button(text : "Configure", configureAction) button(text : "Configure", enabled : bind{model.configureActionEnabled}, configureAction)
button(text : "Sync", enabled : bind{model.syncActionEnabled}, syncAction) button(text : "Sync", enabled : bind{model.syncActionEnabled}, syncAction)
} }
} }
@ -91,6 +91,7 @@ class AdvancedSharingView {
selectionModel.addListSelectionListener({ selectionModel.addListSelectionListener({
def directory = selectedWatchedDirectory() def directory = selectedWatchedDirectory()
model.syncActionEnabled = !(directory == null || directory.autoWatch) model.syncActionEnabled = !(directory == null || directory.autoWatch)
model.configureActionEnabled = directory != null
}) })
watchedDirsTable.addMouseListener(new MouseAdapter() { watchedDirsTable.addMouseListener(new MouseAdapter() {