Class BrowseDirectoryPanel

All Implemented Interfaces:
ILocalized, IRememberPreferences, ImageObserver, MenuContainer, Serializable, Accessible

public class BrowseDirectoryPanel extends JPanel implements IRememberPreferences, ILocalized
Since:
1.0 2008, 1.0
Version:
%I%, %G%
Author:
Steph GAUDRY
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • BrowseDirectoryPanel

      public BrowseDirectoryPanel()
      Constructs a BrowseDirectoryPanel with all default values :
      • prefStorageName : "default"
      • directoryPath : user home directory
      • storageType : LOCAL
    • BrowseDirectoryPanel

      public BrowseDirectoryPanel(String prefStorageName)
      Constructs a BrowseDirectoryPanel with some default values :
      • directoryPath : user home directory
      • storageType : LOCAL
      Parameters:
      prefStorageName - Key used to retrieve or save the directory path with the RememberHelper helper class.
    • BrowseDirectoryPanel

      public BrowseDirectoryPanel(String prefStorageName, RememberHelper.StorageType storageType)
      Constructs a BrowseDirectoryPanel with some default values :
      • directoryPath : user home directory
      Parameters:
      prefStorageName - Key used to retrieve or save the directory path with the RememberHelper helper class.
      storageType - the preferred data path type ( LOCAL or ROAMING).
    • BrowseDirectoryPanel

      public BrowseDirectoryPanel(String prefStorageName, String directoryPath, RememberHelper.StorageType storageType)
      Constructs a BrowseDirectoryPanel with all values.
      Parameters:
      prefStorageName - Key used to retrieve or save the directory path with the RememberHelper helper class.
      directoryPath - Value defined as default directory path with the RememberHelper helper class.
      storageType - the preferred data path type ( LOCAL or ROAMING).
  • Method Details

    • getStorageType

      public RememberHelper.StorageType getStorageType()
      Returns:
      the storageType
    • setStorageType

      public void setStorageType(RememberHelper.StorageType storageType)
      Parameters:
      storageType - the storageType to set
    • getPath

      public String getPath()
      Returns:
      the path
    • setPreferredPath

      public void setPreferredPath(String preferredPath, boolean onlyIfExists)
      Gives a preferred path if the path cannot be loaded
      Parameters:
      preferredPath - the path to set
      onlyIfExists - do not set the preferred path if the path doesn't exists
    • setPath

      public void setPath(String path)
      Sets the directory path and sends a notification to the observers
      Parameters:
      path - the path to set
    • getPreferencesKey

      public String getPreferencesKey()
      Virtual path used to store data (slashes separated)
      Returns:
      the preferencesKey
    • setPreferencesKey

      public void setPreferencesKey(String key)
      Sets the key to store and retrieve the preferred path, and reload preferences corresponding to the new key.
      Be careful : modifying this virtual path involves storing data in another virtual location in the property file
      Parameters:
      key - the preferencesKey to set
    • setFileSelectionMode

      public void setFileSelectionMode(int mode)
      Sets the JFileChooser to allow the user to just select files, just select directories, or select both files and directories. The default is JFilesChooser.FILES_ONLY.
      Parameters:
      mode - the type of files to be displayed:
      • JFileChooser.FILES_ONLY
      • JFileChooser.DIRECTORIES_ONLY
      • JFileChooser.FILES_AND_DIRECTORIES
      Throws:
      IllegalArgumentException - if mode is an illegal file selection mode
      See Also:
      JFileChooser.getFileSelectionMode()
    • setFileSelectionMode

      public void setFileSelectionMode(int mode, FileNameExtensionFilter filesFilter)
    • loadPreferences

      public void loadPreferences()
      Specified by:
      loadPreferences in interface IRememberPreferences
    • savePreferences

      public void savePreferences()
      Specified by:
      savePreferences in interface IRememberPreferences
    • addObserver

      public void addObserver(PropertyChangeListener pcl)
      Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set. The order in which notifications will be delivered to multiple observers is not specified. See the class comment.
      Parameters:
      pcl - an observer to be added.
      Throws:
      NullPointerException - if the parameter o is null.
    • deleteObserver

      public void deleteObserver(PropertyChangeListener pcl)
      Deletes an observer from the set of observers of this object. Passing null to this method will have no effect.
      Parameters:
      pcl - the observer to be deleted.
    • main

      public static void main(String[] args)
      Auto-generated main method to display this JPanel inside a new JFrame.
    • setLanguage

      public void setLanguage()
      Description copied from interface: ILocalized
      Sets localized language The implementation should use a ResourceBundle to load information based on the user's Locale, and may observe the LanguageHelper to update the GUI on Locale switch.
      Specified by:
      setLanguage in interface ILocalized