KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > editors > NameValuePairEditor


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 /*
20  * NameValuePairEditor.java
21  *
22  * Created on January 16, 2002, 6:25 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.ide.editors;
26
27 import java.util.ResourceBundle JavaDoc;
28 import org.netbeans.modules.j2ee.sun.ide.editors.ui.DDTableModelEditor;
29
30 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePair;
31
32 /**
33  *
34  * @author shirleyc
35  */

36 public class NameValuePairEditor extends javax.swing.JPanel JavaDoc implements DDTableModelEditor {
37
38     static final ResourceBundle JavaDoc bundle =
39         ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/editors/Bundle");
40     
41     /** Creates new form NameValuePairEditor */
42     public NameValuePairEditor() {
43         initComponents();
44         getAccessibleContext().setAccessibleName(bundle.getString("LBL_NameValuePairEditorName")); // NOI18N
45
getAccessibleContext().setAccessibleDescription(bundle.getString("LBL_NameValuePairEditorDescription")); // NOI18N
46
// org.openide.util.HelpCtx.setHelpIDString(this, "AS_RTT_NameValueEditor"); // NOI18N
47

48         nameField.getAccessibleContext().setAccessibleDescription(bundle.getString("colHdrParamName")); // NOI18N
49
valueField.getAccessibleContext().setAccessibleDescription(bundle.getString("colHdrParamValue")); // NOI18N
50
//descField.getAccessibleContext().setAccessibleDescription(bundle.getString("colHdrParamDescription")); // NOI18N
51
}
52
53     /** This method is called from within the constructor to
54      * initialize the form.
55      * WARNING: Do NOT modify this code. The content of this method is
56      * always regenerated by the Form Editor.
57      */

58     private void initComponents() {/*GEN-BEGIN:initComponents*/
59         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
60
61         iLabel1 = new javax.swing.JLabel JavaDoc();
62         nameField = new javax.swing.JTextField JavaDoc();
63         //iLabel2 = new javax.swing.JLabel();
64
//descField = new javax.swing.JTextField();
65
iLabel3 = new javax.swing.JLabel JavaDoc();
66         valueField = new javax.swing.JTextField JavaDoc();
67
68         setLayout(new java.awt.GridBagLayout JavaDoc());
69
70         iLabel1.setForeground(java.awt.Color.black);
71         iLabel1.setText(bundle.getString("colHdrParamName")); // NOI18N
72
iLabel1.setLabelFor(nameField);
73         iLabel1.setDisplayedMnemonic(bundle.getString("colHdrParamName_Mnemonic").charAt(0)); // NOI18N
74
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
75         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
76         add(iLabel1, gridBagConstraints);
77
78         nameField.setColumns(40);
79         nameField.setText("jTextField1"); // NOI18N
80
nameField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
81             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
82                 nameFieldActionPerformed(evt);
83             }
84         });
85
86         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
87         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
88         add(nameField, gridBagConstraints);
89
90         /*iLabel2.setForeground(java.awt.Color.black);
91         iLabel2.setText(bundle.getString("colHdrParamDescription")); // NOI18N
92         iLabel2.setLabelFor(descField);
93         iLabel2.setDisplayedMnemonic(bundle.getString("colHdrParamDescription_Mnemonic").charAt(0)); // NOI18N
94         gridBagConstraints = new java.awt.GridBagConstraints();
95         gridBagConstraints.gridx = 0;
96         gridBagConstraints.gridy = 1;
97         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
98         add(iLabel2, gridBagConstraints);
99
100         descField.setColumns(40);
101         descField.setText("jTextField2"); // NOI18N
102         descField.addActionListener(new java.awt.event.ActionListener() {
103             public void actionPerformed(java.awt.event.ActionEvent evt) {
104                 descFieldActionPerformed(evt);
105             }
106         });
107
108         gridBagConstraints = new java.awt.GridBagConstraints();
109         gridBagConstraints.gridx = 1;
110         gridBagConstraints.gridy = 1;
111         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
112         add(descField, gridBagConstraints);
113         */

114         
115         iLabel3.setForeground(java.awt.Color.black);
116         iLabel3.setText(bundle.getString("colHdrParamValue")); // NOI18N
117
iLabel3.setLabelFor(valueField);
118         iLabel3.setDisplayedMnemonic(bundle.getString("colHdrParamValue_Mnemonic").charAt(0)); // NOI18N
119
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
120         gridBagConstraints.gridx = 0;
121         //gridBagConstraints.gridy = 2;
122
gridBagConstraints.gridy = 1;
123         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
124         add(iLabel3, gridBagConstraints);
125
126         valueField.setColumns(40);
127         valueField.setText("jTextField3");// NOI18N
128
valueField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
129             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
130                 valueFieldActionPerformed(evt);
131             }
132         });
133
134         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
135         gridBagConstraints.gridx = 1;
136         //gridBagConstraints.gridy = 2;
137
gridBagConstraints.gridy = 1;
138         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
139         add(valueField, gridBagConstraints);
140
141     }/*GEN-END:initComponents*/
142
143     private void valueFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_valueFieldActionPerformed
144
// Add your handling code here:
145
}//GEN-LAST:event_valueFieldActionPerformed
146

147     private void nameFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_nameFieldActionPerformed
148
// Add your handling code here:
149
}//GEN-LAST:event_nameFieldActionPerformed
150

151     /*private void descFieldActionPerformed(java.awt.event.ActionEvent evt) {
152         // Add your handling code here:
153     } */

154     
155     public javax.swing.JPanel JavaDoc getPanel() {
156         return this;
157     }
158     
159     public java.lang.Object JavaDoc getValue() {
160         NameValuePair retVal = new NameValuePair();
161         retVal.setParamName((String JavaDoc)nameField.getText());
162         //retVal.setParamDescription((String)descField.getText());
163
retVal.setParamValue((String JavaDoc)valueField.getText());
164         return retVal;
165     }
166
167     public void setValue(java.lang.Object JavaDoc obj) {
168         NameValuePair inVal;
169         try {
170             inVal = (NameValuePair) obj;
171             nameField.setText(inVal.getParamName());
172             //descField.setText(inVal.getParamDescription());
173
valueField.setText(inVal.getParamValue());
174         }catch (ClassCastException JavaDoc cce) {
175         }
176     }
177    
178     //private javax.swing.JTextField descField;
179
private javax.swing.JLabel JavaDoc iLabel3;
180     // Variables declaration - do not modify//GEN-BEGIN:variables
181
private javax.swing.JTextField JavaDoc nameField;
182     private javax.swing.JTextField JavaDoc valueField;
183     private javax.swing.JLabel JavaDoc iLabel2;
184     private javax.swing.JLabel JavaDoc iLabel1;
185     // End of variables declaration//GEN-END:variables
186

187 }
188
Popular Tags