Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
f123a7ac
Commit
f123a7ac
authored
Jan 10, 2025
by
Riegel
Browse files
Refactor: Add locking of entryList during operations
parent
cdbfb988
Changes
1
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java
View file @
f123a7ac
...
@@ -150,6 +150,7 @@ public class ZipEntryManager {
...
@@ -150,6 +150,7 @@ public class ZipEntryManager {
decompressBtn
.
setOnAction
(
e
->
{
decompressBtn
.
setOnAction
(
e
->
{
disableTaskButtons
();
disableTaskButtons
();
setEntryListLocked
(
true
);
Thread
t
=
new
Thread
(()
->
{
Thread
t
=
new
Thread
(()
->
{
CityGmlZipEntry
entry
=
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
();
CityGmlZipEntry
entry
=
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
();
logger
.
info
(
"Decompressing entry \"{}\""
,
entry
.
getDisplayName
());
logger
.
info
(
"Decompressing entry \"{}\""
,
entry
.
getDisplayName
());
...
@@ -158,6 +159,8 @@ public class ZipEntryManager {
...
@@ -158,6 +159,8 @@ public class ZipEntryManager {
);
);
Platform
.
runLater
(()
->
{
Platform
.
runLater
(()
->
{
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
progress
.
setProgress
(
0
);
setEntryListLocked
(
false
);
});
});
});
});
t
.
setDaemon
(
true
);
t
.
setDaemon
(
true
);
...
@@ -167,8 +170,7 @@ public class ZipEntryManager {
...
@@ -167,8 +170,7 @@ public class ZipEntryManager {
loadBtn
.
setOnAction
(
e
->
{
loadBtn
.
setOnAction
(
e
->
{
disableTaskButtons
();
disableTaskButtons
();
entryList
.
setMouseTransparent
(
true
);
setEntryListLocked
(
true
);
entryList
.
setFocusTraversable
(
false
);
try
{
try
{
int
selectedIndex
=
entryList
.
getSelectionModel
().
getSelectedIndex
();
int
selectedIndex
=
entryList
.
getSelectionModel
().
getSelectedIndex
();
if
(
selectedIndex
==
currentlyLoadedEntry
)
{
if
(
selectedIndex
==
currentlyLoadedEntry
)
{
...
@@ -189,14 +191,14 @@ public class ZipEntryManager {
...
@@ -189,14 +191,14 @@ public class ZipEntryManager {
currentlyLoadedEntry
=
selectedIndex
;
currentlyLoadedEntry
=
selectedIndex
;
stage
.
hide
();
stage
.
hide
();
}
finally
{
}
finally
{
entryList
.
setMouseTransparent
(
false
);
setEntryListLocked
(
false
);
entryList
.
setFocusTraversable
(
true
);
}
}
});
});
decompressAllBtn
.
setOnAction
(
e
->
{
decompressAllBtn
.
setOnAction
(
e
->
{
disableTaskButtons
();
disableTaskButtons
();
setEntryListLocked
(
true
);
subProgress
.
setVisible
(
true
);
subProgress
.
setVisible
(
true
);
subProgress
.
setProgress
(
0
);
subProgress
.
setProgress
(
0
);
Thread
t
=
new
Thread
(()
->
{
Thread
t
=
new
Thread
(()
->
{
...
@@ -215,6 +217,8 @@ public class ZipEntryManager {
...
@@ -215,6 +217,8 @@ public class ZipEntryManager {
Platform
.
runLater
(()
->
{
Platform
.
runLater
(()
->
{
subProgress
.
setVisible
(
false
);
subProgress
.
setVisible
(
false
);
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
progress
.
setProgress
(
0
);
setEntryListLocked
(
false
);
});
});
});
});
t
.
setDaemon
(
true
);
t
.
setDaemon
(
true
);
...
@@ -329,6 +333,11 @@ public class ZipEntryManager {
...
@@ -329,6 +333,11 @@ public class ZipEntryManager {
}
}
}
}
private
void
setEntryListLocked
(
boolean
locked
)
{
entryList
.
setMouseTransparent
(
locked
);
entryList
.
setFocusTraversable
(!
locked
);
}
public
void
show
()
{
public
void
show
()
{
Platform
.
runLater
(()
->
{
Platform
.
runLater
(()
->
{
stage
.
showAndWait
();
stage
.
showAndWait
();
...
...
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