View Javadoc

1   /*
2    * $Id$
3    *
4    * The contents of this file are subject to the Mozilla Public License 
5    * Version 1.1 (the "License"); you may not use this file except in 
6    * compliance with the License. You may obtain a copy of the License at 
7    * http://www.mozilla.org/MPL/ 
8    *
9    * Software distributed under the License is distributed on an "AS IS" basis, 
10   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
11   * for the specific language governing rights and limitations under the License.
12   *
13   * The Original Code is XML Hammer code. (org.xmlhammer.*)
14   *
15   * The Initial Developer of the Original Code is Edwin Dankert. Portions created 
16   * by the Initial Developer are Copyright (C) 2005 - 2006 the Initial Developer. 
17   * All Rights Reserved.
18   *
19   * Contributor(s): Edwin Dankert <edankert@gmail.com>
20   */
21  
22  package org.xmlhammer.gui.wizard;
23  
24  import java.awt.BorderLayout;
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  import javax.swing.border.EmptyBorder;
29  
30  import org.bounce.wizard.WizardPage;
31  import org.xmlhammer.PreferencesHandler;
32  import org.xmlhammer.gui.parser.SchemaURIsPanel;
33  import org.xmlhammer.gui.util.wizard.HelpEnabledWizardPage;
34  import org.xmlhammer.model.jaxp.SchemaFactoryProperty;
35  import org.xmlhammer.model.project.Document;
36  
37  public class SchemaURIsPage extends HelpEnabledWizardPage {
38      private static final long serialVersionUID = 6688922851481710915L;
39      
40      private SchemaURIsPanel schemaURIsPanel = null;
41      private WizardPage nextPage = null;
42  
43      public SchemaURIsPage(String helpID) {
44          this(helpID, null);
45      }
46  
47      public SchemaURIsPage(String helpID, WizardPage nextPage) {
48          super(new BorderLayout(), helpID);
49  
50          setBorder(new EmptyBorder(10, 10, 0, 10));
51          schemaURIsPanel = new SchemaURIsPanel(null);
52  
53          ArrayList<String> languages = new ArrayList<String>();
54  
55          List<SchemaFactoryProperty> properties = PreferencesHandler.getInstance().getPreferences().getJAXPSettings().getJAXPSchemaFactory().getSchemaFactoryProperties().getSchemaFactoryProperty();
56          for (SchemaFactoryProperty property : properties) {
57              languages.add( property.getLanguage());
58          }
59  
60          schemaURIsPanel.setSchemaLanguages(languages);
61          
62          this.nextPage = nextPage;
63          
64          add(schemaURIsPanel, BorderLayout.NORTH);
65      }
66  
67      public String getSchemaLanguage() {
68          return schemaURIsPanel.getSchemaLanguage();
69      }
70  
71      public List<Document> getURIs() { 
72          return schemaURIsPanel.getURIs(null);
73      }
74  
75      @Override
76      public String getTitle() {
77          return "Specify Schema Language";
78      }
79  
80      @Override
81      public String getDescription() {
82          return "Specify the Schema Language and the Schema(s) to validate against.";
83      }
84  
85      @Override
86      public WizardPage getNext() {
87          // TODO Auto-generated method stub
88          return nextPage;
89      }
90  }