Class Locators

java.lang.Object
jme3utilities.ui.Locators

public class Locators extends Object
Manage the registered locators in the AssetManager of an ActionApplication.
  • Constructor Summary

    Constructors
    Constructor
    Description
    A no-arg constructor to avoid javadoc warnings from JDK 18.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    dumpAll(PrintStream printStream)
    Dump the entire stack of locators to the specified PrintStream.
    static com.jme3.asset.AssetManager
    Access the asset manager.
    static String
    Determine the root path of the sole locator in the current configuration.
    static void
    Register (add) the specified locators to the current configuration, in the specified order.
    static void
    Register (add) the specified locator to the current configuration.
    static void
    register(String rootPath, Class<? extends com.jme3.asset.AssetLocator> locatorType)
    Register (add) a locator of the specified type to the current configuration.
    static void
    Register (add) the default locator(s) to the current configuration, namely: the sandbox (if one exists) followed by the classpath.
    static void
    Register (add) a file locator or zip locator to the current configuration.
    static void
    Restore an old configuration.
    static void
    Save a copy of the current configuration for later restoration.
    static void
    Unregister all locators from the current configuration.
    static void
    Set the current configuration to use only the default locator(s).
    static void
    Set the current configuration to use only the specified file locator or zip locator for assets.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Locators

      public Locators()
      A no-arg constructor to avoid javadoc warnings from JDK 18.
  • Method Details

    • dumpAll

      public static void dumpAll(PrintStream printStream)
      Dump the entire stack of locators to the specified PrintStream.
      Parameters:
      printStream - the output stream (not null)
    • getAssetManager

      public static com.jme3.asset.AssetManager getAssetManager()
      Access the asset manager.
      Returns:
      the pre-existing instance (not null)
    • getRootPath

      public static String getRootPath()
      Determine the root path of the sole locator in the current configuration.
      Returns:
      root path, or "" if there isn't exactly one locator or if the locator isn't a FileLocator/ZipLocator
    • register

      public static void register(String spec)
      Register (add) the specified locator to the current configuration.
      Parameters:
      spec - URL specification (null specifies the default locators)
    • register

      public static void register(String rootPath, Class<? extends com.jme3.asset.AssetLocator> locatorType)
      Register (add) a locator of the specified type to the current configuration.
      Parameters:
      rootPath - (not null, not empty)
      locatorType - type of locator
    • register

      public static void register(Iterable<String> specList)
      Register (add) the specified locators to the current configuration, in the specified order.
      Parameters:
      specList - a list of URL specifications (not null, unaffected)
    • registerDefault

      public static void registerDefault()
      Register (add) the default locator(s) to the current configuration, namely: the sandbox (if one exists) followed by the classpath.
    • registerFilesystem

      public static void registerFilesystem(String rootPath)
      Register (add) a file locator or zip locator to the current configuration.
      Parameters:
      rootPath - absolute filesystem path to the directory/folder/JAR/ZIP (not null, not empty)
    • restore

      public static void restore()
      Restore an old configuration.
    • save

      public static void save()
      Save a copy of the current configuration for later restoration.
    • unregisterAll

      public static void unregisterAll()
      Unregister all locators from the current configuration.
    • useDefault

      public static void useDefault()
      Set the current configuration to use only the default locator(s). Any other locators get unregistered.
    • useFilesystem

      public static void useFilesystem(String rootPath)
      Set the current configuration to use only the specified file locator or zip locator for assets. Any other locators get unregistered.
      Parameters:
      rootPath - absolute filesystem path to the directory/folder/JAR/ZIP (not null, not empty)