Package org.opensourcephysics.tools
Interface Translator
- All Known Implementing Classes:
TranslatorTool
public interface Translator
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Associates an object with a class for property lookup purposes.getProperty
(Class<?> type, String key) Gets the localized value of a property for the specified class.getProperty
(Class<?> type, String key, String defaultValue) Gets the localized value of a property for the specified class.getProperty
(Object obj, String key) Gets the localized value of a property for the specified object.getProperty
(Object obj, String key, String defaultValue) Gets the localized value of a property for the specified object.void
setVisible
(boolean visible) Sets the visibility.void
showProperties
(Class<?> type) Shows the properties for the specified class.
-
Method Details
-
getProperty
Gets the localized value of a property for the specified class. If no localized value is found, the key is returned.- Parameters:
type
- the class requesting the localized valuekey
- the string to localize- Returns:
- the localized string
-
getProperty
Gets the localized value of a property for the specified class. If no localized value is found, the defaultValue is returned.- Parameters:
type
- the class requesting the localized valuekey
- the string to localizedefaultValue
- the default if no localized value found- Returns:
- the localized string
-
getProperty
Gets the localized value of a property for the specified object. The object must first be associated with a class. If no localized value is found, the key is returned.- Parameters:
obj
- the object requesting the localized valuekey
- the string to localize- Returns:
- the localized string
-
getProperty
Gets the localized value of a property for the specified object. The object must first be associated with a class. If no localized value is found, the defaultValue is returned.- Parameters:
obj
- the object requesting the localized valuekey
- the string to localizedefaultValue
- the default if no localized value found- Returns:
- the localized string
-
associate
Associates an object with a class for property lookup purposes.- Parameters:
obj
- the object needing translationstype
- the class
-
showProperties
Shows the properties for the specified class.- Parameters:
type
- the class
-
setVisible
void setVisible(boolean visible) Sets the visibility.- Parameters:
visible
- true to set this visible
-