KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > struts > dialogs > AddExceptionDialogPanel


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 package org.netbeans.modules.web.struts.dialogs;
21
22 import java.util.Iterator JavaDoc;
23 import java.util.List JavaDoc;
24 import javax.swing.DefaultComboBoxModel JavaDoc;
25 import javax.swing.SwingUtilities JavaDoc;
26 import javax.swing.text.JTextComponent JavaDoc;
27 //import org.netbeans.modules.j2ee.common.FQNSearch;
28
import org.netbeans.modules.web.struts.StrutsConfigDataObject;
29 import org.netbeans.modules.web.struts.StrutsConfigUtilities;
30 import org.netbeans.modules.web.struts.config.model.Action;
31 import org.netbeans.modules.web.struts.config.model.MessageResources;
32 import org.openide.util.NbBundle;
33
34 /**
35  *
36  * @author radko
37  */

38 public class AddExceptionDialogPanel extends javax.swing.JPanel JavaDoc implements ValidatingPanel {
39     private static final String JavaDoc DEFAULT_BUNDLE_KEY="org.apache.struts.Globals.MESSAGES_KEY"; //NOI18N
40
StrutsConfigDataObject config;
41     /** Creates new form AddForwardDialog */
42     public AddExceptionDialogPanel(StrutsConfigDataObject config, String JavaDoc targetActionPath) {
43         this.config=config;
44         initComponents();
45         List JavaDoc actions = StrutsConfigUtilities.getAllActionsInModule(config);
46         DefaultComboBoxModel JavaDoc model = (DefaultComboBoxModel JavaDoc)jComboBoxCallAction.getModel();
47         DefaultComboBoxModel JavaDoc model1 = (DefaultComboBoxModel JavaDoc)jComboBoxActionExc.getModel();
48         Iterator JavaDoc iter = actions.iterator();
49         while (iter.hasNext()) {
50             String JavaDoc actionPath=((Action)iter.next()).getAttributeValue("path"); //NOI18N
51
model.addElement(actionPath);
52             model1.addElement(actionPath);
53         }
54         List JavaDoc messageResources = StrutsConfigUtilities.getAllMessageResourcesInModule(config);
55         model = (DefaultComboBoxModel JavaDoc)jComboBoxBundleKey.getModel();
56         iter = messageResources.iterator();
57         while (iter.hasNext()) {
58             String JavaDoc key=((MessageResources)iter.next()).getAttributeValue("key"); //NOI18N
59
model.addElement(key==null?DEFAULT_BUNDLE_KEY:key); //NOI18N
60
}
61         if (targetActionPath != null) {
62             jRadioButtonActionExc.setSelected(true);
63             jComboBoxActionExc.setSelectedItem(targetActionPath);
64         }
65     }
66     
67     public AddExceptionDialogPanel(StrutsConfigDataObject config) {
68         this(config, null);
69     }
70
71     public javax.swing.AbstractButton JavaDoc[] getStateChangeComponents() {
72         return new javax.swing.AbstractButton JavaDoc[]{jRadioButtonResFile, jRadioButtonGlobalExc};
73     }
74
75     public JTextComponent JavaDoc[] getDocumentChangeComponents() {
76         return new JTextComponent JavaDoc[]{jTextFieldExcKey, jTextFieldResFile, (JTextComponent JavaDoc)jComboBoxExcType.getEditor().getEditorComponent()};
77     }
78
79     public String JavaDoc validatePanel() {
80         if (getExceptionKey().length()==0)
81             return NbBundle.getMessage(AddExceptionDialogPanel.class,"MSG_EmptyExcKey");
82         if (getExceptionType().length()==0)
83             return NbBundle.getMessage(AddExceptionDialogPanel.class,"MSG_EmptyExcType");
84         if (jRadioButtonResFile.isSelected()) {
85             String JavaDoc resourceFile = jTextFieldResFile.getText().trim();
86             if (resourceFile.length()==0 || resourceFile.equals("/")) //NOI18N
87
return NbBundle.getMessage(AddExceptionDialogPanel.class,"MSG_EmptyResourceFile");
88         } else if (jComboBoxCallAction.getSelectedItem()==null) {
89             return NbBundle.getMessage(AddExceptionDialogPanel.class,"MSG_EmptyAction");
90         }
91         if (!jRadioButtonGlobalExc.isSelected() && jComboBoxActionExc.getSelectedItem()==null) {
92             return NbBundle.getMessage(AddExceptionDialogPanel.class,"MSG_EmptyAction");
93         }
94         return null;
95     }
96     
97     /** This method is called from within the constructor to
98      * initialize the form.
99      * WARNING: Do NOT modify this code. The content of this method is
100      * always regenerated by the Form Editor.
101      */

102     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
103
private void initComponents() {
104         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
105
106         buttonGroup1 = new javax.swing.ButtonGroup JavaDoc();
107         buttonGroup2 = new javax.swing.ButtonGroup JavaDoc();
108         buttonGroup3 = new javax.swing.ButtonGroup JavaDoc();
109         jLabelBundleKey = new javax.swing.JLabel JavaDoc();
110         jComboBoxBundleKey = new javax.swing.JComboBox JavaDoc();
111         jLabelExcKey = new javax.swing.JLabel JavaDoc();
112         jComboBoxExcType = new javax.swing.JComboBox JavaDoc();
113         jLabelExcType = new javax.swing.JLabel JavaDoc();
114         jTextFieldExcKey = new javax.swing.JTextField JavaDoc();
115         jButtonExcType = new javax.swing.JButton JavaDoc();
116         jLabelCall = new javax.swing.JLabel JavaDoc();
117         jRadioButtonResFile = new javax.swing.JRadioButton JavaDoc();
118         jTextFieldResFile = new javax.swing.JTextField JavaDoc();
119         jButtonBrowse = new javax.swing.JButton JavaDoc();
120         jRadioButtonCallAction = new javax.swing.JRadioButton JavaDoc();
121         jComboBoxCallAction = new javax.swing.JComboBox JavaDoc();
122         jLabelScope = new javax.swing.JLabel JavaDoc();
123         jLabelLocation = new javax.swing.JLabel JavaDoc();
124         jRadioButtonGlobalExc = new javax.swing.JRadioButton JavaDoc();
125         jRadioButtonActionExc = new javax.swing.JRadioButton JavaDoc();
126         jComboBoxActionExc = new javax.swing.JComboBox JavaDoc();
127         jPanel1 = new javax.swing.JPanel JavaDoc();
128         jRadioButtonSession = new javax.swing.JRadioButton JavaDoc();
129         jRadioButtonRequest = new javax.swing.JRadioButton JavaDoc();
130
131         setBorder(javax.swing.BorderFactory.createEmptyBorder(12, 12, 11, 11));
132         setLayout(new java.awt.GridBagLayout JavaDoc());
133
134         jLabelBundleKey.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_BundleKey").charAt(0));
135         jLabelBundleKey.setLabelFor(jComboBoxBundleKey);
136         jLabelBundleKey.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_Bundle Key")); // NOI18N
137
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
138         gridBagConstraints.gridx = 0;
139         gridBagConstraints.gridy = 0;
140         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
141         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 12);
142         add(jLabelBundleKey, gridBagConstraints);
143
144         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
145         gridBagConstraints.gridx = 1;
146         gridBagConstraints.gridy = 0;
147         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
148         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
149         add(jComboBoxBundleKey, gridBagConstraints);
150         java.util.ResourceBundle JavaDoc bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/dialogs/Bundle"); // NOI18N
151
jComboBoxBundleKey.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jComboBoxBundleKey")); // NOI18N
152

153         jLabelExcKey.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_ExcKey").charAt(0));
154         jLabelExcKey.setLabelFor(jTextFieldExcKey);
155         jLabelExcKey.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_ExcKey")); // NOI18N
156
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
157         gridBagConstraints.gridx = 0;
158         gridBagConstraints.gridy = 1;
159         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
160         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 12);
161         add(jLabelExcKey, gridBagConstraints);
162
163         jComboBoxExcType.setEditable(true);
164         jComboBoxExcType.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "java.lang.NumberFormatException", "java.lang.NullPointerException", "java.lang.ArrayIndexOutOfBoundsException", "java.lang.StringIndexOutOfBoundsException", "java.lang.RuntimeException", "java.lang.Exception" }));
165         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
166         gridBagConstraints.gridx = 1;
167         gridBagConstraints.gridy = 2;
168         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
169         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 10, 0);
170         add(jComboBoxExcType, gridBagConstraints);
171         jComboBoxExcType.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jComboBoxExcType")); // NOI18N
172

