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
fb528f1d
Commit
fb528f1d
authored
2 months ago
by
Riegel
Browse files
Options
Download
Email Patches
Plain Diff
Feat: Implement populating of ZipEntryList
parent
6037d7a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
+66
-3
...java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
with
66 additions
and
3 deletions
+66
-3
CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryPicker.java
+
66
-
3
View file @
fb528f1d
...
@@ -82,7 +82,6 @@ public class ZipEntryPicker {
...
@@ -82,7 +82,6 @@ public class ZipEntryPicker {
this
.
controller
=
controller
;
this
.
controller
=
controller
;
archive
=
controller
.
getZipArchive
();
archive
=
controller
.
getZipArchive
();
VBox
box
=
loader
.
load
();
VBox
box
=
loader
.
load
();
this
.
controller
=
controller
;
stage
=
new
Stage
();
stage
=
new
Stage
();
stage
.
getIcons
().
add
(
new
Image
(
MainWindow
.
class
.
getResourceAsStream
(
"icons/CityDoctor-Logo-rot_klein.jpg"
)));
stage
.
getIcons
().
add
(
new
Image
(
MainWindow
.
class
.
getResourceAsStream
(
"icons/CityDoctor-Logo-rot_klein.jpg"
)));
stage
.
setScene
(
new
Scene
(
box
));
stage
.
setScene
(
new
Scene
(
box
));
...
@@ -94,11 +93,16 @@ public class ZipEntryPicker {
...
@@ -94,11 +93,16 @@ public class ZipEntryPicker {
stage
.
close
();
stage
.
close
();
}
}
});
});
entryList
.
getSelectionModel
().
selectedItemProperty
().
addListener
((
obs
,
oldI
,
newI
)
->
{
if
(
newI
!=
null
)
{
showMetadata
(
newI
.
getEntry
());
}
});
}
}
public
void
initialize
()
{
public
void
initialize
()
{
applyLanguageControls
();
applyLocalization
();
applyLocalization
();
populateZipEntryList
();
}
}
private
void
applyLocalization
()
{
private
void
applyLocalization
()
{
...
@@ -120,7 +124,66 @@ public class ZipEntryPicker {
...
@@ -120,7 +124,66 @@ public class ZipEntryPicker {
cancelBtn
.
setText
(
Localization
.
getText
(
"ZipEntryPicker.cancelBtn"
));
cancelBtn
.
setText
(
Localization
.
getText
(
"ZipEntryPicker.cancelBtn"
));
}
}
private
void
applyLanguageControls
()
{
private
void
populateZipEntryList
()
{
entryList
.
getItems
().
clear
();
entryList
.
setCellFactory
(
param
->
new
ZipEntryListCell
());
for
(
CityGmlZipEntry
entry
:
archive
.
getEntries
())
{
entryList
.
getItems
().
add
(
new
ZipEntryNode
(
entry
));
}
}
private
void
showMetadata
(
CityGmlZipEntry
entry
)
{
subpathValueTxt
.
setText
(
entry
.
getFileName
());
if
(
entry
.
getFileSize
()
!=
-
1L
)
{
long
fileSize
=
entry
.
getFileSize
();
long
KB
=
1024L
;
long
MB
=
KB
*
KB
;
long
GB
=
MB
*
KB
;
if
(
fileSize
<
KB
)
{
filesizeValue
.
setText
(
"< 1 KB"
);
}
else
if
(
fileSize
<
MB
)
{
filesizeValue
.
setText
(
String
.
format
(
"%s KB"
,
fileSize
/
KB
));
}
else
if
(
fileSize
<
GB
)
{
filesizeValue
.
setText
(
String
.
format
(
"%s MB"
,
fileSize
/
MB
));
}
else
{
double
gigabytes
=
(
double
)
fileSize
/
GB
;
filesizeValue
.
setText
(
String
.
format
(
"%.2f GB"
,
gigabytes
));
}
}
else
{
filesizeValue
.
setText
(
unknownValueText
);
}
if
(
entry
.
getErrorType
()
!=
null
)
{
erroneousValue
.
setText
(
getErrorText
(
entry
.
getErrorType
()));
validatedValue
.
setText
(
unknownValueText
);
objectCountValue
.
setText
(
unknownValueText
);
}
else
{
erroneousValue
.
setText
(
Localization
.
getText
(
"ZipEntryPicker.no"
));
if
(
entry
.
getModel
()
==
null
)
{
}
}
}
private
String
getErrorText
(
ZipEntryErrorType
error
)
{
switch
(
error
)
{
case
EXCESSIVE_FILESIZE
->
{
return
Localization
.
getText
(
"ZipEntryPicker.excessiveFileSize"
);
}
case
INVALID_CITY_GML_FILE
->
{
return
Localization
.
getText
(
"ZipEntryPicker.invalidCityGml"
);
}
default
->
{
return
Localization
.
getText
(
"ZipEntryPicker.ioError"
);
}
}
}
public
void
show
()
{
Platform
.
runLater
(()
->
{
stage
.
showAndWait
();
});
}
}
}
}
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