Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Fix #732 - Disable the select all button on Export tab if list is emp…
Browse files Browse the repository at this point in the history
…ty (#794)
  • Loading branch information
mayank8318 authored and ggalmazor committed Aug 26, 2019
1 parent cd1b966 commit f7bc502
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/org/opendatakit/briefcase/export/ExportForms.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ public boolean someSelected() {
}

public boolean allSelected() {
return forms.stream().allMatch(FormStatus::isSelected);
return !forms.isEmpty() && forms.stream().allMatch(FormStatus::isSelected);
}

public boolean isEmpty() {
return forms.isEmpty();
}

public boolean noneSelected() {
Expand Down
5 changes: 5 additions & 0 deletions src/org/opendatakit/briefcase/ui/export/ExportPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ private void updateSelectButtons() {
} else {
form.toggleSelectAll();
}

if (forms.isEmpty())
form.disableSelectAll();
else
form.enableSelectAll();
}

public static ExportPanel from(BriefcasePreferences exportPreferences, BriefcasePreferences appPreferences, BriefcasePreferences pullPrefs, Analytics analytics, FormCache formCache, Http http, FormMetadataPort formMetadataPort) {
Expand Down
8 changes: 8 additions & 0 deletions src/org/opendatakit/briefcase/ui/export/ExportPanelForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ void onChange(Runnable callback) {
formsTable.onChange(callback);
}

void disableSelectAll() {
selectAllButton.setEnabled(false);
}

void enableSelectAll() {
selectAllButton.setEnabled(true);
}

void toggleClearAll() {
selectAllButton.setVisible(false);
clearAllButton.setVisible(true);
Expand Down

0 comments on commit f7bc502

Please sign in to comment.