173         jLabelExcType.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_ExcType").charAt(0));
174         jLabelExcType.setLabelFor(jComboBoxExcType);
175         jLabelExcType.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_ExcType")); // NOI18N
176
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
177         gridBagConstraints.gridx = 0;
178         gridBagConstraints.gridy = 2;
179         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
180         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 10, 12);
181         add(jLabelExcType, gridBagConstraints);
182
183         jTextFieldExcKey.setColumns(30);
184         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
185         gridBagConstraints.gridx = 1;
186         gridBagConstraints.gridy = 1;
187         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
188         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
189         add(jTextFieldExcKey, gridBagConstraints);
190         jTextFieldExcKey.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jTextFieldExcKey")); // NOI18N
191

192         jButtonExcType.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddFwdDialog_Browse").charAt(0));
193         jButtonExcType.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_BrowseButton")); // NOI18N
194
jButtonExcType.setEnabled(false);
195         jButtonExcType.addActionListener(new java.awt.event.ActionListener JavaDoc() {
196             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
197                 jButtonExcTypeActionPerformed(evt);
198             }
199         });
200         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
201         gridBagConstraints.gridx = 2;
202         gridBagConstraints.gridy = 2;
203         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
204         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 0);
205         add(jButtonExcType, gridBagConstraints);
206         jButtonExcType.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jButtonExcType")); // NOI18N
207

