Class PopupAttachmentManager


  • public final class PopupAttachmentManager
    extends java.lang.Object
    Manages PopupAttachments for a Popup.
    Since:
    100.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      PopupAttachmentManager​(ArcGISFeature arcGISFeature)
      Constructs a PopupAttachmentManager to manage the attachments of the provided ArcGISFeature.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PopupAttachment addAttachment​(java.lang.String name, android.graphics.Bitmap image, android.graphics.Bitmap.CompressFormat format)
      Adds the specified Bitmap image as an attachment with the specified name and compression format.
      PopupAttachment addAttachment​(java.lang.String name, java.lang.String contentType, java.io.InputStream data)
      Adds the specified data as an attachment with the specified name and content type.
      ListenableFuture<java.lang.Void> applyChangesAsync()
      Applies the current changes to the ArcGISFeature in its ArcGISFeatureTable.
      void deleteAttachment​(PopupAttachment attachment)
      Deletes the specified PopupAttachment.
      ListenableFuture<java.util.List<PopupAttachment>> fetchAttachmentsAsync()
      Fetches the Attachments from the ArcGISFeature and creates PopupAttachments from them.
      java.util.List<PopupAttachment> filterAttachments()
      Returns a list of only the PopupAttachments that can be displayed after having sorted them in an alphabetically ascending order.
      java.util.List<PopupAttachment> getAttachments()
      Gets the current list of PopupAttachments.
      void revertChanges()
      Reverts the current working changes made to the Popup's attachments (such as addAttachment and deleteAttachment).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PopupAttachmentManager

        public PopupAttachmentManager​(ArcGISFeature arcGISFeature)
        Constructs a PopupAttachmentManager to manage the attachments of the provided ArcGISFeature.
        Parameters:
        arcGISFeature - the ArcGISFeature for which to manage the attachments
        Throws:
        java.lang.IllegalArgumentException - if arcGISFeature is null
        Since:
        100.0.0
    • Method Detail

      • addAttachment

        public PopupAttachment addAttachment​(java.lang.String name,
                                             android.graphics.Bitmap image,
                                             android.graphics.Bitmap.CompressFormat format)
                                      throws java.io.IOException
        Adds the specified Bitmap image as an attachment with the specified name and compression format.

        This edit doesn't go into the table until changes are applied to the table through PopupManager.finishEditingAsync().

        Parameters:
        name - the name of the attachment
        image - the image to attach
        format - the compression format of the image, either PNG or JPEG
        Returns:
        the created PopupAttachment
        Throws:
        java.lang.IllegalArgumentException - if image is null
        java.io.IOException - if there is an issue trying to save the image to a temporary file
        Since:
        100.0.0
      • addAttachment

        public PopupAttachment addAttachment​(java.lang.String name,
                                             java.lang.String contentType,
                                             java.io.InputStream data)
                                      throws java.io.IOException
        Adds the specified data as an attachment with the specified name and content type.

        This edit doesn't go into the table until changes are applied to the table through PopupManager.finishEditingAsync().

        Parameters:
        name - the name of the attachment
        contentType - the content type of the data
        data - the data to attach
        Returns:
        the created PopupAttachment
        Throws:
        java.io.IOException - if the stream cannot be read
        Since:
        100.0.0
      • deleteAttachment

        public void deleteAttachment​(PopupAttachment attachment)
        Deletes the specified PopupAttachment.

        This edit doesn't go into the table until changes are applied to the table through PopupManager.finishEditingAsync().

        Parameters:
        attachment - the PopupAttachment to delete
        Since:
        100.0.0
      • fetchAttachmentsAsync

        public ListenableFuture<java.util.List<PopupAttachment>> fetchAttachmentsAsync()
        Fetches the Attachments from the ArcGISFeature and creates PopupAttachments from them.
        Returns:
        a ListenableFuture that represents the result of the operation; the result is a list of PopupAttachments wrapping the ArcGISFeature's Attachments
        Since:
        100.0.0
      • getAttachments

        public java.util.List<PopupAttachment> getAttachments()
        Gets the current list of PopupAttachments.
        Returns:
        the current list of PopupAttachments
        Since:
        100.0.0
      • filterAttachments

        public java.util.List<PopupAttachment> filterAttachments()
        Returns a list of only the PopupAttachments that can be displayed after having sorted them in an alphabetically ascending order.
        Returns:
        an alphabetically sorted list of PopupAttachments that can be shown
        Since:
        100.0.0
      • applyChangesAsync

        public ListenableFuture<java.lang.Void> applyChangesAsync()
        Applies the current changes to the ArcGISFeature in its ArcGISFeatureTable.
        Returns:
        a ListenableFuture that can be used to track the status of the operation
        Since:
        100.0.0
      • revertChanges

        public void revertChanges()
        Reverts the current working changes made to the Popup's attachments (such as addAttachment and deleteAttachment). This does not reverse a call to applyChangesAsync().
        Since:
        100.0.0