KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > tools > generator > SAXGeneratorVersionPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.tools.generator;
20
21 import java.awt.event.*;
22 import java.beans.*;
23 import javax.swing.*;
24 import java.net.URL JavaDoc;
25 import java.net.MalformedURLException JavaDoc;
26
27 /**
28  *
29  * @author Petr Kuzel
30  * @version
31  */

32 public final class SAXGeneratorVersionPanel extends SAXGeneratorAbstractPanel implements ActionListener {
33
34     /** Serial Version UID */
35     private static final long serialVersionUID =-3731567998368428526L;
36
37
38     /** Creates new form SAXGeneratorVersionPanel */
39     public SAXGeneratorVersionPanel() {
40 // try {
41
// this.putClientProperty("WizardPanel_helpURL", new URL("nbresloc:/org/netbeans/modules/xml/tools/generator/SAXGeneratorVersionPanel.html")); //NOI18N
42
// } catch (MalformedURLException ex) {
43
// }
44
}
45     
46     /** This method is called from within the constructor to
47      * initialize the form.
48      * WARNING: Do NOT modify this code. The content of this method is
49      * always regenerated by the FormEditor.
50      */

51     private void initComponents() {//GEN-BEGIN:initComponents
52
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
53
54         descTextArea = new javax.swing.JTextArea JavaDoc();
55         jaxpLabel = new javax.swing.JLabel JavaDoc();
56         jaxpVersionComboBox = new javax.swing.JComboBox JavaDoc();
57         versionLabel = new javax.swing.JLabel JavaDoc();
58         versionComboBox = new javax.swing.JComboBox JavaDoc();
59         propagateSAXCheckBox = new javax.swing.JCheckBox JavaDoc();
60
61         setLayout(new java.awt.GridBagLayout JavaDoc());
62
63         setPreferredSize(new java.awt.Dimension JavaDoc(480, 350));
64         setName(Util.THIS.getString ("SAXGeneratorVersionPanel.Form.name"));
65         descTextArea.setWrapStyleWord(true);
66         descTextArea.setLineWrap(true);
67         descTextArea.setEditable(false);
68         descTextArea.setForeground(new java.awt.Color JavaDoc(102, 102, 153));
69         descTextArea.setFont(javax.swing.UIManager.getFont ("Label.font"));
70         descTextArea.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/xml/tools/generator/Bundle").getString("DESC_saxw_versions"));
71         descTextArea.setDisabledTextColor(javax.swing.UIManager.getColor ("Label.foreground"));
72         descTextArea.setEnabled(false);
73         descTextArea.setOpaque(false);
74         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
75         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
76         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
77         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
78         add(descTextArea, gridBagConstraints);
79
80         jaxpLabel.setText(Util.THIS.getString ("SAXGeneratorVersionPanel.jaxpLabel.text"));
81         jaxpLabel.setForeground(java.awt.Color.black);
82         jaxpLabel.setLabelFor(jaxpVersionComboBox);
83         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
84         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
85         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
86         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
87         add(jaxpLabel, gridBagConstraints);
88
89         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
90         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
91         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
92         gridBagConstraints.weightx = 1.0;
93         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
94         add(jaxpVersionComboBox, gridBagConstraints);
95
96         versionLabel.setText(Util.THIS.getString ("SAXGeneratorCustomizer.versionLabel.text"));
97         versionLabel.setForeground(java.awt.Color.black);
98         versionLabel.setLabelFor(versionComboBox);
99         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
100         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
101         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
102         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
103         add(versionLabel, gridBagConstraints);
104
105         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
106         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
107         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
108         gridBagConstraints.weightx = 1.0;
109         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
110         add(versionComboBox, gridBagConstraints);
111
112         propagateSAXCheckBox.setText(Util.THIS.getString ("SAXGeneratorVersionPanel.propagateSAXCheckBox.text"));
113         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
114         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
115         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
116         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
117         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
118         gridBagConstraints.weightx = 1.0;
119         gridBagConstraints.weighty = 1.0;
120         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
121         add(propagateSAXCheckBox, gridBagConstraints);
122
123     }//GEN-END:initComponents
124

125     protected void updateModel() {
126         model.setSAXversion(versionComboBox.getSelectedIndex() + 1);
127         model.setJAXPversion(jaxpVersionComboBox.getSelectedIndex() + 1);
128         model.setPropagateSAX(propagateSAXCheckBox.isSelected());
129     }
130     
131     protected void initView() {
132         initComponents();
133             
134         //**** set mnemonics
135
jaxpLabel.setDisplayedMnemonic(Util.THIS.getChar("SAXGeneratorVersionPanel.jaxpLabel.mne")); // NOI18N
136
versionLabel.setDisplayedMnemonic(Util.THIS.getChar("SAXGeneratorCustomizer.versionLabel.mne")); // NOI18N
137
propagateSAXCheckBox.setMnemonic(Util.THIS.getChar("SAXGeneratorVersionPanel.propagateSAXCheckBox.mne")); // NOI18N
138
//****
139

140         String JavaDoc items[] = new String JavaDoc[] {"SAX 1.0", "SAX 2.0"}; // NOI18N
141
ComboBoxModel cbModel = new DefaultComboBoxModel(items);
142         versionComboBox.setModel(cbModel);
143         cbModel.setSelectedItem(items[model.getSAXversion() - 1]);
144         
145         items = new String JavaDoc[] {"JAXP 1.0", "JAXP 1.1"}; // NOI18N
146
cbModel = new DefaultComboBoxModel(items);
147         jaxpVersionComboBox.setModel(cbModel);
148         cbModel.setSelectedItem(items[model.getJAXPversion() - 1]);
149         
150         initAccessibility();
151     }
152     
153     protected void updateView() {
154     }
155     
156     public void actionPerformed(java.awt.event.ActionEvent JavaDoc p1) {
157         updateModel();
158     }
159     
160     // Variables declaration - do not modify//GEN-BEGIN:variables
161
private javax.swing.JComboBox JavaDoc jaxpVersionComboBox;
162     private javax.swing.JTextArea JavaDoc descTextArea;
163     private javax.swing.JLabel JavaDoc versionLabel;
164     private javax.swing.JCheckBox JavaDoc propagateSAXCheckBox;
165     private javax.swing.JLabel JavaDoc jaxpLabel;
166     private javax.swing.JComboBox JavaDoc versionComboBox;
167     // End of variables declaration//GEN-END:variables
168

169     /** Initialize accesibility
170      */

171     public void initAccessibility(){
172
173         propagateSAXCheckBox.getAccessibleContext().setAccessibleDescription(Util.THIS.getString("ACSD_propagateSAXCheckBox"));
174         propagateSAXCheckBox.getAccessibleContext().setAccessibleName(Util.THIS.getString("ACSN_propagateSAXCheckBox"));
175         
176         jaxpVersionComboBox.getAccessibleContext().setAccessibleDescription(Util.THIS.getString("ACSD_jaxpVersionComboBox"));
177         propagateSAXCheckBox.getAccessibleContext().setAccessibleDescription(Util.THIS.getString("ACSD_propagateSAXCheckBox"));
178         
179         versionComboBox.getAccessibleContext().setAccessibleDescription(Util.THIS.getString("ACSD_versionComboBox"));
180         
181         this.getAccessibleContext().setAccessibleDescription(Util.THIS.getString("ACSD_SAXGeneratorVersionPanel"));
182     }
183 }
184
Popular Tags