1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.xmlhammer.gui.wizard;
23
24 import java.awt.Frame;
25 import java.util.List;
26
27 import org.xmlhammer.gui.util.wizard.HelpEnabledWizard;
28 import org.xmlhammer.model.jaxp.JAXPSchemaFactory;
29 import org.xmlhammer.model.jaxp.JAXPTransformerFactory;
30 import org.xmlhammer.model.jaxp.Settings;
31 import org.xmlhammer.model.project.Document;
32 import org.xmlhammer.model.project.Input;
33 import org.xmlhammer.model.project.Project;
34
35 public class NewStylesheetValidatorWizard extends HelpEnabledWizard {
36
37 private static final long serialVersionUID = -2924107376836737591L;
38
39 private InputFilterPage filterPage = null;
40 private InputURIsPage urisPage = null;
41 private InputTypeSelectionPage typeSelectionPage = null;
42
43 public NewStylesheetValidatorWizard(Frame parent) {
44 super(parent);
45
46 filterPage = new InputFilterPage("new.style.input.filter", null);
47 urisPage = new InputURIsPage("new.style.input.specify", null);
48 typeSelectionPage = new InputTypeSelectionPage("new.style.input.selection", filterPage, urisPage);
49
50 addPage(typeSelectionPage);
51 addPage(urisPage);
52 addPage(filterPage);
53
54 setPage(typeSelectionPage);
55 }
56
57 public String getWizardTitle() {
58 return "New XML Stylesheet Validator";
59 }
60
61 public Project getProject() {
62 Project project = new Project();
63 Settings settings = new Settings();
64 settings.setJAXPTransformerFactory(new JAXPTransformerFactory());
65 settings.setJAXPSchemaFactory(new JAXPSchemaFactory());
66 project.setJAXPSettings(settings);
67
68
69 Input input = new Input();
70
71 if (typeSelectionPage.isInputFilterSelected()) {
72 input.setFilter(filterPage.getFilter());
73 } else {
74 List<Document> uris = urisPage.getURIs();
75
76 for (Document document : uris) {
77 input.getSourceOrSourceAndResult().add(document);
78 }
79 }
80
81 project.setInput(input);
82
83 return project;
84 }
85 }