|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
The UIManager of an application is responsible for applying all
textual information to all GUI controls within the application.
This naturally includes all labels for buttons, check boxes, combo boxes, menu
items, window titles, tool tips, message boxes and more.
At runtime, text strings are stored in a UIItemList, where
application-specific identifiers are matched to UIItem objects
that hold the text data. In the application itself, only those identifiers
are used to associate a UIItem with a control, thereby decoupling
the localized text from that control. If the application language should change,
the text in the UIItem instance is simply updated. The control,
however, will still point to the same identifier.
A UIManager maintains UIItem instances and their
textual representations. Use class UIManager to create various
types of localized controls and be able to switch the application language
at runtime, without having to restart it.
A UIManager is used by class UIItemEvaluationList
as well as application-specific code to retrieve the designated text resource
for a given control.
UIItemList,
UIItemEvaluationList| Method Summary | |
void |
applyItem(java.lang.String id,
java.lang.Object guiObject)
Sets the values from the UIItem with the parameter id from
the internal ItemList to the given Component. |
boolean |
containsKey(java.lang.String key)
Checks if the specified key has a corresponding localized text. |
java.lang.Object |
createIcon(java.lang.Class refClass,
java.lang.String iconURL)
Factory method for creating an Icon. |
java.lang.Object |
createLocalizedIcon(java.lang.Class refClass,
java.lang.String iconURLKey)
Factory method for creating a new icon. |
UIItemList |
getItemList()
The getItemList method should return an instance of UIItemList
to let users of this UIManager manually retrieve elements from this list.
|
KeyStroke |
getKeyStroke(java.lang.String key)
Factory method for creating a localized Keystroke from a key. |
java.lang.String |
getText(java.lang.String id)
This method looks up the id in the resources currently loaded in this instance and returns the corresponding string. |
java.lang.String |
getText(java.lang.String key,
java.lang.Object[] objects)
The method returns a String for a specific key in the property files. |
void |
setLocale(java.util.Locale locale)
Sets the locale for this UIManager. |
void |
setText(java.lang.String id,
java.lang.String text)
The method setText adds a mappings a String to a specific id. |
| Method Detail |
public UIItemList getItemList()
UIItemList
to let users of this UIManager manually retrieve elements from this list.
This list is meant to store instances UIItem.
public void applyItem(java.lang.String id,
java.lang.Object guiObject)
id from
the internal ItemList to the given Component. Call this method everytime
when you want to initialize the associated Component instance with the
(new) values from the appropriate UIItem from the UIItemList. Used by
the UIItemEvaluationList.apply() and
UIItemEvaluationList.apply(int).
id - the id to be used for the component.guiObject - a component to apply the values to. the class of this
parameter is depending on the used ui toolkit and so
it has to be cast to the concrete type by the
corresponding implementationpublic java.lang.String getText(java.lang.String id)
id - the id of the item of which you want to retrieve the text.
public void setText(java.lang.String id,
java.lang.String text)
id - the id of the item to set.text - the string associated with the given id.public void setLocale(java.util.Locale locale)
locale - The new Locale for the default resources.
public java.lang.Object createIcon(java.lang.Class refClass,
java.lang.String iconURL)
refClass - The reference class for loadingiconURL - The url relative to refClass
public java.lang.Object createLocalizedIcon(java.lang.Class refClass,
java.lang.String iconURLKey)
refClass - The reference class for loadingiconURLKey - The key of the resource containing the url relative to refClass
public KeyStroke getKeyStroke(java.lang.String key)
key - the key to use in the ResourceBundle
for getting the localized Text.
KeyStroke.getKeyStroke(char)
public java.lang.String getText(java.lang.String key,
java.lang.Object[] objects)
objects parameter will be parsed like
described in
MessageFormat.
key - the id of the item of which you want to retrieve the text.objects - An array of objects to be placed as defaults.
MessageFormatpublic boolean containsKey(java.lang.String key)
key -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||