Package arez.dom
Class GeoPosition
java.lang.Object
arez.dom.GeoPosition
@ArezComponent(requireId=DISABLE,
disposeNotifier=DISABLE)
public abstract class GeoPosition
extends Object
A component that exposes the current geo position as an observable property. This component relies on the
underlying Geolocation API and
it's usage is restricted in the same way as the underlying API (i.e. it is only available in secure contexts
and it asks user permission before providing data.).
final GeoPosition geoPosition = GeoPosition.create();
Arez.context().observer( () -> consumePosition( geoPosition.getPosition() ) );
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic GeoPositioncreate()Create the GeoPosition component.Return the error message reported by the geolocation API when position could not be loaded else null.Return an immutable representation of the current position.intReturn the status indicating whether the position is available.
-
Method Details
-
create
Create the GeoPosition component.- Returns:
- the newly created GeoPosition component.
-
getPosition
Return an immutable representation of the current position. This will be null unlessgetStatus()has returned aGeoPosition.Status.POSITION_LOADEDvalue.- Returns:
- the current position as reported by the geolocation API.
-
getStatus
Return the status indicating whether the position is available. It will be one of the values provided byGeoPosition.Status.- Returns:
- the status of the position data.
-
getErrorMessage
Return the error message reported by the geolocation API when position could not be loaded else null.- Returns:
- the error message if any.
-