public class MapComponent
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
MapComponent.Bridge
The Bridge is used to allow the WebView to call java methods by itself.
|
Modifier and Type | Field and Description |
---|---|
private MapComponent.Bridge |
bridge
The Bridge is used to allow the WebView to call java methods by itself.
|
private static java.lang.String |
JAVA_APP |
private MapView |
mapView
The mapView owning the mapComponent
|
private java.util.List<Position> |
markerPositions
The positions of the markers displayed on the map
|
private java.util.List<java.lang.String> |
markersContent
The informations associated to the markers
|
private org.jtwig.JtwigTemplate |
template
The HTML and JavaScript code that runs in the WebView
|
private Position |
userPosition |
private javafx.scene.web.WebView |
webView
The webView in which the map is created
|
Constructor and Description |
---|
MapComponent(MapView mapView) |
Modifier and Type | Method and Description |
---|---|
void |
addMarker(Position position,
java.lang.String markerContent)
Adds a marker to the list that will be given to the JavaScript
|
void |
clearFilters()
Tells the JavaScript that it can redisplay all the Shops
|
private void |
createBridgeToJS()
Creates the bridge between the Java Application and the JavaScript code used to interact with the map.
|
private java.lang.String |
createDayScheduleString(DaySchedule daySchedule)
Create a string representing the schedule for a day.
|
java.lang.String |
createHTMLElement(java.lang.String type,
java.lang.String text)
Creates a simple html element
|
java.lang.String |
createHTMLElement(java.lang.String type,
java.lang.String text,
java.lang.String onClick)
Creates an html elements with an onclick js function on it
|
java.lang.String |
createHTMLElement(java.lang.String type,
java.lang.String text,
java.lang.String onClick,
java.lang.String _class)
Creates an html elements of a specified class with an onclick js function on it
|
java.lang.String |
createHTMLSchedule(java.util.List<DaySchedule> daySchedules)
Creates an html schedule
|
void |
hideFilteredShops(java.util.List<Shop> shopsToKeep)
Asks the JavaScript to hide some shops
|
void |
onClosePane()
Asks the JavaScript to remove all the elements of a best tour from the map
|
void |
removeBestTourPositions()
Asks the JavaScript to remove the start and end point of a best tour from the map
|
void |
showMapInWebView()
Creates the JavaScript model then show it in the webView
|
void |
showRoute(java.util.List<java.util.ArrayList<java.lang.Double>> listOfPos)
Asks the JavaScript to show a route between a list of position
|
private static final java.lang.String JAVA_APP
private javafx.scene.web.WebView webView
private org.jtwig.JtwigTemplate template
private Position userPosition
private MapView mapView
private java.util.List<java.lang.String> markersContent
private java.util.List<Position> markerPositions
private MapComponent.Bridge bridge
public MapComponent(MapView mapView)
private void createBridgeToJS()
public void addMarker(Position position, java.lang.String markerContent)
position
- The position of the markermarkerContent
- The content displayed in the markerpublic void showMapInWebView()
public void showRoute(java.util.List<java.util.ArrayList<java.lang.Double>> listOfPos)
listOfPos
- public void onClosePane()
public void removeBestTourPositions()
public java.lang.String createHTMLElement(java.lang.String type, java.lang.String text, java.lang.String onClick)
type
- The type of the element (e.g Button)text
- The text displayed in the elementonClick
- The method bound to the elementpublic java.lang.String createHTMLElement(java.lang.String type, java.lang.String text, java.lang.String onClick, java.lang.String _class)
type
- The type of the element (e.g Button)text
- The text displayed in the elementonClick
- The method bound to the element_class
- The class of the elementpublic java.lang.String createHTMLElement(java.lang.String type, java.lang.String text)
type
- The type of the element (e.g Button)text
- The text displayed in the elementpublic java.lang.String createHTMLSchedule(java.util.List<DaySchedule> daySchedules)
daySchedules
- private java.lang.String createDayScheduleString(DaySchedule daySchedule)
daySchedule
- public void hideFilteredShops(java.util.List<Shop> shopsToKeep)
shopsToKeep
- public void clearFilters()