1 19 20 package org.netbeans.modules.web.struts.dialogs; 21 22 import java.util.Iterator ; 23 import java.util.List ; 24 import javax.swing.DefaultComboBoxModel ; 25 import javax.swing.SwingUtilities ; 26 import javax.swing.text.JTextComponent ; 27 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 38 public class AddExceptionDialogPanel extends javax.swing.JPanel implements ValidatingPanel { 39 private static final String DEFAULT_BUNDLE_KEY="org.apache.struts.Globals.MESSAGES_KEY"; StrutsConfigDataObject config; 41 42 public AddExceptionDialogPanel(StrutsConfigDataObject config, String targetActionPath) { 43 this.config=config; 44 initComponents(); 45 List actions = StrutsConfigUtilities.getAllActionsInModule(config); 46 DefaultComboBoxModel model = (DefaultComboBoxModel )jComboBoxCallAction.getModel(); 47 DefaultComboBoxModel model1 = (DefaultComboBoxModel )jComboBoxActionExc.getModel(); 48 Iterator iter = actions.iterator(); 49 while (iter.hasNext()) { 50 String actionPath=((Action)iter.next()).getAttributeValue("path"); model.addElement(actionPath); 52 model1.addElement(actionPath); 53 } 54 List messageResources = StrutsConfigUtilities.getAllMessageResourcesInModule(config); 55 model = (DefaultComboBoxModel )jComboBoxBundleKey.getModel(); 56 iter = messageResources.iterator(); 57 while (iter.hasNext()) { 58 String key=((MessageResources)iter.next()).getAttributeValue("key"); model.addElement(key==null?DEFAULT_BUNDLE_KEY:key); } 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 [] getStateChangeComponents() { 72 return new javax.swing.AbstractButton []{jRadioButtonResFile, jRadioButtonGlobalExc}; 73 } 74 75 public JTextComponent [] getDocumentChangeComponents() { 76 return new JTextComponent []{jTextFieldExcKey, jTextFieldResFile, (JTextComponent )jComboBoxExcType.getEditor().getEditorComponent()}; 77 } 78 79 public String 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 resourceFile = jTextFieldResFile.getText().trim(); 86 if (resourceFile.length()==0 || resourceFile.equals("/")) 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 102 private void initComponents() { 104 java.awt.GridBagConstraints gridBagConstraints; 105 106 buttonGroup1 = new javax.swing.ButtonGroup (); 107 buttonGroup2 = new javax.swing.ButtonGroup (); 108 buttonGroup3 = new javax.swing.ButtonGroup (); 109 jLabelBundleKey = new javax.swing.JLabel (); 110 jComboBoxBundleKey = new javax.swing.JComboBox (); 111 jLabelExcKey = new javax.swing.JLabel (); 112 jComboBoxExcType = new javax.swing.JComboBox (); 113 jLabelExcType = new javax.swing.JLabel (); 114 jTextFieldExcKey = new javax.swing.JTextField (); 115 jButtonExcType = new javax.swing.JButton (); 116 jLabelCall = new javax.swing.JLabel (); 117 jRadioButtonResFile = new javax.swing.JRadioButton (); 118 jTextFieldResFile = new javax.swing.JTextField (); 119 jButtonBrowse = new javax.swing.JButton (); 120 jRadioButtonCallAction = new javax.swing.JRadioButton (); 121 jComboBoxCallAction = new javax.swing.JComboBox (); 122 jLabelScope = new javax.swing.JLabel (); 123 jLabelLocation = new javax.swing.JLabel (); 124 jRadioButtonGlobalExc = new javax.swing.JRadioButton (); 125 jRadioButtonActionExc = new javax.swing.JRadioButton (); 126 jComboBoxActionExc = new javax.swing.JComboBox (); 127 jPanel1 = new javax.swing.JPanel (); 128 jRadioButtonSession = new javax.swing.JRadioButton (); 129 jRadioButtonRequest = new javax.swing.JRadioButton (); 130 131 setBorder(javax.swing.BorderFactory.createEmptyBorder(12, 12, 11, 11)); 132 setLayout(new java.awt.GridBagLayout ()); 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")); gridBagConstraints = new java.awt.GridBagConstraints (); 138 gridBagConstraints.gridx = 0; 139 gridBagConstraints.gridy = 0; 140 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 141 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 12); 142 add(jLabelBundleKey, gridBagConstraints); 143 144 gridBagConstraints = new java.awt.GridBagConstraints (); 145 gridBagConstraints.gridx = 1; 146 gridBagConstraints.gridy = 0; 147 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 148 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 0); 149 add(jComboBoxBundleKey, gridBagConstraints); 150 java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/dialogs/Bundle"); jComboBoxBundleKey.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jComboBoxBundleKey")); 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")); gridBagConstraints = new java.awt.GridBagConstraints (); 157 gridBagConstraints.gridx = 0; 158 gridBagConstraints.gridy = 1; 159 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 160 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 12); 161 add(jLabelExcKey, gridBagConstraints); 162 163 jComboBoxExcType.setEditable(true); 164 jComboBoxExcType.setModel(new javax.swing.DefaultComboBoxModel (new String [] { "java.lang.NumberFormatException", "java.lang.NullPointerException", "java.lang.ArrayIndexOutOfBoundsException", "java.lang.StringIndexOutOfBoundsException", "java.lang.RuntimeException", "java.lang.Exception" })); 165 gridBagConstraints = new java.awt.GridBagConstraints (); 166 gridBagConstraints.gridx = 1; 167 gridBagConstraints.gridy = 2; 168 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 169 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 170 add(jComboBoxExcType, gridBagConstraints); 171 jComboBoxExcType.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jComboBoxExcType")); 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")); gridBagConstraints = new java.awt.GridBagConstraints (); 177 gridBagConstraints.gridx = 0; 178 gridBagConstraints.gridy = 2; 179 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 180 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 12); 181 add(jLabelExcType, gridBagConstraints); 182 183 jTextFieldExcKey.setColumns(30); 184 gridBagConstraints = new java.awt.GridBagConstraints (); 185 gridBagConstraints.gridx = 1; 186 gridBagConstraints.gridy = 1; 187 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 188 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 0); 189 add(jTextFieldExcKey, gridBagConstraints); 190 jTextFieldExcKey.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jTextFieldExcKey")); 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")); jButtonExcType.setEnabled(false); 195 jButtonExcType.addActionListener(new java.awt.event.ActionListener () { 196 public void actionPerformed(java.awt.event.ActionEvent evt) { 197 jButtonExcTypeActionPerformed(evt); 198 } 199 }); 200 gridBagConstraints = new java.awt.GridBagConstraints (); 201 gridBagConstraints.gridx = 2; 202 gridBagConstraints.gridy = 2; 203 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 204 gridBagConstraints.insets = new java.awt.Insets (0, 12, 5, 0); 205 add(jButtonExcType, gridBagConstraints); 206 jButtonExcType.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jButtonExcType")); 208 jLabelCall.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_Call")); gridBagConstraints = new java.awt.GridBagConstraints (); 210 gridBagConstraints.gridx = 0; 211 gridBagConstraints.gridy = 3; 212 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 213 gridBagConstraints.insets = new java.awt.Insets (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")); jRadioButtonResFile.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 221 jRadioButtonResFile.setMargin(new java.awt.Insets (0, 0, 0, 0)); 222 jRadioButtonResFile.addItemListener(new java.awt.event.ItemListener () { 223 public void itemStateChanged(java.awt.event.ItemEvent evt) { 224 jRadioButtonResFileItemStateChanged(evt); 225 } 226 }); 227 gridBagConstraints = new java.awt.GridBagConstraints (); 228 gridBagConstraints.gridx = 0; 229 gridBagConstraints.gridy = 4; 230 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 231 gridBagConstraints.insets = new java.awt.Insets (0, 12, 5, 12); 232 add(jRadioButtonResFile, gridBagConstraints); 233 jRadioButtonResFile.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonResFile")); 235 jTextFieldResFile.setColumns(30); 236 gridBagConstraints = new java.awt.GridBagConstraints (); 237 gridBagConstraints.gridx = 1; 238 gridBagConstraints.gridy = 4; 239 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 240 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 0); 241 add(jTextFieldResFile, gridBagConstraints); 242 jTextFieldResFile.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_jTextFieldResFile")); jTextFieldResFile.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jTextFieldResFile")); 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")); jButtonBrowse.addActionListener(new java.awt.event.ActionListener () { 248 public void actionPerformed(java.awt.event.ActionEvent evt) { 249 jButtonBrowseActionPerformed(evt); 250 } 251 }); 252 gridBagConstraints = new java.awt.GridBagConstraints (); 253 gridBagConstraints.gridx = 2; 254 gridBagConstraints.gridy = 4; 255 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 256 gridBagConstraints.insets = new java.awt.Insets (0, 12, 5, 0); 257 add(jButtonBrowse, gridBagConstraints); 258 jButtonBrowse.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jButtonBrowse")); 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")); jRadioButtonCallAction.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 264 jRadioButtonCallAction.setMargin(new java.awt.Insets (0, 0, 0, 0)); 265 gridBagConstraints = new java.awt.GridBagConstraints (); 266 gridBagConstraints.gridx = 0; 267 gridBagConstraints.gridy = 5; 268 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 269 gridBagConstraints.insets = new java.awt.Insets (0, 12, 10, 12); 270 add(jRadioButtonCallAction, gridBagConstraints); 271 jRadioButtonCallAction.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonCallAction")); 273 jComboBoxCallAction.setEnabled(false); 274 gridBagConstraints = new java.awt.GridBagConstraints (); 275 gridBagConstraints.gridx = 1; 276 gridBagConstraints.gridy = 5; 277 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 278 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 279 add(jComboBoxCallAction, gridBagConstraints); 280 jComboBoxCallAction.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jComboBoxCallAction")); 282 jLabelScope.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddExcDialog_Scope")); gridBagConstraints = new java.awt.GridBagConstraints (); 284 gridBagConstraints.gridx = 0; 285 gridBagConstraints.gridy = 6; 286 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 287 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 288 add(jLabelScope, gridBagConstraints); 289 290 jLabelLocation.setText(org.openide.util.NbBundle.getMessage(AddExceptionDialogPanel.class, "LBL_AddFwdDialog_Location")); gridBagConstraints = new java.awt.GridBagConstraints (); 292 gridBagConstraints.gridx = 0; 293 gridBagConstraints.gridy = 7; 294 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 295 gridBagConstraints.insets = new java.awt.Insets (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")); jRadioButtonGlobalExc.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 303 jRadioButtonGlobalExc.setMargin(new java.awt.Insets (0, 0, 0, 0)); 304 jRadioButtonGlobalExc.addItemListener(new java.awt.event.ItemListener () { 305 public void itemStateChanged(java.awt.event.ItemEvent evt) { 306 jRadioButtonGlobalExcItemStateChanged(evt); 307 } 308 }); 309 gridBagConstraints = new java.awt.GridBagConstraints (); 310 gridBagConstraints.gridx = 0; 311 gridBagConstraints.gridy = 8; 312 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 313 gridBagConstraints.insets = new java.awt.Insets (0, 12, 5, 12); 314 add(jRadioButtonGlobalExc, gridBagConstraints); 315 jRadioButtonGlobalExc.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonGlobalExc")); 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")); jRadioButtonActionExc.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 321 jRadioButtonActionExc.setMargin(new java.awt.Insets (0, 0, 0, 0)); 322 gridBagConstraints = new java.awt.GridBagConstraints (); 323 gridBagConstraints.gridx = 0; 324 gridBagConstraints.gridy = 9; 325 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 326 gridBagConstraints.insets = new java.awt.Insets (0, 12, 0, 12); 327 add(jRadioButtonActionExc, gridBagConstraints); 328 jRadioButtonActionExc.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonActionExc")); 330 jComboBoxActionExc.setEnabled(false); 331 gridBagConstraints = new java.awt.GridBagConstraints (); 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")); 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")); jRadioButtonSession.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 344 jRadioButtonSession.setMargin(new java.awt.Insets (0, 0, 0, 0)); 345 jPanel1.add(jRadioButtonSession); 346 jRadioButtonSession.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonSession")); 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")); jRadioButtonRequest.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 352 jRadioButtonRequest.setMargin(new java.awt.Insets (0, 0, 0, 0)); 353 jPanel1.add(jRadioButtonRequest); 354 jRadioButtonRequest.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_jRadioButtonReques")); 356 gridBagConstraints = new java.awt.GridBagConstraints (); 357 gridBagConstraints.gridx = 1; 358 gridBagConstraints.gridy = 6; 359 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 360 gridBagConstraints.insets = new java.awt.Insets (0, 0, 10, 0); 361 add(jPanel1, gridBagConstraints); 362 363 getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_AddExceptionDialogPanel")); } 366 private void jRadioButtonGlobalExcItemStateChanged(java.awt.event.ItemEvent evt) { jComboBoxActionExc.setEnabled(!jRadioButtonGlobalExc.isSelected()); 369 } 371 private void jRadioButtonResFileItemStateChanged(java.awt.event.ItemEvent evt) { boolean selected = jRadioButtonResFile.isSelected(); 374 jTextFieldResFile.setEditable(selected); 375 jButtonBrowse.setEnabled(selected); 376 jComboBoxCallAction.setEnabled(!selected); 377 } 379 private void jButtonExcTypeActionPerformed(java.awt.event.ActionEvent evt) { SwingUtilities.invokeLater(new Runnable () { 381 public void run() { 382 } 385 }); 386 } 388 private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent evt) { 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 res = "/"+StrutsConfigUtilities.getResourcePath(groups,fo,'/',true); 395 jTextFieldResFile.setText(res); 396 } 397 } catch (java.io.IOException ex) {} 398 } 400 401 private javax.swing.ButtonGroup buttonGroup1; 403 private javax.swing.ButtonGroup buttonGroup2; 404 private javax.swing.ButtonGroup buttonGroup3; 405 private javax.swing.JButton jButtonBrowse; 406 private javax.swing.JButton jButtonExcType; 407 private javax.swing.JComboBox jComboBoxActionExc; 408 private javax.swing.JComboBox jComboBoxBundleKey; 409 private javax.swing.JComboBox jComboBoxCallAction; 410 private javax.swing.JComboBox jComboBoxExcType; 411 private javax.swing.JLabel jLabelBundleKey; 412 private javax.swing.JLabel jLabelCall; 413 private javax.swing.JLabel jLabelExcKey; 414 private javax.swing.JLabel jLabelExcType; 415 private javax.swing.JLabel jLabelLocation; 416 private javax.swing.JLabel jLabelScope; 417 private javax.swing.JPanel jPanel1; 418 private javax.swing.JRadioButton jRadioButtonActionExc; 419 private javax.swing.JRadioButton jRadioButtonCallAction; 420 private javax.swing.JRadioButton jRadioButtonGlobalExc; 421 private javax.swing.JRadioButton jRadioButtonRequest; 422 private javax.swing.JRadioButton jRadioButtonResFile; 423 private javax.swing.JRadioButton jRadioButtonSession; 424 private javax.swing.JTextField jTextFieldExcKey; 425 private javax.swing.JTextField jTextFieldResFile; 426 428 public String getResourceBundle() { 429 String key = (String )jComboBoxBundleKey.getSelectedItem(); 430 return DEFAULT_BUNDLE_KEY.equals(key)?null:key; 431 } 432 433 public String getExceptionKey() { 434 String key = jTextFieldExcKey.getText().trim(); 435 return key==null?null:key; 436 } 437 438 public String getExceptionType() { 439 javax.swing.text.Document doc = ((JTextComponent )jComboBoxExcType.getEditor().getEditorComponent()).getDocument(); 440 try { 441 String exceptionType = doc.getText(0,doc.getLength()); 442 return exceptionType==null?null:exceptionType; 443 } catch (javax.swing.text.BadLocationException ex) { 444 return null; 445 } 446 } 447 448 public String getScope() { 449 return (jRadioButtonSession.isSelected()?null:"request"); } 451 452 public String getForwardTo() { 453 if (jRadioButtonResFile.isSelected()) { 454 return jTextFieldResFile.getText().trim(); 455 } else { 456 return (String )jComboBoxCallAction.getSelectedItem(); 457 } 458 } 459 460 public boolean isGlobal() { 461 return jRadioButtonGlobalExc.isSelected(); 462 } 463 464 public String getLocationAction() { 465 return (String )jComboBoxActionExc.getSelectedItem(); 466 } 467 468 } 469 | Popular Tags |