|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.townleyenterprises.swing.AbstractUIBuilder com.townleyenterprises.swing.ResourceUIBuilder
This class provides a concrete implementation of the UIBuilder interface which reads the UI descriptions from a resource bundle. This class is heavily based on the mechanism used in the Java JFC/Swing Notepad demo. This class uses the same approach (and even methods), but abstracts this functionality from a particular application.
It is important to note that this class assumes that the values for each of the labels, etc. are resource keys which will be resolved by the registered resource bundles. String literals should not normally be used for these values.
Field Summary | |
static java.lang.String |
ACCEL_SUFFIX
this is the suffix used when looking up accelerator/shortcuts |
static java.lang.String |
LABEL_SUFFIX
this is the suffix used when looking up various labels |
static java.lang.String |
MNEMONIC_SUFFIX
this is the suffix used when looking up mnemonics |
static java.lang.String |
STATUS_SUFFIX
this is the suffix used when looking up status text |
static java.lang.String |
STATUSTEXT_PROPERTY
this is the client property used to hold the status text |
Fields inherited from class com.townleyenterprises.swing.AbstractUIBuilder |
MAINMENU |
Constructor Summary | |
ResourceUIBuilder(ResourceProvider loader,
java.util.Map actions)
The constructor takes the initialized ResourceLoader used to read the UI definition. |
|
ResourceUIBuilder(ResourceProvider loader,
java.util.Map actions,
javax.swing.event.ChangeListener menuStatusListener)
This version of the constructor takes a ChangeListener which will be notified whenver the menu item or menu changes state. |
Method Summary | |
javax.swing.JMenu |
buildMenu(java.lang.String key)
This method builds a menu based on the specified key. |
javax.swing.JMenuBar |
buildMenuBar(java.lang.String key)
Menubars are described in terms of a whitespace delimited string representing the top-level menus. |
protected javax.swing.JMenuItem |
buildMenuItemHelper(java.lang.String key)
This method builds an individual menu item and associates an action provided in the constructor. |
protected java.lang.String[] |
tokenize(java.lang.String source)
This is a utility method which is used to return an array of strings parsed from the source. |
Methods inherited from class com.townleyenterprises.swing.AbstractUIBuilder |
buildMenuBar, buildMenuItem, getAction, getMenuItem |
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 LABEL_SUFFIX
public static final java.lang.String MNEMONIC_SUFFIX
public static final java.lang.String ACCEL_SUFFIX
public static final java.lang.String STATUS_SUFFIX
public static final java.lang.String STATUSTEXT_PROPERTY
Constructor Detail |
public ResourceUIBuilder(ResourceProvider loader, java.util.Map actions)
loader
- the resource loaderactions
- the action mappublic ResourceUIBuilder(ResourceProvider loader, java.util.Map actions, javax.swing.event.ChangeListener menuStatusListener)
loader
- the resource loaderactions
- the action mapmenuStatusListener
- the change listenerMethod Detail |
public javax.swing.JMenuBar buildMenuBar(java.lang.String key)
The key used for the menu bar is menubar
.
buildMenuBar
in interface UIBuilder
buildMenuBar
in class AbstractUIBuilder
key
- the menubar key
public javax.swing.JMenu buildMenu(java.lang.String key)
-
characters into the menu definition.
buildMenu
in interface UIBuilder
buildMenu
in class AbstractUIBuilder
key
- the key for the menu
protected javax.swing.JMenuItem buildMenuItemHelper(java.lang.String key)
The original version of this method from the Notepad example deals with menu item images. Currently, images aren't supported by this class. Support will be added to the ResourceLoader shortly, so this class will be able to use it "free" once that happens.
buildMenuItemHelper
in class AbstractUIBuilder
key
- the menu item key
protected java.lang.String[] tokenize(java.lang.String source)
source
- the string to parse
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |