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

Fix #732 - Disable the select all button on Export tab if list is empty #794

Merged
merged 1 commit into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -149,6 +149,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) {
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