Class FilePanel

    • Field Detail

      • m_ShowDetails

        protected Boolean m_ShowDetails
        whether to show details on the files.
      • m_MultiSelection

        protected boolean m_MultiSelection
        whether to allow multiple files to be selected.
      • m_ShowHidden

        protected boolean m_ShowHidden
        whether to show hidden files.
      • m_Lister

        protected DirectoryLister m_Lister
        for listing the content of the directory.
      • m_Files

        protected List<FileObject> m_Files
        the currently listed files.
      • m_Worker

        protected SwingWorker m_Worker
        the currently running swingworker.
      • m_IgnoreChanges

        protected boolean m_IgnoreChanges
        whether to ignore changes.
      • m_PanelSearch

        protected SearchPanel m_PanelSearch
        the search panel.
      • m_DirectoryChangeListeners

        protected Set<ChangeListener> m_DirectoryChangeListeners
        the listeners for when the directory gets updated.
      • m_FilesChangeListeners

        protected Set<ChangeListener> m_FilesChangeListeners
        the listeners for when the files get updated.
      • m_SelectionChangeListeners

        protected Set<ChangeListener> m_SelectionChangeListeners
        the listeners for when the selection changes.
      • m_FocusAdapter

        protected FocusAdapter m_FocusAdapter
        the focus adapter.
      • m_KeyAdapter

        protected KeyAdapter m_KeyAdapter
        the key adapter.
      • m_MouseAdapter

        protected MouseAdapter m_MouseAdapter
        the mouse adapter.
    • Constructor Detail

      • FilePanel

        public FilePanel​(boolean showDetails)
        Initializes the panel.
        Parameters:
        showDetails - whether to show details like DIR and size
      • FilePanel

        public FilePanel​(boolean showDetails,
                         DirectoryLister lister)
        Initializes the panel.
        Parameters:
        showDetails - whether to show details like DIR and size
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class BasePanel
      • finishInit

        protected void finishInit()
        Finalizes the initialization.
        Overrides:
        finishInit in class BasePanel
      • isLocal

        public boolean isLocal()
        Returns whether the files are local or remote.
        Returns:
        true if local
      • setDirectoryLister

        public void setDirectoryLister​(DirectoryLister value)
        Sets the directory lister to use.
        Parameters:
        value - the lister
      • getDirectoryLister

        public DirectoryLister getDirectoryLister()
        Returns the current directory lister.
        Returns:
        the lister
      • setCurrentDir

        public void setCurrentDir​(String value)
        Sets the directory to list.
        Parameters:
        value - the directory
      • getCurrentDir

        public String getCurrentDir()
        Returns the current directory.
        Returns:
        the directory
      • setListDirs

        public void setListDirs​(boolean value)
        Sets whether to list directories.
        Parameters:
        value - true if to list directories
      • getListDirs

        public boolean getListDirs()
        Returns whether directories are listed.
        Returns:
        true if to list directories
      • setListFiles

        public void setListFiles​(boolean value)
        Sets whether to list files.
        Parameters:
        value - true if to list files
      • getListFiles

        public boolean getListFiles()
        Returns whether files are listed.
        Returns:
        true if to list files
      • setFilter

        public void setFilter​(BaseRegExp value)
        Sets the filter to use.
        Parameters:
        value - the filter
      • getFilter

        public BaseRegExp getFilter()
        Return the filter in use.
        Returns:
        the filter
      • setCaseSensitive

        public void setCaseSensitive​(boolean value)
        Sets whether to use case-sensitive comparison.
        Parameters:
        value - true if case-sensitive
      • isCaseSensitive

        public boolean isCaseSensitive()
        Returns whether comparison is case-sensitive.
        Returns:
        true if case-sensitive
      • setListDirsFirst

        public void setListDirsFirst​(boolean value)
        Sets whether to list directories first.
        Parameters:
        value - true if to list directories first
      • isListDirsFirst

        public boolean isListDirsFirst()
        Returns whether to list directories first.
        Returns:
        true if to list dirs first
      • setIncludeParentDirs

        public void setIncludeParentDirs​(boolean value)
        Sets whether to use include the parent directories in the comparison.
        Parameters:
        value - true if to include parent directories
      • isIncludeParentDirs

        public boolean isIncludeParentDirs()
        Returns whether to include parent directories in the comparison.
        Returns:
        true if included
      • setShowHidden

        public void setShowHidden​(boolean value)
        Sets whether to show hidden files or not.
        Parameters:
        value - true if to show
      • isShowHidden

        public boolean isShowHidden()
        Returns whether to show hidden files or not.
        Returns:
        true if to show
      • setMultiSelection

        public void setMultiSelection​(boolean value)
        Sets whether to allow multi-selection.
        Parameters:
        value - true if to allow
      • isMultiSelection

        public boolean isMultiSelection()
        Returns whether multi-selection is enabled.
        Returns:
        true if enabled
      • getSelectedFileObject

        protected FileObject getSelectedFileObject​(boolean skipDotDot)
        Returns the currently selected file wrapper, if any.
        Parameters:
        skipDotDot - whether to skip the dot dot file
        Returns:
        the file wrapper, null if none selected
      • getSelectedFile

        protected File getSelectedFile​(boolean skipDotDot)
        Returns the currently selected file, if any.
        Parameters:
        skipDotDot - whether to skip the dot dot file
        Returns:
        the file, null if none selected
      • getSelectedFileObject

        public FileObject getSelectedFileObject()
        Returns the currently selected file object, if any.
        Returns:
        the file object, null if none selected
      • getSelectedFile

        public File getSelectedFile()
        Returns the currently selected file, if any.
        Returns:
        the file, null if none selected
      • getSelectedFileObjects

        public FileObject[] getSelectedFileObjects()
        Returns the currently selected file objects, if any.
        Returns:
        the file objects
      • getSelectedFiles

        public File[] getSelectedFiles()
        Returns the currently selected files, if any.
        Returns:
        the files
      • clearSelection

        public void clearSelection()
        Clears the selection.
      • startUpdate

        public void startUpdate()
        Allows the update of several parameters without triggering an update each time.
      • finishUpdate

        public void finishUpdate()
        Triggers an update after updating several parameters.
      • update

        protected void update()
        Updates the view.
      • updateGUI

        protected void updateGUI()
        Updates the GUI.
      • reload

        public void reload()
        Updates the files (if not busy).
      • setSearchVisible

        public void setSearchVisible​(boolean value)
        Sets the visibility state of the search box. NB: only available when details are shown using a table.
        Parameters:
        value - true if visible
      • isSearchVisible

        public boolean isSearchVisible()
        Returns whether the search box is visible.
        Returns:
        true of visible
      • isBusy

        public boolean isBusy()
        Checks whether we're currently busy.
        Returns:
        true if busy
      • addDirectoryChangeListener

        public void addDirectoryChangeListener​(ChangeListener l)
        Adds the listener to the list of listeners that get notified when the directory changes.
        Parameters:
        l - the listener to add
      • removeDirectoryChangeListener

        public void removeDirectoryChangeListener​(ChangeListener l)
        Removes the listener from the list of listeners that get notified when the directory changes.
        Parameters:
        l - the listener to add
      • notifyDirectoryChangeListeners

        protected void notifyDirectoryChangeListeners()
        Notifies the listeners when the directory has changed.
      • addFilesChangeListener

        public void addFilesChangeListener​(ChangeListener l)
        Adds the listener to the list of listeners that get notified when the files change.
        Parameters:
        l - the listener to add
      • removeFilesChangeListener

        public void removeFilesChangeListener​(ChangeListener l)
        Removes the listener from the list of listeners that get notified when the files change.
        Parameters:
        l - the listener to add
      • notifyFilesChangeListeners

        protected void notifyFilesChangeListeners()
        Notifies the listeners when the files have changed.
      • addSelectionChangeListener

        public void addSelectionChangeListener​(ChangeListener l)
        Adds the listener to the list of listeners that get notified when the selection changes.
        Parameters:
        l - the listener to add
      • removeSelectionChangeListener

        public void removeSelectionChangeListener​(ChangeListener l)
        Removes the listener from the list of listeners that get notified when the selection changes.
        Parameters:
        l - the listener to add
      • notifySelectionChangeListeners

        protected void notifySelectionChangeListeners()
        Notifies the listeners when the selection has changed.
      • addFileDoubleClickListener

        public void addFileDoubleClickListener​(FilePanel.FileDoubleClickListener l)
        Adds the listener to the list of listeners that get notified when a file gets double-clicked.
        Parameters:
        l - the listener to add
      • removeFileDoubleClickListener

        public void removeFileDoubleClickListener​(FilePanel.FileDoubleClickListener l)
        Removes the listener from the list of listeners that get notified when a file gets double-clicked.
        Parameters:
        l - the listener to add
      • notifyFileDoubleClickListeners

        protected void notifyFileDoubleClickListeners​(FilePanel.FileDoubleClickEvent e)
        Notifies the listeners when a file got double-clicked.
      • addSearchListener

        public void addSearchListener​(SearchListener l)
        Adds the specified search listener.
        Parameters:
        l - the listener to add
      • removeSearchListener

        public void removeSearchListener​(SearchListener l)
        Removes the specified search listener.
        Parameters:
        l - the listener to remove
      • main

        public static void main​(String[] args)
        Just for testing.
        Parameters:
        args - the initial directory