Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
f99a7d28
Commit
f99a7d28
authored
May 18, 2015
by
duminil
Browse files
Cross-Platform JavaFX Region Chooser.
parent
f8155886
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/eu/simstadt/regionchooser/RegionChooserFX.java
View file @
f99a7d28
package
eu.simstadt.regionchooser
;
package
eu.simstadt.regionchooser
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
javafx.application.Application
;
import
javafx.application.Application
;
import
javafx.beans.value.ObservableValue
;
import
javafx.beans.value.ObservableValue
;
...
@@ -36,8 +38,14 @@ public static void main(String[] args) {
...
@@ -36,8 +38,14 @@ public static void main(String[] args) {
class
Browser
extends
Region
class
Browser
extends
Region
{
{
public
class
Java
App
public
class
Java
ScriptFXBridge
{
{
private
Path
repo
;
public
JavaScriptFXBridge
()
{
repo
=
Paths
.
get
(
"../TestRepository"
);
}
public
void
downloadRegion
(
String
wktPolygon
)
{
public
void
downloadRegion
(
String
wktPolygon
)
{
System
.
out
.
println
(
"FROM JAVA : DO SOMETHING with "
+
wktPolygon
);
System
.
out
.
println
(
"FROM JAVA : DO SOMETHING with "
+
wktPolygon
);
}
}
...
@@ -47,8 +55,14 @@ public void downloadRegionFromCityGML(String wktPolygon, String citygmlDescripti
...
@@ -47,8 +55,14 @@ public void downloadRegionFromCityGML(String wktPolygon, String citygmlDescripti
}
}
public
boolean
checkIfCityGMLSAreAvailable
(
String
citygmlDescription
)
{
public
boolean
checkIfCityGMLSAreAvailable
(
String
citygmlDescription
)
{
//TODO: IMPLEMENT ME
boolean
available
=
false
;
return
true
;
String
[]
projectAndCityGML
=
citygmlDescription
.
split
(
">"
);
if
(
projectAndCityGML
.
length
==
2
)
{
String
project
=
projectAndCityGML
[
0
];
String
citygml
=
projectAndCityGML
[
1
];
available
=
Files
.
isReadable
(
repo
.
resolve
(
project
+
".simstadt"
).
resolve
(
citygml
));
}
return
available
;
}
}
}
}
...
@@ -59,15 +73,14 @@ public Browser() {
...
@@ -59,15 +73,14 @@ public Browser() {
//apply the styles
//apply the styles
getStyleClass
().
add
(
"browser"
);
getStyleClass
().
add
(
"browser"
);
// load the web page
// load the web page
String
url
=
"file://"
+
Paths
.
get
(
"../RegionChooser/website/index.html"
).
to
AbsolutePath
().
toString
();
String
url
=
Paths
.
get
(
"../RegionChooser/website/index.html"
).
to
Uri
().
toString
();
webEngine
.
load
(
url
);
webEngine
.
load
(
url
);
// process page loading
// process page loading
webEngine
.
getLoadWorker
().
stateProperty
().
addListener
(
webEngine
.
getLoadWorker
().
stateProperty
().
addListener
(
(
ObservableValue
<?
extends
State
>
ov
,
State
oldState
,
(
ObservableValue
<?
extends
State
>
ov
,
State
oldState
,
State
newState
)
->
{
State
newState
)
->
{
if
(
newState
==
State
.
SUCCEEDED
)
{
if
(
newState
==
State
.
SUCCEEDED
)
{
JSObject
win
=
(
JSObject
)
webEngine
.
executeScript
(
"window"
);
JSObject
win
=
(
JSObject
)
webEngine
.
executeScript
(
"window"
);
win
.
setMember
(
"fxapp"
,
new
Java
App
());
win
.
setMember
(
"fxapp"
,
new
Java
ScriptFXBridge
());
}
}
});
});
//add the web view to the scene
//add the web view to the scene
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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