Commit 2f90e7f0 authored by Riegel's avatar Riegel
Browse files

Style: Cleanup code

parent 5eab063f
Pipeline #10968 passed with stage
in 1 minute and 24 seconds
......@@ -116,7 +116,12 @@ public class ZipEntryManager {
private int currentlyLoadedEntry = -1;
private CheckDialog dialog;
private String unknownValueText = Localization.getText("ZipEntryManager.unknownValue");
private final String unknownValueText = Localization.getText("ZipEntryManager.unknownValue");
private static final Predicate<ZipEntryNode> entryDecompressed = node ->
(node.getEntry().isDecompressed() || node.getEntry().getErrorType() != null);
private static final Predicate<ZipEntryNode> entryValidated = entryDecompressed.and(node ->
(node.getEntry().getModel() != null && node.getEntry().getModel().isValidated()));
public ZipEntryManager(Window parent, CityDoctorController controller) throws IOException {
FXMLLoader loader = new FXMLLoader(ZipEntryManager.class.getResource("ZipEntryManager.fxml"));
......@@ -192,7 +197,7 @@ public class ZipEntryManager {
Platform.runLater(() -> progress.setProgress(progressValue))
);
Platform.runLater(() -> {
populateZipEntryList(entryList.getSelectionModel().getSelectedIndex());
refresh();
progress.setProgress(0);
setEntryListLocked(false);
});
......@@ -250,7 +255,7 @@ public class ZipEntryManager {
}
Platform.runLater(() -> {
subProgress.setVisible(false);
populateZipEntryList(entryList.getSelectionModel().getSelectedIndex());
refresh();
progress.setProgress(0);
setEntryListLocked(false);
});
......@@ -344,9 +349,8 @@ public class ZipEntryManager {
entryList.getSelectionModel().clearSelection();
entryList.getSelectionModel().select(selectionIndex);
showMetadata(entryList.getSelectionModel().getSelectedItem().getEntry());
Predicate<ZipEntryNode> allEntriesDecompressed = node -> (node.getEntry().isDecompressed() || node.getEntry().getErrorType() != null);
decompressAllBtn.setDisable(entryList.getItems().stream().allMatch(allEntriesDecompressed));
saveBtn.setDisable(entryList.getItems().stream().allMatch(Predicate.not(allEntriesDecompressed)));
decompressAllBtn.setDisable(entryList.getItems().stream().allMatch(entryDecompressed));
saveBtn.setDisable(entryList.getItems().stream().noneMatch(entryValidated));
}
private void showMetadata(CityGmlZipEntry entry) {
......@@ -403,6 +407,8 @@ public class ZipEntryManager {
decompressBtn.setDisable(true);
loadBtn.setDisable(true);
decompressAllBtn.setDisable(true);
showReportBtn.setDisable(true);
saveBtn.setDisable(true);
}
public void refresh() {
......@@ -429,9 +435,7 @@ public class ZipEntryManager {
}
public void show() {
Platform.runLater(() -> {
stage.showAndWait();
});
populateZipEntryList(entryList.getSelectionModel().getSelectedIndex());
Platform.runLater(() -> stage.showAndWait());
refresh();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment