public class WorldMapView
extends javafx.scene.control.Control
worldMapView.setCountryViewFactory(country -> {
CountryView view = new CountryView(country);
if (showColorsProperty.get()) {
view.getStyleClass().add("country" + ((country.ordinal() % 8) + 1));
}
return view;
});
worldMapView.setLocationViewFactory(location -> {
Circle circle = new Circle();
circle.getStyleClass().add("location");
circle.setRadius(4);
circle.setTranslateX(-4); // translate to center node on location
circle.setTranslateY(-4); // translate to center node on location
return circle;
});
Shown below is a screenshot of the world map view:
| Type | Property and Description |
|---|---|
javafx.beans.property.ListProperty<WorldMapView.Country> |
countries
A property used to store the list of countries that should be shown by the map.
|
javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> |
countrySelectionMode
A property used to store the selection mode that will be applied for the selection
of countries.
|
javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView>> |
countryViewFactory
A property used to store a factory callback for creating new country views.
|
javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> |
locationSelectionMode
A property used to store the selection mode that will be applied for the selection
of locations.
|
javafx.beans.property.ListProperty<WorldMapView.Location> |
locations
A property used to store the list of locations shown by the map.
|
javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Location,javafx.scene.Node>> |
locationViewFactory
A property used to store a factory callback for creating new location views (nodes).
|
javafx.beans.property.ListProperty<WorldMapView.Country> |
selectedCountries
A property used for storing the list of selected countries (aka "the selection model").
|
javafx.beans.property.ListProperty<WorldMapView.Location> |
selectedLocations
A property used for storing the list of selected locations (aka "the selection model").
|
javafx.beans.property.BooleanProperty |
showLocations
A property used to control whether locations will be shown by the map or not.
|
javafx.beans.property.DoubleProperty |
zoomFactor
A property used to store the current zoom factor, a value between 1 and 10.
|
contextMenu, skinClassName, skin, tooltipbackground, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthaccessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, impl_showMnemonics, impl_treeVisible, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, visible| Modifier and Type | Class and Description |
|---|---|
static class |
WorldMapView.Country
An enumerator listing all countries of the world.
|
static class |
WorldMapView.CountryView
A view used to visualize the bounds of a country via SVG.
|
static class |
WorldMapView.Location
An object using latitude and longitude information to specify a location
in the real world.
|
static class |
WorldMapView.SelectionMode
The selection modes supported by the view.
|
| Constructor and Description |
|---|
WorldMapView()
Constructs a new map view with an initially empty list of countries which will
result in the entire world to be shown.
|
| Modifier and Type | Method and Description |
|---|---|
javafx.beans.property.ListProperty<WorldMapView.Country> |
countriesProperty()
A property used to store the list of countries that should be shown by the map.
|
javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> |
countrySelectionModeProperty()
A property used to store the selection mode that will be applied for the selection
of countries.
|
javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView>> |
countryViewFactoryProperty()
A property used to store a factory callback for creating new country views.
|
protected javafx.scene.control.Skin<?> |
createDefaultSkin() |
javafx.collections.ObservableList<WorldMapView.Country> |
getCountries()
Returns the list of countries that will be shown by the map.
|
WorldMapView.SelectionMode |
getCountrySelectionMode()
Returns the value of
countrySelectionModeProperty() |
javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView> |
getCountryViewFactory()
Returns the value of
countryViewFactoryProperty(). |
javafx.collections.ObservableList<WorldMapView.Location> |
getLocations()
Returns the list of locations shown by the map.
|
WorldMapView.SelectionMode |
getLocationSelectionMode()
Returns the value of
locationSelectionModeProperty() |
javafx.util.Callback<WorldMapView.Location,javafx.scene.Node> |
getLocationViewFactory()
Returns the value of
locationViewFactoryProperty(). |
javafx.collections.ObservableList<WorldMapView.Country> |
getSelectedCountries()
Returns the list of currently selected countries.
|
javafx.collections.ObservableList<WorldMapView.Location> |
getSelectedLocations()
Returns the list of currently selected locations.
|
java.lang.String |
getUserAgentStylesheet() |
protected java.lang.String |
getUserAgentStylesheet(java.lang.Class<?> clazz,
java.lang.String fileName)
A helper method that ensures that the resource based lookup of the user
agent stylesheet only happens once.
|
double |
getZoomFactor()
Returns the value of
zoomFactorProperty(). |
boolean |
isShowLocations()
Returns the value of
showLocationsProperty(). |
javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> |
locationSelectionModeProperty()
A property used to store the selection mode that will be applied for the selection
of locations.
|
javafx.beans.property.ListProperty<WorldMapView.Location> |
locationsProperty()
A property used to store the list of locations shown by the map.
|
javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Location,javafx.scene.Node>> |
locationViewFactoryProperty()
A property used to store a factory callback for creating new location views (nodes).
|
javafx.beans.property.ListProperty<WorldMapView.Country> |
selectedCountriesProperty()
A property used for storing the list of selected countries (aka "the selection model").
|
javafx.beans.property.ListProperty<WorldMapView.Location> |
selectedLocationsProperty()
A property used for storing the list of selected locations (aka "the selection model").
|
void |
setCountries(javafx.collections.ObservableList<WorldMapView.Country> countries)
Sets the list of countries that will be shown by the map.
|
void |
setCountrySelectionMode(WorldMapView.SelectionMode mode)
Sets the value of
countrySelectionModeProperty(). |
void |
setCountryViewFactory(javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView> factory)
Sets the value of
countryViewFactoryProperty(). |
void |
setLocations(javafx.collections.ObservableList<WorldMapView.Location> locations)
Sets the list of locations shown by the map.
|
void |
setLocationSelectionMode(WorldMapView.SelectionMode mode)
Sets the value of
locationSelectionModeProperty(). |
void |
setLocationViewFactory(javafx.util.Callback<WorldMapView.Location,javafx.scene.Node> factory)
Sets the value of
locationViewFactoryProperty(). |
void |
setSelectedCountries(javafx.collections.ObservableList<WorldMapView.Country> countries)
Sets the list of currently selected countries.
|
void |
setSelectedLocations(javafx.collections.ObservableList<WorldMapView.Location> locations)
Sets the list of currently selected locations.
|
void |
setShowLocations(boolean show)
Sets the value of
showLocationsProperty(). |
void |
setZoomFactor(double factor)
Sets the value of
zoomFactorProperty(). |
javafx.beans.property.BooleanProperty |
showLocationsProperty()
A property used to control whether locations will be shown by the map or not.
|
javafx.beans.property.DoubleProperty |
zoomFactorProperty()
A property used to store the current zoom factor, a value between 1 and 10.
|
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getSkin, getTooltip, impl_cssGetFocusTraversableInitialValue, impl_processCSS, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipPropertybackgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthPropertygetChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBoundsaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic final javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> countrySelectionModeProperty
public final javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> locationSelectionModeProperty
public final javafx.beans.property.DoubleProperty zoomFactorProperty
getZoomFactor(),
setZoomFactor(double)public final javafx.beans.property.ListProperty<WorldMapView.Country> selectedCountriesProperty
public final javafx.beans.property.ListProperty<WorldMapView.Location> selectedLocationsProperty
public final javafx.beans.property.ListProperty<WorldMapView.Country> countriesProperty
getCountries(),
setCountries(ObservableList)public final javafx.beans.property.ListProperty<WorldMapView.Location> locationsProperty
getLocations(),
setLocations(ObservableList)public final javafx.beans.property.BooleanProperty showLocationsProperty
isShowLocations(),
setShowLocations(boolean)public final javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Location,javafx.scene.Node>> locationViewFactoryProperty
public final javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView>> countryViewFactoryProperty
public WorldMapView()
protected javafx.scene.control.Skin<?> createDefaultSkin()
createDefaultSkin in class javafx.scene.control.Controlpublic java.lang.String getUserAgentStylesheet()
getUserAgentStylesheet in class javafx.scene.layout.Regionpublic final javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> countrySelectionModeProperty()
public final WorldMapView.SelectionMode getCountrySelectionMode()
countrySelectionModeProperty()public final void setCountrySelectionMode(WorldMapView.SelectionMode mode)
countrySelectionModeProperty().mode - the country selection modepublic final javafx.beans.property.ObjectProperty<WorldMapView.SelectionMode> locationSelectionModeProperty()
public final WorldMapView.SelectionMode getLocationSelectionMode()
locationSelectionModeProperty()public final void setLocationSelectionMode(WorldMapView.SelectionMode mode)
locationSelectionModeProperty().mode - the location selection modepublic final javafx.beans.property.DoubleProperty zoomFactorProperty()
getZoomFactor(),
setZoomFactor(double)public final double getZoomFactor()
zoomFactorProperty().public final void setZoomFactor(double factor)
zoomFactorProperty().factor - the zoom factorpublic final javafx.beans.property.ListProperty<WorldMapView.Country> selectedCountriesProperty()
public final javafx.collections.ObservableList<WorldMapView.Country> getSelectedCountries()
public final void setSelectedCountries(javafx.collections.ObservableList<WorldMapView.Country> countries)
countries - the selected countriespublic final javafx.beans.property.ListProperty<WorldMapView.Location> selectedLocationsProperty()
public final javafx.collections.ObservableList<WorldMapView.Location> getSelectedLocations()
public final void setSelectedLocations(javafx.collections.ObservableList<WorldMapView.Location> locations)
locations - the selected locationspublic final javafx.beans.property.ListProperty<WorldMapView.Country> countriesProperty()
getCountries(),
setCountries(ObservableList)public final javafx.collections.ObservableList<WorldMapView.Country> getCountries()
public final void setCountries(javafx.collections.ObservableList<WorldMapView.Country> countries)
countries - the list of countries shown by the mappublic final javafx.beans.property.ListProperty<WorldMapView.Location> locationsProperty()
getLocations(),
setLocations(ObservableList)public final javafx.collections.ObservableList<WorldMapView.Location> getLocations()
public final void setLocations(javafx.collections.ObservableList<WorldMapView.Location> locations)
locations - the list of locationspublic final javafx.beans.property.BooleanProperty showLocationsProperty()
isShowLocations(),
setShowLocations(boolean)public final boolean isShowLocations()
showLocationsProperty().public final void setShowLocations(boolean show)
showLocationsProperty().show - if true then locations are shownpublic final javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Location,javafx.scene.Node>> locationViewFactoryProperty()
public final javafx.util.Callback<WorldMapView.Location,javafx.scene.Node> getLocationViewFactory()
locationViewFactoryProperty().public final void setLocationViewFactory(javafx.util.Callback<WorldMapView.Location,javafx.scene.Node> factory)
locationViewFactoryProperty().factory - the location view factorypublic final javafx.beans.property.ObjectProperty<javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView>> countryViewFactoryProperty()
public final javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView> getCountryViewFactory()
countryViewFactoryProperty().public final void setCountryViewFactory(javafx.util.Callback<WorldMapView.Country,WorldMapView.CountryView> factory)
countryViewFactoryProperty().factory - the country view factoryprotected final java.lang.String getUserAgentStylesheet(java.lang.Class<?> clazz,
java.lang.String fileName)
clazz - the class used for the resource lookupfileName - the name of the user agent stylesheet