Interface IFilePreviewProvider<T>

  • Type Parameters:
    T - File model type consumed by the component.
    All Superinterfaces:
    Serializable

    public interface IFilePreviewProvider<T>
    extends Serializable
    Provides preview behavior for reusable upload file UI components.

    Implementations decide whether a file supports image preview, how preview resource parameters are created, and which streamed content should be used when the preview resource is requested.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      String createPreviewResourceParams​(T file)
      Creates the encoded request parameter payload used to resolve the preview resource for the given file.
      default org.primefaces.model.StreamedContent getDownloadContent​(T file)
      Returns the streamed content used when downloading the given file from the component.
      org.primefaces.model.StreamedContent getPreviewContent()
      Returns the streamed content used by the component preview image.
      default String getPreviewVersion​(T file)
      Returns an optional preview version token that may be appended to the preview resource URL for cache busting.
      boolean isPreviewableImage​(T file)
      Checks whether the given file should be rendered as an image preview instead of the fallback file icon.
    • Method Detail

      • createPreviewResourceParams

        String createPreviewResourceParams​(T file)
        Creates the encoded request parameter payload used to resolve the preview resource for the given file.
        Parameters:
        file - File to create preview parameters for.
        Returns:
        Encoded preview resource parameters.
      • getPreviewContent

        org.primefaces.model.StreamedContent getPreviewContent()
        Returns the streamed content used by the component preview image.
        Returns:
        Streamed preview content.
      • getDownloadContent

        default org.primefaces.model.StreamedContent getDownloadContent​(T file)
        Returns the streamed content used when downloading the given file from the component.
        Parameters:
        file - File to download.
        Returns:
        Streamed download content.
      • isPreviewableImage

        boolean isPreviewableImage​(T file)
        Checks whether the given file should be rendered as an image preview instead of the fallback file icon.
        Parameters:
        file - File to inspect.
        Returns:
        true when the file can be previewed as an image, otherwise false.
      • getPreviewVersion

        default String getPreviewVersion​(T file)
        Returns an optional preview version token that may be appended to the preview resource URL for cache busting.
        Parameters:
        file - File to resolve the preview version for.
        Returns:
        Preview version token, or null when no explicit version is required.