All Packages Class Hierarchy This Package Previous Next Index
Class multilizer.BaseTranslator
java.lang.Object
|
+----multilizer.BaseTranslator
- public class BaseTranslator
- extends Object
- implements StringTranslator, Serializable, DictionaryListener
The abstract translator component.
[BaseTranslator]
Translator
AppletTranslator
- See Also:
- AppletTranslator, Translator, Dictionary, Module
-
BaseTranslator()
- Constructs a new transtor.
-
BaseTranslator(Dictionary)
- Constructs a new transtor and assing a dictionary for it.
-
addAfterTranslateListener(AfterTranslateListener)
- Adds the specified after translate listener to receive after translate events from this translator.
-
addBeforeTranslateListener(BeforeTranslateListener)
- Adds the specified before translate listener to receive before translate events from this translator.
-
addDefaultTargets()
- Adds the most common targets propeties.
-
addLanguageChangeListener(DictionaryListener)
- Adds the specified language change listener to receive language change events from this dictionary.
-
addRestrictObjectListener(RestrictObjectListener)
- Adds the specified restrict object listener to receive object restriction events from this translator.
-
addRestrictPropertyListener(RestrictPropertyListener)
- Adds the specified restrict property listener to receive property restriction events from this translator.
-
addTarget(Target)
- Adds a new target to the target list.
-
addTranslateObjectListener(TranslateObjectListener)
- Adds the specified object translate listener to receive after translate events from this translator.
-
buildInTranslate(Object, RestrictObjectEventObject)
- Performs the build in translation for the object.
-
checkLayout(Container)
-
-
customTranslate(Object, RestrictObjectEventObject)
- Performs the custom translation for the object.
-
dispose()
- Disposes the translator.
-
doesTargetsMatch(String, String)
-
-
doTranslateObject(Object, RestrictObjectEventObject)
- Performs the build in translation for the object.
-
doTranslateString(Object, String, String, String)
- Gets the translates for the property of the given object.
-
finalize()
- Disposes of this translator once it is no longer referenced.
-
getDictionary()
- Gets the dictionary.
-
getDictionaryName()
- Gets the dictionary.
-
getHost()
- Gets the host container.
-
getLocalTranslations()
- Gets the local translations.
-
getTargetCount()
- Gets the target count.
-
getTargets()
- Gets the targets in a single string.
-
getTargets(int)
- Gets an individual target.
-
getTargetsArray()
- Gets the targets.
-
getTranslateTextComponents()
- Gets the state of text component translation.
-
getTranslation(int)
- Gets the translation.
-
getUpdateLocale()
- Gets the update locale property flag.
-
isPropertyRestricted(Object, String)
- Returns true if the translation of the given property is restricted.
-
isTextComponent(Object)
- Returns true of the object is an text component.
-
languageChanged(DictionaryEventObject)
- Retranslates and repaints the host container.
-
loadLocalTranslations()
- Load the local translations.
-
processObject(Object, RestrictObjectEventObject)
- Checks if the translation of an object is restricted.
-
removeAfterTranslateListener(AfterTranslateListener)
- Removes the after translate listener so it no longer receives after translate events from this translator.
-
removeBeforeTranslateListener(BeforeTranslateListener)
- Removes the before translate listener so it no longer receives before translate events from this translator.
-
removeLanguageChangeListener(DictionaryListener)
- Removes the language change listener so it no longer receives language change events from this dictionary.
-
removeRestrictObjectListener(RestrictObjectListener)
- Removes the restrict object listener so it no longer receives object restriction events from this translator.
-
removeRestrictPropertyListener(RestrictPropertyListener)
- Removes the restrict property listener so it no longer receives property restriction events from this translator.
-
removeTarget(int)
- Removes a target form the target list.
-
removeTarget(Target)
- Removes a target form the target list.
-
removeTranslateObjectListener(TranslateObjectListener)
- Removes the object translate listener so it no longer receives after translate events from this translator.
-
setDictionary(Dictionary)
- Sets the dictionary.
-
setDictionaryName(String)
- Sets the dictionary name.
-
setHost(Container)
- Sets the host container.
-
setLocalTranslations(Vector)
- Sets the local translations.
-
setTargets(int, Target)
- Sets an individual target.
-
setTargets(String)
- Sets the targets.
-
setTargets(Target[])
- Sets the targets.
-
setTranslateTextComponents(boolean)
- Enables or disables the translation of text components.
-
setUpdateLocale(boolean)
- Sets the update locale property flag.
-
translate()
- Translates the host container.
-
translate(Container)
- Sets the host and translates it.
-
translate(String)
- Returns the translations for the given string.
-
translate(String, String)
- Returns the translations for the given string.
BaseTranslator
public BaseTranslator()
- Constructs a new transtor.
BaseTranslator
public BaseTranslator(Dictionary dictionary)
- Constructs a new transtor and assing a dictionary for it.
finalize
protected void finalize()
- Disposes of this translator once it is no longer referenced.
- Overrides:
- finalize in class Object
- See Also:
- dispose
dispose
public void dispose()
- Disposes the translator.
This method can be called to release the resources that are used for the
translator before the garbage collector release the dictionary.
- See Also:
- finalize
doTranslateObject
protected boolean doTranslateObject(Object object,
RestrictObjectEventObject parentRestriction)
- Performs the build in translation for the object.
buildInTranslate
protected void buildInTranslate(Object object,
RestrictObjectEventObject parentRestriction)
- Performs the build in translation for the object.
- See Also:
- customTranslate
customTranslate
protected void customTranslate(Object object,
RestrictObjectEventObject parentRestriction)
- Performs the custom translation for the object.
- See Also:
- buildInTranslate
getLocalTranslations
public Vector getLocalTranslations()
- Gets the local translations.
- See Also:
- setLocalTranslations
setLocalTranslations
public void setLocalTranslations(Vector localTranslations)
- Sets the local translations.
- See Also:
- getLocalTranslations
getTranslation
protected TranslatorTranslation getTranslation(int index)
- Gets the translation.
translate
protected String translate(String str,
String component)
- Returns the translations for the given string.
Tries to first find from the local translation table of the translator.
If not found looks from the common dictionary.
- Parameters:
- str - the native string to be translated
- component - the name of the component where the string comes from.
- See Also:
- translate, translate
translate
public String translate(String str)
- Returns the translations for the given string.
Tries to first find from the local translation table of the translator.
If not found looks from the common dictionary.
- Parameters:
- str - the native string to be translated
- See Also:
- translate
doTranslateString
protected String doTranslateString(Object object,
String component,
String property,
String value)
- Gets the translates for the property of the given object.
- Parameters:
- object - the object where the property belongs to
- component - the name of the component where the property belongs
- property - the name of the property
- value - the current value of the property
- Returns:
- the value of the property in the active language
isTextComponent
protected boolean isTextComponent(Object object)
- Returns true of the object is an text component.
isPropertyRestricted
protected boolean isPropertyRestricted(Object object,
String propertyName)
- Returns true if the translation of the given property is restricted.
- Parameters:
- object - The object to be checked
- propertyName - The name of the property to be checked
processObject
protected void processObject(Object object,
RestrictObjectEventObject parentRestriction)
- Checks if the translation of an object is restricted. If not call the
translateObject method that translates the object.
- Returns:
- true if the object was translated. false of the translation was restricted.
- See Also:
- translateObject
checkLayout
protected void checkLayout(Container conteiner)
translate
public void translate(Container host)
- Sets the host and translates it.
translate
public void translate()
- Translates the host container.
To call this method you must set the Host property.
The method translates the host and sets the translator to the dictionary listener.
This makes the translator to translate the host automatically after the dictionary has changed the language.
If you do not want to have the automatic retranslation,
remove this translator from the language change event of the dictionary list by calling the
removeOnLanguageChange method.
languageChanged
public void languageChanged(DictionaryEventObject event)
- Retranslates and repaints the host container.
The dictionary calls this method after either language or locale has been changed.
loadLocalTranslations
public void loadLocalTranslations()
- Load the local translations.
setHost
public void setHost(Container value)
- Sets the host container. This is the container that the translator translates.
getHost
public Container getHost()
- Gets the host container.
setUpdateLocale
public void setUpdateLocale(boolean value)
- Sets the update locale property flag.
If this is true the translator changes the Locale property of every component
to match the active locale. Default is false.
getUpdateLocale
public boolean getUpdateLocale()
- Gets the update locale property flag.
setTranslateTextComponents
public void setTranslateTextComponents(boolean value)
- Enables or disables the translation of text components.
If this is true the translator translates the text components
(e.g. TextComponent, TextField and TextArea).
Default is false.
getTranslateTextComponents
public boolean getTranslateTextComponents()
- Gets the state of text component translation.
setDictionaryName
public void setDictionaryName(String value)
- Sets the dictionary name. This is the dictionary that the translator uses when translating strings.
getDictionaryName
public String getDictionaryName()
- Gets the dictionary.
setDictionary
public void setDictionary(Dictionary value)
- Sets the dictionary. This is the dictionary that the translator uses when translating strings.
getDictionary
public Dictionary getDictionary()
- Gets the dictionary.
doesTargetsMatch
protected boolean doesTargetsMatch(String className,
String propertyName)
getTargets
public String getTargets()
- Gets the targets in a single string.
- See Also:
- getTargets, getTargetsArray
setTargets
public void setTargets(String str)
- Sets the targets.
- See Also:
- setTargets, setTargets
setTargets
public void setTargets(int index,
Target target)
- Sets an individual target.
- See Also:
- setTargets, setTargets
getTargets
public Target getTargets(int index)
- Gets an individual target.
- See Also:
- getTargets, getTargetsArray
setTargets
public void setTargets(Target targets[])
- Sets the targets.
The target list determines what components and properties the translator should translate.
There can be as many targets as it takes to cover the translation of every component.
- See Also:
- setTargets, setTargets, addTarget
getTargetsArray
public Target[] getTargetsArray()
- Gets the targets.
- See Also:
- getTargets, getTargets
getTargetCount
public int getTargetCount()
- Gets the target count.
- See Also:
- addTarget
addTarget
public void addTarget(Target target)
- Adds a new target to the target list.
- See Also:
- setTargets, removeTarget, removeTarget
removeTarget
public void removeTarget(int index)
- Removes a target form the target list.
- See Also:
- addTarget
removeTarget
public void removeTarget(Target target)
- Removes a target form the target list.
- See Also:
- addTarget
addDefaultTargets
public void addDefaultTargets()
- Adds the most common targets propeties.
- See Also:
- addTarget, setTargets
addLanguageChangeListener
public synchronized void addLanguageChangeListener(DictionaryListener l)
- Adds the specified language change listener to receive language change events from this dictionary.
- Parameters:
- l - the language change listener
removeLanguageChangeListener
public synchronized void removeLanguageChangeListener(DictionaryListener l)
- Removes the language change listener so it no longer receives language change events from this dictionary.
- Parameters:
- l - the language change listener
addBeforeTranslateListener
public synchronized void addBeforeTranslateListener(BeforeTranslateListener l)
- Adds the specified before translate listener to receive before translate events from this translator.
removeBeforeTranslateListener
public synchronized void removeBeforeTranslateListener(BeforeTranslateListener l)
- Removes the before translate listener so it no longer receives before translate events from this translator.
addAfterTranslateListener
public synchronized void addAfterTranslateListener(AfterTranslateListener l)
- Adds the specified after translate listener to receive after translate events from this translator.
removeAfterTranslateListener
public synchronized void removeAfterTranslateListener(AfterTranslateListener l)
- Removes the after translate listener so it no longer receives after translate events from this translator.
addTranslateObjectListener
public synchronized void addTranslateObjectListener(TranslateObjectListener l)
- Adds the specified object translate listener to receive after translate events from this translator.
removeTranslateObjectListener
public synchronized void removeTranslateObjectListener(TranslateObjectListener l)
- Removes the object translate listener so it no longer receives after translate events from this translator.
addRestrictObjectListener
public synchronized void addRestrictObjectListener(RestrictObjectListener l)
- Adds the specified restrict object listener to receive object restriction events from this translator.
removeRestrictObjectListener
public synchronized void removeRestrictObjectListener(RestrictObjectListener l)
- Removes the restrict object listener so it no longer receives object restriction events from this translator.
addRestrictPropertyListener
public synchronized void addRestrictPropertyListener(RestrictPropertyListener l)
- Adds the specified restrict property listener to receive property restriction events from this translator.
removeRestrictPropertyListener
public synchronized void removeRestrictPropertyListener(RestrictPropertyListener l)
- Removes the restrict property listener so it no longer receives property restriction events from this translator.
All Packages Class Hierarchy This Package Previous Next Index