KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > db > sql > visualeditor > querybuilder > AddQueryParameterDlg


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.db.sql.visualeditor.querybuilder;
20
21 import java.awt.Dialog JavaDoc;
22 import java.awt.event.ActionListener JavaDoc;
23 import java.awt.event.ActionEvent JavaDoc;
24 import java.awt.Dimension JavaDoc;
25
26 import javax.swing.JTextArea JavaDoc;
27 import javax.swing.JTextField JavaDoc;
28 import javax.swing.JRadioButton JavaDoc;
29 import javax.swing.JComboBox JavaDoc;
30 import javax.swing.JLabel JavaDoc;
31 import javax.swing.ButtonGroup JavaDoc;
32 import javax.swing.JPanel JavaDoc;
33 import javax.swing.border.EtchedBorder JavaDoc;
34
35 import org.openide.util.NbBundle;
36 import org.openide.util.HelpCtx ;
37 import org.openide.NotifyDescriptor;
38 import org.openide.DialogDisplayer;
39 import org.openide.DialogDescriptor;
40
41 /**
42  *
43  * @author jhoff, Sanjay Dhamankar
44  */

45 public class AddQueryParameterDlg extends JPanel JavaDoc {
46
47     // Variables
48

49     /** A return status code - returned if Cancel button has been pressed */
50     public static final int RET_CANCEL = 0;
51
52     /** A return status code - returned if OK button has been pressed */
53     public static final int RET_OK = 1;
54
55     private String JavaDoc _columnName = "<Column Name>"; // NOI18N
56

57     private Dialog JavaDoc dialog;
58     private final int WIDTH = 400;
59     private final int HEIGHT = 280;
60
61
62     // Constructors
63

64     /**
65      * Default constructor
66      */

67     public AddQueryParameterDlg() {
68         this(true, "<Column Name>"); // NOI18N
69
}
70
71 // /** Creates new form AddQueryParameterDlg */
72
// public AddQueryParameterDlg(boolean modal) {
73
// this(modal, "<Column Name>");
74
// }
75

76     /** Creates new form AddQueryParameterDlg */
77     public AddQueryParameterDlg(boolean modal, String JavaDoc columnName) {
78
79         initComponents();
80         // try to make it so that the default information in the field is pre-selected so that the user
81
// can simply type over it without having to select it.
82
valueTxtField.setSelectionEnd(valueTxtField.getText().length());
83         parmTxtField.setSelectionStart(0);
84         parmTxtField.setSelectionEnd(parmTxtField.getText().length());
85
86         ActionListener JavaDoc listener = new ActionListener JavaDoc () {
87
88                 public void actionPerformed (ActionEvent JavaDoc evt) {
89                     Object JavaDoc o = evt.getSource();
90                     if (o == NotifyDescriptor.CANCEL_OPTION) {
91                         returnStatus = RET_CANCEL;
92                     } else if (o == NotifyDescriptor.OK_OPTION) {
93                         // do something useful
94
returnStatus = RET_OK;
95                     } // else if HELP ...
96
}
97             };
98
99         // Note - we may want to use the version that also has help (check with Jeff)
100
DialogDescriptor dlg =
101             new DialogDescriptor(this,
102                     NbBundle.getMessage(AddQueryParameterDlg.class,
103                                  "ADD_QUERY_CRITERIA_TITLE"), // NOI18N
104
modal, listener);
105
106         dlg.setHelpCtx (
107             new HelpCtx( "projrave_ui_elements_dialogs_add_query_criteria" ) ); // NOI18N
108

109         setColumnName(columnName);
110         dialog = DialogDisplayer.getDefault().createDialog(dlg);
111         dialog.setVisible(true);
112     }
113
114     public void setColumnName (String JavaDoc columnName) {
115         _columnName = columnName;
116         dispColumnNameLbl.setText(_columnName);
117     }
118
119     public String JavaDoc getCriteria () {
120
121         StringBuffer JavaDoc criteriaStringBuffer = new StringBuffer JavaDoc ();
122
123         String JavaDoc comboBoxString = (String JavaDoc) comparisonComboBox.getSelectedItem();
124
125         if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "EQUALS") ) ) { // NOI18N
126
criteriaStringBuffer.append ("="); // NOI18N
127
}
128         else if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "LESS_THAN") ) ) { // NOI18N
129
criteriaStringBuffer.append ("<"); // NOI18N
130
}
131         else if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "LESS_THAN_EQUALS") ) ) { // NOI18N
132
criteriaStringBuffer.append ("<="); // NOI18N
133
}
134         else if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "GREATER_THAN") ) ) { // NOI18N
135
criteriaStringBuffer.append (">"); // NOI18N
136
}
137         else if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "GREATER_THAN_EQUALS") ) ) { // NOI18N
138
criteriaStringBuffer.append (">="); // NOI18N
139
}
140         else if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "NOT_EQUALS") ) ) { // NOI18N
141
criteriaStringBuffer.append ("<>"); // NOI18N
142
}
143         else if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "LIKE") ) ) { // NOI18N
144
criteriaStringBuffer.append ("LIKE"); // NOI18N
145
}
146         else if (comboBoxString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "IN") ) ) { // NOI18N
147
criteriaStringBuffer.append ("IN"); // NOI18N
148
}
149         // Get operator plus trailing blank
150
criteriaStringBuffer.append (" "); // NOI18N
151

