The numBat Object Engine
|
|
Most of the small number of classes in the extensions library are self describing. However, one is not. This is the Fractory Dialog. This dialog has three components:
SetupThe navigation is controled by the navigatin nodes. These are set up using an XML (org.jdom.Document) definition file.
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 );
User inputActions 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 SectionThe user can select any of the activated controls in this section.
|