1 19 20 package org.netbeans.modules.j2ee.ddloaders.web.multiview; 21 22 import org.netbeans.modules.j2ee.dd.api.web.JspPropertyGroup; 23 import org.netbeans.modules.j2ee.ddloaders.web.*; 24 import org.netbeans.modules.xml.multiview.ui.*; 25 import org.netbeans.modules.xml.multiview.Error; 26 import org.netbeans.modules.xml.multiview.Utils; 27 import org.openide.util.NbBundle; 28 import org.netbeans.api.project.SourceGroup; 29 30 33 public class JspPGPanel extends SectionInnerPanel implements java.awt.event.ItemListener { 34 private JspPropertyGroup group; 35 private DDDataObject dObj; 36 37 public JspPGPanel(SectionView sectionView, DDDataObject dObj,JspPropertyGroup group) { 38 super(sectionView); 39 this.dObj=dObj; 40 this.group=group; 41 initComponents(); 42 43 trimWhiteSpaces.setEnabled(false); 44 deferredSyntaxAllowed.setEnabled(false); 45 46 dispNameTF.setText(group.getDefaultDisplayName()); 47 addModifier(dispNameTF); 48 49 Utils.makeTextAreaLikeTextField(descriptionTA,dispNameTF); 50 descriptionTA.setText(group.getDefaultDescription()); 51 addModifier(descriptionTA); 52 53 pageEncodingTF.setText(group.getPageEncoding()); 54 addModifier(pageEncodingTF); 55 56 ignoreEL.setSelected(group.isElIgnored()); 57 ignoreEL.addItemListener(this); 58 disableScripting.setSelected(group.isScriptingInvalid()); 59 disableScripting.addItemListener(this); 60 xmlSyntax.setSelected(group.isIsXml()); 61 xmlSyntax.addItemListener(this); 62 63 if (group instanceof org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup){ 64 org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup group25 = (org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group; 65 trimWhiteSpaces.setEnabled(true); 66 deferredSyntaxAllowed.setEnabled(true); 67 trimWhiteSpaces.setSelected(group25.isTrimDirectiveWhitespaces()); 68 trimWhiteSpaces.addItemListener(this); 69 deferredSyntaxAllowed.setSelected(group25.isDeferredSyntaxAllowedAsLiteral()); 70 deferredSyntaxAllowed.addItemListener(this); 71 } 72 73 urlPatternsTF.setText(DDUtils.urlPatternList(group.getUrlPattern())); 74 addValidatee(urlPatternsTF); 75 76 preludeTF.setText(DDUtils.urlPatternList(group.getIncludePrelude())); 77 addModifier(preludeTF); 78 79 codaTF.setText(DDUtils.urlPatternList(group.getIncludeCoda())); 80 addModifier(codaTF); 81 82 LinkButton linkButton = new LinkButton(this, group, "url_patterns"); java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints (); 84 gridBagConstraints.gridx = 3; 85 gridBagConstraints.gridy = 2; 86 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 87 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 88 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 0); 89 linkButton.setText(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSources")); 90 linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSource_mnem").charAt(0)); 91 add(linkButton, gridBagConstraints); 92 93 linkButton = new LinkButton(this, group, "preludes"); gridBagConstraints = new java.awt.GridBagConstraints (); 95 gridBagConstraints.gridx = 3; 96 gridBagConstraints.gridy = 8; 97 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 98 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 99 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 0); 100 linkButton.setText(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSources")); 101 linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSource_mnem1").charAt(0)); 102 add(linkButton, gridBagConstraints); 103 104 linkButton = new LinkButton(this, group, "codas"); gridBagConstraints = new java.awt.GridBagConstraints (); 106 gridBagConstraints.gridx = 3; 107 gridBagConstraints.gridy = 9; 108 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 109 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 110 gridBagConstraints.insets = new java.awt.Insets (5, 10, 5, 0); 111 linkButton.setText(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSources")); 112 linkButton.setMnemonic(NbBundle.getMessage(JspPGPanel.class, "LBL_goToSource_mnem2").charAt(0)); 113 add(linkButton, gridBagConstraints); 114 } 115 public javax.swing.JComponent getErrorComponent(String errorId) { 116 if ("url_patterns".equals(errorId)) return urlPatternsTF; 117 return null; 118 } 119 120 public void documentChanged(javax.swing.text.JTextComponent comp, String value) { 121 if (comp==urlPatternsTF) { 122 String val = (String )value; 123 if (val.length()==0) { 124 getSectionView().getErrorPanel().setError(new Error (Error.TYPE_FATAL, Error.MISSING_VALUE_MESSAGE, "URL Pattern",urlPatternsTF)); 125 return; 126 } 127 getSectionView().getErrorPanel().clearError(); 128 } 129 } 130 131 public void setValue(javax.swing.JComponent source, Object value) { 132 if (source==urlPatternsTF) { 133 String text = (String )value; 134 setUrlPatterns(text); 136 } else if (source==dispNameTF) { 137 String text = (String )value; 138 group.setDisplayName(text.length()==0?null:text); 139 SectionPanel enclosingPanel = getSectionView().findSectionPanel(group); 140 enclosingPanel.setTitle(((PagesMultiViewElement.PagesView)getSectionView()).getJspGroupTitle(group)); 141 enclosingPanel.getNode().setDisplayName(((PagesMultiViewElement.PagesView)getSectionView()).getJspGroupNodeName(group)); 142 } else if (source==descriptionTA) { 143 String text = (String )value; 144 group.setDescription(text.length()==0?null:text); 145 } else if (source==pageEncodingTF) { 146 String text = (String )value; 147 group.setPageEncoding(text.length()==0?null:text); 148 } else if (source==preludeTF) { 149 String text = (String )value; 150 setPreludes(text); 151 } else if (source==codaTF) { 152 String text = (String )value; 153 setCodas(text); 154 } 155 } 156 157 private void setUrlPatterns(String text) { 158 String [] urlPatterns = DDUtils.getStringArray(text); 159 group.setUrlPattern(urlPatterns); 160 SectionPanel enclosingPanel = getSectionView().findSectionPanel(group); 161 enclosingPanel.setTitle(((PagesMultiViewElement.PagesView)getSectionView()).getJspGroupTitle(group)); 162 } 163 private void setPreludes(String text) { 164 String [] preludes = DDUtils.getStringArray(text); 165 group.setIncludePrelude(preludes); 166 } 167 private void setCodas(String text) { 168 String [] codas = DDUtils.getStringArray(text); 169 group.setIncludeCoda(codas); 170 } 171 public void rollbackValue(javax.swing.text.JTextComponent source) { 172 if (source==urlPatternsTF) { 173 urlPatternsTF.setText(DDUtils.urlPatternList(group.getUrlPattern())); 174 } 175 } 176 177 public void linkButtonPressed(Object obj, String id) { 178 String text=null; 179 if ("url_patterns".equals(id)) { 180 text = urlPatternsTF.getText(); 181 } else if ("preludes".equals(id)) { 182 text = preludeTF.getText(); 183 } else if ("codas".equals(id)) { 184 text = codaTF.getText(); 185 } 186 java.util.StringTokenizer tok = new java.util.StringTokenizer (text,","); 187 DDUtils.openEditorForFiles(dObj,tok); 188 } 189 190 191 192 197 private void initComponents() { 199 java.awt.GridBagConstraints gridBagConstraints; 200 201 dispNameLabel = new javax.swing.JLabel (); 202 dispNameTF = new javax.swing.JTextField (); 203 descriptionLabel = new javax.swing.JLabel (); 204 descriptionTA = new javax.swing.JTextArea (); 205 urlPatternsLabel = new javax.swing.JLabel (); 206 urlPatternsTF = new javax.swing.JTextField (); 207 browseButton1 = new javax.swing.JButton (); 208 hintUrlPatterns = new javax.swing.JLabel (); 209 pageEncodingLabel = new javax.swing.JLabel (); 210 pageEncodingTF = new javax.swing.JTextField (); 211 ignoreEL = new javax.swing.JCheckBox (); 212 disableScripting = new javax.swing.JCheckBox (); 213 xmlSyntax = new javax.swing.JCheckBox (); 214 preludeLabel = new javax.swing.JLabel (); 215 preludeTF = new javax.swing.JTextField (); 216 browseButton2 = new javax.swing.JButton (); 217 codaLabel = new javax.swing.JLabel (); 218 codaTF = new javax.swing.JTextField (); 219 browseButton3 = new javax.swing.JButton (); 220 filler = new javax.swing.JPanel (); 221 trimWhiteSpaces = new javax.swing.JCheckBox (); 222 deferredSyntaxAllowed = new javax.swing.JCheckBox (); 223 224 setLayout(new java.awt.GridBagLayout ()); 225 226 dispNameLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_displayName_mnem").charAt(0)); 227 dispNameLabel.setLabelFor(dispNameTF); 228 dispNameLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_displayName")); 229 gridBagConstraints = new java.awt.GridBagConstraints (); 230 gridBagConstraints.gridx = 0; 231 gridBagConstraints.gridy = 0; 232 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 233 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 10); 234 add(dispNameLabel, gridBagConstraints); 235 236 gridBagConstraints = new java.awt.GridBagConstraints (); 237 gridBagConstraints.gridx = 1; 238 gridBagConstraints.gridy = 0; 239 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 240 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 241 add(dispNameTF, gridBagConstraints); 242 243 descriptionLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_description_mnem").charAt(0)); 244 descriptionLabel.setLabelFor(descriptionTA); 245 descriptionLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_description")); 246 gridBagConstraints = new java.awt.GridBagConstraints (); 247 gridBagConstraints.gridx = 0; 248 gridBagConstraints.gridy = 1; 249 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 250 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 10); 251 add(descriptionLabel, gridBagConstraints); 252 253 descriptionTA.setRows(3); 254 gridBagConstraints = new java.awt.GridBagConstraints (); 255 gridBagConstraints.gridx = 1; 256 gridBagConstraints.gridy = 1; 257 gridBagConstraints.gridwidth = 2; 258 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 259 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 260 add(descriptionTA, gridBagConstraints); 261 262 urlPatternsLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_urlPatterns_mnem").charAt(0)); 263 urlPatternsLabel.setLabelFor(urlPatternsTF); 264 urlPatternsLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_urlPatterns")); 265 gridBagConstraints = new java.awt.GridBagConstraints (); 266 gridBagConstraints.gridx = 0; 267 gridBagConstraints.gridy = 2; 268 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 269 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 10); 270 add(urlPatternsLabel, gridBagConstraints); 271 272 urlPatternsTF.setColumns(40); 273 gridBagConstraints = new java.awt.GridBagConstraints (); 274 gridBagConstraints.gridx = 1; 275 gridBagConstraints.gridy = 2; 276 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 277 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 278 add(urlPatternsTF, gridBagConstraints); 279 280 browseButton1.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse_mnem").charAt(0)); 281 browseButton1.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse")); 282 browseButton1.setMargin(new java.awt.Insets (0, 14, 0, 14)); 283 browseButton1.addActionListener(new java.awt.event.ActionListener () { 284 public void actionPerformed(java.awt.event.ActionEvent evt) { 285 browseButton1ActionPerformed(evt); 286 } 287 }); 288 289 gridBagConstraints = new java.awt.GridBagConstraints (); 290 gridBagConstraints.gridx = 2; 291 gridBagConstraints.gridy = 2; 292 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 293 gridBagConstraints.insets = new java.awt.Insets (3, 5, 0, 0); 294 add(browseButton1, gridBagConstraints); 295 296 hintUrlPatterns.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "HINT_urlPatterns")); 297 gridBagConstraints = new java.awt.GridBagConstraints (); 298 gridBagConstraints.gridx = 1; 299 gridBagConstraints.gridy = 3; 300 gridBagConstraints.gridwidth = 2; 301 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 302 add(hintUrlPatterns, gridBagConstraints); 303 304 pageEncodingLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_pageEncoding_mnem").charAt(0)); 305 pageEncodingLabel.setLabelFor(pageEncodingTF); 306 pageEncodingLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_pageEncoding")); 307 gridBagConstraints = new java.awt.GridBagConstraints (); 308 gridBagConstraints.gridx = 0; 309 gridBagConstraints.gridy = 4; 310 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 311 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 10); 312 add(pageEncodingLabel, gridBagConstraints); 313 314 gridBagConstraints = new java.awt.GridBagConstraints (); 315 gridBagConstraints.gridx = 1; 316 gridBagConstraints.gridy = 4; 317 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 318 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 319 add(pageEncodingTF, gridBagConstraints); 320 321 ignoreEL.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreEL_mnem").charAt(0)); 322 ignoreEL.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreEL")); 323 ignoreEL.setActionCommand("Expression Language Ignored"); 324 ignoreEL.setOpaque(false); 325 gridBagConstraints = new java.awt.GridBagConstraints (); 326 gridBagConstraints.gridx = 1; 327 gridBagConstraints.gridy = 5; 328 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 329 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 330 add(ignoreEL, gridBagConstraints); 331 332 disableScripting.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreScripting_mnem").charAt(0)); 333 disableScripting.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_ignoreScripting")); 334 disableScripting.setOpaque(false); 335 gridBagConstraints = new java.awt.GridBagConstraints (); 336 gridBagConstraints.gridx = 1; 337 gridBagConstraints.gridy = 6; 338 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 339 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 340 add(disableScripting, gridBagConstraints); 341 342 xmlSyntax.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_xmlSyntax_mnem").charAt(0)); 343 xmlSyntax.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "CHB_xmlSyntax")); 344 xmlSyntax.setOpaque(false); 345 gridBagConstraints = new java.awt.GridBagConstraints (); 346 gridBagConstraints.gridx = 1; 347 gridBagConstraints.gridy = 7; 348 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 349 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 350 add(xmlSyntax, gridBagConstraints); 351 352 preludeLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includePrelude_mnem").charAt(0)); 353 preludeLabel.setLabelFor(preludeTF); 354 preludeLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includePrelude")); 355 gridBagConstraints = new java.awt.GridBagConstraints (); 356 gridBagConstraints.gridx = 0; 357 gridBagConstraints.gridy = 10; 358 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 359 gridBagConstraints.insets = new java.awt.Insets (5, 10, 0, 10); 360 add(preludeLabel, gridBagConstraints); 361 362 gridBagConstraints = new java.awt.GridBagConstraints (); 363 gridBagConstraints.gridx = 1; 364 gridBagConstraints.gridy = 10; 365 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 366 gridBagConstraints.insets = new java.awt.Insets (5, 0, 0, 0); 367 add(preludeTF, gridBagConstraints); 368 369 browseButton2.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse_mnem1").charAt(0)); 370 browseButton2.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse")); 371 browseButton2.setMargin(new java.awt.Insets (0, 14, 0, 14)); 372 browseButton2.addActionListener(new java.awt.event.ActionListener () { 373 public void actionPerformed(java.awt.event.ActionEvent evt) { 374 browseButton2ActionPerformed(evt); 375 } 376 }); 377 378 gridBagConstraints = new java.awt.GridBagConstraints (); 379 gridBagConstraints.gridx = 2; 380 gridBagConstraints.gridy = 10; 381 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 382 gridBagConstraints.insets = new java.awt.Insets (3, 5, 0, 0); 383 add(browseButton2, gridBagConstraints); 384 385 codaLabel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includeCoda_mnem").charAt(0)); 386 codaLabel.setLabelFor(codaTF); 387 codaLabel.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_includeCoda")); 388 gridBagConstraints = new java.awt.GridBagConstraints (); 389 gridBagConstraints.gridx = 0; 390 gridBagConstraints.gridy = 11; 391 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 392 gridBagConstraints.insets = new java.awt.Insets (5, 10, 5, 10); 393 add(codaLabel, gridBagConstraints); 394 395 gridBagConstraints = new java.awt.GridBagConstraints (); 396 gridBagConstraints.gridx = 1; 397 gridBagConstraints.gridy = 11; 398 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 399 gridBagConstraints.insets = new java.awt.Insets (5, 0, 5, 0); 400 add(codaTF, gridBagConstraints); 401 402 browseButton3.setMnemonic(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse_mnem2").charAt(0)); 403 browseButton3.setText(org.openide.util.NbBundle.getMessage(JspPGPanel.class, "LBL_browse")); 404 browseButton3.setMargin(new java.awt.Insets (0, 14, 0, 14)); 405 browseButton3.addActionListener(new java.awt.event.ActionListener () { 406 public void actionPerformed(java.awt.event.ActionEvent evt) { 407 browseButton3ActionPerformed(evt); 408 } 409 }); 410 411 gridBagConstraints = new java.awt.GridBagConstraints (); 412 gridBagConstraints.gridx = 2; 413 gridBagConstraints.gridy = 11; 414 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 415 gridBagConstraints.insets = new java.awt.Insets (3, 5, 5, 0); 416 add(browseButton3, gridBagConstraints); 417 418 filler.setOpaque(false); 419 gridBagConstraints = new java.awt.GridBagConstraints (); 420 gridBagConstraints.gridx = 4; 421 gridBagConstraints.gridy = 0; 422 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 423 gridBagConstraints.weightx = 1.0; 424 add(filler, gridBagConstraints); 425 426 trimWhiteSpaces.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_TrimDirectiveWhitespace_mnem").charAt(0)); 427 trimWhiteSpaces.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_TrimDirectiveWhitespace")); 428 trimWhiteSpaces.setOpaque(false); 429 gridBagConstraints = new java.awt.GridBagConstraints (); 430 gridBagConstraints.gridx = 1; 431 gridBagConstraints.gridy = 8; 432 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 433 add(trimWhiteSpaces, gridBagConstraints); 434 435 deferredSyntaxAllowed.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_DeferredSyntaxAllowedAsLiteral_mnem").charAt(0)); 436 deferredSyntaxAllowed.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ddloaders/web/multiview/Bundle").getString("CHB_DeferredSyntaxAllowedAsLiteral")); 437 deferredSyntaxAllowed.setOpaque(false); 438 gridBagConstraints = new java.awt.GridBagConstraints (); 439 gridBagConstraints.gridx = 1; 440 gridBagConstraints.gridy = 9; 441 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 442 add(deferredSyntaxAllowed, gridBagConstraints); 443 444 } 446 private void browseButton3ActionPerformed(java.awt.event.ActionEvent evt) { try { 450 SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj); 451 org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups); 452 if (fo!=null) { 453 String fileName = "/"+DDUtils.getResourcePath(groups,fo,'/',true); 454 String oldValue = codaTF.getText(); 455 if (fileName.length()>0) { 456 String newValue = DDUtils.addItem(oldValue,fileName,false); 457 if (!oldValue.equals(newValue)) { 458 dObj.modelUpdatedFromUI(); 459 dObj.setChangedFromUI(true); 460 codaTF.setText(newValue); 461 setCodas(newValue); 462 dObj.setChangedFromUI(false); 463 } 464 } 465 } 466 } catch (java.io.IOException ex) {} 467 } 469 private void browseButton2ActionPerformed(java.awt.event.ActionEvent evt) { try { 472 SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj); 473 org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups); 474 if (fo!=null) { 475 String fileName = "/"+DDUtils.getResourcePath(groups,fo,'/',true); 476 String oldValue = preludeTF.getText(); 477 if (fileName.length()>0) { 478 String newValue = DDUtils.addItem(oldValue,fileName,false); 479 if (!oldValue.equals(newValue)) { 480 dObj.modelUpdatedFromUI(); 481 dObj.setChangedFromUI(true); 482 preludeTF.setText(newValue); 483 setPreludes(newValue); 484 dObj.setChangedFromUI(false); 485 } 486 } 487 } 488 } catch (java.io.IOException ex) {} 489 } 491 private void browseButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { 494 SourceGroup[] groups = DDUtils.getDocBaseGroups(dObj); 495 org.openide.filesystems.FileObject fo = BrowseFolders.showDialog(groups); 496 if (fo!=null) { 497 String fileName = "/"+DDUtils.getResourcePath(groups,fo,'/',true); 498 String oldValue = urlPatternsTF.getText(); 499 if (fileName.length()>0) { 500 String newValue = DDUtils.addItem(oldValue,fileName,false); 501 if (!oldValue.equals(newValue)) { 502 dObj.modelUpdatedFromUI(); 503 dObj.setChangedFromUI(true); 504 urlPatternsTF.setText(newValue); 505 setUrlPatterns(newValue); 506 dObj.setChangedFromUI(false); 507 getSectionView().checkValidity(); 508 } 509 } 510 } 511 } catch (java.io.IOException ex) {} 512 } 514 515 private javax.swing.JButton browseButton1; 517 private javax.swing.JButton browseButton2; 518 private javax.swing.JButton browseButton3; 519 private javax.swing.JLabel codaLabel; 520 private javax.swing.JTextField codaTF; 521 private javax.swing.JCheckBox deferredSyntaxAllowed; 522 private javax.swing.JLabel descriptionLabel; 523 private javax.swing.JTextArea descriptionTA; 524 private javax.swing.JCheckBox disableScripting; 525 private javax.swing.JLabel dispNameLabel; 526 private javax.swing.JTextField dispNameTF; 527 private javax.swing.JPanel filler; 528 private javax.swing.JLabel hintUrlPatterns; 529 private javax.swing.JCheckBox ignoreEL; 530 private javax.swing.JLabel pageEncodingLabel; 531 private javax.swing.JTextField pageEncodingTF; 532 private javax.swing.JLabel preludeLabel; 533 private javax.swing.JTextField preludeTF; 534 private javax.swing.JCheckBox trimWhiteSpaces; 535 private javax.swing.JLabel urlPatternsLabel; 536 private javax.swing.JTextField urlPatternsTF; 537 private javax.swing.JCheckBox xmlSyntax; 538 540 public void itemStateChanged(java.awt.event.ItemEvent evt) { 541 System.out.println("State changed: " + evt); 543 System.out.println("State changed: " + evt.getSource()); 544 dObj.modelUpdatedFromUI(); 545 dObj.setChangedFromUI(true); 546 if (evt.getSource() == ignoreEL) { 547 group.setElIgnored(ignoreEL.isSelected()); 548 } else if (evt.getSource() == disableScripting) { 549 group.setScriptingInvalid(disableScripting.isSelected()); 550 } else if (evt.getSource() == xmlSyntax) { 551 group.setIsXml(xmlSyntax.isSelected()); 552 }else if (evt.getSource() == trimWhiteSpaces){ 553 ((org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group).setTrimDirectiveWhitespaces(trimWhiteSpaces.isSelected()); 554 } else if (evt.getSource() == deferredSyntaxAllowed){ 555 ((org.netbeans.modules.j2ee.dd.impl.web.model_2_5.JspPropertyGroup) group).setDeferredSyntaxAllowedAsLiteral(deferredSyntaxAllowed.isSelected()); 556 } 557 dObj.setChangedFromUI(false); 558 } 559 561 protected void startUIChange() { 562 dObj.setChangedFromUI(true); 563 } 564 565 567 protected void endUIChange() { 568 dObj.modelUpdatedFromUI(); 569 dObj.setChangedFromUI(false); 570 } 571 } 572 | Popular Tags |