Class UserDirectoryManager

java.lang.Object
qupath.lib.gui.UserDirectoryManager

public class UserDirectoryManager extends Object
Helper class for managing a user directory, and associated subdirectories.

Note that only the main user directory can be directly specified. Other directories are derived from this.

Since:
v0.5.0
Author:
Pete Bankhead
  • Property Details

  • Field Details

    • DIR_EXTENSIONS

      public static final String DIR_EXTENSIONS
      Name of subdirectory containing extensions.
      See Also:
    • DIR_CSS

      public static final String DIR_CSS
      Name of subdirectory containing css files for styling.
      See Also:
    • DIR_SCRIPTS

      public static final String DIR_SCRIPTS
      Name of subdirectory containing shared scripts.
      See Also:
    • DIR_COLORMAPS

      public static final String DIR_COLORMAPS
      Name of subdirectory containing colormaps.
      See Also:
    • DIR_LOGS

      public static final String DIR_LOGS
      Name of subdirectory containing log files.
      See Also:
    • DIR_LOCALIZATION

      public static final String DIR_LOCALIZATION
      Name of subdirectory containing properties files for localization.
      See Also:
  • Method Details

    • getInstance

      public static UserDirectoryManager getInstance()
      Get the singleton instance of the UserDirectoryManager.
      Returns:
    • createRelativePathProperty

      public ReadOnlyObjectProperty<Path> createRelativePathProperty(String other)
      Create a read only property for a relative path of the user subdirectory. This can be used if the default subdirectories aren't sufficient.
      Parameters:
      other -
      Returns:
    • userDirectoryProperty

      public ObjectProperty<Path> userDirectoryProperty()
      Property representing the user directory. This may be null if the directory has not been set.
      Returns:
    • extensionsDirectoryProperty

      public ReadOnlyObjectProperty<Path> extensionsDirectoryProperty()
      Read only property representing the extensions directory. This is based upon userDirectoryProperty and DIR_EXTENSIONS.
      Returns:
    • cssDirectoryProperty

      public ReadOnlyObjectProperty<Path> cssDirectoryProperty()
      Read only property representing the css directory. This is based upon userDirectoryProperty and DIR_CSS.
      Returns:
    • localizationDirectoryProperty

      public ReadOnlyObjectProperty<Path> localizationDirectoryProperty()
      Read only property representing the localization directory. This is based upon userDirectoryProperty and DIR_LOCALIZATION.
      Returns:
    • logDirectoryProperty

      public ReadOnlyObjectProperty<Path> logDirectoryProperty()
      Read only property representing the log file directory. This is based upon userDirectoryProperty and DIR_LOGS.
      Returns:
    • scriptsDirectoryProperty

      public ReadOnlyObjectProperty<Path> scriptsDirectoryProperty()
      Read only property representing the shared scripts directory. This is based upon userDirectoryProperty and DIR_SCRIPTS.
      Returns:
    • colormapsDirectoryProperty

      public ReadOnlyObjectProperty<Path> colormapsDirectoryProperty()
      Read only property representing the custom colormaps directory. This is based upon userDirectoryProperty and DIR_COLORMAPS.
      Returns:
    • getUserPath

      public Path getUserPath()
      Get the user path where additional files may be stored.
      Returns:
    • getRelativePathOrNull

      public Path getRelativePathOrNull(String other)
    • setUserPath

      public void setUserPath(Path path) throws IllegalArgumentException
      Set the user path where additional files may be stored. Note that the specified path must exist and must represent a directory.
      Parameters:
      path -
      Throws:
      IllegalArgumentException - if the path is not null, but does not represent a valid, existing directory
    • getExtensionsPath

      public Path getExtensionsPath()
      Get the path to where extensions should be stored. This depends upon userDirectoryProperty().
      Returns:
      the path if available, or null if getUserPath() returns null
    • getCssStylesPath

      public Path getCssStylesPath()
      Get the path to where user directory for storing CSS styles. This depends upon userDirectoryProperty().
      Returns:
      the path if available, or null if getUserPath() returns null
      Since:
      v0.4.0
    • getLogDirectoryPath

      public Path getLogDirectoryPath()
      Get the path to where log files should be written. This depends upon userDirectoryProperty().
      Returns:
      the path if available, or null if getUserPath() returns null
    • getLocalizationDirectoryPath

      public Path getLocalizationDirectoryPath()
      Get the path to where localization property files should be written. This depends upon userDirectoryProperty().
      Returns:
      the path if available, or null if getUserPath() returns null
    • getColormapsDirectoryPath

      public Path getColormapsDirectoryPath()
      Get the path to where colormaps should be written. This depends upon userDirectoryProperty().
      Returns:
      the path if available, or null if getUserPath() returns null
    • getScriptsDirectoryPath

      public Path getScriptsDirectoryPath()
      Get the path to where shared script files should be written. This depends upon userDirectoryProperty().
      Returns:
      the path if available, or null if getUserPath() returns null