Skip to content
GitLab
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
10 years ago
by
duminil
Browse files
Options
Download
Email Patches
Plain Diff
Cross-Platform JavaFX Region Chooser.
parent
f8155886
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/eu/simstadt/regionchooser/RegionChooserFX.java
+20
-7
src/eu/simstadt/regionchooser/RegionChooserFX.java
with
20 additions
and
7 deletions
+20
-7
src/eu/simstadt/regionchooser/RegionChooserFX.java
+
20
-
7
View file @
f99a7d28
package
eu.simstadt.regionchooser
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
javafx.application.Application
;
import
javafx.beans.value.ObservableValue
;
...
...
@@ -36,8 +38,14 @@ public static void main(String[] args) {
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
)
{
System
.
out
.
println
(
"FROM JAVA : DO SOMETHING with "
+
wktPolygon
);
}
...
...
@@ -47,8 +55,14 @@ public void downloadRegionFromCityGML(String wktPolygon, String citygmlDescripti
}
public
boolean
checkIfCityGMLSAreAvailable
(
String
citygmlDescription
)
{
//TODO: IMPLEMENT ME
return
true
;
boolean
available
=
false
;
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() {
//apply the styles
getStyleClass
().
add
(
"browser"
);
// 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
);
// process page loading
webEngine
.
getLoadWorker
().
stateProperty
().
addListener
(
(
ObservableValue
<?
extends
State
>
ov
,
State
oldState
,
State
newState
)
->
{
(
ObservableValue
<?
extends
State
>
ov
,
State
oldState
,
State
newState
)
->
{
if
(
newState
==
State
.
SUCCEEDED
)
{
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
...
...
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