Module qupath.fx

Class LocalizedResourceManager

java.lang.Object
qupath.fx.localization.LocalizedResourceManager

public class LocalizedResourceManager extends Object
Class to manage the use of localized strings with JavaFX properties. String properties can be created or registered here, and then refreshed all at once.
  • Method Details

    • createInstance

      public static LocalizedResourceManager createInstance(String defaultBundleName)
      Create an instance.
      Parameters:
      defaultBundleName - default bundle name to use when the bundle is not specified
      Returns:
    • createInstance

      public static LocalizedResourceManager createInstance(String defaultBundleName, ResourceBundle.Control control)
      Create an instance, optionally providing an alternative Control to handle identifying resource bundles.
      Parameters:
      defaultBundleName - default bundle name to use when the bundle is not specified
      control - optional control (may be null)
      Returns:
    • getDefaultBundleName

      public String getDefaultBundleName()
      Get the default bundle name to use where a bundle is not specified. This may be null.
      Returns:
    • hasString

      public boolean hasString(String key)
      Query whether a string is available in the default bundle.
      Parameters:
      key -
      Returns:
    • hasString

      public boolean hasString(String bundleName, String key)
      Query whether a string is available in the specified bundle.
      Parameters:
      bundleName -
      key -
      Returns:
    • getString

      public String getString(String key)
      Get a string from the default bundle.
      Parameters:
      key -
      Returns:
    • getString

      public String getString(String bundleName, String key)
      Get a string from a specified bundle.
      Parameters:
      bundleName -
      key -
      Returns:
    • refresh

      public void refresh()
      Refresh all string properties associated with this manager. This should be called whenever the locale is changed.
    • registerProperty

      public void registerProperty(javafx.beans.property.StringProperty property, String key)
      Register a string property from the default resource bundle that should be updated when the locale changes.
      Parameters:
      property - the property to update
      key - the bundle key
    • registerProperty

      public void registerProperty(javafx.beans.property.StringProperty property, String bundle, String key)
      Register a string property that should be updated when the locale changes.
      Parameters:
      property - the property to update
      bundle - the bundle name
      key - the bundle key
    • createProperty

      public javafx.beans.property.StringProperty createProperty(String key)
    • createProperty

      public javafx.beans.property.StringProperty createProperty(String bundle, String key)