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

Constructor Index

 o BaseTranslator()
Constructs a new transtor.
 o BaseTranslator(Dictionary)
Constructs a new transtor and assing a dictionary for it.

Method Index

 o addAfterTranslateListener(AfterTranslateListener)
Adds the specified after translate listener to receive after translate events from this translator.
 o addBeforeTranslateListener(BeforeTranslateListener)
Adds the specified before translate listener to receive before translate events from this translator.
 o addDefaultTargets()
Adds the most common targets propeties.
 o addLanguageChangeListener(DictionaryListener)
Adds the specified language change listener to receive language change events from this dictionary.
 o addRestrictObjectListener(RestrictObjectListener)
Adds the specified restrict object listener to receive object restriction events from this translator.
 o addRestrictPropertyListener(RestrictPropertyListener)
Adds the specified restrict property listener to receive property restriction events from this translator.
 o addTarget(Target)
Adds a new target to the target list.
 o addTranslateObjectListener(TranslateObjectListener)
Adds the specified object translate listener to receive after translate events from this translator.
 o buildInTranslate(Object, RestrictObjectEventObject)
Performs the build in translation for the object.
 o checkLayout(Container)
 o customTranslate(Object, RestrictObjectEventObject)
Performs the custom translation for the object.
 o dispose()
Disposes the translator.
 o doesTargetsMatch(String, String)
 o doTranslateObject(Object, RestrictObjectEventObject)
Performs the build in translation for the object.
 o doTranslateString(Object, String, String, String)
Gets the translates for the property of the given object.
 o finalize()
Disposes of this translator once it is no longer referenced.
 o getDictionary()
Gets the dictionary.
 o getDictionaryName()
Gets the dictionary.
 o getHost()
Gets the host container.
 o getLocalTranslations()
Gets the local translations.
 o getTargetCount()
Gets the target count.
 o getTargets()
Gets the targets in a single string.
 o getTargets(int)
Gets an individual target.
 o getTargetsArray()
Gets the targets.
 o getTranslateTextComponents()
Gets the state of text component translation.
 o getTranslation(int)
Gets the translation.
 o getUpdateLocale()
Gets the update locale property flag.
 o isPropertyRestricted(Object, String)
Returns true if the translation of the given property is restricted.
 o isTextComponent(Object)
Returns true of the object is an text component.
 o languageChanged(DictionaryEventObject)
Retranslates and repaints the host container.
 o loadLocalTranslations()
Load the local translations.
 o processObject(Object, RestrictObjectEventObject)
Checks if the translation of an object is restricted.
 o removeAfterTranslateListener(AfterTranslateListener)
Removes the after translate listener so it no longer receives after translate events from this translator.
 o removeBeforeTranslateListener(BeforeTranslateListener)
Removes the before translate listener so it no longer receives before translate events from this translator.
 o removeLanguageChangeListener(DictionaryListener)
Removes the language change listener so it no longer receives language change events from this dictionary.
 o removeRestrictObjectListener(RestrictObjectListener)
Removes the restrict object listener so it no longer receives object restriction events from this translator.
 o removeRestrictPropertyListener(RestrictPropertyListener)
Removes the restrict property listener so it no longer receives property restriction events from this translator.
 o removeTarget(int)
Removes a target form the target list.
 o removeTarget(Target)
Removes a target form the target list.
 o removeTranslateObjectListener(TranslateObjectListener)
Removes the object translate listener so it no longer receives after translate events from this translator.
 o setDictionary(Dictionary)
Sets the dictionary.
 o setDictionaryName(String)
Sets the dictionary name.
 o setHost(Container)
Sets the host container.
 o setLocalTranslations(Vector)
Sets the local translations.
 o setTargets(int, Target)
Sets an individual target.
 o setTargets(String)
Sets the targets.
 o setTargets(Target[])
Sets the targets.
 o setTranslateTextComponents(boolean)
Enables or disables the translation of text components.
 o setUpdateLocale(boolean)
Sets the update locale property flag.
 o translate()
Translates the host container.
 o translate(Container)
Sets the host and translates it.
 o translate(String)
Returns the translations for the given string.
 o translate(String, String)
Returns the translations for the given string.

Constructors

 o BaseTranslator
 public BaseTranslator()
Constructs a new transtor.

 o BaseTranslator
 public BaseTranslator(Dictionary dictionary)
Constructs a new transtor and assing a dictionary for it.

Methods

 o finalize
 protected void finalize()
Disposes of this translator once it is no longer referenced.

Overrides:
finalize in class Object
See Also:
dispose
 o 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
 o doTranslateObject
 protected boolean doTranslateObject(Object object,
                                     RestrictObjectEventObject parentRestriction)
Performs the build in translation for the object.

 o buildInTranslate
 protected void buildInTranslate(Object object,
                                 RestrictObjectEventObject parentRestriction)
