1 19 package org.netbeans.modules.xml.tax.beans.customizer; 20 21 import java.awt.CardLayout ; 22 import java.beans.PropertyChangeEvent ; 23 24 import org.netbeans.tax.TreeEntityDecl; 25 import org.netbeans.tax.TreeException; 26 27 import org.netbeans.modules.xml.tax.util.TAXUtil; 28 29 34 public class TreeEntityDeclCustomizer extends AbstractTreeCustomizer { 35 36 37 private static final long serialVersionUID = -4905667144375255810L; 38 39 40 41 private static final String TYPE_GENERAL = "General"; 43 private static final String TYPE_PARAMETER = "Parameter"; 45 private static final String [] typeItems = { TYPE_GENERAL, TYPE_PARAMETER }; 46 47 48 49 50 public TreeEntityDeclCustomizer () { 51 super (); 52 53 initComponents (); 54 nameLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_ElementName_mn")); typeLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_EntityType_mn")); internalRadio.setMnemonic (Util.THIS.getChar ("RAD_Internal_mn")); externalRadio.setMnemonic (Util.THIS.getChar ("RAD_External_mn")); unparsedRadio.setMnemonic (Util.THIS.getChar ("RAD_Unparsed_mn")); 60 internValueLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_internValue_mn")); externPublicLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_externPublic_mn")); externSystemLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_externSystem_mn")); unparsedPublicLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_unparsedPublic_mn")); unparsedSystemLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_unparsedSystem_mn")); unparsedNotationLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_unparsedNotation_mn")); 67 initAccessibility (); 68 } 69 70 71 73 protected final TreeEntityDecl getEntityDecl () { 74 return (TreeEntityDecl)getTreeObject (); 75 } 76 77 78 80 protected void safePropertyChange (PropertyChangeEvent pche) { 81 super.safePropertyChange (pche); 82 83 if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_PARAMETER)) { 84 updateParameterComponent (); 85 } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_NAME)) { 86 updateNameComponent (); 87 } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_INTERNAL_TEXT)) { 88 updateInternalTextComponent (); 89 } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_PUBLIC_ID)) { 90 updatePublicIdComponent (); 91 } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_SYSTEM_ID)) { 92 updateSystemIdComponent (); 93 } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_NOTATION_NAME)) { 94 updateNotationComponent (); 95 } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_TYPE)) { 96 updateTypeComponent (); 97 } 98 } 99 100 102 protected final void updateEntityDeclParameter () { 103 if ( typeCombo.getSelectedItem () == null ) { 104 return; 105 } 106 107 try { 108 getEntityDecl ().setParameter (typeCombo.getSelectedItem () == TYPE_PARAMETER); 109 } catch (TreeException exc) { 110 updateParameterComponent (); 111 TAXUtil.notifyTreeException (exc); 112 } 113 } 114 115 117 protected final void updateParameterComponent () { 118 if (getEntityDecl ().isParameter ()) { 119 typeCombo.setSelectedItem (TYPE_PARAMETER); 120 } else { 121 typeCombo.setSelectedItem (TYPE_GENERAL); 122 } 123 } 124 125 127 protected final void updateEntityDeclName () { 128 try { 129 getEntityDecl ().setName (nameField.getText ()); 130 } catch (TreeException exc) { 131 updateNameComponent (); 132 TAXUtil.notifyTreeException (exc); 133 } 134 } 135 136 138 protected final void updateNameComponent () { 139 nameField.setText (getEntityDecl ().getName ()); 140 } 141 142 143 144 146 protected final void updateEntityDeclInternalText () { 147 try { 148 getEntityDecl ().setInternalText (text2null (internValueField.getText ())); 149 } catch (TreeException exc) { 150 updateInternalTextComponent (); 151 TAXUtil.notifyTreeException (exc); 152 } 153 } 154 155 157 protected final void updateInternalTextComponent () { 158 internValueField.setText (null2text (getEntityDecl ().getInternalText ())); 159 } 160 161 163 protected final void updateEntityDeclPublicId () { 164 try { 165 if ( externalRadio.isSelected () ) { 166 getEntityDecl ().setPublicId (text2null (externPublicField.getText ())); 167 } else if ( unparsedRadio.isSelected () ) { 168 getEntityDecl ().setPublicId (text2null (unparsedPublicField.getText ())); 169 } 170 } catch (TreeException exc) { 171 updatePublicIdComponent (); 172 TAXUtil.notifyTreeException (exc); 173 } 174 } 175 176 178 protected final void updatePublicIdComponent () { 179 externPublicField.setText (null2text (getEntityDecl ().getPublicId ())); 180 unparsedPublicField.setText (null2text (getEntityDecl ().getPublicId ())); 181 } 182 183 185 protected final void updateEntityDeclSystemId () { 186 try { 187 if ( externalRadio.isSelected () ) { 188 getEntityDecl ().setSystemId (text2null (externSystemField.getText ())); 189 } else if ( unparsedRadio.isSelected () ) { 190 getEntityDecl ().setSystemId (text2null (unparsedSystemField.getText ())); 191 } 192 } catch (TreeException exc) { 193 updateSystemIdComponent (); 194 TAXUtil.notifyTreeException (exc); 195 } 196 } 197 198 200 protected final void updateSystemIdComponent () { 201 externSystemField.setText (null2text (getEntityDecl ().getSystemId ())); 202 unparsedSystemField.setText (null2text (getEntityDecl ().getSystemId ())); 203 } 204 205 206 208 protected final void updateEntityDeclNotationName () { 209 try { 210 getEntityDecl ().setNotationName (text2null (unparsedNotationField.getText ())); 211 } catch (TreeException exc) { 212 updateNotationComponent (); 213 TAXUtil.notifyTreeException (exc); 214 } 215 } 216 217 219 protected final void updateNotationComponent () { 220 unparsedNotationField.setText (null2text (getEntityDecl ().getNotationName ())); 221 } 222 223 225 protected final void updateTypeComponent () { 226 CardLayout cl = (CardLayout )typeCardPanel.getLayout (); 227 if ( getEntityDecl ().getType () == TreeEntityDecl.TYPE_INTERNAL ) { 228 internalRadio.setSelected (true); 229 cl.show (typeCardPanel, "internalPanel"); } else if ( getEntityDecl ().getType () == TreeEntityDecl.TYPE_EXTERNAL ) { 231 externalRadio.setSelected (true); 232 cl.show (typeCardPanel, "externalPanel"); } else { 234 unparsedRadio.setSelected (true); 235 cl.show (typeCardPanel, "unparsedPanel"); } 237 } 238 239 240 242 protected final void initComponentValues () { 243 updateParameterComponent (); 244 updateNameComponent (); 245 updateInternalTextComponent (); 246 updatePublicIdComponent (); 247 updateSystemIdComponent (); 248 updateNotationComponent (); 249 updateTypeComponent (); 250 } 251 252 253 255 protected void updateReadOnlyStatus (boolean editable) { 256 nameField.setEditable (editable); 257 typeCombo.setEnabled (editable); 258 internalRadio.setEnabled (editable); 259 externalRadio.setEnabled (editable); 260 unparsedRadio.setEnabled (editable); 261 internValueField.setEditable (editable); 262 externPublicField.setEditable (editable); 263 externSystemField.setEditable (editable); 264 unparsedPublicField.setEditable (editable); 265 unparsedSystemField.setEditable (editable); 266 unparsedNotationField.setEditable (editable); 267 } 268 269 270 275 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 277 278 buttonGroup = new javax.swing.ButtonGroup (); 279 nameLabel = new javax.swing.JLabel (); 280 nameField = new javax.swing.JTextField (); 281 typeLabel = new javax.swing.JLabel (); 282 typeCombo = new javax.swing.JComboBox (typeItems); 283 entityTypePanel = new javax.swing.JPanel (); 284 internalRadio = new javax.swing.JRadioButton (); 285 externalRadio = new javax.swing.JRadioButton (); 286 unparsedRadio = new javax.swing.JRadioButton (); 287 typeCardPanel = new javax.swing.JPanel (); 288 internalPanel = new javax.swing.JPanel (); 289 internValueLabel = new javax.swing.JLabel (); 290 internValueField = new javax.swing.JTextField (); 291 externalPanel = new javax.swing.JPanel (); 292 externPublicLabel = new javax.swing.JLabel (); 293 externPublicField = new javax.swing.JTextField (); 294 externSystemLabel = new javax.swing.JLabel (); 295 externSystemField = new javax.swing.JTextField (); 296 unparsedPanel = new javax.swing.JPanel (); 297 unparsedPublicLabel = new javax.swing.JLabel (); 298 unparsedPublicField = new javax.swing.JTextField (); 299 unparsedSystemLabel = new javax.swing.JLabel (); 300 unparsedSystemField = new javax.swing.JTextField (); 301 unparsedNotationLabel = new javax.swing.JLabel (); 302 unparsedNotationField = new javax.swing.JTextField (); 303 304 setLayout(new java.awt.GridBagLayout ()); 305 306 nameLabel.setText(Util.THIS.getString ("LAB_ElementName")); 307 nameLabel.setLabelFor(nameField); 308 gridBagConstraints = new java.awt.GridBagConstraints (); 309 gridBagConstraints.gridx = 0; 310 gridBagConstraints.gridy = 0; 311 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 312 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 313 add(nameLabel, gridBagConstraints); 314 315 nameField.setColumns(20); 316 nameField.addActionListener(new java.awt.event.ActionListener () { 317 public void actionPerformed(java.awt.event.ActionEvent evt) { 318 nameFieldActionPerformed(evt); 319 } 320 }); 321 322 nameField.addFocusListener(new java.awt.event.FocusAdapter () { 323 public void focusGained(java.awt.event.FocusEvent evt) { 324 nameFieldFocusGained(evt); 325 } 326 public void focusLost(java.awt.event.FocusEvent evt) { 327 nameFieldFocusLost(evt); 328 } 329 }); 330 331 gridBagConstraints = new java.awt.GridBagConstraints (); 332 gridBagConstraints.gridx = 1; 333 gridBagConstraints.gridy = 0; 334 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 335 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 336 gridBagConstraints.weightx = 1.0; 337 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 338 add(nameField, gridBagConstraints); 339 340 typeLabel.setText(Util.THIS.getString ("LAB_EntityType")); 341 typeLabel.setLabelFor(typeCombo); 342 gridBagConstraints = new java.awt.GridBagConstraints (); 343 gridBagConstraints.gridx = 0; 344 gridBagConstraints.gridy = 1; 345 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 346 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 347 add(typeLabel, gridBagConstraints); 348 349 typeCombo.addActionListener(new java.awt.event.ActionListener () { 350 public void actionPerformed(java.awt.event.ActionEvent evt) { 351 typeComboActionPerformed(evt); 352 } 353 }); 354 355 gridBagConstraints = new java.awt.GridBagConstraints (); 356 gridBagConstraints.gridx = 1; 357 gridBagConstraints.gridy = 1; 358 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 359 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 360 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 361 add(typeCombo, gridBagConstraints); 362 363 entityTypePanel.setLayout(new java.awt.GridBagLayout ()); 364 365 entityTypePanel.setBorder(new javax.swing.border.TitledBorder (new javax.swing.border.EmptyBorder (new java.awt.Insets (0, 0, 0, 0)))); 366 internalRadio.setSelected(true); 367 internalRadio.setText(Util.THIS.getString ("RAD_Internal")); 368 buttonGroup.add(internalRadio); 369 internalRadio.addActionListener(new java.awt.event.ActionListener () { 370 public void actionPerformed(java.awt.event.ActionEvent evt) { 371 internalRadioActionPerformed(evt); 372 } 373 }); 374 375 gridBagConstraints = new java.awt.GridBagConstraints (); 376 gridBagConstraints.gridx = 0; 377 gridBagConstraints.gridy = 0; 378 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 379 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 380 entityTypePanel.add(internalRadio, gridBagConstraints); 381 382 externalRadio.setText(Util.THIS.getString ("RAD_External")); 383 buttonGroup.add(externalRadio); 384 externalRadio.addActionListener(new java.awt.event.ActionListener () { 385 public void actionPerformed(java.awt.event.ActionEvent evt) { 386 externalRadioActionPerformed(evt); 387 } 388 }); 389 390 gridBagConstraints = new java.awt.GridBagConstraints (); 391 gridBagConstraints.gridx = 1; 392 gridBagConstraints.gridy = 0; 393 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 394 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 395 entityTypePanel.add(externalRadio, gridBagConstraints); 396 397 unparsedRadio.setText(Util.THIS.getString ("RAD_Unparsed")); 398 buttonGroup.add(unparsedRadio); 399 unparsedRadio.addActionListener(new java.awt.event.ActionListener () { 400 public void actionPerformed(java.awt.event.ActionEvent evt) { 401 unparsedRadioActionPerformed(evt); 402 } 403 }); 404 405 gridBagConstraints = new java.awt.GridBagConstraints (); 406 gridBagConstraints.gridx = 2; 407 gridBagConstraints.gridy = 0; 408 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 409 gridBagConstraints.weightx = 1.0; 410 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 411 entityTypePanel.add(unparsedRadio, gridBagConstraints); 412 413 gridBagConstraints = new java.awt.GridBagConstraints (); 414 gridBagConstraints.gridx = 0; 415 gridBagConstraints.gridy = 2; 416 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 417 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 418 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 419 add(entityTypePanel, gridBagConstraints); 420 421 typeCardPanel.setLayout(new java.awt.CardLayout ()); 422 423 internalPanel.setLayout(new java.awt.GridBagLayout ()); 424 425 internValueLabel.setText(Util.THIS.getString ("LAB_Internal_Text")); 426 internValueLabel.setLabelFor(internValueField); 427 gridBagConstraints = new java.awt.GridBagConstraints (); 428 gridBagConstraints.gridx = 0; 429 gridBagConstraints.gridy = 0; 430 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 431 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 432 gridBagConstraints.weighty = 1.0; 433 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 434 internalPanel.add(internValueLabel, gridBagConstraints); 435 436 internValueField.addActionListener(new java.awt.event.ActionListener () { 437 public void actionPerformed(java.awt.event.ActionEvent evt) { 438 internValueFieldActionPerformed(evt); 439 } 440 }); 441 442 internValueField.addFocusListener(new java.awt.event.FocusAdapter () { 443 public void focusGained(java.awt.event.FocusEvent evt) { 444 internValueFieldFocusGained(evt); 445 } 446 public void focusLost(java.awt.event.FocusEvent evt) { 447 internValueFieldFocusLost(evt); 448 } 449 }); 450 451 gridBagConstraints = new java.awt.GridBagConstraints (); 452 gridBagConstraints.gridx = 1; 453 gridBagConstraints.gridy = 0; 454 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 455 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 456 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 457 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 458 gridBagConstraints.weightx = 1.0; 459 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 460 internalPanel.add(internValueField, gridBagConstraints); 461 462 typeCardPanel.add(internalPanel, "internalPanel"); 463 464 externalPanel.setLayout(new java.awt.GridBagLayout ()); 465 466 externPublicLabel.setText(Util.THIS.getString ("LAB_External_PublicId")); 467 externPublicLabel.setLabelFor(externPublicField); 468 gridBagConstraints = new java.awt.GridBagConstraints (); 469 gridBagConstraints.gridx = 0; 470 gridBagConstraints.gridy = 0; 471 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 472 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 473 externalPanel.add(externPublicLabel, gridBagConstraints); 474 475 externPublicField.addActionListener(new java.awt.event.ActionListener () { 476 public void actionPerformed(java.awt.event.ActionEvent evt) { 477 externPublicFieldActionPerformed(evt); 478 } 479 }); 480 481 externPublicField.addFocusListener(new java.awt.event.FocusAdapter () { 482 public void focusLost(java.awt.event.FocusEvent evt) { 483 externPublicFieldFocusLost(evt); 484 } 485 }); 486 487 gridBagConstraints = new java.awt.GridBagConstraints (); 488 gridBagConstraints.gridx = 1; 489 gridBagConstraints.gridy = 0; 490 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 491 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 492 gridBagConstraints.weightx = 1.0; 493 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 494 externalPanel.add(externPublicField, gridBagConstraints); 495 496 externSystemLabel.setText(Util.THIS.getString ("LAB_External_SystemId")); 497 externSystemLabel.setLabelFor(externSystemField); 498 gridBagConstraints = new java.awt.GridBagConstraints (); 499 gridBagConstraints.gridx = 0; 500 gridBagConstraints.gridy = 1; 501 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 502 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 503 gridBagConstraints.weighty = 1.0; 504 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 505 externalPanel.add(externSystemLabel, gridBagConstraints); 506 507 externSystemField.addActionListener(new java.awt.event.ActionListener () { 508 public void actionPerformed(java.awt.event.ActionEvent evt) { 509 externSystemFieldActionPerformed(evt); 510 } 511 }); 512 513 externSystemField.addFocusListener(new java.awt.event.FocusAdapter () { 514 public void focusLost(java.awt.event.FocusEvent evt) { 515 externSystemFieldFocusLost(evt); 516 } 517 }); 518 519 gridBagConstraints = new java.awt.GridBagConstraints (); 520 gridBagConstraints.gridx = 1; 521 gridBagConstraints.gridy = 1; 522 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 523 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 524 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 525 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 526 gridBagConstraints.weightx = 1.0; 527 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 528 externalPanel.add(externSystemField, gridBagConstraints); 529 530 typeCardPanel.add(externalPanel, "externalPanel"); 531 532 unparsedPanel.setLayout(new java.awt.GridBagLayout ()); 533 534 unparsedPublicLabel.setText(Util.THIS.getString ("LAB_Unparsed_PublicId")); 535 unparsedPublicLabel.setLabelFor(unparsedPublicField); 536 gridBagConstraints = new java.awt.GridBagConstraints (); 537 gridBagConstraints.gridx = 0; 538 gridBagConstraints.gridy = 0; 539 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 540 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 541 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 542 unparsedPanel.add(unparsedPublicLabel, gridBagConstraints); 543 544 unparsedPublicField.addActionListener(new java.awt.event.ActionListener () { 545 public void actionPerformed(java.awt.event.ActionEvent evt) { 546 unparsedPublicFieldActionPerformed(evt); 547 } 548 }); 549 550 unparsedPublicField.addFocusListener(new java.awt.event.FocusAdapter () { 551 public void focusLost(java.awt.event.FocusEvent evt) { 552 unparsedPublicFieldFocusLost(evt); 553 } 554 }); 555 556 gridBagConstraints = new java.awt.GridBagConstraints (); 557 gridBagConstraints.gridx = 1; 558 gridBagConstraints.gridy = 0; 559 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 560 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 561 gridBagConstraints.weightx = 1.0; 562 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 563 unparsedPanel.add(unparsedPublicField, gridBagConstraints); 564 565 unparsedSystemLabel.setText(Util.THIS.getString ("LAB_Unparsed_SystemId")); 566 unparsedSystemLabel.setLabelFor(unparsedSystemField); 567 gridBagConstraints = new java.awt.GridBagConstraints (); 568 gridBagConstraints.gridx = 0; 569 gridBagConstraints.gridy = 1; 570 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 571 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 572 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 573 unparsedPanel.add(unparsedSystemLabel, gridBagConstraints); 574 575 unparsedSystemField.addActionListener(new java.awt.event.ActionListener () { 576 public void actionPerformed(java.awt.event.ActionEvent evt) { 577 unparsedSystemFieldActionPerformed(evt); 578 } 579 }); 580 581 unparsedSystemField.addFocusListener(new java.awt.event.FocusAdapter () { 582 public void focusLost(java.awt.event.FocusEvent evt) { 583 unparsedSystemFieldFocusLost(evt); 584 } 585 }); 586 587 gridBagConstraints = new java.awt.GridBagConstraints (); 588 gridBagConstraints.gridx = 1; 589 gridBagConstraints.gridy = 1; 590 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 591 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 592 gridBagConstraints.weightx = 1.0; 593 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 594 unparsedPanel.add(unparsedSystemField, gridBagConstraints); 595 596 unparsedNotationLabel.setText(Util.THIS.getString ("LAB_Unparsed_NotationName")); 597 unparsedNotationLabel.setLabelFor(unparsedNotationField); 598 gridBagConstraints = new java.awt.GridBagConstraints (); 599 gridBagConstraints.gridx = 0; 600 gridBagConstraints.gridy = 2; 601 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 602 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 603 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 604 gridBagConstraints.weighty = 1.0; 605 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 606 unparsedPanel.add(unparsedNotationLabel, gridBagConstraints); 607 608 unparsedNotationField.addActionListener(new java.awt.event.ActionListener () { 609 public void actionPerformed(java.awt.event.ActionEvent evt) { 610 unparsedNotationFieldActionPerformed(evt); 611 } 612 }); 613 614 unparsedNotationField.addFocusListener(new java.awt.event.FocusAdapter () { 615 public void focusLost(java.awt.event.FocusEvent evt) { 616 unparsedNotationFieldFocusLost(evt); 617 } 618 }); 619 620 gridBagConstraints = new java.awt.GridBagConstraints (); 621 gridBagConstraints.gridx = 1; 622 gridBagConstraints.gridy = 2; 623 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 624 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 625 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 626 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 627 gridBagConstraints.weightx = 1.0; 628 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 629 unparsedPanel.add(unparsedNotationField, gridBagConstraints); 630 631 typeCardPanel.add(unparsedPanel, "unparsedPanel"); 632 633 gridBagConstraints = new java.awt.GridBagConstraints (); 634 gridBagConstraints.gridx = 0; 635 gridBagConstraints.gridy = 3; 636 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 637 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 638 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 639 gridBagConstraints.weightx = 1.0; 640 gridBagConstraints.weighty = 1.0; 641 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 642 add(typeCardPanel, gridBagConstraints); 643 644 } 646 private void internValueFieldFocusGained(java.awt.event.FocusEvent evt) { internValueField.selectAll (); 649 } 651 private void nameFieldFocusGained(java.awt.event.FocusEvent evt) { nameField.selectAll (); 654 } 656 private void unparsedNotationFieldFocusLost(java.awt.event.FocusEvent evt) { updateEntityDeclNotationName (); 659 } 661 private void unparsedNotationFieldActionPerformed(java.awt.event.ActionEvent evt) { updateEntityDeclNotationName (); 664 } 666 private void unparsedSystemFieldFocusLost(java.awt.event.FocusEvent evt) { updateEntityDeclSystemId (); 669 } 671 private void unparsedSystemFieldActionPerformed(java.awt.event.ActionEvent evt) { updateEntityDeclSystemId (); 674 } 676 private void unparsedPublicFieldFocusLost(java.awt.event.FocusEvent evt) { updateEntityDeclPublicId (); 679 } 681 private void unparsedPublicFieldActionPerformed(java.awt.event.ActionEvent evt) { updateEntityDeclPublicId (); 684 } 686 private void externSystemFieldFocusLost(java.awt.event.FocusEvent evt) { updateEntityDeclSystemId (); 689 } 691 private void externSystemFieldActionPerformed(java.awt.event.ActionEvent evt) { updateEntityDeclSystemId (); 694 } 696 private void externPublicFieldActionPerformed(java.awt.event.ActionEvent evt) { updateEntityDeclPublicId (); 699 } 701 private void externPublicFieldFocusLost(java.awt.event.FocusEvent evt) { updateEntityDeclPublicId (); 704 } 706 private void internValueFieldFocusLost(java.awt.event.FocusEvent evt) { updateEntityDeclInternalText (); 709 } 711 private void internValueFieldActionPerformed(java.awt.event.ActionEvent evt) { updateEntityDeclInternalText (); 714 } 716 private void nameFieldFocusLost(java.awt.event.FocusEvent evt) { updateEntityDeclName (); 719 } 721 private void nameFieldActionPerformed(java.awt.event.ActionEvent evt) { updateEntityDeclName (); 724 } 726 private void unparsedRadioActionPerformed(java.awt.event.ActionEvent evt) { CardLayout cl = (CardLayout )typeCardPanel.getLayout (); 729 cl.show (typeCardPanel, "unparsedPanel"); } 732 private void externalRadioActionPerformed(java.awt.event.ActionEvent evt) { CardLayout cl = (CardLayout )typeCardPanel.getLayout (); 735 cl.show (typeCardPanel, "externalPanel"); } 738 private void internalRadioActionPerformed(java.awt.event.ActionEvent evt) { CardLayout cl = (CardLayout )typeCardPanel.getLayout (); 741 cl.show (typeCardPanel, "internalPanel"); } 744 private void typeComboActionPerformed(java.awt.event.ActionEvent evt) { unparsedRadio.setEnabled (typeCombo.getSelectedIndex () != 1); 746 if (unparsedRadio.isSelected ()) { 747 internalRadio.setSelected (true); 748 internalRadioActionPerformed (evt); 749 } 750 updateEntityDeclParameter (); 751 } 753 private javax.swing.JTextField unparsedSystemField; 755 private javax.swing.JLabel nameLabel; 756 private javax.swing.JLabel externSystemLabel; 757 private javax.swing.JRadioButton internalRadio; 758 private javax.swing.JTextField nameField; 759 private javax.swing.JTextField externSystemField; 760 private javax.swing.JLabel typeLabel; 761 private javax.swing.JPanel internalPanel; 762 private javax.swing.JLabel unparsedPublicLabel; 763 private javax.swing.JLabel internValueLabel; 764 private javax.swing.JTextField unparsedPublicField; 765 private javax.swing.JLabel externPublicLabel; 766 private javax.swing.JRadioButton unparsedRadio; 767 private javax.swing.JTextField internValueField; 768 private javax.swing.JTextField externPublicField; 769 private javax.swing.JPanel entityTypePanel; 770 private javax.swing.JLabel unparsedNotationLabel; 771 private javax.swing.JPanel unparsedPanel; 772 private javax.swing.JRadioButton externalRadio; 773 private javax.swing.ButtonGroup buttonGroup; 774 private javax.swing.JTextField unparsedNotationField; 775 private javax.swing.JPanel typeCardPanel; 776 private javax.swing.JLabel unparsedSystemLabel; 777 private javax.swing.JPanel externalPanel; 778 private javax.swing.JComboBox typeCombo; 779 781 783 public void initAccessibility (){ 784 785 this.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_TreeEntityDeclCustomizer")); 786 787 nameField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_nameField2")); 788 typeCombo.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_typeCombo")); 789 790 internValueField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_internValueField")); 791 internValueField.selectAll (); 792 793 externPublicField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_externPublicField")); 794 externSystemField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_externSystemField")); 795 796 unparsedPublicField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_unparsedPublicField")); 797 unparsedSystemField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_unparsedSystemField")); 798 unparsedNotationField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_unparsedNotationField")); 799 800 } 801 } 802 | Popular Tags |