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
a5a82382
Commit
a5a82382
authored
Jul 31, 2024
by
Riegel
Browse files
Open Source release of CityDoctor-GUI
parent
7a22ca9c
Pipeline
#10028
failed with stage
in 7 seconds
Changes
126
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorGUI/.gitignore
0 → 100644
View file @
a5a82382
GUISettings.properties
/.gradle/
CityDoctorParent/CityDoctorGUI/checkForSolid.xml
0 → 100644
View file @
a5a82382
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns=
"http://purl.oclc.org/dsdl/schematron"
queryBinding=
"xslt2"
>
<ns
prefix=
"gml"
uri=
"http://www.opengis.net/gml"
/>
<ns
prefix=
"bldg"
uri=
"http://www.opengis.net/citygml/building/2.0"
/>
<pattern>
<rule
context=
"//*:Building"
>
<assert
test=
"count(descendant::*:lod1Solid) > 0 or count(descendant::*:lod2Solid) > 0 or count(descendant::*:lod3Solid) > 0 or count(descendant::*:lod4Solid) > 0"
><value-of
select=
"@gml:id | @id"
/>
||||SE_ATTRIBUTE_MISSING||any solid
</assert>
</rule>
<rule
context=
"//*:BuildingPart"
>
<assert
test=
"count(*:lod1Solid) = 1 or count(*:lod2Solid) = 1 or count(*:lod3Solid) = 1 or count(*:lod4Solid) = 1"
><value-of
select=
"ancestor::*:Building/@*:id"
/>
||
<value-of
select=
"@gml:id | @id"
/>
||SE_ATTRIBUTE_MISSING||any solid
</assert>
</rule>
</pattern>
</schema>
CityDoctorParent/CityDoctorGUI/pom.xml
0 → 100644
View file @
a5a82382
<?xml version="1.0" encoding="utf-8"?>
<project
xmlns=
"https://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorParent
</artifactId>
<version>
3.14.1
</version>
<relativePath></relativePath>
</parent>
<artifactId>
CityDoctorGUI
</artifactId>
<name>
CityDoctorGUI
</name>
<description>
Graphical User Interface for CityDoctor
</description>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-jar-plugin
</artifactId>
<version>
3.2.0
</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorModel
</artifactId>
</dependency>
<dependency>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorValidation
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-slf4j18-impl
</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>
create-binaries
</id>
<properties>
<win-jre>
jre-${jre-version-short}-full
</win-jre>
<lin-jre>
${win-jre}
</lin-jre>
<mac-jre>
${win-jre}.jre
</mac-jre>
</properties>
<build>
<plugins>
<plugin>
<groupId>
com.googlecode.maven-download-plugin
</groupId>
<artifactId>
download-maven-plugin
</artifactId>
<version>
1.7.0
</version>
<executions>
<execution>
<id>
downloadWindowsJre
</id>
<phase>
install
</phase>
<goals>
<goal>
wget
</goal>
</goals>
<configuration>
<uri>
https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-windows-amd64-full.zip
</uri>
<unpack>
false
</unpack>
<outputDirectory>
${project.build.directory}/jre/jre-win
</outputDirectory>
<outputFileName>
win-runtime.zip
</outputFileName>
</configuration>
</execution>
<execution>
<id>
downloadLinuxJre
</id>
<phase>
install
</phase>
<goals>
<goal>
wget
</goal>
</goals>
<configuration>
<uri>
https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-linux-amd64-full.tar.gz
</uri>
<unpack>
false
</unpack>
<outputDirectory>
${project.build.directory}/jre/jre-lin
</outputDirectory>
<outputFileName>
lin-runtime.tar.gz
</outputFileName>
</configuration>
</execution>
<execution>
<id>
downloadMacJre
</id>
<phase>
install
</phase>
<goals>
<goal>
wget
</goal>
</goals>
<configuration>
<uri>
https://download.bell-sw.com/java/${jre-version}/bellsoft-jre${jre-version}-macos-amd64-full.zip
</uri>
<unpack>
false
</unpack>
<outputDirectory>
${project.build.directory}/jre/jre-mac
</outputDirectory>
<outputFileName>
mac-runtime.zip
</outputFileName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<version>
3.1.0
</version>
<executions>
<execution>
<id>
unpack
</id>
<phase>
install
</phase>
<configuration>
<target
name=
"unpack"
>
<untar
src=
"${project.build.directory}/jre/jre-lin/lin-runtime.tar.gz"
dest=
"${project.build.directory}/jre/jre-lin/runtime"
compression=
"gzip"
></untar>
<unzip
src=
"${project.build.directory}/jre/jre-win/win-runtime.zip"
dest=
"${project.build.directory}/jre/jre-win/runtime"
></unzip>
<unzip
src=
"${project.build.directory}/jre/jre-mac/mac-runtime.zip"
dest=
"${project.build.directory}/jre/jre-mac/runtime"
></unzip>
</target>
</configuration>
<goals>
<goal>
run
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<configuration>
<appendAssemblyId>
false
</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>
create-archive-no-runtime
</id>
<phase>
install
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<finalName>
${project.artifactId}-${project.version}-no-runtime
</finalName>
<descriptors>
<descriptor>
${project.basedir}/src/assembly/no_runtime/assembly.xml
</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>
create-archive-win
</id>
<phase>
install
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<finalName>
${project.artifactId}-${project.version}-win
</finalName>
<descriptors>
<descriptor>
${project.basedir}/src/assembly/win/assembly.xml
</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>
create-archive-lin
</id>
<phase>
install
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<finalName>
${project.artifactId}-${project.version}-lin
</finalName>
<descriptors>
<descriptor>
${project.basedir}/src/assembly/lin/assembly.xml
</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>
create-archive-mac
</id>
<phase>
install
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<finalName>
${project.artifactId}-${project.version}-mac
</finalName>
<descriptors>
<descriptor>
${project.basedir}/src/assembly/mac/assembly.xml
</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/common/checkForSolid.xml
0 → 100644
View file @
a5a82382
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns=
"http://purl.oclc.org/dsdl/schematron"
queryBinding=
"xslt2"
>
<ns
prefix=
"gml"
uri=
"http://www.opengis.net/gml"
/>
<ns
prefix=
"bldg"
uri=
"http://www.opengis.net/citygml/building/2.0"
/>
<pattern>
<rule
context=
"//*:Building"
>
<assert
test=
"count(descendant::*:lod1Solid) > 0 or count(descendant::*:lod2Solid) > 0 or count(descendant::*:lod3Solid) > 0 or count(descendant::*:lod4Solid) > 0"
><value-of
select=
"@gml:id | @id"
/>
||||SE_ATTRIBUTE_MISSING||any solid
</assert>
</rule>
<rule
context=
"//*:BuildingPart"
>
<assert
test=
"count(*:lod1Solid) = 1 or count(*:lod2Solid) = 1 or count(*:lod3Solid) = 1 or count(*:lod4Solid) = 1"
><value-of
select=
"ancestor::*:Building/@*:id"
/>
||
<value-of
select=
"@gml:id | @id"
/>
||SE_ATTRIBUTE_MISSING||any solid
</assert>
</rule>
</pattern>
</schema>
CityDoctorParent/CityDoctorGUI/src/assembly/lin/assembly.xml
0 → 100644
View file @
a5a82382
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<id>
zip
</id>
<formats>
<format>
zip
</format>
</formats>
<includeBaseDirectory>
false
</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>
app
</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>
${project.basedir}/src/assembly/lin
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
start.sh
</include>
</includes>
<filtered>
true
</filtered>
</fileSet>
<fileSet>
<directory>
${project.basedir}/src/assembly/common
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
checkForSolid.xml
</include>
</includes>
<filtered>
false
</filtered>
</fileSet>
<fileSet>
<directory>
${project.build.directory}/jre/jre-lin/runtime/${lin-jre}/
</directory>
<outputDirectory>
/runtime
</outputDirectory>
<includes>
<include>
**/*
</include>
</includes>
<filtered>
false
</filtered>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/lin/start.sh
0 → 100644
View file @
a5a82382
#!/bin/sh
./runtime/bin/java
-classpath
app/
*
:plugin/
*
de.hft.stuttgart.citydoctor2.gui.CityDoctorGUIStarter
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/mac/assembly.xml
0 → 100644
View file @
a5a82382
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<id>
zip
</id>
<formats>
<format>
zip
</format>
</formats>
<includeBaseDirectory>
false
</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>
app
</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>
${project.basedir}/src/assembly/lin
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
start.sh
</include>
</includes>
<filtered>
true
</filtered>
</fileSet>
<fileSet>
<directory>
${project.basedir}/src/assembly/common
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
checkForSolid.xml
</include>
</includes>
<filtered>
false
</filtered>
</fileSet>
<fileSet>
<directory>
${project.build.directory}/jre/jre-mac/runtime/${mac-jre}/
</directory>
<outputDirectory>
/runtime
</outputDirectory>
<includes>
<include>
**/*
</include>
</includes>
<filtered>
false
</filtered>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/no_runtime/assembly.xml
0 → 100644
View file @
a5a82382
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<id>
zip
</id>
<formats>
<format>
zip
</format>
</formats>
<includeBaseDirectory>
false
</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>
app
</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>
${project.basedir}/src/assembly/no_runtime
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
start.bat
</include>
<include>
start.sh
</include>
</includes>
<filtered>
true
</filtered>
</fileSet>
<fileSet>
<directory>
${project.basedir}/src/assembly/common
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
checkForSolid.xml
</include>
</includes>
<filtered>
false
</filtered>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/no_runtime/start.bat
0 → 100644
View file @
a5a82382
java
-classpath
app
/
*;
plugins
/
*
de
.hft.stuttgart.citydoctor2.gui.CityDoctorGUIStarter
pause
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/no_runtime/start.sh
0 → 100644
View file @
a5a82382
#!/bin/sh
java
-classpath
app/
*
:plugin/
*
de.hft.stuttgart.citydoctor2.gui.CityDoctorGUIStarter
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/win/assembly.xml
0 → 100644
View file @
a5a82382
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<id>
zip
</id>
<formats>
<format>
zip
</format>
</formats>
<includeBaseDirectory>
false
</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>
app
</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>
${project.basedir}/src/assembly/win
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
start.bat
</include>
</includes>
<filtered>
true
</filtered>
</fileSet>
<fileSet>
<directory>
${project.basedir}/src/assembly/common
</directory>
<outputDirectory>
/
</outputDirectory>
<includes>
<include>
checkForSolid.xml
</include>
</includes>
<filtered>
false
</filtered>
</fileSet>
<fileSet>
<directory>
${project.build.directory}/jre/jre-win/runtime/${win-jre}/
</directory>
<outputDirectory>
/runtime
</outputDirectory>
<includes>
<include>
**/*
</include>
</includes>
<filtered>
false
</filtered>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/assembly/win/start.bat
0 → 100644
View file @
a5a82382
"runtime/bin/java.exe"
-classpath
app
/
*;
plugins
/
*
de
.hft.stuttgart.citydoctor2.gui.CityDoctorGUIStarter
pause
\ No newline at end of file
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/AboutDialog.java
0 → 100644
View file @
a5a82382
package
de.hft.stuttgart.citydoctor2.gui
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
javafx.fxml.FXML
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.Scene
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.Label
;
import
javafx.scene.image.Image
;
import
javafx.scene.image.ImageView
;
import
javafx.scene.layout.VBox
;
import
javafx.stage.Modality
;
import
javafx.stage.Stage
;
import
javafx.stage.StageStyle
;
import
javafx.stage.Window
;
public
class
AboutDialog
{
@FXML
private
ImageView
logoView
;
@FXML
private
ImageView
beuthView
;
@FXML
private
ImageView
minisView
;
@FXML
private
ImageView
hftView
;
@FXML
private
Button
closeBtn
;
@FXML
private
Label
cdLabel
;
private
Stage
stage
;
public
AboutDialog
(
Window
parent
)
throws
IOException
{
FXMLLoader
loader
=
new
FXMLLoader
(
AboutDialog
.
class
.
getResource
(
"AboutDialog.fxml"
));
loader
.
setController
(
this
);
VBox
box
=
loader
.
load
();
stage
=
new
Stage
(
StageStyle
.
UTILITY
);
stage
.
setTitle
(
Localization
.
getText
(
"AboutDialog.title"
));
stage
.
setResizable
(
false
);
Scene
scene
=
new
Scene
(
box
);
stage
.
setScene
(
scene
);
stage
.
initOwner
(
parent
);
stage
.
initModality
(
Modality
.
APPLICATION_MODAL
);
}
public
void
initialize
()
{
String
developedBy
=
Localization
.
getText
(
"AboutDialog.developedBy"
);
String
contact
=
Localization
.
getText
(
"AboutDialog.contact"
);
closeBtn
.
setText
(
Localization
.
getText
(
"AboutDialog.closeBtn"
));
cdLabel
.
setText
(
"CityDoctor Version "
+
Localization
.
getText
(
Localization
.
VERSION
)
+
"\n\n"
+
developedBy
+
":\n"
+
"Hochschule für Technik\n"
+
"Beuth Hochschule Berlin\n\n"
+
contact
+
":\n"
+
"Matthias Betz\n"
+
"matthias.betz@hft-stuttgart.de"
);
closeBtn
.
setOnAction
(
ae
->
hide
());
try
{
try
(
InputStream
inStream
=
MainWindow
.
class
.
getResourceAsStream
(
"icons/CityDoctor-Logo-rot_klein.png"
))
{
Image
img
=
new
Image
(
inStream
);
logoView
.
setImage
(
img
);
}
try
(
InputStream
inStream
=
MainWindow
.
class
.
getResourceAsStream
(
"icons/hft_logo.png"
))
{
Image
img
=
new
Image
(
inStream
);
hftView
.
setImage
(
img
);
}
try
(
InputStream
inStream
=
MainWindow
.
class
.
getResourceAsStream
(
"icons/Beuth-Logo_basis.png"
))
{
Image
img
=
new
Image
(
inStream
);
beuthView
.
setImage
(
img
);
}
try
(
InputStream
inStream
=
MainWindow
.
class
.
getResourceAsStream
(
"icons/BMBF_Logo.png"
))
{
Image
img
=
new
Image
(
inStream
);
minisView
.
setImage
(
img
);
}
}
catch
(
IOException
e
)
{
// ignore close exception
}
}
public
void
show
()
{
stage
.
show
();
}
public
void
hide
()
{
stage
.
hide
();
}
}
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CheckDialog.java
0 → 100644
View file @
a5a82382
package
de.hft.stuttgart.citydoctor2.gui
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
de.hft.stuttgart.citydoctor2.check.DefaultParameter
;
import
de.hft.stuttgart.citydoctor2.check.FilterConfiguration
;
import
de.hft.stuttgart.citydoctor2.check.GlobalParameters
;
import
de.hft.stuttgart.citydoctor2.check.Requirement
;
import
de.hft.stuttgart.citydoctor2.check.RequirementConfiguration
;
import
de.hft.stuttgart.citydoctor2.check.RequirementType
;
import
de.hft.stuttgart.citydoctor2.check.Unit
;
import
de.hft.stuttgart.citydoctor2.check.ValidationConfiguration
;
import
de.hft.stuttgart.citydoctor2.checks.Checks
;
import
de.hft.stuttgart.citydoctor2.gui.tree.TreeRequirement
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
javafx.application.Platform
;
import
javafx.event.Event
;
import
javafx.fxml.FXML
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.Scene
;
import
javafx.scene.control.Button
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.ProgressBar
;
import
javafx.scene.control.ScrollPane
;
import
javafx.scene.control.Tab
;
import
javafx.scene.control.TabPane
;
import
javafx.scene.control.TableColumn
;
import
javafx.scene.control.TableView
;
import
javafx.scene.control.TextField
;
import
javafx.scene.control.TreeItem
;
import
javafx.scene.control.TreeTableColumn
;
import
javafx.scene.control.TreeTableView
;
import
javafx.scene.control.cell.CheckBoxTreeTableCell
;
import
javafx.scene.control.cell.PropertyValueFactory
;
import
javafx.scene.control.cell.TextFieldTableCell
;
import
javafx.scene.image.Image
;
import
javafx.scene.image.ImageView
;
import
javafx.scene.layout.VBox
;
import
javafx.stage.FileChooser
;
import
javafx.stage.FileChooser.ExtensionFilter
;
import
javafx.stage.Modality
;
import
javafx.stage.Stage
;
import
javafx.stage.Window
;
import
javafx.util.StringConverter
;
import
javafx.util.converter.DefaultStringConverter
;
public
class
CheckDialog
{
private
static
final
String
NUMBER_OF_ROUNDING_PLACES
=
"numberOfRoundingPlaces"
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
CheckDialog
.
class
);
private
static
final
String
CHECK_ENABLED
=
Localization
.
getText
(
"CheckDialog.checkEnabled"
);
private
static
final
String
NAME
=
Localization
.
getText
(
"CheckDialog.checkName"
);
private
static
final
String
VALUE
=
Localization
.
getText
(
"CheckDialog.parameterValue"
);
private
static
final
String
UNIT
=
Localization
.
getText
(
"CheckDialog.parameterUnit"
);
private
Stage
stage
;
@FXML
private
TreeTableView
<
TreeRequirement
>
geometricTable
;
@FXML
private
TreeTableView
<
TreeRequirement
>
semanticTable
;
@FXML
private
TableView
<
GlobalParameter
>
globalParametersTable
;
@FXML
private
ScrollPane
scrollPane
;
@FXML
private
Button
cancelBtn
;
@FXML
private
Button
checkBtn
;
@FXML
private
ProgressBar
progress
;
@FXML
private
Tab
filterTab
;
@FXML
private
TabPane
tabPane
;
@FXML
private
Button
loadBtn
;
@FXML
private
ImageView
loadView
;
@FXML
private
Button
saveBtn
;
@FXML
private
ImageView
saveView
;
@FXML
private
Button
selectBtn
;
@FXML
private
TextField
schematronField
;
@FXML
private
Tab
checksTab
;
@FXML
private
Label
globalParametersLabel
;
@FXML
private
Label
availableChecksLabel
;
@FXML
private
Label
geometricChecksLabel
;
@FXML
private
Label
semanticChecksLabel
;
@FXML
private
Label
schematronFileLabel
;
private
CityDoctorController
controller
;
private
FilterPane
filterPane
;
private
MainWindow
window
;
public
CheckDialog
(
MainWindow
window
,
Window
parent
,
CityDoctorController
controller
)
throws
IOException
{
this
.
window
=
window
;
this
.
controller
=
controller
;
FXMLLoader
loader
=
new
FXMLLoader
(
CheckDialog
.
class
.
getResource
(
"CheckDialog.fxml"
));
loader
.
setController
(
this
);
VBox
box
=
loader
.
load
();
stage
=
new
Stage
();
stage
.
getIcons
().
add
(
new
Image
(
MainWindow
.
class
.
getResourceAsStream
(
"icons/CityDoctor-Logo-rot_klein.jpg"
)));
Scene
scene
=
new
Scene
(
box
);
stage
.
setScene
(
scene
);
stage
.
initOwner
(
parent
);
stage
.
initModality
(
Modality
.
APPLICATION_MODAL
);
stage
.
setTitle
(
Localization
.
getText
(
"CheckDialog.title"
));
}
public
void
initialize
()
{
createEnableColumn
(
geometricTable
);
createNameColumn
(
geometricTable
);
createValueColumn
(
geometricTable
);
createUnitColumn
(
geometricTable
);
createEnableColumn
(
semanticTable
);
createNameColumn
(
semanticTable
);
createValueColumn
(
semanticTable
);
createUnitColumn
(
semanticTable
);
checksTab
.
setText
(
Localization
.
getText
(
"CheckDialog.checksTab"
));
filterTab
.
setText
(
Localization
.
getText
(
"CheckDialog.filterTab"
));
globalParametersLabel
.
setText
(
Localization
.
getText
(
"CheckDialog.globalParametersLabel"
));
availableChecksLabel
.
setText
(
Localization
.
getText
(
"CheckDialog.availableChecksLabel"
));
geometricChecksLabel
.
setText
(
Localization
.
getText
(
"CheckDialog.geometricChecksLabel"
));
semanticChecksLabel
.
setText
(
Localization
.
getText
(
"CheckDialog.semanticChecksLabel"
));
schematronFileLabel
.
setText
(
Localization
.
getText
(
"CheckDialog.schematronFileLabel"
));
selectBtn
.
setText
(
Localization
.
getText
(
"CheckDialog.selectBtn"
));
checkBtn
.
setText
(
Localization
.
getText
(
"CheckDialog.checkBtn"
));
cancelBtn
.
setText
(
Localization
.
getText
(
"CheckDialog.cancelBtn"
));
List
<
TableColumn
<
GlobalParameter
,
?>>
columns
=
globalParametersTable
.
getColumns
();
TableColumn
<
GlobalParameter
,
String
>
nameCol
=
new
TableColumn
<>(
NAME
);
columns
.
add
(
nameCol
);
nameCol
.
setMinWidth
(
200
);
nameCol
.
setPrefWidth
(
325
);
nameCol
.
setCellValueFactory
(
new
PropertyValueFactory
<>(
"name"
));
setupValueColumns
(
columns
);
TableColumn
<
GlobalParameter
,
Unit
>
unitCol
=
new
TableColumn
<>(
UNIT
);
columns
.
add
(
unitCol
);
unitCol
.
setMinWidth
(
50
);
unitCol
.
setPrefWidth
(
75
);
unitCol
.
setMaxWidth
(
100
);
unitCol
.
setEditable
(
false
);
unitCol
.
setCellValueFactory
(
new
PropertyValueFactory
<>(
"unit"
));
unitCol
.
setCellFactory
(
TextFieldTableCell
.
forTableColumn
(
new
StringConverter
<
Unit
>()
{
@Override
public
String
toString
(
Unit
object
)
{
return
object
.
getRepresentation
();
}
@Override
public
Unit
fromString
(
String
string
)
{
return
Unit
.
valueOf
(
string
);
}
}));
loadImages
();
setupSelectButton
();
setupSaveButton
();
setupLoadButton
();
populateTreeWithChecks
(
geometricTable
,
RequirementType
.
GEOMETRY
,
true
);
populateTreeWithChecks
(
semanticTable
,
RequirementType
.
SEMANTIC
,
false
);
globalParametersTable
.
getItems
().
add
(
new
GlobalParameter
(
NUMBER_OF_ROUNDING_PLACES
,
"8"
,
Unit
.
NONE
));
globalParametersTable
.
getItems
().
add
(
new
GlobalParameter
(
"minVertexDistance"
,
"0.0001"
,
Unit
.
METER
));
cancelBtn
.
setOnAction
(
ea
->
stage
.
close
());
setupCheckButton
();
tabPane
.
getSelectionModel
().
selectedIndexProperty
().
addListener
((
v
,
old
,
newV
)
->
{
if
(
newV
.
intValue
()
==
1
&&
filterPane
==
null
)
{
try
{
getFilterPane
();
}
catch
(
IOException
e
)
{
window
.
showExceptionDialog
(
e
);
}
}
});
schematronField
.
setText
(
ValidationConfiguration
.
CHECK_FOR_SOLID_XML
);
}
private
void
setupValueColumns
(
List
<
TableColumn
<
GlobalParameter
,
?>>
columns
)
{
TableColumn
<
GlobalParameter
,
String
>
valueCol
=
new
TableColumn
<>(
VALUE
);
columns
.
add
(
valueCol
);
valueCol
.
setMinWidth
(
150
);
valueCol
.
setPrefWidth
(
200
);
valueCol
.
setEditable
(
true
);
valueCol
.
setCellValueFactory
(
new
PropertyValueFactory
<>(
"value"
));
valueCol
.
setCellFactory
(
column
->
new
TableEditCell
<
GlobalParameter
,
String
>(
new
DefaultStringConverter
())
{
@Override
public
void
updateItem
(
String
item
,
boolean
empty
)
{
super
.
updateItem
(
item
,
empty
);
if
(!
empty
&&
item
!=
null
)
{
GlobalParameter
row
=
(
GlobalParameter
)
getTableRow
().
getItem
();
if
(
row
==
null
)
{
return
;
}
row
.
setValue
(
item
);
if
(
NUMBER_OF_ROUNDING_PLACES
.
equals
(
row
.
getName
()))
{
setEditable
(
false
);
}
}
}
});
}
private
void
setupSelectButton
()
{
selectBtn
.
setOnAction
(
ae
->
{
FileChooser
chooser
=
new
FileChooser
();
List
<
String
>
extensions
=
new
ArrayList
<>();
extensions
.
add
(
"*.xml"
);
String
schematronFiles
=
Localization
.
getText
(
"CheckDialog.schematronFiles"
);
chooser
.
getExtensionFilters
().
add
(
new
ExtensionFilter
(
schematronFiles
,
extensions
));
File
dir
=
new
File
(
Settings
.
get
(
Settings
.
LAST_OPEN_FOLDER
,
""
));
if
(
dir
.
exists
()
&&
dir
.
isDirectory
())
{
chooser
.
setInitialDirectory
(
dir
);
}
String
schematronChooserTitle
=
Localization
.
getText
(
"CheckDialog.schematronChooserTitle"
);
chooser
.
setTitle
(
schematronChooserTitle
);
File
file
=
chooser
.
showOpenDialog
(
stage
);
if
(
file
!=
null
)
{
schematronField
.
setText
(
file
.
getAbsolutePath
());
}
});
}
private
void
setupLoadButton
()
{
loadBtn
.
setOnAction
(
ae
->
{
FileChooser
fc
=
new
FileChooser
();
String
validationConfiguration
=
Localization
.
getText
(
"CheckDialog.validationConfiguration"
);
fc
.
getExtensionFilters
().
add
(
new
ExtensionFilter
(
validationConfiguration
,
"*.yml"
));
File
dir
=
new
File
(
Settings
.
get
(
Settings
.
LAST_OPEN_FOLDER
,
""
));
if
(
dir
.
exists
()
&&
dir
.
isDirectory
())
{
fc
.
setInitialDirectory
(
dir
);
}
else
{
Settings
.
set
(
Settings
.
LAST_OPEN_FOLDER
,
""
);
}
File
f
=
fc
.
showOpenDialog
(
stage
);
if
(
f
!=
null
)
{
Settings
.
set
(
Settings
.
LAST_OPEN_FOLDER
,
f
.
getParent
());
try
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadValidationConfig
(
f
.
getAbsolutePath
());
applyConfig
(
config
);
}
catch
(
IOException
e
)
{
window
.
showExceptionDialog
(
e
);
}
}
});
}
private
void
setupSaveButton
()
{
saveBtn
.
setOnAction
(
ae
->
{
ValidationConfiguration
config
=
createConfig
();
FileChooser
fc
=
new
FileChooser
();
fc
.
getExtensionFilters
()
.
add
(
new
ExtensionFilter
(
Localization
.
getText
(
"CheckDialog.validationConfiguration"
),
"*.yml"
));
File
dir
=
new
File
(
Settings
.
get
(
Settings
.
LAST_OPEN_FOLDER
,
""
));
if
(
dir
.
exists
()
&&
dir
.
isDirectory
())
{
fc
.
setInitialDirectory
(
dir
);
}
else
{
Settings
.
set
(
Settings
.
LAST_OPEN_FOLDER
,
""
);
}
File
f
=
fc
.
showSaveDialog
(
stage
);
if
(
f
!=
null
)
{
Settings
.
set
(
Settings
.
LAST_OPEN_FOLDER
,
f
.
getParent
());
try
{
config
.
saveAs
(
f
);
}
catch
(
IOException
e
)
{
window
.
showExceptionDialog
(
e
);
}
}
});
}
private
void
applyConfig
(
ValidationConfiguration
config
)
throws
IOException
{
FilterConfiguration
filter
=
config
.
getFilter
();
if
(
filter
!=
null
)
{
getFilterPane
().
applyFilterConfig
(
filter
);
}
Map
<
String
,
RequirementConfiguration
>
checks
=
config
.
getRequirements
();
for
(
Entry
<
String
,
RequirementConfiguration
>
e
:
checks
.
entrySet
())
{
for
(
TreeItem
<
TreeRequirement
>
ti
:
geometricTable
.
getRoot
().
getChildren
())
{
applyCheckConfig
(
e
,
ti
);
}
}
globalParametersTable
.
getItems
().
clear
();
globalParametersTable
.
getItems
().
add
(
new
GlobalParameter
(
GlobalParameters
.
NUMBER_OF_ROUNDING_PLACES
,
config
.
getNumberOfRoundingPlacesAsString
(),
Unit
.
NONE
));
globalParametersTable
.
getItems
().
add
(
new
GlobalParameter
(
GlobalParameters
.
MIN_VERTEX_DISTANCE
,
config
.
getMinVertexDistanceAsString
(),
Unit
.
METER
));
schematronField
.
setText
(
config
.
getSchematronFilePath
());
}
private
FilterPane
getFilterPane
()
throws
IOException
{
if
(
filterPane
==
null
)
{
filterPane
=
new
FilterPane
();
Platform
.
runLater
(()
->
filterTab
.
setContent
(
filterPane
.
getPane
()));
}
return
filterPane
;
}
private
void
applyCheckConfig
(
Entry
<
String
,
RequirementConfiguration
>
e
,
TreeItem
<
TreeRequirement
>
ti
)
{
Requirement
r
=
ti
.
getValue
().
getRequirement
();
RequirementConfiguration
cConfig
=
e
.
getValue
();
if
(
r
.
getId
().
equals
(
e
.
getKey
()))
{
ti
.
getValue
().
getEnabledProperty
().
set
(
cConfig
.
isEnabled
());
for
(
Entry
<
String
,
String
>
paramEntry
:
cConfig
.
getParameters
().
entrySet
())
{
String
name
=
paramEntry
.
getKey
();
String
value
=
paramEntry
.
getValue
();
for
(
TreeItem
<
TreeRequirement
>
configItem
:
ti
.
getChildren
())
{
TreeRequirement
parameterCheck
=
configItem
.
getValue
();
if
(
name
.
equals
(
parameterCheck
.
getNameProperty
().
getValue
()))
{
parameterCheck
.
setValue
(
value
);
}
}
}
}
}
private
boolean
collectCheckConfiguration
(
ValidationConfiguration
config
)
{
collectCheckInformationFromTree
(
config
,
geometricTable
);
collectCheckInformationFromTree
(
config
,
semanticTable
);
config
.
setSchematronFilePathInGlobalParameters
(
schematronField
.
getText
());
config
.
setMinVertexDistanceInGlobalParameters
(
Double
.
parseDouble
(
globalParametersTable
.
getItems
().
get
(
1
).
getValue
()));
// check if everything is okay with the configuration
config
.
validateConfiguration
();
return
true
;
}
private
void
collectCheckInformationFromTree
(
ValidationConfiguration
config
,
TreeTableView
<
TreeRequirement
>
table
)
{
for
(
TreeItem
<
TreeRequirement
>
ti
:
table
.
getRoot
().
getChildren
())
{
Requirement
r
=
ti
.
getValue
().
getRequirement
();
if
(
ti
.
getValue
().
getEnabledProperty
().
getValue
().
booleanValue
())
{
RequirementConfiguration
cc
=
config
.
getRequirements
().
get
(
r
.
getId
());
cc
.
setEnabled
(
ti
.
getValue
().
isEnabled
());
// collect parameters
collectParameters
(
cc
,
ti
);
}
else
{
config
.
getRequirements
().
get
(
r
.
getId
()).
setEnabled
(
false
);
}
}
}
private
void
loadImages
()
{
try
{
try
(
InputStream
inStream
=
MainWindow
.
class
.
getResourceAsStream
(
"icons/openFolderIcon.png"
))
{
Image
img
=
new
Image
(
inStream
);
loadView
.
setImage
(
img
);
}
try
(
InputStream
inStream
=
MainWindow
.
class
.
getResourceAsStream
(
"icons/save.png"
))
{
Image
img
=
new
Image
(
inStream
);
saveView
.
setImage
(
img
);
}
}
catch
(
IOException
e
)
{
// ignore close exception
}
}
private
void
setupCheckButton
()
{
checkBtn
.
setOnAction
(
ea
->
{
ValidationConfiguration
config
=
createConfig
();
checkBtn
.
setDisable
(
true
);
cancelBtn
.
setDisable
(
true
);
stage
.
setOnCloseRequest
(
Event:
:
consume
);
Thread
t
=
new
Thread
(()
->
{
try
{
if
(
logger
.
isInfoEnabled
())
{
String
startingChecks
=
Localization
.
getText
(
"CheckDialog.startingChecks"
);
logger
.
info
(
startingChecks
);
}
controller
.
startChecks
(
config
,
progress:
:
setProgress
);
if
(
logger
.
isInfoEnabled
())
{
String
checksDone
=
Localization
.
getText
(
"CheckDialog.checksDone"
);
logger
.
info
(
checksDone
);
}
}
catch
(
Exception
e
)
{
if
(
logger
.
isErrorEnabled
())
{
String
failedChecks
=
Localization
.
getText
(
"CheckDialog.failedChecks"
);
logger
.
error
(
failedChecks
,
e
);
}
Platform
.
runLater
(()
->
{
ExceptionDialog
dialog
=
new
ExceptionDialog
();
dialog
.
show
(
e
);
});
}
finally
{
Platform
.
runLater
(()
->
{
checkBtn
.
setDisable
(
false
);
cancelBtn
.
setDisable
(
false
);
stage
.
setOnCloseRequest
(
null
);
stage
.
close
();
});
}
});
t
.
start
();
});
}
private
ValidationConfiguration
createConfig
()
{
ValidationConfiguration
config
=
ValidationConfiguration
.
loadStandardValidationConfig
();
config
.
setMinVertexDistanceInGlobalParameters
(
Double
.
parseDouble
(
globalParametersTable
.
getItems
().
get
(
1
).
getValue
()));
if
(
filterPane
!=
null
)
{
config
.
setFilter
(
filterPane
.
getConfiguration
());
}
collectCheckConfiguration
(
config
);
if
(
schematronField
.
getText
().
isEmpty
())
{
return
config
;
}
File
f
=
new
File
(
schematronField
.
getText
());
if
(!
f
.
exists
()
||
f
.
isDirectory
()
&&
logger
.
isWarnEnabled
())
{
String
schematronFileNotExisting
=
Localization
.
getText
(
"CheckDialog.schematronFileNotExisting"
);
logger
.
warn
(
schematronFileNotExisting
);
}
else
{
config
.
setSchematronFilePathInGlobalParameters
(
schematronField
.
getText
());
}
return
config
;
}
private
void
collectParameters
(
RequirementConfiguration
cc
,
TreeItem
<
TreeRequirement
>
ti
)
{
Map
<
String
,
String
>
parameters
=
new
HashMap
<>();
for
(
TreeItem
<
TreeRequirement
>
paramTi
:
ti
.
getChildren
())
{
String
name
=
paramTi
.
getValue
().
getNameProperty
().
getValue
();
String
value
=
paramTi
.
getValue
().
getValueProperty
().
getValue
();
parameters
.
put
(
name
,
value
);
}
cc
.
setParameters
(
parameters
);
}
private
void
createEnableColumn
(
TreeTableView
<
TreeRequirement
>
view
)
{
TreeTableColumn
<
TreeRequirement
,
Boolean
>
enableColumn
=
new
TreeTableColumn
<>(
CHECK_ENABLED
);
view
.
getColumns
().
add
(
enableColumn
);
enableColumn
.
setCellValueFactory
(
param
->
{
TreeRequirement
check
=
param
.
getValue
().
getValue
();
if
(
check
!=
null
)
{
return
check
.
getEnabledProperty
();
}
return
null
;
});
StringConverter
<
Boolean
>
converter
=
new
StringConverter
<
Boolean
>()
{
@Override
public
String
toString
(
Boolean
object
)
{
return
" "
;
}
@Override
public
Boolean
fromString
(
String
string
)
{
return
Boolean
.
parseBoolean
(
string
);
}
};
enableColumn
.
setCellFactory
(
list
->
new
CheckBoxTreeTableCell
<
TreeRequirement
,
Boolean
>(
null
,
converter
)
{
@Override
public
void
updateItem
(
Boolean
item
,
boolean
empty
)
{
super
.
updateItem
(
item
,
empty
);
if
(
empty
||
item
==
null
)
{
setGraphic
(
null
);
setText
(
null
);
}
}
});
}
private
void
createNameColumn
(
TreeTableView
<
TreeRequirement
>
view
)
{
TreeTableColumn
<
TreeRequirement
,
String
>
nameColumn
=
new
TreeTableColumn
<>(
NAME
);
nameColumn
.
setEditable
(
false
);
view
.
getColumns
().
add
(
nameColumn
);
nameColumn
.
setCellValueFactory
(
param
->
{
if
(
param
.
getValue
().
getValue
()
!=
null
)
{
return
param
.
getValue
().
getValue
().
getNameProperty
();
}
return
null
;
});
}
private
void
createValueColumn
(
TreeTableView
<
TreeRequirement
>
view
)
{
TreeTableColumn
<
TreeRequirement
,
String
>
valueColumn
=
new
TreeTableColumn
<>(
VALUE
);
view
.
getColumns
().
add
(
valueColumn
);
valueColumn
.
setCellValueFactory
(
param
->
{
if
(
param
.
getValue
().
getValue
()
!=
null
)
{
return
param
.
getValue
().
getValue
().
getValueProperty
();
}
return
null
;
});
valueColumn
.
setCellFactory
(
col
->
new
TreeEditCell
<>(
new
DefaultStringConverter
()));
valueColumn
.
setPrefWidth
(
100
);
}
private
void
createUnitColumn
(
TreeTableView
<
TreeRequirement
>
view
)
{
TreeTableColumn
<
TreeRequirement
,
String
>
unitColumn
=
new
TreeTableColumn
<>(
UNIT
);
unitColumn
.
setEditable
(
false
);
view
.
getColumns
().
add
(
unitColumn
);
unitColumn
.
setCellValueFactory
(
param
->
{
if
(
param
.
getValue
().
getValue
()
!=
null
)
{
return
param
.
getValue
().
getValue
().
getUnitProperty
();
}
return
null
;
});
}
private
void
populateTreeWithChecks
(
TreeTableView
<
TreeRequirement
>
view
,
RequirementType
type
,
boolean
enabled
)
{
view
.
setRoot
(
new
TreeItem
<>());
List
<
Requirement
>
requirements
=
new
ArrayList
<>(
Checks
.
getAvailableRequirements
().
values
());
Collections
.
sort
(
requirements
,
(
r1
,
r2
)
->
r1
.
getId
().
compareTo
(
r2
.
getId
()));
for
(
Requirement
r
:
requirements
)
{
if
(
r
.
getType
()
!=
type
)
{
continue
;
}
TreeRequirement
treeCheck
=
new
TreeRequirement
(
r
);
treeCheck
.
setEnabled
(
enabled
);
TreeItem
<
TreeRequirement
>
ti
=
new
TreeItem
<>(
treeCheck
);
view
.
getRoot
().
getChildren
().
add
(
ti
);
for
(
DefaultParameter
dp
:
r
.
getDefaultParameter
())
{
TreeItem
<
TreeRequirement
>
dpTi
=
new
TreeItem
<>(
new
TreeRequirement
(
dp
));
ti
.
getChildren
().
add
(
dpTi
);
}
ti
.
setExpanded
(
true
);
}
}
public
void
show
()
{
Platform
.
runLater
(()
->
{
if
(
controller
.
getCurrentConfig
()
!=
null
)
{
for
(
GlobalParameter
parameter
:
globalParametersTable
.
getItems
())
{
if
(
parameter
.
getName
().
equals
(
NUMBER_OF_ROUNDING_PLACES
))
{
parameter
.
setValue
(
""
+
controller
.
getCurrentConfig
().
getNumberOfRoundingPlaces
());
}
}
}
globalParametersTable
.
refresh
();
progress
.
setProgress
(
0
d
);
stage
.
showAndWait
();
});
}
}
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CheckStatus.java
0 → 100644
View file @
a5a82382
package
de.hft.stuttgart.citydoctor2.gui
;
public
enum
CheckStatus
{
ERROR
,
OK
,
NOT_CHECKED
}
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java
0 → 100644
View file @
a5a82382
This diff is collapsed.
Click to expand it.
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorGUIStarter.java
0 → 100644
View file @
a5a82382
/*-
* Copyright 2022 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.gui
;
public
class
CityDoctorGUIStarter
{
public
static
void
main
(
String
[]
args
)
{
MainWindow
.
main
(
args
);
}
}
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ClickDispatcher.java
0 → 100644
View file @
a5a82382
package
de.hft.stuttgart.citydoctor2.gui
;
import
javafx.scene.input.MouseEvent
;
public
interface
ClickDispatcher
{
public
void
click
(
MouseEvent
me
,
ClickHandler
handler
);
}
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ClickHandler.java
0 → 100644
View file @
a5a82382
package
de.hft.stuttgart.citydoctor2.gui
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
javafx.scene.input.MouseEvent
;
public
interface
ClickHandler
{
public
void
onPolygonClick
(
Polygon
p
,
MouseEvent
me
);
public
void
onVertexClick
(
Vertex
v
,
MouseEvent
me
);
}
CityDoctorParent/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ExceptionDialog.java
0 → 100644
View file @
a5a82382
package
de.hft.stuttgart.citydoctor2.gui
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
de.hft.stuttgart.citydoctor2.utils.Localization
;
import
javafx.scene.control.Alert
;
import
javafx.scene.control.Alert.AlertType
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.TextArea
;
import
javafx.scene.layout.GridPane
;
import
javafx.scene.layout.Priority
;
public
class
ExceptionDialog
{
private
Alert
alert
;
private
TextArea
textArea
;
public
ExceptionDialog
()
{
alert
=
new
Alert
(
AlertType
.
ERROR
);
alert
.
setTitle
(
"Exception Dialog"
);
alert
.
getDialogPane
().
setPrefWidth
(
800
);
Label
label
=
new
Label
(
Localization
.
getText
(
"ExceptionDialog.stacktrace"
));
textArea
=
new
TextArea
();
textArea
.
setEditable
(
false
);
textArea
.
setWrapText
(
true
);
textArea
.
setMaxWidth
(
Double
.
MAX_VALUE
);
textArea
.
setMaxHeight
(
Double
.
MAX_VALUE
);
GridPane
.
setVgrow
(
textArea
,
Priority
.
ALWAYS
);
GridPane
.
setHgrow
(
textArea
,
Priority
.
ALWAYS
);
GridPane
expContent
=
new
GridPane
();
expContent
.
setMaxWidth
(
Double
.
MAX_VALUE
);
expContent
.
add
(
label
,
0
,
0
);
expContent
.
add
(
textArea
,
0
,
1
);
// Set expandable Exception into the dialog pane.
alert
.
getDialogPane
().
setExpandableContent
(
expContent
);
}
public
void
show
(
Throwable
ex
)
{
// Create expandable Exception.
StringWriter
sw
=
new
StringWriter
();
PrintWriter
pw
=
new
PrintWriter
(
sw
);
ex
.
printStackTrace
(
pw
);
String
exceptionText
=
sw
.
toString
();
textArea
.
setText
(
exceptionText
);
alert
.
setContentText
(
ex
.
getMessage
());
alert
.
setHeaderText
(
ex
.
getClass
().
getSimpleName
());
alert
.
showAndWait
();
}
}
Prev
1
2
3
4
5
…
7
Next
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