Class AbstractFileViewPanel<T>

Type Parameters:
T - Type tag of the underlying data.
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Scrollable

public abstract class AbstractFileViewPanel<T> extends JCommandButtonPanel
Panel that hosts file-related command buttons with progress indication and cancellation capabilities.
See Also:
  • Field Details

  • Constructor Details

    • AbstractFileViewPanel

      public AbstractFileViewPanel(Dimension startingDimension)
      Creates a new panel.
      Parameters:
      startingDimension - Initial dimension for icons.
    • AbstractFileViewPanel

      public AbstractFileViewPanel(CommandButtonPresentationState startingState)
      Creates a new panel.
      Parameters:
      startingState - Initial state for icons.
  • Method Details

    • setProgressListener

      public void setProgressListener(ProgressListener progressListener)
    • getProgressListener

      public ProgressListener getProgressListener()
    • setFolder

      public void setFolder(List<BreadcrumbItem<T>> leaves)
      Sets the current entries to show. The current contents of the panel are discarded. For each matching entry determined by the toShowFile(BreadcrumbItem) call, a new JCommandButton with matching implementation of RadianceIcon from getRadianceIcon(Leaf, InputStream, CommandButtonPresentationState, Dimension) is added to the panel.
      Parameters:
      leaves - Information on the entries to show in the panel.
    • getLoadedIconCount

      public int getLoadedIconCount()
      Returns the number of loaded icons.
      Returns:
      The number of loaded icons.
    • cancelMainWorker

      public void cancelMainWorker()
      Cancels the pending processing.
    • toShowFile

      protected abstract boolean toShowFile(BreadcrumbItem<T> item)
      Returns indication whether the specified file should be shown on this panel.
      Parameters:
      item - Information on the file.
      Returns:
      true if the specified file should be shown on this panel, false otherwise.
    • getRadianceIcon

      protected abstract RadianceIcon getRadianceIcon(AbstractFileViewPanel.Leaf leaf, InputStream stream, CommandButtonPresentationState state, Dimension dimension)
      Returns the icon for the specified parameters.
      Parameters:
      leaf - Information on the file.
      stream - Input stream with the file contents.
      state - Icon state.
      dimension - Icon dimension.
      Returns:
      File icon.
    • configureCommand

      protected void configureCommand(AbstractFileViewPanel.Leaf leaf, Command command, RadianceIcon icon)
      Configures the specified command. Can be used to wire additional behavior, such as tooltips or action listeners if the specific panel implementation requires it.
      Parameters:
      leaf - Information on the file "behind" the command.
      command - Command to configure.
      icon - Command icon.
    • getLeafContent

      protected abstract InputStream getLeafContent(T leaf)
      Returns the input stream with the file contents.
      Parameters:
      leaf - Leaf (file behind a command on this panel).
      Returns:
      Input stream with the file contents.