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 InputTypeSelectionPage extends HelpEnabledWizardPage {
12
13 private static final long serialVersionUID = -1909903213579390495L;
14
15 private InputFilterPage filterPage = null;
16 private InputURIsPage urisPage = null;
17
18 private JRadioButton selectInputFilter = null;
19 private JRadioButton selectInputURIs = null;
20
21 public InputTypeSelectionPage(String helpID, InputFilterPage filterPage, InputURIsPage urisPage) {
22 super(new FormLayout(11, 5), helpID);
23
24 setBorder(new EmptyBorder(20, 50, 10, 10));
25
26 selectInputFilter = new JRadioButton("Specify the input documents using a Filter");
27 selectInputURIs = new JRadioButton("Specify specific URIs for the input documents");
28
29 ButtonGroup group = new ButtonGroup();
30 group.add(selectInputFilter);
31 group.add(selectInputURIs);
32
33 selectInputFilter.setSelected(true);
34
35 add(selectInputFilter, FormLayout.FULL);
36 add(selectInputURIs, FormLayout.FULL);
37
38 this.filterPage = filterPage;
39 this.urisPage = urisPage;
40 }
41
42 public boolean isInputFilterSelected() {
43 return selectInputFilter.isSelected();
44 }
45
46
47 public void selectInputFilter() {
48 selectInputFilter.setSelected(true);
49 }
50
51
52 public void selectInputURIs() {
53 selectInputURIs.setSelected(true);
54 }
55
56 @Override
57 public String getTitle() {
58 return "Select Input Type";
59 }
60
61 @Override
62 public String getDescription() {
63 return "Define the mechanism to use to specify input documents.";
64 }
65
66 @Override
67 public WizardPage getNext() {
68 if (selectInputFilter.isSelected()) {
69 return filterPage;
70 }
71
72 return urisPage;
73 }
74 }