    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class xu.xu_FrameConfigManager

    java.lang.Object
       |
       +----com.sun.java.swing.tree.DefaultMutableTreeNode
               |
               +----xg.xg_Node
                       |
                       +----xg.xg_Document
                               |
                               +----xu.xu_FrameConfigManager

public class xu_FrameConfigManager
extends xg_Document

xu_FrameConfigManager is a repository for configuration details of any kind (ie. it has no knowledge of what they mean). It also has specific processing for certain types of configuration: for externally-defined menus and toolbars (hence the 'Frame' in the class name).

xu_FrameConfigManager can be used for the following purposes:

- Obtaining general configuration values, knowing nothing of their meaning.
- Setting up menus. It is possible to set up a whole menu bar and all its menus, or it can set up individual menus one at a time. Note that xu_FrameConfigManager has a table of the actions supported by the calling frame, and the appropriate action is automatically associated with each menu item. (Of course, to do this, the actions must be set up first - by calling the registerAction and/or registerActions methods.

  There are limits to what generic processing can do (though it could be expanded to handle more), so it is recognised that it may be necessary to set up certain menus and menu items is a bespoke fashion. For this reason, xu_FrameConfigManager allows considerable flexibility in how it is used.

- Setting up a toolbar. As for menu items, each toolbar button is automatically associated with its action.
- Providing a number of convenience functions, to retrieve the frame's title, icon image, preferred location and size, etc.

  At present, all configuration is read from standard Java resource files (for the user's default locale) but it is intended to replace these with XML configuration files.

  ##

  xu_FrameConfigManager()
    Constructor.

  ##

  convertToURL(String)
    Get the value of the URL whose name is InputResourceName.
  getAction(String)
    Get the action registered under the given name.
  getFrameIconImage()
    Get the icon image for this frame.
  getFrameRectangle()
    Get the location and size of the controlled frame.
  getFrameTitle()
    Get the title of this frame.
  getMenuBar()
    Get the first menu bar.
  getResourceBundle()
    Get the text resource bundle.
  getResourceString(String)
    Get the value of the string whose name is InputResourceName.
  getResourceURL(String)
    Get the value of the URL whose name is InputResourceName.
  getToolBar()
    Get the tool bar.
  load(String)
    Load the configuration from the named XML file.
  loadConfigFile(String)
    Load the configuration from the named XML file.
  registerAction(Action)
  registerActions(Action[])
    Add an array of actions to the array of known actions.
  registerElementClasses()

    Register special types of element classes used to represent particular parts of the configuration.

    The present approach isn't ideal: it's static, so affects all XML parsing, and it doesn't permit the unregistering of all the special registrations.

  ##

  xu_FrameConfigManager

       public xu_FrameConfigManager()

    Constructor.

    Parameters:
      InputControlledFrame - The frame whose configuration this is.

  ##

  load

       public boolean load(String InputConfigFileName)

    Load the configuration from the named XML file.

    Parameters:
      InputConfigFileName - The name of the XML configuration file from which to obtain information. It omits its '.xml' ending, since locale-specific endings are tried as appropriate.
    Returns:
      A flag indicating whether the load was successful
  loadConfigFile

       public boolean loadConfigFile(String InputConfigFileName)

    Load the configuration from the named XML file.

    Parameters:
      InputConfigFileName - The name of the XML configuration file from which to obtain information. It omits its '.xml' ending, since locale-specific endings are tried as appropriate.
    Returns:
      A flag indicating whether the load was successful
  registerElementClasses

       public void registerElementClasses()

    Register special types of element classes used to represent particular parts of the configuration.

    The present approach isn't ideal: it's static, so affects all XML parsing, and it doesn't permit the unregistering of all the special registrations.

  registerActions

       public void registerActions(Action InputActionArray[])

    Add an array of actions to the array of known actions.

  registerAction

       public void registerAction(Action InputAction)

  getResourceURL

       public URL getResourceURL(String InputResourceName)

    Get the value of the URL whose name is InputResourceName.

  convertToURL

       public URL convertToURL(String InputValue)

    Get the value of the URL whose name is InputResourceName.

  getResourceString

       public String getResourceString(String InputResourceName)

    Get the value of the string whose name is InputResourceName.

  getAction

       public Action getAction(String InputActionName)

    Get the action registered under the given name.

  getToolBar

       public JToolBar getToolBar()

    Get the tool bar.

  getMenuBar

       public JMenuBar getMenuBar()

    Get the first menu bar.

  getFrameRectangle

       public Rectangle getFrameRectangle()

    Get the location and size of the controlled frame. (Presently, the values are fixed, but it is intended - once we've switched to XML - to obtain them from the config. file.)

  getFrameIconImage

       public Image getFrameIconImage()

    Get the icon image for this frame.

  getFrameTitle

       public String getFrameTitle()

    Get the title of this frame.

  getResourceBundle

       public ResourceBundle getResourceBundle()

    Get the text resource bundle.

      All Packages  Class Hierarchy  This Package  Previous  Next  Index