View Javadoc

1   /*
2    * $Id: JAXPPropertiesDialog.java,v 1.14 2007/07/04 19:42:50 edankert Exp $
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  
23  package org.xmlhammer.gui.preferences;
24  
25  import java.awt.Frame;
26  
27  import javax.swing.JFrame;
28  import javax.swing.event.TreeSelectionListener;
29  
30  import org.xmlhammer.PreferencesHandler;
31  import org.xmlhammer.gui.util.preferences.HelpEnabledPreferencesDialog;
32  import org.xmlhammer.model.preferences.Preferences;
33  
34  /***
35   * JAXP Properties ...
36   * 
37   * @version $Revision: 1.14 $, $Date: 2007/07/04 19:42:50 $
38   * @author Edwin Dankert <edankert@gmail.com>
39   */
40  
41  public class JAXPPropertiesDialog extends HelpEnabledPreferencesDialog implements TreeSelectionListener {
42  	private static final long serialVersionUID = -7403432397234000652L;
43  
44  	private Preferences preferences = null;
45  
46  	protected SAXParserFactoryPreferencesPanel saxParserFactoryPreferencesPanel = null;
47  	protected PropertiesPanel saxParserFactoryPropertiesPanel = null;
48  	protected FeaturesPanel saxParserFactoryFeaturesPanel = null;
49  	protected AttributesPanel documentBuilderFactoryAttributesPanel = null;
50  	protected FeaturesPanel documentBuilderFactoryFeaturesPanel = null;
51  	protected FeaturesPanel xpathFactoryFeaturesPanel = null;
52  	protected XPathFactoryPreferencesPanel xpathFactoryPreferencesPanel = null;
53      protected PrefixNamespaceMappingsPanel prefixNamespaceMappingsPanel = null;
54  	protected TransformerFactoryPreferencesPanel transformerFactoryPreferencesPanel = null;
55  	protected AttributesPanel transformerFactoryAttributesPanel = null;
56  	protected FeaturesPanel transformerFactoryFeaturesPanel = null;
57  	protected DocumentBuilderFactoryPreferencesPanel documentBuilderFactoryPreferencesPanel = null;
58  	protected SchemaFactoryPreferencesPanel schemaFactoryPreferencesPanel = null;
59  	protected PropertiesPanel schemaFactoryPropertiesPanel = null;
60  	protected FeaturesPanel schemaFactoryFeaturesPanel = null;
61  
62  	/***
63  	 * @param parent
64  	 * @throws java.awt.HeadlessException
65  	 */
66  	public JAXPPropertiesDialog(Frame parent, String title) {
67  		super(parent, title);
68  		
69  		this.preferences = PreferencesHandler.getInstance().getPreferences();
70  	}
71      
72      public Preferences getPreferences() {
73  		return preferences;
74  	}
75  	
76      protected SAXParserFactoryPreferencesPanel getSAXParserFactoryPreferencesPanel() {
77  		if ( saxParserFactoryPreferencesPanel == null) {
78  			saxParserFactoryPreferencesPanel = new SAXParserFactoryPreferencesPanel();
79  		}
80  		
81  		return saxParserFactoryPreferencesPanel;
82  	}
83  		
84  	protected PropertiesPanel getSAXParserFactoryPropertiesPanel() {
85  		if ( saxParserFactoryPropertiesPanel == null) {
86  			saxParserFactoryPropertiesPanel = new PropertiesPanel((JFrame)getParent(), "Properties", "preferences.sax.properties");
87  		}
88  
89  		return saxParserFactoryPropertiesPanel;
90  	}
91  
92  	protected FeaturesPanel getSAXParserFactoryFeaturesPanel() {
93  		if ( saxParserFactoryFeaturesPanel == null) {
94  			saxParserFactoryFeaturesPanel = new FeaturesPanel((JFrame)getParent(), "Features", "preferences.sax.features");
95  		}
96  
97  		return saxParserFactoryFeaturesPanel;
98  	}
99  
100 	protected DocumentBuilderFactoryPreferencesPanel getDocumentBuilderFactoryPreferencesPanel() {
101 		if ( documentBuilderFactoryPreferencesPanel == null) {
102 			documentBuilderFactoryPreferencesPanel = new DocumentBuilderFactoryPreferencesPanel();
103 		}
104 
105 		return documentBuilderFactoryPreferencesPanel;
106 	}
107 
108 	protected AttributesPanel getDocumentBuilderFactoryAttributesPanel() {
109 		if ( documentBuilderFactoryAttributesPanel == null) {
110 			documentBuilderFactoryAttributesPanel = new AttributesPanel((JFrame)getParent(), "Attributes", "preferences.dom.attributes");
111 		}
112 
113 		return documentBuilderFactoryAttributesPanel;
114 	}
115 
116 	protected FeaturesPanel getDocumentBuilderFactoryFeaturesPanel() {
117 		if ( documentBuilderFactoryFeaturesPanel == null) {
118 			documentBuilderFactoryFeaturesPanel = new FeaturesPanel((JFrame)getParent(), "Features", "preferences.dom.features");
119 		}
120 
121 		return documentBuilderFactoryFeaturesPanel;
122 	}
123 
124 	protected TransformerFactoryPreferencesPanel getTransformerFactoryPreferencesPanel() {
125 		if ( transformerFactoryPreferencesPanel == null) {
126 			transformerFactoryPreferencesPanel = new TransformerFactoryPreferencesPanel();
127 		}
128 
129 		return transformerFactoryPreferencesPanel;
130 	}
131 
132 	protected AttributesPanel getTransformerFactoryAttributesPanel() {
133 		if ( transformerFactoryAttributesPanel == null) {
134 			transformerFactoryAttributesPanel = new AttributesPanel((JFrame)getParent(), "Attributes", "preferences.trax.attributes");
135 		}
136 
137 		return transformerFactoryAttributesPanel;
138 	}
139 
140 	protected FeaturesPanel getTransformerFactoryFeaturesPanel() {
141 		if ( transformerFactoryFeaturesPanel == null) {
142 			transformerFactoryFeaturesPanel = new FeaturesPanel((JFrame)getParent(), "Features", "preferences.trax.features");
143 		}
144 
145 		return transformerFactoryFeaturesPanel;
146 	}
147 
148 	protected XPathFactoryPreferencesPanel getXPathFactoryPreferencesPanel() {
149 		if ( xpathFactoryPreferencesPanel == null) {
150 			xpathFactoryPreferencesPanel = new XPathFactoryPreferencesPanel();
151 		}
152 
153 		return xpathFactoryPreferencesPanel;
154 	}
155 
156 	protected FeaturesPanel getXPathFactoryFeaturesPanel() {
157 		if ( xpathFactoryFeaturesPanel == null) {
158 			xpathFactoryFeaturesPanel = new FeaturesPanel((JFrame)getParent(), "Features", "preferences.xpath.features");
159 		}
160 
161 		return xpathFactoryFeaturesPanel;
162 	}
163 
164     protected PrefixNamespaceMappingsPanel getPrefixNamespaceMappingsPanel() {
165         if ( prefixNamespaceMappingsPanel == null) {
166             prefixNamespaceMappingsPanel = new PrefixNamespaceMappingsPanel((JFrame)getParent(), "Mappings", "preferences.xpath.mappings");
167         }
168 
169         return prefixNamespaceMappingsPanel;
170     }
171 
172 	protected SchemaFactoryPreferencesPanel getSchemaFactoryPreferencesPanel() {
173 		if ( schemaFactoryPreferencesPanel == null) {
174 			schemaFactoryPreferencesPanel = new SchemaFactoryPreferencesPanel((JFrame)getParent());
175 		}
176 		
177 		return schemaFactoryPreferencesPanel;
178 	}
179 		
180 	protected PropertiesPanel getSchemaFactoryPropertiesPanel() {
181 		if ( schemaFactoryPropertiesPanel == null) {
182 			schemaFactoryPropertiesPanel = new PropertiesPanel((JFrame)getParent(), "Properties", "preferences.schema.properties");
183 		}
184 
185 		return schemaFactoryPropertiesPanel;
186 	}
187 
188 	protected FeaturesPanel getSchemaFactoryFeaturesPanel() {
189 		if ( schemaFactoryFeaturesPanel == null) {
190 			schemaFactoryFeaturesPanel = new FeaturesPanel((JFrame)getParent(), "Features", "preferences.schema.features");
191 		}
192 
193 		return schemaFactoryFeaturesPanel;
194 	}
195 }