com.townleyenterprises.swing
Class AbstractUIBuilder

java.lang.Object
  extended bycom.townleyenterprises.swing.AbstractUIBuilder
All Implemented Interfaces:
UIBuilder
Direct Known Subclasses:
ResourceUIBuilder

public abstract class AbstractUIBuilder
extends java.lang.Object
implements UIBuilder

This class provides a convenient base class for concrete implementations of the UIBuilder interface.

Since:
2.1
Version:
$Id: AbstractUIBuilder.java,v 1.4 2004/07/28 10:33:59 atownley Exp $
Author:
Andrew S. Townley

Field Summary
static java.lang.String MAINMENU
          this is the property name used to look up the main menu bar description
 
Constructor Summary
AbstractUIBuilder(java.util.Map actions)
          The constructor takes a map of Action instances which are to be associated with the menu items.
 
Method Summary
abstract  javax.swing.JMenu buildMenu(java.lang.String key)
          This method builds a given menu based on the appropriate key value.
 javax.swing.JMenuBar buildMenuBar()
          This method will build a completely initialized menu bar from the input source using the default MANIMENU key.
abstract  javax.swing.JMenuBar buildMenuBar(java.lang.String key)
          This method will build a completely initialized menu bar from the input source.
 javax.swing.JMenuItem buildMenuItem(java.lang.String key)
          This method builds a menu item based on the given key.
protected abstract  javax.swing.JMenuItem buildMenuItemHelper(java.lang.String key)
          This method must be implemented by derived classes.
 javax.swing.Action getAction(java.lang.String key)
          This method is used to retrieve the action for the specified key in the actions specified in the constructor.
 javax.swing.JMenuItem getMenuItem(java.lang.String key)
          This method is used to retrieve a menu item instance created by the abstract builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAINMENU

public static final java.lang.String MAINMENU
this is the property name used to look up the main menu bar description

See Also:
Constant Field Values
Constructor Detail

AbstractUIBuilder

public AbstractUIBuilder(java.util.Map actions)
The constructor takes a map of Action instances which are to be associated with the menu items. The keys of the map should match the keys used to resolve the menu items.

Parameters:
actions - the action map
Method Detail

buildMenuBar

public javax.swing.JMenuBar buildMenuBar()
This method will build a completely initialized menu bar from the input source using the default MANIMENU key.

Specified by:
buildMenuBar in interface UIBuilder
Returns:
a JMenuBar instance

buildMenuBar

public abstract javax.swing.JMenuBar buildMenuBar(java.lang.String key)
This method will build a completely initialized menu bar from the input source.

Specified by:
buildMenuBar in interface UIBuilder
Parameters:
key - the menu bar key
Returns:
a JMenuBar instance

buildMenu

public abstract javax.swing.JMenu buildMenu(java.lang.String key)
This method builds a given menu based on the appropriate key value. For a given key, the following items should be defined:

Specified by:
buildMenu in interface UIBuilder
Parameters:
key - the key for the menu
Returns:
a JMenu instance

buildMenuItem

public final javax.swing.JMenuItem buildMenuItem(java.lang.String key)
Description copied from interface: UIBuilder
This method builds a menu item based on the given key. For a given key, the following items should be defined:

getAction

public javax.swing.Action getAction(java.lang.String key)
This method is used to retrieve the action for the specified key in the actions specified in the constructor.

Parameters:
key - the key of the action
Returns:
the Action or null if none exists

getMenuItem

public javax.swing.JMenuItem getMenuItem(java.lang.String key)
This method is used to retrieve a menu item instance created by the abstract builder.

Parameters:
key - the key of the menu item to retrieve
Returns:
a JMenuItem instance. If no instance was created, this method returns null.

buildMenuItemHelper

protected abstract javax.swing.JMenuItem buildMenuItemHelper(java.lang.String key)
This method must be implemented by derived classes. It is functionally equivalent to the buildMenuItem(java.lang.String) method, but it is used to ensure that the menu items get registered.

Parameters:
key - the menu item key
Returns:
a JMenuItem


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.