152         // Append criterion value or parameter
153
if ( parmRadioBtn.isSelected() ) {
154             criteriaStringBuffer.append ((String JavaDoc) parmTxtField.getText());
155         } else if ( valueRadioBtn.isSelected() )
156             criteriaStringBuffer.append ((String JavaDoc) valueTxtField.getText());
157
158         /* Ask Jeff how to handle this ?
159            criteriaStringBuffer.append ((String) defaultValTxtField.getText());
160         */

161
162         return ( criteriaStringBuffer.toString() );
163     }
164     
165     
166     /** @return the return status of this dialog - one of RET_OK or RET_CANCEL */
167     public int getReturnStatus() {
168         return returnStatus;
169     }
170     
171     private void updateLabel ( String JavaDoc comparisonString ) {
172         /*
173         // "= Equals",
174         if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "EQUALS") ) ) { // NOI18N
175             columnNameHintLbl.setText (
176                 NbBundle.getMessage(AddQueryParameterDlg.class,
177                     "HINT_EQUALS") ); // NOI18N
178         }
179         // "< Less Than",
180         else if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "LESS_THAN") ) ) { // NOI18N
181             columnNameHintLbl.setText (
182                 NbBundle.getMessage(AddQueryParameterDlg.class,
183                     "HINT_LESS_THAN") ); // NOI18N
184         }
185         // "<= Less Than Equals",
186         else if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "LESS_THAN_EQUALS") ) ) { // NOI18N
187             columnNameHintLbl.setText (
188                 NbBundle.getMessage(AddQueryParameterDlg.class,
189                     "HINT_LESS_THAN_EQUALS") ); // NOI18N
190         }
191         // "> Greater Than",
192         else if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "GREATER_THAN") ) ) { // NOI18N
193             columnNameHintLbl.setText (
194                 NbBundle.getMessage(AddQueryParameterDlg.class,
195                     "HINT_GREATER_THAN") ); // NOI18N
196         }
197         // ">= Greater Than Equals"
198         else if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "GREATER_THAN_EQUALS") ) ) { // NOI18N
199             columnNameHintLbl.setText (
200                 NbBundle.getMessage(AddQueryParameterDlg.class,
201                     "HINT_GREATER_THAN_EQUALS") ); // NOI18N
202         }
203         // "<> Not Equals"
204         else if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "NOT_EQUALS") ) ) { // NOI18N
205             columnNameHintLbl.setText (
206                 NbBundle.getMessage(AddQueryParameterDlg.class,
207                     "HINT_NOT_EQUALS") ); // NOI18N
208         }
209         // "LIKE"
210         else
211             */

212             
213         if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "LIKE") ) ) { // NOI18N
214
comparisonHintLbl.setText (
215                 NbBundle.getMessage(AddQueryParameterDlg.class,
216                     "HINT_LIKE") ); // NOI18N
217
}
218         // "IN"
219
else if (comparisonString.equals (NbBundle.getMessage(AddQueryParameterDlg.class, "IN") ) ) { // NOI18N
220
comparisonHintLbl.setText (
221                 NbBundle.getMessage(AddQueryParameterDlg.class,
222                     "HINT_IN") ); // NOI18N
223
}
224         else {
225             comparisonHintLbl.setText ( " " ); // NOI18N
226
}
227
228     }
229
230     /** This method is called from within the constructor to
231      * initialize the form.
232      * WARNING: Do NOT modify this code. The content of this method is
233      * always regenerated by the Form Editor.
234      */

