Class PlatformFileUploadPanel

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, io.clogr.Clogged, Box, Component, CompositeComponent, Container, LayoutComponent, Panel, ProgressListenable<Long>, Displayable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject, Iterable<Component>

public class PlatformFileUploadPanel extends AbstractPanel implements ProgressListenable<Long>
Panel to browse platform files and upload them to the specified destination. Progress events are sent both for individual platform file transfer progress and for overall progress. For the former, the source of the event will be the relevant PlatformFile; for the latter, the source of the event will be a PlatformFileUploadTask.
Author:
Garret Wilson
  • Field Details

    • DESTINATION_URI_PROPERTY

      public static final String DESTINATION_URI_PROPERTY
      The bound property of the destination URI.
    • DESTINATION_BOOKMARK_PROPERTY

      public static final String DESTINATION_BOOKMARK_PROPERTY
      The bound property of the destination bookmark.
  • Constructor Details

    • PlatformFileUploadPanel

      public PlatformFileUploadPanel(URI destinationURI)
      Destination URI constructor.
      Parameters:
      destinationURI - The collection URI representing the base destination of the platform files, either absolute or relative to the application.
      Throws:
      NullPointerException - if the given list of platform files and/or destination URI is null.
      IllegalArgumentException - if the provided URI is not a collection URI.
      IllegalArgumentException - if the provided URI specifies a query and/or fragment.
    • PlatformFileUploadPanel

      public PlatformFileUploadPanel(URI destinationURI, Bookmark destinationBookmark)
      Destination URI and destination bookmark constructor.
      Parameters:
      destinationURI - The collection URI representing the base destination of the platform files, either absolute or relative to the application.
      destinationBookmark - The bookmark to be used in sending resources to the destination URI, or null if there is no bookmark specified.
      Throws:
      NullPointerException - if the given list of platform files and/or destination URI is null.
      IllegalArgumentException - if the provided URI is not a collection URI.
      IllegalArgumentException - if the provided URI specifies a query and/or fragment.
    • PlatformFileUploadPanel

      public PlatformFileUploadPanel()
      Default constructor with a default vertical flow layout.
  • Method Details

    • getControlPanel

      public Panel getControlPanel()
      Returns:
      The panel containing controls such as buttons.
    • getDestinationURI

      public URI getDestinationURI()
      Returns:
      The collection URI representing the base destination of the platform files, either absolute or relative to the application, or null if the destination URI has not yet been set.
    • setDestinationURI

      public void setDestinationURI(URI newDestinationURI)
      Sets the destination base URI of the upload. This is a bound property.
      Parameters:
      newDestinationURI - The collection URI representing the base destination of the platform files, either absolute or relative to the application.
      Throws:
      NullPointerException - if the given URI is null.
      IllegalArgumentException - if the provided URI is not a collection URI.
      IllegalArgumentException - if the provided URI specifies a query and/or fragment.
      See Also:
    • getDestinationBookmark

      public Bookmark getDestinationBookmark()
      Returns:
      The bookmark to be used in sending resources to the destination URI, or null if there is no bookmark specified.
    • setDestinationBookmark

      public void setDestinationBookmark(Bookmark newDestinationBookmark)
      Sets the destination bookmark of the upload. This is a bound property.
      Parameters:
      newDestinationBookmark - The bookmark to be used in sending resources to the destination URI, or null if there is no bookmark specified.
      See Also:
    • getBrowseActionPrototype

      public ActionPrototype getBrowseActionPrototype()
      Returns:
      The action prototype for browsing the platforom file system.
    • getUploadActionPrototype

      public ActionPrototype getUploadActionPrototype()
      Returns:
      The action prototype for uploading.
    • getCancelActionPrototype

      public ActionPrototype getCancelActionPrototype()
      Returns:
      The action prototype for canceling.
    • updateComponents

      protected void updateComponents()
      Updates the state of components.
    • updatePlatformFileStatusLabel

      protected void updatePlatformFileStatusLabel(PlatformFile platformFile, com.globalmentor.model.TaskState state, Long progress, Long completion)
      Updates the status label for an individual platform file.
      Parameters:
      platformFile - The current platform file.
      state - The new transfer state, or null if there is no state.
      progress - The current number of bytes transferred, or null if the bytes transferred is not known.
      completion - The total number of bytes to transfer, or null if the total is not known.
      Throws:
      NullPointerException - if the given platform file is null.
    • updateOverallStatusLabel

      protected void updateOverallStatusLabel(com.globalmentor.model.TaskState state, Long progress, Long completion)
      Updates the status label for the overall progress.
      Parameters:
      state - The new transfer state, or null if there is no state.
      progress - The current number of bytes transferred, or null if the bytes transferred is not known.
      completion - The total number of bytes to transfer, or null if the total is not known.
    • addProgressListener

      public void addProgressListener(ProgressListener<Long> progressListener)
      Description copied from interface: ProgressListenable
      Adds a progress listener.
      Specified by:
      addProgressListener in interface ProgressListenable<Long>
      Parameters:
      progressListener - The progress listener to add.
    • removeProgressListener

      public void removeProgressListener(ProgressListener<Long> progressListener)
      Description copied from interface: ProgressListenable
      Removes an progress listener.
      Specified by:
      removeProgressListener in interface ProgressListenable<Long>
      Parameters:
      progressListener - The progress listener to remove.
    • fireProgressed

      protected void fireProgressed(ProgressEvent<Long> progressEvent)
      Fires a given progress event to all registered progress listeners.
      Parameters:
      progressEvent - The progress event to fire.