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
1c4d930e
Commit
1c4d930e
authored
2 months ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Refactor: Improve handling of ZipEntryPicker
parent
88f03504
master
dev
dev_gui_features_zip_loading
3.17.0
archive/dev_gui_features_zip_loading
2 merge requests
!28
Version 3.17.0 Release
,
!26
Add ZIP-archive support
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
+29
-15
...java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
with
29 additions
and
15 deletions
+29
-15
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
+
29
-
15
View file @
1c4d930e
...
...
@@ -94,7 +94,7 @@ public class ZipEntryPicker {
private
ProgressBar
subProgress
;
private
CityDoctorController
controller
;
private
int
currentlyLoadedEntry
=
-
1
;
private
String
unknownValueText
=
Localization
.
getText
(
"ZipEntryPicker.unknownValue"
);
...
...
@@ -156,10 +156,6 @@ public class ZipEntryPicker {
Platform
.
runLater
(()
->
progress
.
setProgress
(
progressValue
))
);
Platform
.
runLater
(()
->
{
if
(!
decompressAllBtn
.
isDisable
()
&&
entryList
.
getItems
().
stream
().
allMatch
(
zipEntryNode
->
zipEntryNode
.
getEntry
().
isDecompressed
()))
{
decompressAllBtn
.
setDisable
(
true
);
}
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
});
});
...
...
@@ -169,17 +165,31 @@ public class ZipEntryPicker {
loadBtn
.
setOnAction
(
e
->
{
disableTaskButtons
();
entryList
.
setMouseTransparent
(
true
);
entryList
.
setFocusTraversable
(
false
);
try
{
int
selectedIndex
=
entryList
.
getSelectionModel
().
getSelectedIndex
();
if
(
selectedIndex
==
currentlyLoadedEntry
)
{
stage
.
hide
();
return
;
}
CityGmlZipEntry
entry
=
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
();
if
(
entry
.
getErrorType
()
!=
null
)
{
/**
* Button
i
s disabled when an erroneous entry gets selected.
* Button s
hould be
disabled when an erroneous entry gets selected.
* Silently fail in case an erroneous entry is somehow selected on Action.
*/
logger
.
debug
(
"IllegalState: loadBtn was pressed while an erroneous entry was selected"
);
populateZipEntryList
(
selectedIndex
);
return
;
}
controller
.
loadZipEntry
(
entry
);
currentlyLoadedEntry
=
selectedIndex
;
stage
.
hide
();
}
finally
{
entryList
.
setMouseTransparent
(
false
);
entryList
.
setFocusTraversable
(
true
);
}
});
...
...
@@ -242,6 +252,8 @@ public class ZipEntryPicker {
entryList
.
getSelectionModel
().
clearSelection
();
entryList
.
getSelectionModel
().
select
(
selectionIndex
);
showMetadata
(
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
());
decompressAllBtn
.
setDisable
(
entryList
.
getItems
().
stream
().
allMatch
(
zipEntryNode
->
zipEntryNode
.
getEntry
().
isDecompressed
()));
}
private
void
showMetadata
(
CityGmlZipEntry
entry
)
{
...
...
@@ -288,6 +300,7 @@ public class ZipEntryPicker {
}
objectCountValue
.
setText
(
String
.
valueOf
(
entry
.
getModel
().
getNumberOfFeatures
()));
}
}
private
void
disableTaskButtons
()
{
...
...
@@ -314,5 +327,6 @@ public class ZipEntryPicker {
Platform
.
runLater
(()
->
{
stage
.
showAndWait
();
});
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
}
}
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