235     private void initComponents() {//GEN-BEGIN:initComponents
236
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
237
238         buttonGroup1 = new ButtonGroup JavaDoc();
239         mainPanel = new JPanel JavaDoc();
240         columnNameLbl = new JLabel JavaDoc();
241         dispColumnNameLbl = new JLabel JavaDoc();
242         comparisonLbl = new JLabel JavaDoc();
243         comparisonHintLbl = new JLabel JavaDoc();
244         comparisonComboBox = new JComboBox JavaDoc();
245         radioButtonPanel = new JPanel JavaDoc();
246         valueRadioBtn = new JRadioButton JavaDoc();
247         parmRadioBtn = new JRadioButton JavaDoc();
248         valueTxtField = new JTextField JavaDoc();
249         valueTxtFieldLbl = new JLabel JavaDoc();
250         parmTxtField = new JTextField JavaDoc();
251         parmTxtFieldLbl = new JLabel JavaDoc();
252         
253 // Default are disabled until we restore parameterized execution, which requires ParameterMetaData
254
// defaultValTxtField = new JTextField();
255
// defaultValueLbl = new JLabel();
256
fillerLbl = new JLabel JavaDoc();
257        
258         setLayout(new java.awt.GridBagLayout JavaDoc());
259
260         mainPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
261
262         getAccessibleContext().setAccessibleName(
263             NbBundle.getMessage(AddQueryParameterDlg.class, "ADD_QUERY_CRITERIA_a11yName"));
264         getAccessibleContext().setAccessibleDescription(
265             NbBundle.getMessage(AddQueryParameterDlg.class, "ADD_QUERY_CRITERIA_a11yDescription"));
266
267         // do we need to make it a11y compliant ?
268
instructions = new JTextArea JavaDoc(
269             NbBundle.getMessage(AddQueryParameterDlg.class, "QUERY_INSTRUCTIONS") ); // NOI18N
270
instructions.setLineWrap(true);
271         instructions.setWrapStyleWord(true);
272         instructions.setEditable(false);
273         instructions.setBorder(new EtchedBorder JavaDoc(EtchedBorder.LOWERED));
274         instructions.setFocusable(false);
275         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
276 // gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
277
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
278 // gridBagConstraints.gridx = 0;
279
// gridBagConstraints.gridy = 0;
280
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
281         gridBagConstraints.weightx = 1.0;
282         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 10, 0);
283         mainPanel.add(instructions, gridBagConstraints);
284
285         columnNameLbl.setText (
286             NbBundle.getMessage(AddQueryParameterDlg.class, "COLUMN_NAME") ); // NOI18N
287
columnNameLbl.getAccessibleContext().setAccessibleDescription(
288             NbBundle.getMessage(AddQueryParameterDlg.class, "COLUMN_NAME_a11yDescription"));
289         columnNameLbl.setDisplayedMnemonic(NbBundle.getMessage(AddQueryParameterDlg.class, "COLUMN_NAME_Mnemonic").charAt(0));
290
291         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
292         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
293         gridBagConstraints.gridx = 0;
294         gridBagConstraints.gridy = 1;
295         mainPanel.add(columnNameLbl, gridBagConstraints);
296
297 // dispColumnNameLbl.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
298
// No a11y ?
299
dispColumnNameLbl.setText(_columnName);
300         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
301         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 10, 0, 0);
302         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
303         gridBagConstraints.weightx = 1.0;
304         gridBagConstraints.gridx = 1;
305         gridBagConstraints.gridy = 1;
306         mainPanel.add(dispColumnNameLbl, gridBagConstraints);
307
308         comparisonLbl.setLabelFor(comparisonComboBox);
309         comparisonLbl.setText(
310             NbBundle.getMessage(AddQueryParameterDlg.class, "COMPARISON") ); // NOI18N
311
comparisonLbl.getAccessibleContext().setAccessibleDescription(
312             NbBundle.getMessage(AddQueryParameterDlg.class, "COMPARISON_a11yDescription"));
313         comparisonLbl.setDisplayedMnemonic(NbBundle.getMessage(AddQueryParameterDlg.class, "COMPARISON_Mnemonic").charAt(0));
314
315         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
316         gridBagConstraints.gridx = 0;
317         gridBagConstraints.gridy = 2;
318         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
319         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
320         mainPanel.add(comparisonLbl, gridBagConstraints);
321
322         comparisonComboBox.addActionListener (
323                 new java.awt.event.ActionListener JavaDoc() {
324                   public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
325                     JComboBox JavaDoc cb = (JComboBox JavaDoc)evt.getSource();
326                     String JavaDoc comparisonString = (String JavaDoc)cb.getSelectedItem();
327                     updateLabel(comparisonString);
328                 }
329             });
330
331         comparisonComboBox.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(AddQueryParameterDlg.class, "COMPARISON_a11yDescription"));
332
333         comparisonComboBox.setModel(
334             new javax.swing.DefaultComboBoxModel JavaDoc(
335                 new String JavaDoc[] {
336                 // "= Equals",
337
NbBundle.getMessage(AddQueryParameterDlg.class, "EQUALS"), // NOI18N
338
// "< Less Than",
339
NbBundle.getMessage(AddQueryParameterDlg.class, "LESS_THAN"), // NOI18N
340
// "<= Less Than Equals",
341
NbBundle.getMessage(AddQueryParameterDlg.class, "LESS_THAN_EQUALS"), // NOI18N
342
// "> Greater Than",
343
NbBundle.getMessage(AddQueryParameterDlg.class, "GREATER_THAN"), // NOI18N
344
// ">= Greater Than Equals"
345
NbBundle.getMessage(AddQueryParameterDlg.class, "GREATER_THAN_EQUALS"), // NOI18N
346
// "<> Not Equals"
347
NbBundle.getMessage(AddQueryParameterDlg.class, "NOT_EQUALS"), // NOI18N
348
// "LIKE"
349
NbBundle.getMessage(AddQueryParameterDlg.class, "LIKE"), // NOI18N
350
// "IN"
351
NbBundle.getMessage(AddQueryParameterDlg.class, "IN"), // NOI18N
352
}));
353         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
354         gridBagConstraints.gridx = 1;
355         gridBagConstraints.gridy = 2;
356         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 10, 0, 0);
357         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
358         gridBagConstraints.weightx = 1.0;
359         mainPanel.add(comparisonComboBox, gridBagConstraints);
360
361         radioButtonPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
362
363         valueRadioBtn.setSelected(true);
364         valueRadioBtn.setMnemonic (NbBundle.getMessage(AddQueryParameterDlg.class, "VALUE_Mnemonic").charAt(0));
365         valueRadioBtn.getAccessibleContext().setAccessibleDescription(
366             NbBundle.getMessage(AddQueryParameterDlg.class, "VALUE_RADIO_BUTTON_a11yDescription"));
367         valueRadioBtn.setText(
368             NbBundle.getMessage(AddQueryParameterDlg.class, "VALUE") ); // NOI18N
369
buttonGroup1.add(valueRadioBtn);
370         valueRadioBtn.addActionListener(new java.awt.event.ActionListener JavaDoc() {
371                 public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
372                     valueRadioBtnActionPerformed(evt);
373                 }
374             });
375
376         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
377         gridBagConstraints.gridwidth = 2;
378         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
379         radioButtonPanel.add(valueRadioBtn, gridBagConstraints);
380
381         parmRadioBtn.setMnemonic (NbBundle.getMessage(AddQueryParameterDlg.class, "PARAMETER_Mnemonic").charAt(0));
382         parmRadioBtn.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(AddQueryParameterDlg.class, "PARAMETER_RADIO_BUTTON_a11yDescription"));
383         parmRadioBtn.setText(
384             NbBundle.getMessage(AddQueryParameterDlg.class, "PARAMETER") ); // NOI18N
385
buttonGroup1.add(parmRadioBtn);
386         parmRadioBtn.addActionListener(new java.awt.event.ActionListener JavaDoc() {
387                 public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
388                     parmRadioBtnActionPerformed(evt);
389                 }
390             });
391
392         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
393         gridBagConstraints.gridx = 0;
394         gridBagConstraints.gridy = 2;
395         gridBagConstraints.gridwidth = 2;
396         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
397         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
398         radioButtonPanel.add(parmRadioBtn, gridBagConstraints);
399
400         valueTxtField.setHorizontalAlignment(JTextField.TRAILING);
401         valueTxtField.setText("0"); // NOI18N
402
valueTxtField.getAccessibleContext().setAccessibleName(
403             NbBundle.getMessage(AddQueryParameterDlg.class, "VALUE_a11yName"));
404         valueTxtField.getAccessibleContext().setAccessibleDescription(
405             NbBundle.getMessage(AddQueryParameterDlg.class, "VALUE_a11yDescription"));
406         valueTxtFieldLbl.setText(
407             NbBundle.getMessage(AddQueryParameterDlg.class, "VALUE_label"));
408         valueTxtFieldLbl.setLabelFor(valueTxtField);
409         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
410         gridBagConstraints.gridx = 2;
411         gridBagConstraints.gridy = 0;
412         gridBagConstraints.gridwidth = 2;
413         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
414         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 10, 0, 0);
415         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
416         gridBagConstraints.weightx = 1.0;
417         radioButtonPanel.add(valueTxtField, gridBagConstraints);
418
419         comparisonHintLbl.setHorizontalAlignment(JTextField.LEADING);
420         comparisonHintLbl.setText(" "); // NOI18N
421
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
422         gridBagConstraints.gridx = 2;
423         gridBagConstraints.gridy = 1;
424         gridBagConstraints.gridwidth = 2;
425         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
426         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 10, 0, 0);
427         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
428         gridBagConstraints.weightx = 1.0;
429         radioButtonPanel.add(comparisonHintLbl, gridBagConstraints);
430
431         parmTxtField.setText("?"); // NOI18N
432
parmTxtField.getAccessibleContext().setAccessibleName(
433             NbBundle.getMessage(AddQueryParameterDlg.class, "PARAMETER_a11yName"));
434         parmTxtField.getAccessibleContext().setAccessibleDescription(
435             NbBundle.getMessage(AddQueryParameterDlg.class, "PARAMETER_a11yDescription"));
436         parmTxtFieldLbl.setText(
437             NbBundle.getMessage(AddQueryParameterDlg.class, "PARAMETER_label"));
438         parmTxtFieldLbl.setLabelFor(parmTxtField);
439         // what happens if the criteria is like "IN ( ?, ? )" ?
440
// parmTxtField.setEnabled(false);
441
// Per JDBC restrictions, parameter markers must be "?", so disable editing
442
// parmTxtField.setEditable(false);
443
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
444         gridBagConstraints.gridx = 2;
445         gridBagConstraints.gridy = 2;
446         gridBagConstraints.gridwidth = 2;
447         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
448         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 10, 0, 0);
449         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
450         gridBagConstraints.weightx = 1.0;
451         radioButtonPanel.add(parmTxtField, gridBagConstraints);
452
453 // defaultValTxtField.setText(" ");
454
// defaultValTxtField.setEnabled(false);
455
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
456         gridBagConstraints.gridx = 3;
457         gridBagConstraints.gridy = 3;
458         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
459         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 10, 0, 0);
460         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
461         gridBagConstraints.weightx = 1.0;
462 // radioButtonPanel.add(defaultValTxtField, gridBagConstraints);
463

