The numBat Object Engine
Extensions
Home ] [ Extensions ] numBat Engine ] Life, the universe, everything! ]


 

 

Most of the small number of classes in the extensions library are self describing. However, one is not. This is the Fractory Dialog.

wpe1.jpg (10662 bytes)

This dialog has three components:

  1. A navigation section on the top left.
  2. A programmer specified section in the top right.
  3. A set of navigation buttons across the bottom.

Setup

The navigation is controled by the navigatin nodes. These are set up using an XML (org.jdom.Document) definition file.

** XML Specification Here **

The following code is an example of a subclas that implements the FactoryDialog.

public class CharacterSelectionDialog extends FactoryDialog 
{
/** Creates new CharacterSelectionDialog */
public CharacterSelectionDialog() 
{
  super( new Frame( "New Character Selection Dialogue." ) , true );
  // set up the navigation tree
  SAXBuilder sb = new SAXBuilder();
  try
  {
    super.setNavigationTree( sb.build( new File( "yarps" + 
                             System.getProperty( "file.separator" ) +
                             "createDefinition.xml" ) ) );
  } catch ( Exception e )
  {
    // debug error!!!! This is bad. Very bad....
  }
  this.setBounds( WindowUtilities.centreWindow( this.getGraphicsConfiguration(), 20 ) );
}

The progress section is currently unimplemented.

The programmer's section adds the following interfaces, that must be implemented to allow access into the frame.

abstract void setSelectionState(org.jdom.Document state);
abstract org.jdom.Document getSelectionState();
abstract void addSelectionListener( extensions.gui.factoryDialog.NavigationNode nn );
abstract void removeSelectionListener( extensions.gui.factoryDialog.NavigationNode nn );

 

FactoryDialogOverview.png (20278 bytes)

User input

Actions in the programmer's section.

From the progammer's secton the user makes selections and choices. Before the a control action that moves to a new section is activated, the program queries the frame for the current state. This is passed back and then on as an XML document.

If the user makes a selection that changes the target of the next action, the a selection node event is passed with the new selection id.

Actions in the control Section

The user can select any of the activated controls in this section.

Back will take the user to the previous navigation node. If the node is the root of the tree, this action is disabled.

Forward will take the user to the next node. If the default next node is -1, or the selection has no next node, then this button is disabled.

Finish and Cancel will cause the Factory Dialog to exit. The only difference is that a call on the result will return Finish or Cancelled as appropriate.

Help will display another window with the specified HTML 3.2 file.