Class AbstractFileViewPanel<T>

    • Field Detail

      • progressListener

        protected ProgressListener progressListener
        Progress listener to report back on loaded images.
      • loadedSet

        protected Set<JCommandButton> loadedSet
        Contains the buttons with completely loaded images.
    • Constructor Detail

      • AbstractFileViewPanel

        public AbstractFileViewPanel​(int startingDimension,
                                     ProgressListener progressListener)
        Creates a new panel.
        Parameters:
        startingDimension - Initial dimension for icons.
        progressListener - Progress listener to report back on loaded icons.
      • AbstractFileViewPanel

        public AbstractFileViewPanel​(CommandButtonDisplayState startingState,
                                     ProgressListener progressListener)
        Creates a new panel.
        Parameters:
        startingState - Initial state for icons.
        progressListener - Progress listener to report back on loaded icons.
    • Method Detail

      • setFolder

        public void setFolder​(List<StringValuePair<T>> leafs)
        Sets the current entries to show. The current contents of the panel are discarded. For each matching entry determined by the toShowFile(StringValuePair) call, a new JCommandButton hosting an the matching implementation of ResizableIcon is added to the panel.
        Parameters:
        leafs - 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.
      • getButtonMap

        public Map<String,​JCommandButton> getButtonMap()
        Returns the button map.
        Returns:
        Unmodifiable view on the button map.
      • toShowFile

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

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

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