208         jLabelCall.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_Call")); // NOI18N
209
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
210         gridBagConstraints.gridx = 0;
211         gridBagConstraints.gridy = 3;
212         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
213         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
214         add(jLabelCall, gridBagConstraints);
215
216         buttonGroup1.add(jRadioButtonResFile);
217         jRadioButtonResFile.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddFwdDialog_ResFile").charAt(0));
218         jRadioButtonResFile.setSelected(true);
219         jRadioButtonResFile.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "RB_ResourceFile")); // NOI18N
220
jRadioButtonResFile.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
221         jRadioButtonResFile.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
222         jRadioButtonResFile.addItemListener(new java.awt.event.ItemListener JavaDoc() {
223             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
224                 jRadioButtonResFileItemStateChanged(evt);
225             }
226         });
227         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
228         gridBagConstraints.gridx = 0;
229         gridBagConstraints.gridy = 4;
230         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
231         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 12);
232         add(jRadioButtonResFile, gridBagConstraints);
233         jRadioButtonResFile.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonResFile")); // NOI18N
234

235         jTextFieldResFile.setColumns(30);
236         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
237         gridBagConstraints.gridx = 1;
238         gridBagConstraints.gridy = 4;
239         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
240         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
241         add(jTextFieldResFile, gridBagConstraints);
242         jTextFieldResFile.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_jTextFieldResFile")); // NOI18N
243
jTextFieldResFile.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jTextFieldResFile")); // NOI18N
244

245         jButtonBrowse.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_ResFileBrowse").charAt(0));
246         jButtonBrowse.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_BrowseButton")); // NOI18N
247
jButtonBrowse.addActionListener(new java.awt.event.ActionListener JavaDoc() {
248             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
249                 jButtonBrowseActionPerformed(evt);
250             }
251         });
252         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
253         gridBagConstraints.gridx = 2;
254         gridBagConstraints.gridy = 4;
255         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
256         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 0);
257         add(jButtonBrowse, gridBagConstraints);
258         jButtonBrowse.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jButtonBrowse")); // NOI18N
259

260         buttonGroup1.add(jRadioButtonCallAction);
261         jRadioButtonCallAction.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddFwdDialog_FwdAction").charAt(0));
262         jRadioButtonCallAction.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "RB_Action")); // NOI18N
263
jRadioButtonCallAction.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
264         jRadioButtonCallAction.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
265         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
266         gridBagConstraints.gridx = 0;
267         gridBagConstraints.gridy = 5;
268         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
269         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 10, 12);
270         add(jRadioButtonCallAction, gridBagConstraints);
271         jRadioButtonCallAction.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonCallAction")); // NOI18N
272

273         jComboBoxCallAction.setEnabled(false);
274         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
275         gridBagConstraints.gridx = 1;
276         gridBagConstraints.gridy = 5;
277         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
278         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 10, 0);
279         add(jComboBoxCallAction, gridBagConstraints);
280         jComboBoxCallAction.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jComboBoxCallAction")); // NOI18N
281

