1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.xmlhammer.gui.xslt;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import javax.swing.JFrame;
29 import javax.swing.event.TreeSelectionListener;
30
31 import org.xmlhammer.gui.preferences.JAXPPropertiesDialog;
32 import org.xmlhammer.gui.preferences.PropertiesPanel;
33 import org.xmlhammer.gui.util.preferences.HelpEnabledPreferencesPage;
34 import org.xmlhammer.model.jaxp.Property;
35 import org.xmlhammer.model.tools.xslt.OutputProperty;
36
37 /***
38 * Put comment...
39 *
40 * @version $Revision$, $Date$
41 * @author Edwin Dankert <edankert@gmail.com>
42 */
43
44 public class XMLOutputPropertiesDialog extends JAXPPropertiesDialog implements TreeSelectionListener {
45 private static final long serialVersionUID = 2673193241652494262L;
46
47 private PropertiesPanel propertiesPanel = null;
48
49 /***
50 * @param parent the underlying frame
51 */
52 public XMLOutputPropertiesDialog(JFrame parent) {
53 super( parent, "Properties");
54
55 add((HelpEnabledPreferencesPage)null, getOutputPropertiesPanel());
56 }
57
58 protected PropertiesPanel getOutputPropertiesPanel() {
59 if (propertiesPanel == null) {
60 propertiesPanel = new PropertiesPanel(null, "Output Properties", "project.trax.output", false);
61 }
62
63 return propertiesPanel;
64 }
65
66 /***
67 * @return the SAXParserfactory settings,
68 * null if global settings should be used.
69 */
70 public List<OutputProperty> getOutputProperties( ) {
71 List<OutputProperty> properties = new ArrayList<OutputProperty>();
72 List<Property> props = getOutputPropertiesPanel().getProperties();
73
74 for (Property prop : props) {
75 OutputProperty property = new OutputProperty();
76 property.setName(prop.getName());
77 property.setValue(prop.getValue());
78 property.setActive(prop.isActive());
79 properties.add(property);
80 }
81
82 return properties;
83 }
84
85 /***
86 * @return the SAXParserfactory settings,
87 * null if global settings should be used.
88 */
89 public void setOutputProperties(List<OutputProperty> properties) {
90 List<Property> props = new ArrayList<Property>();
91
92 for (OutputProperty property : properties) {
93 Property prop = new Property();
94 prop.setName(property.getName());
95 prop.setValue(property.getValue());
96 prop.setActive(property.isActive());
97 props.add(prop);
98 }
99
100 getOutputPropertiesPanel().setProperties(props);
101 }
102 }