|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.clackrouter.jgraph.utils.gui.LocaleChangeAdapter
public class LocaleChangeAdapter
The adapter is a listener for local change events.
If you change the locale at the translator then this
adapter will update all registered GUI Elements.
To register a GUI Element you can use the
addContainer(Container)
method.
To unregister a GUI Element you can use the
removeContainer(Container)
method.
A typical frame implementation can look like this:
public class MyFrame extend JFrame { public MyFrame(){ setName("MyFrame"); JButton b = new JButton(); b.setName("OK"); getContentPane().add(b); // after con catting the whole GUI tree // register the frame for locale // events // The LocalChangeAdapter will update // all labels and co automatically LocaleChangeAdapter.addContainer(this); pack(); setVisible(true); } public void dispose(){ super.dispose(); // unregister the locale change adapter LocaleChangeAdapter.removeContainer(this); } }Furthermore this class is a proper name provider for proper names from the swing gui. For example the look and feel names are proper names and we do not need to add the look and feel names at each property language file. This class contains this proper names.
Field Summary | |
---|---|
protected static java.util.Vector |
containers
vector with all registered containers |
static java.lang.String |
DONT_SET_MNEMONIC
Key for the special jcomponent client property. |
static java.lang.String |
DONT_SET_TOOL_TIP_TEXT
Key for the special jcomponent client property. |
protected static LocaleChangeAdapter |
localeChangeAdapter
A reference to the default locale change adapter |
static java.lang.String |
SET_TEXT_IF_ICON_NOT_AVAILABLE
Key for the special jcomponent client property. |
Fields inherited from interface net.clackrouter.jgraph.pad.resources.TranslatorConstants |
---|
PREFIX_COMPONENT, PREFIX_MESSAGE_ERROR, PREFIX_MESSAGE_INFORMATION, PREFIX_MESSAGE_WARING, SUFFIX_ACCELERATOR, SUFFIX_ACTION, SUFFIX_ICON, SUFFIX_IMAGE, SUFFIX_LABEL, SUFFIX_MENU, SUFFIX_MNEMONIC, SUFFIX_TEXT, SUFFIX_TITLE, SUFFIX_TOOL_TIP_TEXT |
Constructor Summary | |
---|---|
LocaleChangeAdapter()
Creates a new local change adapter and registers itself at the translator for a locale change listener and for a proper name provider. |
Method Summary | |
---|---|
static void |
addContainer(java.awt.Container comp)
Adds a container to the control of the local change adapter |
java.util.Enumeration |
getKeys()
returns the keys for the proper names |
protected static LocaleChangeAdapter |
getLocaleChangeAdapter()
returns the default local change adapter |
java.lang.String |
getString(java.lang.String key)
returns the value for a proper name key |
void |
localeChanged(LocaleChangeEvent e)
Will be called from the translator if a locale was changed |
static void |
removeContainer(java.awt.Container comp)
Removes a container from the control of the local change adapter |
static void |
updateComponent(java.awt.Component comp)
This method will be called from the updateContainer method. |
static void |
updateContainer(java.awt.Container oComp)
This method will be called from the localeChanged method or it will be called recursively. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SET_TEXT_IF_ICON_NOT_AVAILABLE
public static final java.lang.String DONT_SET_TOOL_TIP_TEXT
public static final java.lang.String DONT_SET_MNEMONIC
protected static LocaleChangeAdapter localeChangeAdapter
protected static java.util.Vector containers
Constructor Detail |
---|
public LocaleChangeAdapter()
Method Detail |
---|
protected static LocaleChangeAdapter getLocaleChangeAdapter()
public static void addContainer(java.awt.Container comp)
comp
- the specified containerpublic static void removeContainer(java.awt.Container comp)
comp
- the specified containerpublic void localeChanged(LocaleChangeEvent e)
localeChanged
in interface LocaleChangeListener
public static void updateContainer(java.awt.Container oComp)
oComp
- the concerning containerlocaleChanged(LocaleChangeEvent)
public static void updateComponent(java.awt.Component comp)
comp
- the concerning componentupdateContainer(Container)
public java.util.Enumeration getKeys()
getKeys
in interface ProperNameProvider
public java.lang.String getString(java.lang.String key)
getString
in interface ProperNameProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |