Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
9bd18e59
Commit
9bd18e59
authored
1 month ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Feat: Add saveBtn to ZipEntryManager
parent
faa5b330
master
dev
dev_gui_features_zip_loading
archive/dev_gui_features_zip_loading
2 merge requests
!28
Version 3.17.0 Release
,
!26
Add ZIP-archive support
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java
+29
-3
...ava/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.fxml
+75
-53
...ces/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.fxml
with
104 additions
and
56 deletions
+104
-56
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java
+
29
-
3
View file @
9bd18e59
...
...
@@ -2,6 +2,7 @@ package de.hft.stuttgart.citydoctor2.gui;
import
de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryListCell
;
import
de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryNode
;
import
de.hft.stuttgart.citydoctor2.utils.ArchivePacker
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive
;
import
de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry
;
...
...
@@ -22,14 +23,17 @@ import javafx.scene.image.ImageView;
import
javafx.scene.input.KeyCode
;
import
javafx.scene.input.KeyEvent
;
import
javafx.scene.layout.VBox
;
import
javafx.stage.FileChooser
;
import
javafx.stage.Modality
;
import
javafx.stage.Stage
;
import
javafx.stage.Window
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.function.Predicate
;
public
class
ZipEntryManager
{
...
...
@@ -96,6 +100,11 @@ public class ZipEntryManager {
@FXML
private
ImageView
showReportImageView
;
@FXML
private
Button
saveBtn
;
@FXML
private
ImageView
saveImageView
;
@FXML
private
ListView
<
ZipEntryNode
>
entryList
;
@FXML
...
...
@@ -165,6 +174,10 @@ public class ZipEntryManager {
Image
img
=
new
Image
(
inStream
);
showReportImageView
.
setImage
(
img
);
}
try
(
InputStream
inStream
=
MainWindow
.
class
.
getResourceAsStream
(
"icons/save.png"
))
{
Image
img
=
new
Image
(
inStream
);
saveImageView
.
setImage
(
img
);
}
}
catch
(
IOException
ignored
)
{
//ignore exceptions
}
...
...
@@ -273,6 +286,19 @@ public class ZipEntryManager {
});
showReportBtn
.
setDisable
(
true
);
saveBtn
.
setOnAction
(
e
->
{
FileChooser
fileChooser
=
new
FileChooser
();
fileChooser
.
setTitle
(
"Export Zip file"
);
FileChooser
.
ExtensionFilter
zipFilter
=
new
FileChooser
.
ExtensionFilter
(
"Zip File"
,
"*.zip"
);
fileChooser
.
getExtensionFilters
().
add
(
zipFilter
);
File
f
=
fileChooser
.
showSaveDialog
(
stage
.
getOwner
());
if
(
f
!=
null
)
{
ArchivePacker
.
packArchive
(
f
.
getAbsolutePath
(),
archive
);
}
});
saveBtn
.
setDisable
(
true
);
cancelBtn
.
setOnAction
(
e
->
stage
.
close
());
}
...
...
@@ -311,9 +337,9 @@ public class ZipEntryManager {
entryList
.
getSelectionModel
().
clearSelection
();
entryList
.
getSelectionModel
().
select
(
selectionIndex
);
showMetadata
(
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
());
decompressAllBtn
.
setDisable
(
entryList
.
getItems
().
stream
().
allMatch
(
zip
Entr
yNode
->
(
zipEntryNode
.
getEntry
().
isDecompressed
())
||
zipEntryNode
.
getEntry
().
getErrorType
()
!=
null
));
Predicate
<
ZipEntryNode
>
allEntriesDecompressed
=
node
->
(
node
.
getEntry
().
isDecompressed
()
||
node
.
getEntry
().
getErrorType
()
!=
null
);
decompressAllBtn
.
setDisable
(
entryList
.
getItems
().
stream
().
allMatch
(
all
Entr
iesDecompressed
));
saveBtn
.
setDisable
(
entryList
.
getItems
().
stream
().
allMatch
(
Predicate
.
not
(
allEntriesDecompressed
)
));
}
private
void
showMetadata
(
CityGmlZipEntry
entry
)
{
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.fxml
+
75
-
53
View file @
9bd18e59
...
...
@@ -17,60 +17,82 @@
<VBox
xmlns=
"http://javafx.com/javafx/22"
xmlns:fx=
"http://javafx.com/fxml/1"
>
<children>
<HBox
prefHeight=
"50.0"
prefWidth=
"200.0"
spacing=
"5.0"
>
<padding>
<Insets
bottom=
"5.0"
left=
"5.0"
right=
"5.0"
top=
"5.0"
/>
</padding>
<children>
<Button
fx:id=
"loadBtn"
alignment=
"CENTER"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"loadImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Button
fx:id=
"decompressBtn"
alignment=
"CENTER"
layoutX=
"15.0"
layoutY=
"15.0"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"decompressImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Button
fx:id=
"showReportBtn"
alignment=
"CENTER"
layoutX=
"70.0"
layoutY=
"15.0"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"showReportImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Separator
orientation=
"VERTICAL"
prefHeight=
"200.0"
/>
<Button
fx:id=
"decompressAllBtn"
alignment=
"CENTER"
layoutX=
"70.0"
layoutY=
"15.0"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"decompressAllImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Button
fx:id=
"checkAllBtn"
alignment=
"CENTER"
layoutX=
"126.0"
layoutY=
"15.0"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"checkAllImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<HBox
spacing=
"5.0"
>
<children>
<Button
fx:id=
"loadBtn"
alignment=
"CENTER"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"loadImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Button
fx:id=
"decompressBtn"
alignment=
"CENTER"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"decompressImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Button
fx:id=
"showReportBtn"
alignment=
"CENTER"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"showReportImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Separator
orientation=
"VERTICAL"
prefHeight=
"200.0"
/>
<Button
fx:id=
"decompressAllBtn"
alignment=
"CENTER"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"decompressAllImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
<Button
fx:id=
"checkAllBtn"
alignment=
"CENTER"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"checkAllImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
</children>
<padding>
<Insets
bottom=
"5.0"
left=
"5.0"
right=
"5.0"
top=
"5.0"
/>
</padding>
</HBox>
<HBox
alignment=
"TOP_RIGHT"
prefHeight=
"52.0"
prefWidth=
"124.0"
>
<children>
<Button
fx:id=
"saveBtn"
alignment=
"CENTER"
maxWidth=
"1.7976931348623157E308"
mnemonicParsing=
"false"
>
<font>
<Font
size=
"14.0"
/>
</font>
<graphic>
<ImageView
fx:id=
"saveImageView"
fitHeight=
"32.0"
fitWidth=
"32.0"
pickOnBounds=
"true"
preserveRatio=
"true"
/>
</graphic>
</Button>
</children>
<padding>
<Insets
bottom=
"5.0"
left=
"5.0"
right=
"5.0"
top=
"5.0"
/>
</padding>
</HBox>
</children>
</HBox>
<HBox
fillHeight=
"false"
prefHeight=
"200.0"
prefWidth=
"600.0"
VBox.vgrow=
"ALWAYS"
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets