java.lang.Object
qupath.fx.localization.LocalizedResourceManager
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 Summary
Modifier and TypeMethodDescriptionstatic LocalizedResourceManagercreateInstance(String defaultBundleName) Create an instance.static LocalizedResourceManagercreateInstance(String defaultBundleName, ResourceBundle.Control control) Create an instance, optionally providing an alternative Control to handle identifying resource bundles.javafx.beans.property.StringPropertycreateProperty(String key) javafx.beans.property.StringPropertycreateProperty(String bundle, String key) Get the default bundle name to use where a bundle is not specified.Get a string from the default bundle.Get a string from a specified bundle.booleanQuery whether a string is available in the default bundle.booleanQuery whether a string is available in the specified bundle.voidrefresh()Refresh all string properties associated with this manager.voidregisterProperty(javafx.beans.property.StringProperty property, String key) Register a string property from the default resource bundle that should be updated when the locale changes.voidregisterProperty(javafx.beans.property.StringProperty property, String bundle, String key) Register a string property that should be updated when the locale changes.
-
Method Details
-
createInstance
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 specifiedcontrol- optional control (may be null)- Returns:
-
getDefaultBundleName
Get the default bundle name to use where a bundle is not specified. This may be null.- Returns:
-
hasString
Query whether a string is available in the default bundle.- Parameters:
key-- Returns:
-
hasString
Query whether a string is available in the specified bundle.- Parameters:
bundleName-key-- Returns:
-
getString
Get a string from the default bundle.- Parameters:
key-- Returns:
-
getString
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
Register a string property from the default resource bundle that should be updated when the locale changes.- Parameters:
property- the property to updatekey- 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 updatebundle- the bundle namekey- the bundle key
-
createProperty
-
createProperty
-