1 19 20 package org.netbeans.modules.web.struts.wizards; 21 22 import java.util.ArrayList ; 23 import java.util.List ; 24 import org.netbeans.modules.j2ee.dd.api.common.InitParam; 25 import org.netbeans.modules.j2ee.dd.api.web.Servlet; 26 import org.netbeans.modules.web.struts.config.model.Action; 27 import org.netbeans.modules.web.struts.config.model.FormBean; 28 import org.netbeans.modules.web.struts.dialogs.BrowseFolders; 29 import org.openide.WizardDescriptor; 30 import org.openide.loaders.DataObject; 31 import org.openide.loaders.DataObjectNotFoundException; 32 import org.openide.util.HelpCtx; 33 import org.netbeans.api.project.Project; 34 import org.netbeans.modules.web.api.webmodule.WebModule; 35 import org.netbeans.modules.web.struts.StrutsConfigUtilities; 36 import org.netbeans.modules.web.struts.StrutsConfigDataObject; 37 import org.openide.util.NbBundle; 38 39 public class ActionPanel1Visual extends javax.swing.JPanel implements HelpCtx.Provider { 40 String configFile; 41 private ActionPanel1 panel; 42 43 44 public ActionPanel1Visual(ActionPanel1 panel) { 45 this.panel=panel; 46 initComponents(); 47 setName(NbBundle.getMessage(ActionPanel1Visual.class,"TITLE_FormBean&Parameter")); 48 putClientProperty("NewFileWizard_Title", NbBundle.getMessage(ActionPanel1Visual.class, "TITLE_StrutsAction")); 50 } 51 52 57 private void initComponents() { 59 java.awt.GridBagConstraints gridBagConstraints; 60 61 buttonGroup1 = new javax.swing.ButtonGroup (); 62 buttonGroup2 = new javax.swing.ButtonGroup (); 63 jLabelFormName = new javax.swing.JLabel (); 64 CBFormName = new javax.swing.JComboBox (); 65 CBInputAction = new javax.swing.JComboBox (); 66 TFInputResource = new javax.swing.JTextField (); 67 CHBUseFormBean = new javax.swing.JCheckBox (); 68 jButtonBrowse = new javax.swing.JButton (); 69 jPanel1 = new javax.swing.JPanel (); 70 RBSession = new javax.swing.JRadioButton (); 71 RBRequest = new javax.swing.JRadioButton (); 72 jLabelScope = new javax.swing.JLabel (); 73 jLabelAttribute = new javax.swing.JLabel (); 74 TFAttribute = new javax.swing.JTextField (); 75 CHBValidate = new javax.swing.JCheckBox (); 76 jLabelParameter = new javax.swing.JLabel (); 77 TFParameter = new javax.swing.JTextField (); 78 RBInputResource = new javax.swing.JRadioButton (); 79 RBInputAction = new javax.swing.JRadioButton (); 80 jParameterSpecificLabel = new javax.swing.JLabel (); 81 82 setLayout(new java.awt.GridBagLayout ()); 83 84 getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_ActionPanel1")); 85 jLabelFormName.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_FormName_mnem").charAt(0)); 86 jLabelFormName.setLabelFor(CBFormName); 87 jLabelFormName.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_FormName")); 88 gridBagConstraints = new java.awt.GridBagConstraints (); 89 gridBagConstraints.gridx = 0; 90 gridBagConstraints.gridy = 1; 91 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 92 gridBagConstraints.insets = new java.awt.Insets (5, 20, 0, 0); 93 add(jLabelFormName, gridBagConstraints); 94 95 gridBagConstraints = new java.awt.GridBagConstraints (); 96 gridBagConstraints.gridx = 1; 97 gridBagConstraints.gridy = 1; 98 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 99 gridBagConstraints.weightx = 1.0; 100 gridBagConstraints.insets = new java.awt.Insets (5, 12, 0, 0); 101 add(CBFormName, gridBagConstraints); 102 CBFormName.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_CBFormName")); 103 104 CBInputAction.setEnabled(false); 105 gridBagConstraints = new java.awt.GridBagConstraints (); 106 gridBagConstraints.gridx = 1; 107 gridBagConstraints.gridy = 3; 108 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 109 gridBagConstraints.insets = new java.awt.Insets (5, 12, 0, 0); 110 add(CBInputAction, gridBagConstraints); 111 CBInputAction.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("RB_InputAction")); 112 CBInputAction.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_CBInputAction")); 113 114 TFInputResource.setText("/"); 115 gridBagConstraints = new java.awt.GridBagConstraints (); 116 gridBagConstraints.gridx = 1; 117 gridBagConstraints.gridy = 2; 118 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 119 gridBagConstraints.insets = new java.awt.Insets (5, 12, 0, 0); 120 add(TFInputResource, gridBagConstraints); 121 TFInputResource.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("RB_InputResource")); 122 TFInputResource.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_TFInputResource")); 123 124 CHBUseFormBean.setMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_UseFormBean_mnem").charAt(0)); 125 CHBUseFormBean.setSelected(true); 126 CHBUseFormBean.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "CB_UseFormBean")); 127 CHBUseFormBean.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 128 CHBUseFormBean.setMargin(new java.awt.Insets (0, 0, 0, 0)); 129 CHBUseFormBean.addItemListener(new java.awt.event.ItemListener () { 130 public void itemStateChanged(java.awt.event.ItemEvent evt) { 131 CHBUseFormBeanItemStateChanged(evt); 132 } 133 }); 134 135 gridBagConstraints = new java.awt.GridBagConstraints (); 136 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 137 add(CHBUseFormBean, gridBagConstraints); 138 CHBUseFormBean.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_CHBUseFormBean")); 139 140 jButtonBrowse.setMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_BrowseButton_mnem").charAt(0)); 141 jButtonBrowse.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_BrowseButton")); 142 jButtonBrowse.addActionListener(new java.awt.event.ActionListener () { 143 public void actionPerformed(java.awt.event.ActionEvent evt) { 144 jButtonBrowseActionPerformed(evt); 145 } 146 }); 147 148 gridBagConstraints = new java.awt.GridBagConstraints (); 149 gridBagConstraints.gridx = 2; 150 gridBagConstraints.gridy = 2; 151 gridBagConstraints.insets = new java.awt.Insets (5, 5, 0, 0); 152 add(jButtonBrowse, gridBagConstraints); 153 jButtonBrowse.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_jButtonBrowse")); 154 155 buttonGroup1.add(RBSession); 156 RBSession.setMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_Session_mnem").charAt(0)); 157 RBSession.setSelected(true); 158 RBSession.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_Sesson")); 159 RBSession.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 160 RBSession.setMargin(new java.awt.Insets (0, 0, 0, 0)); 161 jPanel1.add(RBSession); 162 RBSession.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_RBSession")); 163 164 buttonGroup1.add(RBRequest); 165 RBRequest.setMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_Request_mnem").charAt(0)); 166 RBRequest.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_Request")); 167 RBRequest.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 168 RBRequest.setMargin(new java.awt.Insets (0, 0, 0, 0)); 169 jPanel1.add(RBRequest); 170 RBRequest.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_Request")); 171 172 gridBagConstraints = new java.awt.GridBagConstraints (); 173 gridBagConstraints.gridx = 1; 174 gridBagConstraints.gridy = 4; 175 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 176 gridBagConstraints.insets = new java.awt.Insets (5, 12, 0, 0); 177 add(jPanel1, gridBagConstraints); 178 179 jLabelScope.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Scope")); 180 gridBagConstraints = new java.awt.GridBagConstraints (); 181 gridBagConstraints.gridx = 0; 182 gridBagConstraints.gridy = 4; 183 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 184 gridBagConstraints.insets = new java.awt.Insets (5, 20, 0, 0); 185 add(jLabelScope, gridBagConstraints); 186 187 jLabelAttribute.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Attribute_mnem").charAt(0)); 188 jLabelAttribute.setLabelFor(TFAttribute); 189 jLabelAttribute.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Attribute")); 190 gridBagConstraints = new java.awt.GridBagConstraints (); 191 gridBagConstraints.gridx = 0; 192 gridBagConstraints.gridy = 5; 193 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 194 gridBagConstraints.insets = new java.awt.Insets (5, 20, 0, 0); 195 add(jLabelAttribute, gridBagConstraints); 196 197 gridBagConstraints = new java.awt.GridBagConstraints (); 198 gridBagConstraints.gridx = 1; 199 gridBagConstraints.gridy = 5; 200 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 201 gridBagConstraints.insets = new java.awt.Insets (5, 12, 0, 0); 202 add(TFAttribute, gridBagConstraints); 203 TFAttribute.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_TFAttribute")); 204 205 CHBValidate.setMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "CB_Validate_mnem").charAt(0)); 206 CHBValidate.setSelected(true); 207 CHBValidate.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "CB_Validate")); 208 CHBValidate.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 209 CHBValidate.setMargin(new java.awt.Insets (0, 0, 0, 0)); 210 gridBagConstraints = new java.awt.GridBagConstraints (); 211 gridBagConstraints.gridx = 0; 212 gridBagConstraints.gridy = 6; 213 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 214 gridBagConstraints.insets = new java.awt.Insets (5, 20, 0, 0); 215 add(CHBValidate, gridBagConstraints); 216 CHBValidate.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_CHBValidate")); 217 218 jLabelParameter.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Parameter_mnem").charAt(0)); 219 jLabelParameter.setLabelFor(TFParameter); 220 jLabelParameter.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Parameter")); 221 gridBagConstraints = new java.awt.GridBagConstraints (); 222 gridBagConstraints.gridx = 0; 223 gridBagConstraints.gridy = 7; 224 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 225 gridBagConstraints.insets = new java.awt.Insets (20, 0, 0, 0); 226 add(jLabelParameter, gridBagConstraints); 227 228 gridBagConstraints = new java.awt.GridBagConstraints (); 229 gridBagConstraints.gridx = 1; 230 gridBagConstraints.gridy = 7; 231 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 232 gridBagConstraints.insets = new java.awt.Insets (20, 12, 0, 0); 233 add(TFParameter, gridBagConstraints); 234 TFParameter.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_TFParameter")); 235 236 buttonGroup2.add(RBInputResource); 237 RBInputResource.setMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_InputResource_mnem").charAt(0)); 238 RBInputResource.setSelected(true); 239 RBInputResource.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_InputResource")); 240 RBInputResource.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 241 RBInputResource.setMargin(new java.awt.Insets (0, 0, 0, 0)); 242 RBInputResource.addItemListener(new java.awt.event.ItemListener () { 243 public void itemStateChanged(java.awt.event.ItemEvent evt) { 244 RBInputResourceItemStateChanged(evt); 245 } 246 }); 247 248 gridBagConstraints = new java.awt.GridBagConstraints (); 249 gridBagConstraints.gridx = 0; 250 gridBagConstraints.gridy = 2; 251 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 252 gridBagConstraints.insets = new java.awt.Insets (5, 20, 0, 0); 253 add(RBInputResource, gridBagConstraints); 254 RBInputResource.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("ACSD_RBInputResource")); 255 256 buttonGroup2.add(RBInputAction); 257 RBInputAction.setMnemonic(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_InputAction_mnem").charAt(0)); 258 RBInputAction.setText(org.openide.util.NbBundle.getMessage(ActionPanel1Visual.class, "RB_InputAction")); 259 RBInputAction.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 260 RBInputAction.setMargin(new java.awt.Insets (0, 0, 0, 0)); 261 RBInputAction.addItemListener(new java.awt.event.ItemListener () { 262 public void itemStateChanged(java.awt.event.ItemEvent evt) { 263 RBInputActionItemStateChanged(evt); 264 } 265 }); 266 267 gridBagConstraints = new java.awt.GridBagConstraints (); 268 gridBagConstraints.gridx = 0; 269 gridBagConstraints.gridy = 3; 270 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 271 gridBagConstraints.insets = new java.awt.Insets (5, 20, 0, 0); 272 add(RBInputAction, gridBagConstraints); 273 RBInputAction.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/web/struts/wizards/Bundle").getString("RBInputAction")); 274 275 gridBagConstraints = new java.awt.GridBagConstraints (); 276 gridBagConstraints.gridx = 1; 277 gridBagConstraints.gridy = 8; 278 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 279 gridBagConstraints.weighty = 1.0; 280 gridBagConstraints.insets = new java.awt.Insets (0, 12, 0, 0); 281 add(jParameterSpecificLabel, gridBagConstraints); 282 283 } 285 private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent evt) { Project proj = panel.getProject(); 288 WebModule wm = WebModule.getWebModule(proj.getProjectDirectory()); 289 org.openide.filesystems.FileObject configFO = wm.getDocumentBase().getFileObject(configFile); 290 if (configFO!=null) { 291 try { 292 DataObject dObj = DataObject.find(configFO); 293 if (dObj instanceof StrutsConfigDataObject) { 294 StrutsConfigDataObject config = (StrutsConfigDataObject)dObj; 295 org.netbeans.api.project.SourceGroup[] groups = StrutsConfigUtilities.getDocBaseGroups(configFO); 296 org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups); 297 if (fo!=null) { 298 String res = "/"+StrutsConfigUtilities.getResourcePath(groups,fo,'/',true); 299 TFInputResource.setText(res); 300 } 301 } 302 } catch (DataObjectNotFoundException ex) {} catch (java.io.IOException ex) {} 303 } 304 } 306 private void RBInputActionItemStateChanged(java.awt.event.ItemEvent evt) { boolean selected = RBInputAction.isSelected(); 309 TFInputResource.setEditable(!selected); 310 jButtonBrowse.setEnabled(!selected); 311 CBInputAction.setEnabled(selected); 312 } 314 private void RBInputResourceItemStateChanged(java.awt.event.ItemEvent evt) { boolean selected = RBInputResource.isSelected(); 317 TFInputResource.setEditable(selected); 318 jButtonBrowse.setEnabled(selected); 319 CBInputAction.setEnabled(!selected); 320 } 322 private void CHBUseFormBeanItemStateChanged(java.awt.event.ItemEvent evt) { boolean selected = CHBUseFormBean.isSelected(); 325 CBFormName.setEnabled(selected); 326 RBInputResource.setEnabled(selected); 327 RBInputAction.setEnabled(selected); 328 if (selected) { 329 if (RBInputResource.isSelected()) { 330 TFInputResource.setEditable(true); 331 jButtonBrowse.setEnabled(true); 332 } else { 333 CBInputAction.setEnabled(true); 334 } 335 } else { 336 TFInputResource.setEditable(false); 337 jButtonBrowse.setEnabled(false); 338 CBInputAction.setEnabled(false); 339 } 340 341 RBSession.setEnabled(selected); 342 RBRequest.setEnabled(selected); 343 TFAttribute.setEditable(selected); 344 CHBValidate.setEnabled(selected); 345 } 347 348 private javax.swing.JComboBox CBFormName; 350 private javax.swing.JComboBox CBInputAction; 351 private javax.swing.JCheckBox CHBUseFormBean; 352 private javax.swing.JCheckBox CHBValidate; 353 private javax.swing.JRadioButton RBInputAction; 354 private javax.swing.JRadioButton RBInputResource; 355 private javax.swing.JRadioButton RBRequest; 356 private javax.swing.JRadioButton RBSession; 357 private javax.swing.JTextField TFAttribute; 358 private javax.swing.JTextField TFInputResource; 359 private javax.swing.JTextField TFParameter; 360 private javax.swing.ButtonGroup buttonGroup1; 361 private javax.swing.ButtonGroup buttonGroup2; 362 private javax.swing.JButton jButtonBrowse; 363 private javax.swing.JLabel jLabelAttribute; 364 private javax.swing.JLabel jLabelFormName; 365 private javax.swing.JLabel jLabelParameter; 366 private javax.swing.JLabel jLabelScope; 367 private javax.swing.JPanel jPanel1; 368 private javax.swing.JLabel jParameterSpecificLabel; 369 371 boolean valid(WizardDescriptor wizardDescriptor) { 372 return true; 373 } 374 375 void read(WizardDescriptor settings) { 376 377 if (settings.getProperty(WizardProperties.ACTION_PARAMETER)==null) { 379 String actionClass = (String )settings.getProperty(WizardProperties.ACTION_SUPERCLASS); 380 if (ActionPanelVisual.DISPATCH_ACTION.equals(actionClass)){ 381 TFParameter.setText("method"); jParameterSpecificLabel.setText(NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Dispatch_Action")); } else if (ActionPanelVisual.MAPPING_DISPATCH_ACTION.equals(actionClass)){ 384 TFParameter.setText("customMethod"); jParameterSpecificLabel.setText(NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Mapping_Dispatch_Action")); } else if (ActionPanelVisual.LOOKUP_DISPATCH_ACTION.equals(actionClass)){ 387 TFParameter.setText(""); jParameterSpecificLabel.setText(NbBundle.getMessage(ActionPanel1Visual.class, "LBL_Lookup_Dispatch_Action")); } else{ 390 TFParameter.setText(""); jParameterSpecificLabel.setText(""); } 393 } 394 configFile = (String )settings.getProperty(WizardProperties.ACTION_CONFIG_FILE); 395 Project proj = panel.getProject(); 396 WebModule wm = WebModule.getWebModule(proj.getProjectDirectory()); 397 if (wm != null && configFile != null && !"".equals(configFile.trim())){ org.openide.filesystems.FileObject fo = wm.getDocumentBase().getFileObject(configFile); 399 if (fo!=null) { 400 try { 401 DataObject dObj = DataObject.find(fo); 402 if (dObj instanceof StrutsConfigDataObject) { 403 StrutsConfigDataObject strutsDO = (StrutsConfigDataObject)dObj; 404 405 List actions = StrutsConfigUtilities.getAllActionsInModule(strutsDO); 407 String [] actionPaths = new String [actions.size()]; 408 for (int i=0;i<actionPaths.length;i++) { 409 actionPaths[i]=((Action)actions.get(i)).getAttributeValue("path"); if (actionPaths[i]==null) actionPaths[i]="???"; } 412 CBInputAction.setModel(new javax.swing.DefaultComboBoxModel (actionPaths)); 413 414 List formBeans = StrutsConfigUtilities.getAllFormBeansInModule(strutsDO); 416 String [] beans = new String [formBeans.size()]; 417 for (int i=0;i<beans.length;i++) { 418 beans[i]=((FormBean)formBeans.get(i)).getAttributeValue("name"); if (beans[i]==null) beans[i]="???"; } 421 CBFormName.setModel(new javax.swing.DefaultComboBoxModel (beans)); 422 jButtonBrowse.setEnabled(true); 423 return; 424 } 425 } catch (DataObjectNotFoundException ex) {} 426 } 427 } else{ 428 jButtonBrowse.setEnabled(false); 429 } 430 431 CBInputAction.setModel(new javax.swing.DefaultComboBoxModel (new String []{})); 432 CBFormName.setModel(new javax.swing.DefaultComboBoxModel (new String []{})); 433 } 434 435 void store(WizardDescriptor settings) { 436 settings.putProperty(WizardProperties.ACTION_FORM_NAME, 437 CHBUseFormBean.isSelected()?CBFormName.getSelectedItem():null); 438 settings.putProperty(WizardProperties.ACTION_INPUT, 439 CHBUseFormBean.isSelected()?getInput():null); 440 settings.putProperty(WizardProperties.ACTION_SCOPE, 441 CHBUseFormBean.isSelected()?getScope():null); 442 settings.putProperty(WizardProperties.ACTION_ATTRIBUTE, 443 CHBUseFormBean.isSelected()?getAttribute():null); 444 settings.putProperty(WizardProperties.ACTION_VALIDATE, 445 CHBUseFormBean.isSelected()?isValidate():null); 446 String param = getParameter(); 448 if (param!=null) { 449 String actionClass = (String )settings.getProperty(WizardProperties.ACTION_SUPERCLASS); 450 if (ActionPanelVisual.DISPATCH_ACTION.equals(actionClass) && param.equals("method")) return; if (ActionPanelVisual.MAPPING_DISPATCH_ACTION.equals(actionClass) && param.equals("customMethod")) return; settings.putProperty(WizardProperties.ACTION_PARAMETER, param); 453 } 454 } 455 456 private String getInput() { 457 if (RBInputResource.isSelected()) { 458 String input=TFInputResource.getText().trim(); 459 return input.length()==0?null:input; 460 } else { 461 return (String )CBInputAction.getSelectedItem(); 462 } 463 } 464 465 private String getScope() { 466 if (RBSession.isSelected()) { 467 return "session"; } else { 469 return "request"; } 471 } 472 473 private Boolean isValidate() { 474 return Boolean.valueOf(CHBValidate.isSelected()); 475 } 476 477 private String getAttribute() { 478 String attr=TFAttribute.getText().trim(); 479 return attr.length()==0?null:attr; 480 } 481 482 private String getParameter() { 483 String param=TFParameter.getText().trim(); 484 return param.length()==0?null:param; 485 } 486 487 public HelpCtx getHelpCtx() { 488 return new HelpCtx(ActionPanel1Visual.class); 489 } 490 491 } 492 | Popular Tags |