All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class multilizer.Translator

java.lang.Object
   |
   +----multilizer.BaseTranslator
           |
           +----multilizer.Translator

public class Translator
extends BaseTranslator
A component that iterates every property of the host component and its sub components. If it find any String, String[] or Object[] typed property that matches the targets it translates the property.

Set the Host property to contain the component that the translator translates. In most cases this is the frame where the translator belongs to. Call the translate method to translate the host component.

The DictionaryName property specifies the dictionary that the translator uses to translate the strings. If this is empty the translator uses the default dictionary. The Targets property specifies what components and the properties the translator should translate. If this is empty the translator uses the default targets.

The translator can also update the Locale property of the compoment to match the current locale. If you want to update the Locale properties set the UpdateLocale property true.

An example:

 Translator translator = new Translator();
 translator.translate(this);
 

Bidirectional languages

The translator can mirror the host if a bidirectional language, such as Arabic, Farsi or Hebrew, is active.

The following paragraphs contain the layout information you need to create containers that can be mirrored.

BorderLayout

Use the BidiBorderLayout instead.

FlowLayout

No special requirements.

GridBagLayout

The container must use only absolute positions (gridx and gridy). If you need to use relative positions use the BidiGridBagLayout instead.

GridLayout

The container must contain at least as many components as the amount of grid cells.

No layout

No special requirements.

Any other layout

Derive a new translator class from this class and override the mirrorContainer method.


See Also:
Dictionary, AppletTranslator, SwingModule

Variable Index

 o LEFT_TO_RIGHT
 o MAXGRIDSIZE
 o RIGHT_TO_LEFT

Constructor Index

 o Translator()
Constructs a new transtor.
 o Translator(Dictionary)
Constructs a new transtor and assings a dictionary for it.

Method Index

 o checkLayout(Container)
 o doTranslateObject(Object, RestrictObjectEventObject)
Performs the build in translation for the object.
 o getMirror()
Gets the mirror flag.
 o getNativeLayout()
Gets the native layout.
 o hostTranslated()
 o mirrorContainer(Container)
Mirrors the given container.
 o setMirror(boolean)
Sets the mirror flag.
 o setNativeLayout(int)
Sets the native layout.

Variables

 o LEFT_TO_RIGHT
 public static int LEFT_TO_RIGHT
 o RIGHT_TO_LEFT
 public static int RIGHT_TO_LEFT
 o MAXGRIDSIZE
 protected static final int MAXGRIDSIZE

Constructors

 o Translator
 public Translator()
Constructs a new transtor.

 o Translator
 public Translator(Dictionary dictionary)
Constructs a new transtor and assings a dictionary for it.

Methods

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

Overrides:
doTranslateObject in class BaseTranslator
 o setNativeLayout
 public void setNativeLayout(int value)
Sets the native layout.

 o getNativeLayout
 public int getNativeLayout()
Gets the native layout.

 o checkLayout
 protected void checkLayout(Container container)
Overrides:
checkLayout in class BaseTranslator
 o hostTranslated
 protected void hostTranslated()
 o mirrorContainer
 protected void mirrorContainer(Container container)
Mirrors the given container. If you use any nonestandard layout derive a new translator from this class and override this method.

 o setMirror
 public void setMirror(boolean value)
Sets the mirror flag. If this is true the translator mirrors the host whenever a bidirectional language is active. The default value is true.

 o getMirror
 public boolean getMirror()
Gets the mirror flag.


All Packages  Class Hierarchy  This Package  Previous  Next  Index