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.


    Constructor Index

     o xu_FrameConfigManager()
    Constructor.

    Method Index

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

    Constructors

     o xu_FrameConfigManager
     public xu_FrameConfigManager()
    
    Constructor.

    Parameters:
    InputControlledFrame - The frame whose configuration this is.

    Methods

     o 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
     o 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
     o 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.

     o registerActions
     public void registerActions(Action InputActionArray[])
    
    Add an array of actions to the array of known actions.

     o registerAction
     public void registerAction(Action InputAction)
    
     o getResourceURL
     public URL getResourceURL(String InputResourceName)
    
    Get the value of the URL whose name is InputResourceName.

     o convertToURL
     public URL convertToURL(String InputValue)
    
    Get the value of the URL whose name is InputResourceName.

     o getResourceString
     public String getResourceString(String InputResourceName)
    
    Get the value of the string whose name is InputResourceName.

     o getAction
     public Action getAction(String InputActionName)
    
    Get the action registered under the given name.

     o getToolBar
     public JToolBar getToolBar()
    
    Get the tool bar.

     o getMenuBar
     public JMenuBar getMenuBar()
    
    Get the first menu bar.

     o 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.)

     o getFrameIconImage
     public Image getFrameIconImage()
    
    Get the icon image for this frame.

     o getFrameTitle
     public String getFrameTitle()
    
    Get the title of this frame.

     o getResourceBundle
     public ResourceBundle getResourceBundle()
    
    Get the text resource bundle.


    All Packages  Class Hierarchy  This Package  Previous  Next  Index