Class PopupManager


  • public final class PopupManager
    extends Object
    Manages the viewing and editing of a Popup.
    Since:
    100.0.0
    • Constructor Detail

      • PopupManager

        public PopupManager​(android.content.Context context,
                            Popup popup)
        Constructs a PopupManager to manage the specified Popup. The GeoElement associated with the Popup must be loaded for the PopupManager to work properly.
        Parameters:
        popup - the Popup to manage
        Throws:
        IllegalArgumentException - if popup or context is null
        Since:
        100.0.0
    • Method Detail

      • getPopup

        public Popup getPopup()
        Gets the Popup being managed.
        Returns:
        the Popup being managed
        Since:
        100.0.0
      • getDisplayedFields

        public List<PopupField> getDisplayedFields()
        Gets the list of PopupFields that are visible.
        Returns:
        an unmodifiable list of PopupFields that are visible
        Since:
        100.0.0
      • getEditableFields

        public List<PopupField> getEditableFields()
        Gets the list of PopupFields that are editable.
        Returns:
        an unmodifiable list of PopupFields that are editable
        Since:
        100.0.0
      • getFeatureTypes

        public List<FeatureType> getFeatureTypes()
        Gets the list of feature types or null if the GeoElement is not an ArcGISFeature in an ArcGISFeatureTable.
        Returns:
        an unmodifiable list of feature types
        Since:
        100.0.0
      • getFieldType

        public Field.Type getFieldType​(PopupField popupField)
        Gets the Field.Type corresponding to the PopupField.
        Parameters:
        popupField - the PopupField for which to get the Field.Type
        Returns:
        the Field.Type corresponding to the PopupField
        Since:
        100.0.0
      • isEditing

        public boolean isEditing()
        Checks whether the PopupManager is currently in editing mode.
        Returns:
        true if the Popup is currently being edited; otherwise false
        Since:
        100.0.0
      • startEditing

        public boolean startEditing()
        Initiates an editing session with the Popup.
        Returns:
        true if an editing session is started; false if the Popup is already in editing or editing is not allowed
        Since:
        100.0.0
      • finishEditingAsync

        public ListenableFuture<ArcGISRuntimeException> finishEditingAsync()
        Finishes the editing session.
        Returns:
        a ListenableFuture that can be used to track the status of the operation; the result is an ArcGISRuntimeException, or null if the editing session succeeded
        Since:
        100.0.0
      • cancelEditing

        public void cancelEditing()
        Cancels the editing session.
        Since:
        100.0.0
      • isGeoElementValid

        public boolean isGeoElementValid()
        Checks whether the GeoElement is valid or not.
        Returns:
        true if the GeoElement is valid; otherwise false
        Since:
        100.0.0
      • doesChangeRequireNotification

        public boolean doesChangeRequireNotification​(FeatureTemplate featureTemplate)
        Checks whether changing to the specified FeatureTemplate requires warning the user that some data may be overwritten by the change.
        Parameters:
        featureTemplate - the new FeatureTemplate
        Returns:
        true if the user needs to be warned of data loss; otherwise false
        Since:
        100.0.0
      • updateValue

        public ArcGISRuntimeException updateValue​(FeatureTemplate featureTemplate,
                                                  PopupManager.FeatureTypeChangeMode changeMode)
        Updates the GeoElement's FeatureTemplate value, which in turn updates the values of its attribute table to match those in the feature template, dependent on the change mode. If changeMode is RESET_TO_DEFAULTS, then all current values will be reset to the defaults specified in the FeatureTemplate. If KEEP_VALUES, current values will be kept unless they are not valid for the new feature type (for example, if a CodedValueDomain changes and the current value is not in the new domain).
        Parameters:
        featureTemplate - the FeatureTemplate to use in updating the attribute table
        changeMode - the FeatureTypeChangeMode to apply
        Returns:
        null if successful or an ArcGISRuntimeException if the type ID field is invalid
        Since:
        100.0.0
      • getAttachmentManager

        public PopupAttachmentManager getAttachmentManager()
        Returns the PopupAttachmentManager for this PopupManager, or null if there isn't one.
        Returns:
        the PopupAttachmentManager
        Since:
        100.0.0
      • updateValue

        public ArcGISRuntimeException updateValue​(Object newValue,
                                                  PopupField popupField)
        Updates the value of the specified PopupField to the specified value.
        Parameters:
        newValue - the value with which to update the PopupField
        popupField - the PopupField to update
        Returns:
        null if successful or an ArcGISRuntimeException if the value isn't valid
        Since:
        100.0.0
      • getValidationError

        public ArcGISRuntimeException getValidationError​(PopupField popupField)
        Checks if the PopupField's current attribute value is valid. If it is invalid, an ArcGISRuntimeException will be returned.
        Parameters:
        popupField - the PopupField to check
        Returns:
        null if successful or an ArcGISRuntimeException if the value isn't valid
        Since:
        100.0.0
      • getRangeDomainValidationText

        public String getRangeDomainValidationText​(PopupField popupField)
        Gets a String that can be used to hint the acceptable values for a RangeDomain field.
        Parameters:
        popupField - the PopupField for which to get a range domain hint
        Returns:
        a String hinting at the acceptable values
        Since:
        100.0.0
      • getField

        public Field getField​(PopupField popupField)
        Gets the Field corresponding to the PopupField, or null if the GeoElement is not an ArcGISFeature.
        Parameters:
        popupField - the PopupField for which to get the corresponding Field
        Returns:
        the Field corresponding to the PopupField
        Since:
        100.0.0
      • isShowCustomHtmlDescription

        public boolean isShowCustomHtmlDescription()
        Checks whether the custom HTML description should be shown.
        Returns:
        true if it should be shown
        Since:
        100.0.0
      • getTitle

        public String getTitle()
        Gets the Popup's title text.
        Returns:
        the Popup's title text
        Since:
        100.0.0
      • getCustomHtmlDescription

        public String getCustomHtmlDescription()
        Gets the Popup's custom description HTML. Returns null if a description is not defined on the popup.
        Returns:
        the Popup's custom description HTML
        Since:
        100.0.0
      • getEditSummary

        public String getEditSummary()
        Gets the current edit summary. This details the user and/or time of the last edit, or of the creation if the ArcGISFeature has not been edited. Returns null if the GeoElement is not an ArcGISFeature or if there is no editor tracking information.
        Returns:
        the edit summary
        Since:
        100.0.0
      • getEditInfo

        public EditFieldsInfo getEditInfo()
        If the Popup's GeoElement is an ArcGISFeature, this returns the EditFieldsInfo contained in the ArcGISFeatureTable's ArcGISFeatureLayerInfo. Otherwise, null is returned.
        Returns:
        the EditFieldsInfo
        Since:
        100.0.0
      • getMaxLength

        public int getMaxLength​(PopupField popupField)
        Gets the maximum allowed length of the specified PopupField.
        Parameters:
        popupField - the PopupField to check
        Returns:
        the maximum length of the PopupField, or -1 if the GeoElement is not an ArcGISFeature
        Since:
        100.0.0
      • isNullable

        public boolean isNullable​(PopupField popupField)
        Checks if the specified PopupField is nullable.
        Parameters:
        popupField - the PopupField to check
        Returns:
        true if the PopupField is nullable; otherwise false
        Since:
        100.0.0
      • isAllowEdit

        public boolean isAllowEdit()
        Checks whether editing the GeoElement's attributes is allowed.
        Returns:
        true if the GeoElement's attributes can be edited; otherwise false
        Since:
        100.0.0
      • isAllowDelete

        public boolean isAllowDelete()
        Checks whether deleting the GeoElement is allowed.
        Returns:
        true if the GeoElement can be deleted; otherwise false
        Since:
        100.0.0
      • isAllowEditGeometry

        public boolean isAllowEditGeometry()
        Checks whether editing the GeoElement's geometry is allowed.
        Returns:
        true if editing the GeoElement's geometry is allowed; otherwise false
        Since:
        100.0.0
      • isShowAttachments

        public boolean isShowAttachments()
        Checks whether attachments should be shown.
        Returns:
        true if attachments should be shown; otherwise false
        Since:
        100.0.0
      • isShowMedia

        public boolean isShowMedia()
        Checks whether the PopupMedias should be shown.
        Returns:
        true if the PopupMedias should be shown; otherwise false
        Since:
        100.0.0
      • isShowEditSummary

        public boolean isShowEditSummary()
        Checks whether the EditInfo summary should be shown.
        Returns:
        true if the EditInfo summary should be shown; otherwise false
        Since:
        100.0.0
      • getFormattedValue

        public String getFormattedValue​(PopupField popupField)
        Gets a formatted String representation of the specified PopupField.
        Parameters:
        popupField - the PopupField for which to get a formatted String
        Returns:
        the formatted String
        Since:
        100.0.0
      • getFieldLabel

        public String getFieldLabel​(PopupField popupField)
        Gets the field label string for the given PopupField. If popupField is an Arcade expression field, it will return the title of the PopupExpression associated with the popup field.
        Parameters:
        popupField - the PopupField object
        Returns:
        a label string for the popup field
        Since:
        100.3.0
      • substitute

        public String substitute​(String templateString)
        Substitutes attribute values for attribute place-holders in a given template string. An example string would be: "This tree's leaves are {leafColor} in the {season}", where leafColor and season are both attribute keys / field names.
        Parameters:
        templateString - the template string containing place-holders
        Returns:
        a String with attribute values substituted for the place-holders
        Since:
        100.0.0
      • setGeoElementValidityChangedListener

        public void setGeoElementValidityChangedListener​(GeoElementValidityChangedListener geoElementValidityChangedListener)
        Sets a GeoElementValidityChangedListener to be invoked when the validity of the Popup's GeoElement changes. For example, this could be used to change the UI when a Popup is determined to be invalid, such as disabling a submit button or showing a warning.
        Parameters:
        geoElementValidityChangedListener - the listener to set
        Since:
        100.0.0
      • setFeatureTypeChangedListener

        public void setFeatureTypeChangedListener​(FeatureTypeChangedListener featureTypeChangedListener)
        Sets a FeatureTypeChangedListener to be invoked when the FeatureType of the Popup's GeoElement changes. For example, this could be used to change the symbol of the GeoElement if each feature type has its own unique symbol.
        Parameters:
        featureTypeChangedListener - the listener to set
        Since:
        100.0.0
      • getFieldValue

        public Object getFieldValue​(PopupField popupField)
        Gets the value of the specified PopupField.
        Parameters:
        popupField - the PopupField for which to get the value
        Returns:
        the attribute value for that PopupField
        Since:
        100.0.0
      • getField

        public Field getField​(String fieldName)
        Gets the Field object corresponding to the specified field name, or null if either there is no such field or the GeoElement is not an ArcGISFeature with fields.
        Parameters:
        fieldName - the name of the field for which to get the Field object
        Returns:
        the Field object for the specified field name
        Since:
        100.0.0
      • isFeatureType

        public boolean isFeatureType​(PopupField popupField)
        Checks if the specified PopupField is the feature type field.
        Parameters:
        popupField - the PopupField to check
        Returns:
        true if the PopupField is the type ID field; otherwise false
        Since:
        100.0.0
      • getDomain

        public Domain getDomain​(PopupField popupField)
        Gets the Domain for the specified PopupField or null if there isn't one.
        Parameters:
        popupField - the PopupField for which to get the Domain
        Returns:
        the Domain for the specified PopupField
        Since:
        100.0.0
      • getSymbol

        public Symbol getSymbol()
        Gets the symbol of the Popup.
        Returns:
        the symbol of the Popup
        Since:
        100.0.0