464 // defaultValueLbl.setText("Default Value");
465
// defaultValueLbl.setEnabled(false);
466
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
467         gridBagConstraints.gridx = 1;
468         gridBagConstraints.gridy = 2;
469         gridBagConstraints.gridwidth = 2;
470         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
471         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
472 // radioButtonPanel.add(defaultValueLbl, gridBagConstraints);
473

474         fillerLbl.setText(" "); // NOI18N
475
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
476         gridBagConstraints.gridx = 0;
477         gridBagConstraints.gridy = 3;
478         gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
479         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
480         gridBagConstraints.weighty = 1.0;
481         radioButtonPanel.add(fillerLbl, gridBagConstraints);
482
483         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
484         gridBagConstraints.gridx = 0;
485         gridBagConstraints.gridy = 4;
486         gridBagConstraints.gridwidth = 2;
487         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
488         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
489         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
490         gridBagConstraints.weightx = 1.0;
491         gridBagConstraints.weighty = 1.0;
492         mainPanel.add(radioButtonPanel, gridBagConstraints);
493
494         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
495         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
496         gridBagConstraints.insets = new java.awt.Insets JavaDoc(10, 10, 0, 10);
497         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
498         gridBagConstraints.weightx = 1.0;
499         gridBagConstraints.weighty = 1.0;
500         mainPanel.setPreferredSize(new Dimension JavaDoc(WIDTH, HEIGHT)); // needed to get good initial size
501

