View Javadoc

1   package org.xmlhammer.gui.wizard;
2   
3   import javax.swing.ButtonGroup;
4   import javax.swing.JRadioButton;
5   import javax.swing.border.EmptyBorder;
6   
7   import org.bounce.FormLayout;
8   import org.bounce.wizard.WizardPage;
9   import org.xmlhammer.gui.util.wizard.HelpEnabledWizardPage;
10  
11  public class ParserSelectionPage extends HelpEnabledWizardPage {
12  
13      private static final long serialVersionUID = -1909903213579390495L;
14      
15      private ParserPropertiesPage parserPropertiesPage = null;
16  
17      private JRadioButton selectDOM = null;
18      private JRadioButton selectSAX = null;
19  
20      public ParserSelectionPage(String helpID, ParserPropertiesPage parserPropertiesPage) {
21          super(new FormLayout(11, 5), helpID);
22          
23          setBorder(new EmptyBorder(20, 50, 10, 10));
24          this.parserPropertiesPage = parserPropertiesPage;
25          
26          selectDOM = new JRadioButton("DOM (Document Object Model)");
27          selectSAX = new JRadioButton("SAX (Simple API for XML)");
28          
29          ButtonGroup group = new ButtonGroup();
30          group.add(selectDOM);
31          group.add(selectSAX);
32          
33          selectDOM.setSelected(true);
34          
35          add(selectDOM, FormLayout.FULL);
36          add(selectSAX, FormLayout.FULL);
37      }
38      
39      public boolean isDOMSelected() {
40          return selectDOM.isSelected();
41      }
42      
43      // @unittest
44      public void selectDOM() {
45          selectDOM.setSelected(true);
46      }
47      
48      // @unittest
49      public void selectSAX() {
50          selectSAX.setSelected(true);
51      }
52  
53      @Override
54      public String getTitle() {
55          return "Select XML Parser";
56      }
57  
58      @Override
59      public String getDescription() {
60          return "Define the type of XML Parser to use.";
61      }
62  
63      @Override
64      public WizardPage getNext() {
65          return parserPropertiesPage;
66      }
67  }