- All Implemented Interfaces:
RemoteResource
,LayerContent
,Loadable
,PopupSource
- Direct Known Subclasses:
ArcGISMapImageSublayer
,ArcGISTiledSublayer
,SubtypeSublayer
ArcGISMapImageSublayer
, ArcGISTiledSublayer
and
SubtypeSublayer
.
Some layers, such as ArcGISMapImageLayer
, ArcGISTiledLayer
, and SubtypeFeatureLayer
, represent
a collection of layers that are referred to as sublayers. For example, ArcGISMapImageLayer
represents the
collection of ArcGISMapImageLayer.getSublayers()
.
If one of the sublayers is a group layer (where the ArcGISMapServiceSublayerInfo.getServiceType()
is
ArcGISMapServiceSublayerInfo.ServiceType.GROUP_LAYER
, for example), it will also have a collection of sublayers. Use
getSublayers()
to obtain the collection of sublayers. If one of these sublayers is a group
layer it will also contain a collection of sublayers, and so on.
Note: Some of the sublayer properties can only be accessed once the sublayer has loaded.
- Since:
- 100.0.0
- See Also:
-
Property Summary
TypePropertyDescriptionThe load error.The load status. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDoneLoadingListener
(Runnable listener) Adds a listener to the loadable resource that is invoked when loading has completed.void
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.void
Cancels loading metadata for the object.boolean
Checks whether we can change the visibility of this layer.boolean
True if the sublayer renderers its symbols based on scale, false otherwise.boolean
Checks if this layer will be listed in the legend.abstract ArcGISSublayer
copy()
Creates a deep copy of this ArcGISSublayer instance.protected void
copyTo
(ArcGISSublayer copy) Copies fields in this class to the copy instance.Gets properties from the legend information of this sublayer.Gets the credential used to authenticate the user with the sublayer.A SQL statement where clause that stipulates a subset of features to be displayed.long
getId()
Gets the ID that uniquely identifies this sublayer.Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.Returns theLoadStatus
of the loadable resource.Gets the metadata for this sublayer.double
Gets the maximum viewing level at which this sublayer can be visible on a map.double
Gets the minimum viewing level at which this sublayer can be visible on a map.getName()
Gets the name property of this sublayer.float
Gets the opacity of this sublayer.Gets the PopupDefinition defined in the ArcGISSublayer definition or set viasetPopupDefinition(PopupDefinition)
, or null if one is not defined and one has not been set.Gets the renderer for this sublayer.Gets the RequestConfiguration in use by this sublayer.Returns a list of sub layers, if any.Gets the collection of sublayers of a sublayer.getUri()
Gets the URL for this sublayer.boolean
True if the sublayer's labels are enabled, false otherwise.boolean
Checks if the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.boolean
Indicates if the sublayer is visible on the map.boolean
isVisibleAtScale
(double scale) Checks if this layer has effective visibility at the given scale.void
Loads the metadata of the loadable resource asynchronously.The load error.The load status.boolean
removeDoneLoadingListener
(Runnable listener) Removes a done loading listener from the loadable resource.boolean
Removes aLoadStatusChangedListener
from the loadable resource.void
Loads or retries loading metadata for the object asynchronously.void
setCanShowInLegend
(boolean canShowInLegend) Sets whether or not this layer should be visible in the legend.void
setCredential
(Credential credential) Sets the credential used to authenticate the user with the sublayer.void
setPopupDefinition
(PopupDefinition popupDefinition) Sets the PopupDefinition for the ArcGISSublayer, overriding the previous one (for example, the one defined in the ArcGISSublayer definition).void
setPopupEnabled
(boolean enabled) Sets whether the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.protected void
setRenderer
(Renderer renderer) Allows sub-classes to set the renderer reference e.g.void
setRequestConfiguration
(RequestConfiguration requestConfiguration) Sets the configuration parameters used for sending a network request using this sublayer object.void
setVisible
(boolean isVisible) Shows or hides this sublayer from a map.
-
Property Details
-
loadStatus
- Specified by:
loadStatusProperty
in interfaceLoadable
- See Also:
-
loadError
- Specified by:
loadErrorProperty
in interfaceLoadable
- See Also:
-
-
Method Details
-
getId
public long getId()Gets the ID that uniquely identifies this sublayer.- Returns:
- the ID of this sublayer
- Since:
- 100.0.0
-
getSublayers
Gets the collection of sublayers of a sublayer.This collection is usually empty unless the parent layer is loaded. Modifying this collection has no effect unless this sublayer is associated with an ArcGIS map service that supports dynamic layers. "Supports Dynamic Layers" must be set to true in the ArcGIS MapServer REST Services Directory.
- Returns:
- the collection of sublayers of a sublayer
- Since:
- 100.0.0
-
getMinScale
public double getMinScale()Gets the minimum viewing level at which this sublayer can be visible on a map.- Returns:
- the minimum scale that this sublayer will be visible
- Since:
- 100.0.0
-
getMaxScale
public double getMaxScale()Gets the maximum viewing level at which this sublayer can be visible on a map.- Returns:
- the maximum scale that this sublayer will be visible
- Since:
- 100.0.0
-
getDefinitionExpression
A SQL statement where clause that stipulates a subset of features to be displayed.The definition expression string uses the SQL-92 where clause syntax. Be sure to escape special characters in the expression string as required for your platform. The DATE keyword expects the date format yyyy-mm-dd and the TIMESTAMP keyword expects the time stamp format yyyy-mm-dd hh:mm:ss. For more information, see the ArcGIS Blog article Querying Feature Services Date-Time Queries.
- Returns:
- the definition expression
- Since:
- 100.1.0
-
getMapServiceSublayerInfo
Gets the metadata for this sublayer.- Returns:
- the metadata, or null if this sublayer is not loaded
- Since:
- 100.1.0
-
getOpacity
public float getOpacity()Gets the opacity of this sublayer.- Returns:
- the opacity
- Since:
- 100.1.0
-
getRenderer
Gets the renderer for this sublayer.- Returns:
- the renderer, or null if the sublayer is not loaded
- Since:
- 100.1.0
-
setRenderer
Allows sub-classes to set the renderer reference e.g.ArcGISMapImageSublayer
allows a renderer to be set.- Parameters:
renderer
- the renderer to set- Since:
- 100.1.0
-
canScaleSymbols
public boolean canScaleSymbols()True if the sublayer renderers its symbols based on scale, false otherwise.- Returns:
- true if the text and symbols will change as the map scale varies, false otherwise
- Since:
- 100.1.0
-
isLabelsEnabled
public boolean isLabelsEnabled()True if the sublayer's labels are enabled, false otherwise.- Returns:
- true if labels are enabled, false otherwise
- Since:
- 100.1.0
-
getName
Gets the name property of this sublayer.- Specified by:
getName
in interfaceLayerContent
- Returns:
- the name of this sublayer
- Since:
- 100.0.0
-
getPopupDefinition
Gets the PopupDefinition defined in the ArcGISSublayer definition or set viasetPopupDefinition(PopupDefinition)
, or null if one is not defined and one has not been set.- Specified by:
getPopupDefinition
in interfacePopupSource
- Returns:
- the ArcGISSublayer's PopupDefinition
- Since:
- 100.0.0
- See Also:
-
setPopupDefinition
Sets the PopupDefinition for the ArcGISSublayer, overriding the previous one (for example, the one defined in the ArcGISSublayer definition).- Specified by:
setPopupDefinition
in interfacePopupSource
- Parameters:
popupDefinition
- the PopupDefinition to set- Since:
- 100.0.0
- See Also:
-
isPopupEnabled
public boolean isPopupEnabled()Description copied from interface:PopupSource
Checks if the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.- Specified by:
isPopupEnabled
in interfacePopupSource
- Returns:
- true if the pop-up definition is enabled; false otherwise. Will return false if an error occurs.
- See Also:
-
setPopupEnabled
public void setPopupEnabled(boolean enabled) Description copied from interface:PopupSource
Sets whether the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.- Specified by:
setPopupEnabled
in interfacePopupSource
- Parameters:
enabled
- true to enable the PopupDefinition; false otherwise- See Also:
-
isVisible
public boolean isVisible()Indicates if the sublayer is visible on the map.The visibility of a sublayer can change if it is manually set,
setVisible(boolean)
, or the map's scale is outside of the sublayer's scale.- Specified by:
isVisible
in interfaceLayerContent
- Returns:
- true if sublayer is visible; false otherwise
- Since:
- 100.0.0
- See Also:
-
setVisible
public void setVisible(boolean isVisible) Shows or hides this sublayer from a map.The default value for a sublayer's visibility is set to true.
- Specified by:
setVisible
in interfaceLayerContent
- Parameters:
isVisible
- true makes the sublayer visible, false makes it invisible- Since:
- 100.0.0
- See Also:
-
fetchLegendInfosAsync
Gets properties from the legend information of this sublayer.These properties allow access to a Feature's name and symbol.
- Specified by:
fetchLegendInfosAsync
in interfaceLayerContent
- Returns:
- a listenable future that supplies a list of legend information.
- Since:
- 100.0.0
- See Also:
-
canShowInLegend
public boolean canShowInLegend()Description copied from interface:LayerContent
Checks if this layer will be listed in the legend.- Specified by:
canShowInLegend
in interfaceLayerContent
- Returns:
- true if this layer will be visible in the legend; false otherwise
-
setCanShowInLegend
public void setCanShowInLegend(boolean canShowInLegend) Description copied from interface:LayerContent
Sets whether or not this layer should be visible in the legend.- Specified by:
setCanShowInLegend
in interfaceLayerContent
- Parameters:
canShowInLegend
- true to show in the legend; false to omit it from the legend
-
getSubLayerContents
Description copied from interface:LayerContent
Returns a list of sub layers, if any. If there are no sub-layers, an empty list will be returned. This list cannot be used to add or remove sub-layers.- Specified by:
getSubLayerContents
in interfaceLayerContent
- Returns:
- a read only list of sub-layers, if any
-
isVisibleAtScale
public boolean isVisibleAtScale(double scale) Description copied from interface:LayerContent
Checks if this layer has effective visibility at the given scale. This effective visibility takes care of the effective visibility of the parents at the specified scale.- Specified by:
isVisibleAtScale
in interfaceLayerContent
- Parameters:
scale
- the scale the visibility has to be calculated for- Returns:
- true if the layer will be visible at the given scale; false otherwise
-
canChangeVisibility
public boolean canChangeVisibility()Description copied from interface:LayerContent
Checks whether we can change the visibility of this layer.- Specified by:
canChangeVisibility
in interfaceLayerContent
- Returns:
- true if we can change this layer's visibility; false otherwise
-
getLoadStatus
Description copied from interface:Loadable
Returns theLoadStatus
of the loadable resource.- Specified by:
getLoadStatus
in interfaceLoadable
- Returns:
- the LoadStatus of the loadable resource
- Since:
- 100.1.0
-
getLoadError
Description copied from interface:Loadable
Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.If the resource subsequently transitions to
LoadStatus.LOADED
(for example, if a call toretryLoadAsync
completes successfully) the error is cleared out.- Specified by:
getLoadError
in interfaceLoadable
- Returns:
- the most recent error that was encountered when the loadable resource transitioned to the
LoadStatus.FAILED_TO_LOAD
state. - Since:
- 100.1.0
-
loadAsync
public void loadAsync()Description copied from interface:Loadable
Loads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADED
toLoadStatus.LOADING
. A listener can be added viaLoadable.addDoneLoadingListener(java.lang.Runnable)
that is invoked upon completion of the asynchronous load operation.If the load operation completes successfully, the load status will be
LoadStatus.LOADED
, which means the resource has loaded its metadata.If the load operation failed, the load status will be
LoadStatus.FAILED_TO_LOAD
and the error can be retrieved by callingLoadable.getLoadError()
.This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (
LoadStatus.LOADING
state) whenloadAsync
is called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADED
orLoadStatus.FAILED_TO_LOAD
state) whenloadAsync
is called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling
loadAsync
on it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource,Loadable.retryLoadAsync()
needs to be used.A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by callingLoadable.cancelLoad()
. -
retryLoadAsync
public void retryLoadAsync()Description copied from interface:Loadable
Loads or retries loading metadata for the object asynchronously.Will retry loading the metadata if the object's load status is
LoadStatus.FAILED_TO_LOAD
. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.For more details on the load process see
Loadable.loadAsync()
.- Specified by:
retryLoadAsync
in interfaceLoadable
- Since:
- 100.1.0
-
cancelLoad
public void cancelLoad()Description copied from interface:Loadable
Cancels loading metadata for the object.Cancels loading the metadata if the object is loading, and always invokes the done loading listener.
A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADING
toLoadStatus.FAILED_TO_LOAD
state. If the load operation was successfully cancelled, a CancellationException will be returned fromLoadable.getLoadError()
.Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.
This method does nothing if the resource is not in
LoadStatus.LOADING
state.- Specified by:
cancelLoad
in interfaceLoadable
- Since:
- 100.1.0
-
addDoneLoadingListener
Description copied from interface:Loadable
Adds a listener to the loadable resource that is invoked when loading has completed.The listener may be added at any point, whether the loadable resource has already completed loading or not.
- For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.
Alternatively, to be notified when there is any change in the load status, add a listener to the
Loadable.loadStatusProperty()
instead.- Specified by:
addDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- a Runnable that is invoked upon completion of the load operation- Since:
- 100.1.0
-
removeDoneLoadingListener
Description copied from interface:Loadable
Removes a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
- Since:
- 100.1.0
-
addLoadStatusChangedListener
Description copied from interface:Loadable
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the
Loadable.addDoneLoadingListener(Runnable)
method.- Specified by:
addLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be added- Since:
- 100.1.0
-
removeLoadStatusChangedListener
Description copied from interface:Loadable
Removes aLoadStatusChangedListener
from the loadable resource.- Specified by:
removeLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be removed- Returns:
- true if the listener was removed, otherwise false
- Since:
- 100.1.0
-
loadStatusProperty
Description copied from interface:Loadable
The load status.- Specified by:
loadStatusProperty
in interfaceLoadable
- Returns:
- the
loadStatus
property - See Also:
-
loadErrorProperty
Description copied from interface:Loadable
The load error.- Specified by:
loadErrorProperty
in interfaceLoadable
- Returns:
- the
loadError
property - See Also:
-
setCredential
Sets the credential used to authenticate the user with the sublayer.- Specified by:
setCredential
in interfaceRemoteResource
- Parameters:
credential
- the credential used to authenticate the user with the sublayer- Since:
- 100.1.0
-
getCredential
Gets the credential used to authenticate the user with the sublayer.- Specified by:
getCredential
in interfaceRemoteResource
- Returns:
- the credential used to authenticate the user with the sublayer
- Since:
- 100.1.0
-
setRequestConfiguration
Sets the configuration parameters used for sending a network request using this sublayer object. The global RequestConfiguration is used if no RequestConfiguration is set or null is set (seeRequestConfiguration.getGlobalRequestConfiguration()
).- Specified by:
setRequestConfiguration
in interfaceRemoteResource
- Parameters:
requestConfiguration
- a RequestConfiguration containing the parameters to use- Since:
- 100.1.0
-
getRequestConfiguration
Gets the RequestConfiguration in use by this sublayer. If null is returned, it indicates that the global RequestConfiguration is used instead.- Specified by:
getRequestConfiguration
in interfaceRemoteResource
- Returns:
- the RequestConfiguration, or null if none is set
- Since:
- 100.1.0
-
getUri
Gets the URL for this sublayer.- Specified by:
getUri
in interfaceRemoteResource
- Returns:
- the URL, or null if the sublayer is not loaded
- Since:
- 100.1.0
-
copy
Creates a deep copy of this ArcGISSublayer instance.- Returns:
- a deep copy of this ArcGISSublayer instance
- Since:
- 100.1.0
-
copyTo
Copies fields in this class to the copy instance.- Parameters:
copy
- instance to copy the fields of this class to- Since:
- 100.1.0
-