502         add(mainPanel, gridBagConstraints);
503     }//GEN-END:initComponents
504

505
506     private void parmRadioBtnActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_parmRadioBtnActionPerformed
507
// Add your handling code here:
508
enableDlgControls();
509     }//GEN-LAST:event_parmRadioBtnActionPerformed
510

511
512     private void valueRadioBtnActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_valueRadioBtnActionPerformed
513
// Add your handling code here:
514
enableDlgControls();
515     }//GEN-LAST:event_valueRadioBtnActionPerformed
516

517
518     private void enableDlgControls() {
519         boolean parmSelected = parmRadioBtn.isSelected();
520         parmTxtField.setEnabled(parmSelected);
521         parmTxtField.repaint();
522 // defaultValTxtField.enable(parmSelected);
523
// defaultValueLbl.enable(parmSelected);
524
// defaultValueLbl.repaint();
525
valueTxtField.setEnabled(!parmSelected);
526         valueTxtField.repaint();
527     }
528     
529     // Variables declaration - do not modify//GEN-BEGIN:variables
530
private ButtonGroup JavaDoc buttonGroup1;
531     private JLabel JavaDoc columnNameLbl;
532     private JComboBox JavaDoc comparisonComboBox;
533     private JLabel JavaDoc comparisonLbl;
534     private JLabel JavaDoc comparisonHintLbl;
535 // private JTextField defaultValTxtField;
536
// private JLabel defaultValueLbl;
537
private JLabel JavaDoc dispColumnNameLbl;
538     private JLabel JavaDoc fillerLbl;
539     private JPanel JavaDoc mainPanel;
540     private JRadioButton JavaDoc parmRadioBtn;
541     private JPanel JavaDoc radioButtonPanel;
542     private JRadioButton JavaDoc valueRadioBtn;
543     private JTextField JavaDoc valueTxtField;
544     private JLabel JavaDoc valueTxtFieldLbl;
545     private JTextField JavaDoc parmTxtField;
546     private JLabel JavaDoc parmTxtFieldLbl;
547
548     private JTextArea JavaDoc instructions;
549
550     // End of variables declaration//GEN-END:variables
551

552     private int returnStatus = RET_CANCEL;
553 }
554
Popular Tags