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
5443cf78
Commit
5443cf78
authored
2 months ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Feat: Add ProgressBar to ZipEntryPicker
parent
3146882d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java
+2
-2
...e/hft/stuttgart/citydoctor2/gui/CityDoctorController.java
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
+53
-12
...java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.fxml
+13
-6
...rces/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.fxml
with
68 additions
and
20 deletions
+68
-20
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java
+
2
-
2
View file @
5443cf78
...
@@ -189,8 +189,8 @@ public class CityDoctorController {
...
@@ -189,8 +189,8 @@ public class CityDoctorController {
**/
**/
}
}
public
void
decompressZipEntry
(
CityGmlZipEntry
entry
)
{
public
void
decompressZipEntry
(
CityGmlZipEntry
entry
,
ProgressListener
l
)
{
entry
.
loadEntry
(
currentConfig
);
entry
.
loadEntry
(
currentConfig
,
l
);
}
}
public
CityGmlZipArchive
getZipArchive
()
{
public
CityGmlZipArchive
getZipArchive
()
{
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
+
53
-
12
View file @
5443cf78
...
@@ -13,6 +13,7 @@ import javafx.scene.Scene;
...
@@ -13,6 +13,7 @@ import javafx.scene.Scene;
import
javafx.scene.control.Button
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.ListView
;
import
javafx.scene.control.ListView
;
import
javafx.scene.control.ProgressBar
;
import
javafx.scene.control.TextField
;
import
javafx.scene.control.TextField
;
import
javafx.scene.control.TitledPane
;
import
javafx.scene.control.TitledPane
;
import
javafx.scene.control.Tooltip
;
import
javafx.scene.control.Tooltip
;
...
@@ -87,6 +88,10 @@ public class ZipEntryPicker {
...
@@ -87,6 +88,10 @@ public class ZipEntryPicker {
@FXML
@FXML
private
ListView
<
ZipEntryNode
>
entryList
;
private
ListView
<
ZipEntryNode
>
entryList
;
@FXML
private
ProgressBar
progress
;
@FXML
private
ProgressBar
subProgress
;
private
CityDoctorController
controller
;
private
CityDoctorController
controller
;
...
@@ -110,14 +115,16 @@ public class ZipEntryPicker {
...
@@ -110,14 +115,16 @@ public class ZipEntryPicker {
stage
.
close
();
stage
.
close
();
}
}
});
});
}
public
void
initialize
()
{
subProgress
.
setVisible
(
false
);
entryList
.
getSelectionModel
().
selectedItemProperty
().
addListener
((
obs
,
oldI
,
newI
)
->
{
entryList
.
getSelectionModel
().
selectedItemProperty
().
addListener
((
obs
,
oldI
,
newI
)
->
{
if
(
newI
!=
null
)
{
if
(
newI
!=
null
)
{
showMetadata
(
newI
.
getEntry
());
showMetadata
(
newI
.
getEntry
());
}
}
});
});
}
entryList
.
setCellFactory
(
param
->
new
ZipEntryListCell
());
public
void
initialize
()
{
setupButtons
();
setupButtons
();
applyLocalization
();
applyLocalization
();
populateZipEntryList
();
populateZipEntryList
();
...
@@ -142,23 +149,52 @@ public class ZipEntryPicker {
...
@@ -142,23 +149,52 @@ public class ZipEntryPicker {
}
}
decompressBtn
.
setOnAction
(
e
->
{
decompressBtn
.
setOnAction
(
e
->
{
disableTaskButtons
();
Thread
t
=
new
Thread
(()
->
{
CityGmlZipEntry
entry
=
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
();
CityGmlZipEntry
entry
=
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
();
controller
.
decompressZipEntry
(
entry
);
controller
.
decompressZipEntry
(
entry
,
progressValue
->
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
());
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
});
});
t
.
start
();
});
});
loadBtn
.
setOnAction
(
e
->
{
loadBtn
.
setOnAction
(
e
->
{
disableTaskButtons
();
CityGmlZipEntry
entry
=
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
();
CityGmlZipEntry
entry
=
entryList
.
getSelectionModel
().
getSelectedItem
().
getEntry
();
});
});
decompressAllBtn
.
setOnAction
(
e
->
{
decompressAllBtn
.
setOnAction
(
e
->
{
disableTaskButtons
();
subProgress
.
setVisible
(
true
);
subProgress
.
setProgress
(
0
);
Thread
t
=
new
Thread
(()
->
{
progress
.
setProgress
(
0
);
int
count
=
0
;
int
total
=
entryList
.
getItems
().
size
();
for
(
ZipEntryNode
node
:
entryList
.
getItems
())
{
for
(
ZipEntryNode
node
:
entryList
.
getItems
())
{
controller
.
decompressZipEntry
(
node
.
getEntry
());
controller
.
decompressZipEntry
(
node
.
getEntry
(),
progressValue
->
Platform
.
runLater
(()
->
subProgress
.
setProgress
(
progressValue
))
);
count
++;
double
progressValue
=
count
*
1.0
/
total
;
Platform
.
runLater
(()
->
progress
.
setProgress
(
progressValue
));
}
}
Platform
.
runLater
(()
->
{
subProgress
.
setVisible
(
false
);
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
populateZipEntryList
(
entryList
.
getSelectionModel
().
getSelectedIndex
());
decompressAllBtn
.
setDisable
(
true
);
});
});
t
.
start
();
});
});
cancelBtn
.
setOnAction
(
e
->
stage
.
close
());
cancelBtn
.
setOnAction
(
e
->
stage
.
close
());
...
@@ -190,7 +226,6 @@ public class ZipEntryPicker {
...
@@ -190,7 +226,6 @@ public class ZipEntryPicker {
private
void
populateZipEntryList
(
int
selectionIndex
)
{
private
void
populateZipEntryList
(
int
selectionIndex
)
{
entryList
.
getItems
().
clear
();
entryList
.
getItems
().
clear
();
entryList
.
setCellFactory
(
param
->
new
ZipEntryListCell
());
for
(
CityGmlZipEntry
entry
:
archive
.
getEntries
())
{
for
(
CityGmlZipEntry
entry
:
archive
.
getEntries
())
{
entryList
.
getItems
().
add
(
new
ZipEntryNode
(
entry
));
entryList
.
getItems
().
add
(
new
ZipEntryNode
(
entry
));
}
}
...
@@ -245,6 +280,12 @@ public class ZipEntryPicker {
...
@@ -245,6 +280,12 @@ public class ZipEntryPicker {
}
}
}
}
private
void
disableTaskButtons
()
{
decompressBtn
.
setDisable
(
true
);
loadBtn
.
setDisable
(
true
);
decompressAllBtn
.
setDisable
(
true
);
}
private
String
getErrorText
(
ZipEntryErrorType
error
)
{
private
String
getErrorText
(
ZipEntryErrorType
error
)
{
switch
(
error
)
{
switch
(
error
)
{
case
EXCESSIVE_FILESIZE
->
{
case
EXCESSIVE_FILESIZE
->
{
...
...
This diff is collapsed.
Click to expand it.
CityDoctorParent/Extensions/CityDoctorGUI/src/main/resources/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.fxml
+
13
-
6
View file @
5443cf78
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Font?>
...
@@ -140,12 +141,18 @@
...
@@ -140,12 +141,18 @@
</HBox>
</HBox>
<HBox
spacing=
"5.0"
>
<HBox
spacing=
"5.0"
>
<children>
<children>
<ProgressBar
fx:id=
"progress"
maxWidth=
"1.7976931348623157E308"
minHeight=
"40.0"
prefHeight=
"40.0"
<StackPane
HBox.hgrow=
"ALWAYS"
>
progress=
"0.0"
HBox.hgrow=
"ALWAYS"
>
<children>
<ProgressBar
fx:id=
"progress"
maxWidth=
"1.7976931348623157E308"
minHeight=
"40.0"
prefHeight=
"40.0"
progress=
"0.0"
>
<padding>
<padding>
<Insets
bottom=
"5.0"
right=
"5.0"
top=
"5.0"
/>
<Insets
bottom=
"5.0"
right=
"5.0"
top=
"5.0"
/>
</padding>
</padding>
</ProgressBar>
</ProgressBar>
<ProgressBar
fx:id=
"subProgress"
prefHeight=
"11.0"
prefWidth=
"520.0"
progress=
"0.0"
StackPane.alignment=
"CENTER_LEFT"
/>
</children>
</StackPane>
<Button
fx:id=
"cancelBtn"
alignment=
"CENTER"
mnemonicParsing=
"false"
text=
"Cancel"
>
<Button
fx:id=
"cancelBtn"
alignment=
"CENTER"
mnemonicParsing=
"false"
text=
"Cancel"
>
<font>
<font>
<Font
size=
"14.0"
/>
<Font
size=
"14.0"
/>
...
...
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