Class Popup
- java.lang.Object
-
- com.esri.arcgisruntime.mapping.popup.Popup
-
public final class Popup extends java.lang.Object
Represents the combination of aPopupDefinition
and aGeoElement
, which allows a visual representation of the GeoElement's attributes as well as the ability to edit them.- Since:
- 100.0.0
-
-
Constructor Summary
Constructors Constructor Description Popup(GeoElement geoElement)
Creates a new popup from aGeoElement
.Popup(GeoElement geoElement, PopupDefinition popupDefinition)
Creates a new popup from aGeoElement
andPopupDefinition
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListenableFuture<java.util.List<PopupExpressionEvaluation>>
evaluateExpressionsAsync()
Asynchronously evaluates all expressions available atPopupDefinition.getExpressions()
or atExpressionPopupElement.getPopupExpression()
.java.lang.String
getDescription()
Gets the description of the Popup.java.util.List<PopupElement>
getEvaluatedElements()
Gets an unmodifiable list ofPopupElement
objects evaluated asynchronously byevaluateExpressionsAsync()
.java.lang.String
getFormattedValue(PopupField popupField)
Gets the formatted value of the popup field.GeoElement
getGeoElement()
Gets theGeoElement
of the pop-up.PopupDefinition
getPopupDefinition()
Gets the popup definition associated with the popup.Symbol
getSymbol()
Gets the symbol of the Popup.java.lang.String
getTitle()
Gets the title of the Popup.
-
-
-
Constructor Detail
-
Popup
public Popup(GeoElement geoElement)
Creates a new popup from aGeoElement
. This method creates a defaultPopupDefinition
with default properties and default popup elements based on the givenGeoElement
.- Parameters:
geoElement
- theGeoElement
for the popup, such as aFeature
orGraphic
- Throws:
java.lang.IllegalArgumentException
- if geoElement is null- Since:
- 100.0.0
-
Popup
public Popup(GeoElement geoElement, PopupDefinition popupDefinition)
Creates a new popup from aGeoElement
andPopupDefinition
.If the
PopupDefinition
is null, a new one will be created based off the attributes of theGeoElement
.- Parameters:
geoElement
- theGeoElement
for the popup, such as aFeature
orGraphic
popupDefinition
- the PopupDefinition- Throws:
java.lang.IllegalArgumentException
- if geoElement is null- Since:
- 100.0.0
-
-
Method Detail
-
getPopupDefinition
public PopupDefinition getPopupDefinition()
Gets the popup definition associated with the popup.- Returns:
- the popup definition associated with the popup
- Since:
- 100.0.0
-
getGeoElement
public GeoElement getGeoElement()
Gets theGeoElement
of the pop-up.- Returns:
- the
GeoElement
of the pop-up - Since:
- 100.0.0
-
getTitle
public java.lang.String getTitle()
Gets the title of the Popup.- Returns:
- the title of the Popup
- Since:
- 100.0.0
-
getDescription
public java.lang.String getDescription()
Gets the description of the Popup.- Returns:
- the description of the Popup
- Since:
- 100.0.0
-
getSymbol
public Symbol getSymbol()
Gets the symbol of the Popup.- Returns:
- the symbol of the Popup
- Since:
- 100.0.0
-
getFormattedValue
public java.lang.String getFormattedValue(PopupField popupField)
Gets the formatted value of the popup field.Dates/times are returned in the local timezone. If
PopupDefinition.getExpressions()
is not empty, then it is possible that thePopupField
may be using expressions with Arcade FeatureSets functions. UseevaluateExpressionsAsync()
to evaluate the Arcade expressions before trying to get the formatted String representation of the popup field's value; otherwise it may return an empty string or "0.00" if the return type isPopupExpression.ReturnType.NUMBER
.If the field is part of a
CodedValueDomain
, theCodedValue.getName()
is returned.- Parameters:
popupField
- the popup field- Returns:
- the formatted string representing the value of the popup field.
- Since:
- 100.3.0
-
evaluateExpressionsAsync
public ListenableFuture<java.util.List<PopupExpressionEvaluation>> evaluateExpressionsAsync()
Asynchronously evaluates all expressions available atPopupDefinition.getExpressions()
or atExpressionPopupElement.getPopupExpression()
. The expression can include Arcade FeatureSet functions, which need to be evaluated asynchronously.Also populates the
getEvaluatedElements()
from thePopupDefinition.getElements()
. During the evaluation, eachExpressionPopupElement
is replaced by thePopupElement
returned by the Arcade expression and each placeholder is replaced by its value.This method must be called before displaying the popup information in a UI so you can use synchronous methods
getFormattedValue(PopupField)
andsubstitute(String)
to get the formattedString
representation. If there are noPopupDefinition.getExpressions()
and no popup elements of typeExpressionPopupElement
then the result array will be empty.The
PopupExpression
may be used in thePopupDefinition.getFields()
,PopupDefinition.getMedia()
,PopupDefinition.getTitle()
andPopupDefinition.getDescription()
.- Returns:
- a
ListenableFuture
that contains an array ofPopupExpressionEvaluation
- Since:
- 100.8.0
-
getEvaluatedElements
public java.util.List<PopupElement> getEvaluatedElements()
Gets an unmodifiable list ofPopupElement
objects evaluated asynchronously byevaluateExpressionsAsync()
. During the evaluation, eachExpressionPopupElement
is replaced by thePopupElement
returned by the Arcade expression and each placeholder is replaced by its value. If the Arcade expression returns a list of attributes to be used by the popup element, these attributes will be used bygetFormattedValue(PopupField)
}.The list is empty while
evaluateExpressionsAsync()
has not been executed, and is cleared ifevaluateExpressionsAsync()
is executed more than once. After evaluation, the order of the popup elements in the list matches the order elements present inPopupDefinition.getElements()
and shown in the pop-up window. If anExpressionPopupElement
fails to be evaluated, then it will be skipped in the list. Use the array ofPopupExpressionEvaluation
returned fromevaluateExpressionsAsync()
to learn the cause of the error.- Returns:
- an unmodifiable list of
PopupElement
evaluated asynchronously byevaluateExpressionsAsync()
. During the evaluation, eachExpressionPopupElement
is replaced by thePopupElement
returned by the Arcade expression and each placeholder is replaced by its value. If the Arcade expression returns a list of attributes to be used by the popup element, these attributes will be used bygetFormattedValue(PopupField)
. - Since:
- 100.14.0
- See Also:
PopupDefinition.getElements()
,evaluateExpressionsAsync()
-
-