282         jLabelScope.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_Scope")); // NOI18N
283
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
284         gridBagConstraints.gridx = 0;
285         gridBagConstraints.gridy = 6;
286         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
287         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 10, 0);
288         add(jLabelScope, gridBagConstraints);
289
290         jLabelLocation.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddFwdDialog_Location")); // NOI18N
291
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
292         gridBagConstraints.gridx = 0;
293         gridBagConstraints.gridy = 7;
294         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
295         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
296         add(jLabelLocation, gridBagConstraints);
297
298         buttonGroup3.add(jRadioButtonGlobalExc);
299         jRadioButtonGlobalExc.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_GlobalExc").charAt(0));
300         jRadioButtonGlobalExc.setSelected(true);
301         jRadioButtonGlobalExc.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_GlobalExc")); // NOI18N
302
jRadioButtonGlobalExc.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
303         jRadioButtonGlobalExc.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
304         jRadioButtonGlobalExc.addItemListener(new java.awt.event.ItemListener JavaDoc() {
305             public void itemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {
306                 jRadioButtonGlobalExcItemStateChanged(evt);
307             }
308         });
309         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
310         gridBagConstraints.gridx = 0;
311         gridBagConstraints.gridy = 8;
312         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
313         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 5, 12);
314         add(jRadioButtonGlobalExc, gridBagConstraints);
315         jRadioButtonGlobalExc.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonGlobalExc")); // NOI18N
316

317         buttonGroup3.add(jRadioButtonActionExc);
318         jRadioButtonActionExc.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_ActionExc").charAt(0));
319         jRadioButtonActionExc.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_ActionExc")); // NOI18N
320
jRadioButtonActionExc.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
321         jRadioButtonActionExc.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
322         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
323         gridBagConstraints.gridx = 0;
324         gridBagConstraints.gridy = 9;
325         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
326         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 12);
327         add(jRadioButtonActionExc, gridBagConstraints);
328         jRadioButtonActionExc.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonActionExc")); // NOI18N
329

330         jComboBoxActionExc.setEnabled(false);
331         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
332         gridBagConstraints.gridx = 1;
333         gridBagConstraints.gridy = 9;
334         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
335         gridBagConstraints.weightx = 1.0;
336         add(jComboBoxActionExc, gridBagConstraints);
337         jComboBoxActionExc.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jComboBoxActionExc")); // NOI18N
338

339         buttonGroup2.add(jRadioButtonSession);
340         jRadioButtonSession.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_Session").charAt(0));
341         jRadioButtonSession.setSelected(true);
342         jRadioButtonSession.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_Session")); // NOI18N
343
jRadioButtonSession.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
344         jRadioButtonSession.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
345         jPanel1.add(jRadioButtonSession);
346         jRadioButtonSession.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonSession")); // NOI18N
347

348         buttonGroup2.add(jRadioButtonRequest);
349         jRadioButtonRequest.setMnemonic(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "MNE_AddExcDialog_Request").charAt(0));
350         jRadioButtonRequest.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_Request")); // NOI18N
351
jRadioButtonRequest.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
352         jRadioButtonRequest.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
353         jPanel1.add(jRadioButtonRequest);
354         jRadioButtonRequest.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonReques")); // NOI18N
355

356         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
357         gridBagConstraints.gridx = 1;
358         gridBagConstraints.gridy = 6;
359         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
360         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 10, 0);
361         add(jPanel1, gridBagConstraints);
362
363         getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_AddExceptionDialogPanel")); // NOI18N
364
}// </editor-fold>//GEN-END:initComponents
365

366     private void jRadioButtonGlobalExcItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_jRadioButtonGlobalExcItemStateChanged
367
// TODO add your handling code here:
368
jComboBoxActionExc.setEnabled(!jRadioButtonGlobalExc.isSelected());
369     }//GEN-LAST:event_jRadioButtonGlobalExcItemStateChanged
370

371     private void jRadioButtonResFileItemStateChanged(java.awt.event.ItemEvent JavaDoc evt) {//GEN-FIRST:event_jRadioButtonResFileItemStateChanged
372
// TODO add your handling code here:
373
boolean selected = jRadioButtonResFile.isSelected();
374         jTextFieldResFile.setEditable(selected);
375         jButtonBrowse.setEnabled(selected);
376         jComboBoxCallAction.setEnabled(!selected);
377     }//GEN-LAST:event_jRadioButtonResFileItemStateChanged
378

