001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.web.wizards;
043:
044: /**
045: *
046: * @author mk115033
047: */
048: public class AttrDialog extends javax.swing.JPanel {
049:
050: /** Creates new form AttrDialog */
051: public AttrDialog() {
052: initComponents();
053: }
054:
055: /** Creates new form AttrDialog */
056: public AttrDialog(String attrName, String attrType,
057: boolean required, boolean rtexpr) {
058: initComponents();
059: jTextField1.setText(attrName);
060: jComboBox1.setSelectedItem(attrType);
061: jCheckBox1.setSelected(required);
062: if (rtexpr)
063: jRadioButton1.setSelected(true);
064: else
065: jRadioButton2.setSelected(true);
066:
067: }
068:
069: public String getAttrName() {
070: return jTextField1.getText().trim();
071: }
072:
073: public String getAttrType() {
074: return (String) jComboBox1.getSelectedItem();
075: }
076:
077: public boolean isRequired() {
078: return jCheckBox1.isSelected();
079: }
080:
081: public boolean isRtexpr() {
082: return jRadioButton1.isSelected();
083: }
084:
085: javax.swing.JTextField getAttrNameTF() {
086: return jTextField1;
087: }
088:
089: /** This method is called from within the constructor to
090: * initialize the form.
091: * WARNING: Do NOT modify this code. The content of this method is
092: * always regenerated by the Form Editor.
093: */
094: private void initComponents() {//GEN-BEGIN:initComponents
095: java.awt.GridBagConstraints gridBagConstraints;
096:
097: buttonGroup1 = new javax.swing.ButtonGroup();
098: jLabel1 = new javax.swing.JLabel();
099: jLabel2 = new javax.swing.JLabel();
100: jTextField1 = new javax.swing.JTextField();
101: jComboBox1 = new javax.swing.JComboBox();
102: jCheckBox1 = new javax.swing.JCheckBox();
103: jPanel1 = new javax.swing.JPanel();
104: jRadioButton1 = new javax.swing.JRadioButton();
105: jRadioButton2 = new javax.swing.JRadioButton();
106:
107: setLayout(new java.awt.GridBagLayout());
108:
109: getAccessibleContext().setAccessibleDescription(
110: java.util.ResourceBundle.getBundle(
111: "org/netbeans/modules/web/wizards/Bundle")
112: .getString("A11Y_DESC_AttrDialog"));
113: jLabel1.setDisplayedMnemonic(java.util.ResourceBundle
114: .getBundle("org/netbeans/modules/web/wizards/Bundle")
115: .getString("A11Y_AttrName_mnem").charAt(0));
116: jLabel1.setLabelFor(jTextField1);
117: jLabel1.setText(org.openide.util.NbBundle.getMessage(
118: AttrDialog.class, "LBL_AttrName"));
119: gridBagConstraints = new java.awt.GridBagConstraints();
120: gridBagConstraints.gridx = 0;
121: gridBagConstraints.gridy = 0;
122: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
123: gridBagConstraints.weightx = 1.0;
124: gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 0);
125: add(jLabel1, gridBagConstraints);
126:
127: jLabel2.setDisplayedMnemonic(java.util.ResourceBundle
128: .getBundle("org/netbeans/modules/web/wizards/Bundle")
129: .getString("A11Y_AttrType_mnem").charAt(0));
130: jLabel2.setLabelFor(jComboBox1);
131: jLabel2.setText(org.openide.util.NbBundle.getMessage(
132: AttrDialog.class, "LBL_AttrType"));
133: gridBagConstraints = new java.awt.GridBagConstraints();
134: gridBagConstraints.gridx = 0;
135: gridBagConstraints.gridy = 1;
136: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
137: gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 0);
138: add(jLabel2, gridBagConstraints);
139:
140: gridBagConstraints = new java.awt.GridBagConstraints();
141: gridBagConstraints.gridx = 1;
142: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
143: gridBagConstraints.weightx = 1.0;
144: gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 0);
145: add(jTextField1, gridBagConstraints);
146: jTextField1.getAccessibleContext().setAccessibleDescription(
147: java.util.ResourceBundle.getBundle(
148: "org/netbeans/modules/web/wizards/Bundle")
149: .getString("LBL_AttrName"));
150:
151: jComboBox1.setEditable(true);
152: jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(
153: new String[] { "java.lang.String", "boolean", "char",
154: "byte", "short", "int", "long", "float",
155: "double", "java.lang.Boolean",
156: "java.lang.Character", "java.lang.Byte",
157: "java.lang.Short", "java.lang.Integer",
158: "java.lang.Long", "java.lang.Float",
159: "java.lang.Double", "java.lang.Object" }));
160: gridBagConstraints = new java.awt.GridBagConstraints();
161: gridBagConstraints.gridx = 1;
162: gridBagConstraints.gridy = 1;
163: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
164: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
165: gridBagConstraints.weightx = 1.0;
166: gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 0);
167: add(jComboBox1, gridBagConstraints);
168: jComboBox1.getAccessibleContext().setAccessibleDescription(
169: java.util.ResourceBundle.getBundle(
170: "org/netbeans/modules/web/wizards/Bundle")
171: .getString("LBL_AttrType"));
172:
173: jCheckBox1.setMnemonic(java.util.ResourceBundle.getBundle(
174: "org/netbeans/modules/web/wizards/Bundle").getString(
175: "A11Y_AttrRequired_mnem").charAt(0));
176: jCheckBox1.setText(org.openide.util.NbBundle.getMessage(
177: AttrDialog.class, "OPT_attrRequired"));
178: gridBagConstraints = new java.awt.GridBagConstraints();
179: gridBagConstraints.gridx = 1;
180: gridBagConstraints.gridy = 2;
181: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
182: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
183: gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 0);
184: add(jCheckBox1, gridBagConstraints);
185: jCheckBox1.getAccessibleContext().setAccessibleDescription(
186: java.util.ResourceBundle.getBundle(
187: "org/netbeans/modules/web/wizards/Bundle")
188: .getString("OPT_attrRequired"));
189:
190: gridBagConstraints = new java.awt.GridBagConstraints();
191: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
192: gridBagConstraints.weightx = 3.0;
193: add(jPanel1, gridBagConstraints);
194:
195: jRadioButton1.setMnemonic(java.util.ResourceBundle.getBundle(
196: "org/netbeans/modules/web/wizards/Bundle").getString(
197: "A11Y_AttrRequestTime_mnem").charAt(0));
198: jRadioButton1.setSelected(true);
199: jRadioButton1.setText(org.openide.util.NbBundle.getMessage(
200: AttrDialog.class, "OPT_attrRequestTime"));
201: buttonGroup1.add(jRadioButton1);
202: gridBagConstraints = new java.awt.GridBagConstraints();
203: gridBagConstraints.gridx = 1;
204: gridBagConstraints.gridy = 3;
205: gridBagConstraints.gridwidth = 2;
206: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
207: gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
208: add(jRadioButton1, gridBagConstraints);
209: jRadioButton1.getAccessibleContext().setAccessibleDescription(
210: java.util.ResourceBundle.getBundle(
211: "org/netbeans/modules/web/wizards/Bundle")
212: .getString("OPT_attrRequestTime"));
213:
214: jRadioButton2.setMnemonic(java.util.ResourceBundle.getBundle(
215: "org/netbeans/modules/web/wizards/Bundle").getString(
216: "A11Y_AttrJspTranslationTime_mnem").charAt(0));
217: jRadioButton2.setText(org.openide.util.NbBundle.getMessage(
218: AttrDialog.class, "OPT_attrTranslationTime"));
219: buttonGroup1.add(jRadioButton2);
220: gridBagConstraints = new java.awt.GridBagConstraints();
221: gridBagConstraints.gridx = 1;
222: gridBagConstraints.gridy = 4;
223: gridBagConstraints.gridwidth = 2;
224: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
225: gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 6);
226: add(jRadioButton2, gridBagConstraints);
227: jRadioButton2.getAccessibleContext().setAccessibleDescription(
228: java.util.ResourceBundle.getBundle(
229: "org/netbeans/modules/web/wizards/Bundle")
230: .getString("OPT_attrTranslationTime"));
231:
232: }//GEN-END:initComponents
233:
234: // Variables declaration - do not modify//GEN-BEGIN:variables
235: private javax.swing.ButtonGroup buttonGroup1;
236: private javax.swing.JCheckBox jCheckBox1;
237: private javax.swing.JComboBox jComboBox1;
238: private javax.swing.JLabel jLabel1;
239: private javax.swing.JLabel jLabel2;
240: private javax.swing.JPanel jPanel1;
241: private javax.swing.JRadioButton jRadioButton1;
242: private javax.swing.JRadioButton jRadioButton2;
243: private javax.swing.JTextField jTextField1;
244: // End of variables declaration//GEN-END:variables
245:
246: }
|