Performs the build in translation for the object.

See Also:
customTranslate
 o customTranslate
 protected void customTranslate(Object object,
                                RestrictObjectEventObject parentRestriction)
Performs the custom translation for the object.

See Also:
buildInTranslate
 o getLocalTranslations
 public Vector getLocalTranslations()
Gets the local translations.

See Also:
setLocalTranslations
 o setLocalTranslations
 public void setLocalTranslations(Vector localTranslations)
Sets the local translations.

See Also:
getLocalTranslations
 o getTranslation
 protected TranslatorTranslation getTranslation(int index)
Gets the translation.

 o 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
 o 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
 o 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
 o isTextComponent
 protected boolean isTextComponent(Object object)
Returns true of the object is an text component.

 o 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
 o 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
 o checkLayout
 protected void checkLayout(Container conteiner)
 o translate
 public void translate(Container host)
Sets the host and translates it.

 o 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.

 o 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.

 o loadLocalTranslations
 public void loadLocalTranslations()
Load the local translations.

 o setHost
 public void setHost(Container value)
Sets the host container. This is the container that the translator translates.

 o getHost
 public Container getHost()
Gets the host container.

 o 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.

 o getUpdateLocale
 public boolean getUpdateLocale()
Gets the update locale property flag.

 o 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.

 o getTranslateTextComponents
 public boolean getTranslateTextComponents()
Gets the state of text component translation.

 o setDictionaryName
 public void setDictionaryName(String value)
Sets the dictionary name. This is the dictionary that the translator uses when translating strings.

 o getDictionaryName
 public String getDictionaryName()
Gets the dictionary.

 o setDictionary
 public void setDictionary(Dictionary value)
Sets the dictionary. This is the dictionary that the translator uses when translating strings.

 o getDictionary
 public Dictionary getDictionary()
Gets the dictionary.

 o doesTargetsMatch
 protected boolean doesTargetsMatch(String className,
                                    String propertyName)
 o getTargets
 public String getTargets()
Gets the targets in a single string.

See Also:
getTargets, getTargetsArray
 o setTargets
 public void setTargets(String str)
Sets the targets.

See Also:
setTargets, setTargets
 o setTargets
 public void setTargets(int index,
                        Target target)
Sets an individual target.

See Also:
setTargets, setTargets
 o getTargets
 public Target getTargets(int index)
Gets an individual target.

See Also:
getTargets, getTargetsArray
 o 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
 o getTargetsArray
 public Target[] getTargetsArray()
Gets the targets.

See Also:
getTargets, getTargets
 o getTargetCount
 public int getTargetCount()
Gets the target count.

See Also:
addTarget
 o addTarget
 public void addTarget(Target target)
Adds a new target to the target list.

See Also:
setTargets, removeTarget, removeTarget
 o removeTarget
 public void removeTarget(int index)
Removes a target form the target list.

See Also:
addTarget
 o removeTarget
 public void removeTarget(Target target)
Removes a target form the target list.

See Also:
addTarget
 o addDefaultTargets
 public void addDefaultTargets()
Adds the most common targets propeties.

See Also:
addTarget, setTargets
 o 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
 o 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
 o addBeforeTranslateListener
 public synchronized void addBeforeTranslateListener(BeforeTranslateListener l)
Adds the specified before translate listener to receive before translate events from this translator.

 o removeBeforeTranslateListener
 public synchronized void removeBeforeTranslateListener(BeforeTranslateListener l)
Removes the before translate listener so it no longer receives before translate events from this translator.

 o addAfterTranslateListener
 public synchronized void addAfterTranslateListener(AfterTranslateListener l)
Adds the specified after translate listener to receive after translate events from this translator.

 o removeAfterTranslateListener
 public synchronized void removeAfterTranslateListener(AfterTranslateListener l)
Removes the after translate listener so it no longer receives after translate events from this translator.

 o addTranslateObjectListener
 public synchronized void addTranslateObjectListener(TranslateObjectListener l)
Adds the specified object translate listener to receive after translate events from this translator.

 o removeTranslateObjectListener
 public synchronized void removeTranslateObjectListener(TranslateObjectListener l)
Removes the object translate listener so it no longer receives after translate events from this translator.

 o addRestrictObjectListener
 public synchronized void addRestrictObjectListener(RestrictObjectListener l)
Adds the specified restrict object listener to receive object restriction events from this translator.

 o removeRestrictObjectListener
 public synchronized void removeRestrictObjectListener(RestrictObjectListener l)
Removes the restrict object listener so it no longer receives object restriction events from this translator.

 o addRestrictPropertyListener
 public synchronized void addRestrictPropertyListener(RestrictPropertyListener l)
Adds the specified restrict property listener to receive property restriction events from this translator.

 o 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