379     private void jButtonExcTypeActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jButtonExcTypeActionPerformed
380
SwingUtilities.invokeLater(new Runnable JavaDoc() {
381             public void run() {
382 //TODO: RETOUCHE
383
// FQNSearch.showFastOpen((JTextComponent)jComboBoxExcType.getEditor().getEditorComponent());
384
}
385         });
386     }//GEN-LAST:event_jButtonExcTypeActionPerformed
387

388     private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jButtonBrowseActionPerformed
389
// TODO add your handling code here:
390
try{
391         org.netbeans.api.project.SourceGroup[] groups = StrutsConfigUtilities.getDocBaseGroups(config.getPrimaryFile());
392             org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups);
393             if (fo!=null) {
394                 String JavaDoc res = "/"+StrutsConfigUtilities.getResourcePath(groups,fo,'/',true);
395                 jTextFieldResFile.setText(res);
396             }
397         } catch (java.io.IOException JavaDoc ex) {}
398     }//GEN-LAST:event_jButtonBrowseActionPerformed
399

400     
401     // Variables declaration - do not modify//GEN-BEGIN:variables
402
private javax.swing.ButtonGroup JavaDoc buttonGroup1;
403     private javax.swing.ButtonGroup JavaDoc buttonGroup2;
404     private javax.swing.ButtonGroup JavaDoc buttonGroup3;
405     private javax.swing.JButton JavaDoc jButtonBrowse;
406     private javax.swing.JButton JavaDoc jButtonExcType;
407     private javax.swing.JComboBox JavaDoc jComboBoxActionExc;
408     private javax.swing.JComboBox JavaDoc jComboBoxBundleKey;
409     private javax.swing.JComboBox JavaDoc jComboBoxCallAction;
410     private javax.swing.JComboBox JavaDoc jComboBoxExcType;
411     private javax.swing.JLabel JavaDoc jLabelBundleKey;
412     private javax.swing.JLabel JavaDoc jLabelCall;
413     private javax.swing.JLabel JavaDoc jLabelExcKey;
414     private javax.swing.JLabel JavaDoc jLabelExcType;
415     private javax.swing.JLabel JavaDoc jLabelLocation;
416     private javax.swing.JLabel JavaDoc jLabelScope;
417     private javax.swing.JPanel JavaDoc jPanel1;
418     private javax.swing.JRadioButton JavaDoc jRadioButtonActionExc;
419     private javax.swing.JRadioButton JavaDoc jRadioButtonCallAction;
420     private javax.swing.JRadioButton JavaDoc jRadioButtonGlobalExc;
421     private javax.swing.JRadioButton JavaDoc jRadioButtonRequest;
422     private javax.swing.JRadioButton JavaDoc jRadioButtonResFile;
423     private javax.swing.JRadioButton JavaDoc jRadioButtonSession;
424     private javax.swing.JTextField JavaDoc jTextFieldExcKey;
425     private javax.swing.JTextField JavaDoc jTextFieldResFile;
426     // End of variables declaration//GEN-END:variables
427

428     public String JavaDoc getResourceBundle() {
429         String JavaDoc key = (String JavaDoc)jComboBoxBundleKey.getSelectedItem();
430         return DEFAULT_BUNDLE_KEY.equals(key)?null:key;
431     }
432     
433     public String JavaDoc getExceptionKey() {
434         String JavaDoc key = jTextFieldExcKey.getText().trim();
435         return key==null?null:key;
436     }
437     
438     public String JavaDoc getExceptionType() {
439         javax.swing.text.Document JavaDoc doc = ((JTextComponent JavaDoc)jComboBoxExcType.getEditor().getEditorComponent()).getDocument();
440         try {
441             String JavaDoc exceptionType = doc.getText(0,doc.getLength());
442             return exceptionType==null?null:exceptionType;
443         } catch (javax.swing.text.BadLocationException JavaDoc ex) {
444             return null;
445         }
446     }
447     
448     public String JavaDoc getScope() {
449         return (jRadioButtonSession.isSelected()?null:"request"); //NOI18N
450
}
451     
452     public String JavaDoc getForwardTo() {
453         if (jRadioButtonResFile.isSelected()) {
454             return jTextFieldResFile.getText().trim();
455         } else {
456             return (String JavaDoc)jComboBoxCallAction.getSelectedItem();
457         }
458     }
459
460     public boolean isGlobal() {
461         return jRadioButtonGlobalExc.isSelected();
462     }
463     
464     public String JavaDoc getLocationAction() {
465         return (String JavaDoc)jComboBoxActionExc.getSelectedItem();
466     }
467     
468 }
469
Popular Tags