Commit d33d54b8 authored by Riegel's avatar Riegel
Browse files

Feat: Implement checkAllBtn functionality

2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Showing with 180 additions and 2 deletions
+180 -2
......@@ -18,6 +18,7 @@ CheckDialog.parameterValue=Value
CheckDialog.parameterUnit=Unit
CityDoctorController.noDatamodel=Datamodel is null, no checks could be done
CityDoctorController.noSourceFile=Source file is null, no checks could be done
CityDoctorController.noZipFile=ZIP archive is null, no checks could be done
CityDoctorController.exportSuccess=Successfully exported feature
ExceptionDialog.stacktrace=The exception stacktrace was:
FilterPane.buildings=Buildings
......@@ -104,6 +105,13 @@ CheckDialog.schematronFileLabel=Schematron File:
CheckDialog.selectBtn=Select
CheckDialog.checkBtn=Check
CheckDialog.cancelBtn=Cancel
CheckDialog.streamCheckOption=Use low memory mode
CheckDialog.streamCheckLabel=Citymodels are not loaded and kept in memory. Check results are saved to the QualityADE in copies of the input files.
CheckDialog.outputPathLabel=Output path (Required):
CheckDialog.outputPathBtn=Select
CheckDialog.pdfReportsOption=Create PDF reports
CheckDialog.xmlReportsOption=Create XML reports
CheckDialog.noPathError=Output path is missing!
ZipEntryManager.title=Zip-entry manager
ZipEntryManager.entryListTitle=Zip-entries
ZipEntryManager.metadata=Metadata
......
......@@ -16,6 +16,7 @@ CheckDialog.parameterValue=Wert
CheckDialog.parameterUnit=Einheit
CityDoctorController.noDatamodel=Datenmodell ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
CityDoctorController.noSourceFile=Quelldatei ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
CityDoctorController.noZipFile=ZIP-Archiv ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
CityDoctorController.exportSuccess=Feature export erfolgreich abgeschlossen
ExceptionDialog.stacktrace=Der Stacktrace des Fehlers war:
FilterPane.buildings=Geb\u00e4ude
......@@ -102,6 +103,13 @@ CheckDialog.schematronFileLabel=Schematron Datei
CheckDialog.selectBtn=Ausw\u00e4hlen
CheckDialog.checkBtn=Pr\u00fcfen
CheckDialog.cancelBtn=Abbrechen
CheckDialog.streamCheckOption=Niedrigen Arbeitsspeicherverbrauchsmodus aktivieren
CheckDialog.streamCheckLabel=Stadtmodelle werden nicht in den Arbeitsspeicher geladen. Ergebnisse werden in der QualityADE in Kopien der Eingangsdateien gespeichert.
CheckDialog.outputPathLabel=Ausgabepfad (Pflichtfeld):
CheckDialog.outputPathBtn=Ausw\u00e4hlen
CheckDialog.pdfReportsOption=PDF Berichte erstellen
CheckDialog.xmlReportsOption=XML Berichte erstellen
CheckDialog.noPathError=Ausgabepfad wurde nicht gesetzt!
ZipEntryManager.title=Zipeintrag Manager
ZipEntryManager.entryListTitle=Zipeintr\u00e4ge
ZipEntryManager.metadata=Metadaten
......
......@@ -3,6 +3,7 @@ package de.hft.stuttgart.citydoctor2.gui;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
......@@ -10,6 +11,12 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.Tooltip;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -131,9 +138,29 @@ public class CheckDialog {
@FXML
private Label schematronFileLabel;
@FXML
private VBox zipArchiveOptionsVBox;
@FXML
private CheckBox streamCheckOption;
@FXML
private Label streamCheckLabel;
@FXML
private VBox streamCheckParametersVBox;
@FXML
private Label outputPathLabel;
@FXML
private TextField outputPathTextField;
@FXML
private Button outputPathBtn;
@FXML
private CheckBox pdfReportsOption;
@FXML
private CheckBox xmlReportsOption;
private CityDoctorController controller;
private FilterPane filterPane;
private MainWindow window;
private boolean zipArchiveMode;
public CheckDialog(MainWindow window, Window parent, CityDoctorController controller) throws IOException {
this.window = window;
......@@ -153,6 +180,8 @@ public class CheckDialog {
}
public void initialize() {
setupZipArchiveOptions();
createEnableColumn(geometricTable);
createNameColumn(geometricTable);
createValueColumn(geometricTable);
......@@ -256,6 +285,30 @@ public class CheckDialog {
});
}
private void setupZipArchiveOptions() {
streamCheckOption.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
streamCheckParametersVBox.setDisable(!streamCheckOption.isSelected());
}
});
streamCheckOption.setText(Localization.getText("CheckDialog.streamCheckOption"));
streamCheckLabel.setTooltip(new Tooltip(Localization.getText("CheckDialog.streamCheckLabel")));
outputPathLabel.setText(Localization.getText("CheckDialog.outputPathLabel"));
outputPathBtn.setText(Localization.getText("CheckDialog.outputPathBtn"));
pdfReportsOption.setText(Localization.getText("CheckDialog.pdfReportsOption"));
xmlReportsOption.setText(Localization.getText("CheckDialog.xmlReportsOption"));
showZipArchiveOptions(false);
}
public void showZipArchiveOptions(boolean enabled) {
zipArchiveOptionsVBox.setDisable(!enabled);
zipArchiveOptionsVBox.setVisible(enabled);
zipArchiveMode = enabled;
}
private void setupSelectButton() {
selectBtn.setOnAction(ae -> {
FileChooser chooser = new FileChooser();
......@@ -416,13 +469,33 @@ public class CheckDialog {
checkBtn.setDisable(true);
cancelBtn.setDisable(true);
stage.setOnCloseRequest(Event::consume);
Thread t = new Thread(() -> {
try {
if (logger.isInfoEnabled()) {
String startingChecks = Localization.getText("CheckDialog.startingChecks");
logger.info(startingChecks);
}
controller.startChecks(config, progress::setProgress);
if (zipArchiveMode) {
Path outputPath = null;
if (streamCheckOption.isSelected()) {
if (outputPathTextField.getText().isEmpty()) {
Alert warning = new Alert(Alert.AlertType.ERROR);
warning.setTitle("Error");
warning.setContentText(Localization.getText("CheckDialog.noPathError"));
warning.showAndWait();
return;
}
outputPath = Path.of(outputPathTextField.getText());
progress.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
}
controller.startZipFileChecks(config, progress::setProgress, streamCheckOption.isSelected(),
outputPath, pdfReportsOption.isSelected(),
xmlReportsOption.isSelected());
} else {
controller.startChecks(config, progress::setProgress);
}
if (logger.isInfoEnabled()) {
String checksDone = Localization.getText("CheckDialog.checksDone");
logger.info(checksDone);
......@@ -574,6 +647,7 @@ public class CheckDialog {
}
}
public void show() {
Platform.runLater(() -> {
if (controller.getCurrentConfig() != null) {
......
......@@ -100,6 +100,7 @@ public class ZipEntryManager {
private CityDoctorController controller;
private int currentlyLoadedEntry = -1;
private CheckDialog dialog;
private String unknownValueText = Localization.getText("ZipEntryManager.unknownValue");
......@@ -120,6 +121,8 @@ public class ZipEntryManager {
stage.close();
}
});
dialog = new CheckDialog(null, parent, controller);
dialog.showZipArchiveOptions(true);
}
public void initialize() {
......@@ -234,6 +237,19 @@ public class ZipEntryManager {
t.start();
});
checkAllBtn.setOnAction(e -> {
disableTaskButtons();
setEntryListLocked(true);
try {
dialog.show();
} finally {
setEntryListLocked(false);
}
});
cancelBtn.setOnAction(e -> stage.close());
}
......
......@@ -2,6 +2,7 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.Tab?>
......@@ -16,7 +17,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox prefHeight="800.0" spacing="15.0" xmlns="http://javafx.com/javafx/8.0.221" xmlns:fx="http://javafx.com/fxml/1">
<VBox prefHeight="800.0" spacing="15.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TabPane fx:id="tabPane" VBox.vgrow="ALWAYS">
<tabs>
......@@ -51,6 +52,77 @@
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
<VBox fx:id="zipArchiveOptionsVBox" prefHeight="176.0" prefWidth="485.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<CheckBox fx:id="streamCheckOption" mnemonicParsing="false"
text="Use low memory mode">
<font>
<Font size="14.0"/>
</font>
</CheckBox>
<Label fx:id="streamCheckLabel" text="(?)" underline="true">
<opaqueInsets>
<Insets/>
</opaqueInsets>
<padding>
<Insets left="3.0"/>
</padding>
<font>
<Font size="14.0"/>
</font>
</Label>
</children>
</HBox>
<VBox fx:id="streamCheckParametersVBox" prefHeight="200.0" prefWidth="100.0">
<children>
<Label fx:id="outputPathLabel" text="Output path:">
<font>
<Font size="14.0"/>
</font>
</Label>
<HBox prefWidth="485.0">
<children>
<TextField fx:id="outputPathTextField" prefHeight="25.0"
prefWidth="291.0">
<font>
<Font size="14.0"/>
</font>
</TextField>
<Button fx:id="outputPathBtn" mnemonicParsing="false" prefHeight="30.0"
prefWidth="86.0" text="Select">
<font>
<Font size="14.0"/>
</font>
</Button>
</children>
</HBox>
<CheckBox fx:id="pdfReportsOption" mnemonicParsing="false"
text="Create PDF reports">
<padding>
<Insets top="10.0"/>
</padding>
<font>
<Font size="14.0"/>
</font>
</CheckBox>
<CheckBox layoutX="10.0" layoutY="60.0" mnemonicParsing="false"
text="Create XML reports" fx:id="xmlReportsOption">
<padding>
<Insets top="10.0"/>
</padding>
<font>
<Font size="14.0"/>
</font>
</CheckBox>
</children>
</VBox>
</children>
<HBox.margin>
<Insets left="30.0"/>
</HBox.margin>
</VBox>
</children>
</HBox>
<HBox spacing="5.0" VBox.vgrow="NEVER">
......
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