3 The file is used to create, update spdHeader of Spd file
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.frameworkwizard
.packaging
.ui
;
18 import java
.awt
.event
.ActionEvent
;
19 import java
.awt
.event
.ComponentEvent
;
20 import java
.awt
.event
.FocusAdapter
;
21 import java
.awt
.event
.FocusEvent
;
23 import javax
.swing
.JButton
;
24 import javax
.swing
.JLabel
;
25 import javax
.swing
.JOptionPane
;
26 import javax
.swing
.JPanel
;
27 import javax
.swing
.JScrollPane
;
28 import javax
.swing
.JTextArea
;
29 import javax
.swing
.JTextField
;
31 import org
.tianocore
.PackageSurfaceAreaDocument
;
32 import org
.tianocore
.frameworkwizard
.common
.DataValidation
;
33 import org
.tianocore
.frameworkwizard
.common
.Tools
;
34 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
35 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
36 import org
.tianocore
.frameworkwizard
.common
.ui
.StarLabel
;
37 import javax
.swing
.JCheckBox
;
38 import javax
.swing
.event
.DocumentEvent
;
39 import javax
.swing
.event
.DocumentListener
;
42 The class is used to create, update spdHeader of Spd file
43 It extends IInternalFrame
45 @since PackageEditor 1.0
48 public class SpdHeader
extends IInternalFrame
implements DocumentListener
{
50 private int dialogWidth
= 560;
52 private int labelColumn
= 12;
54 private int labelWidth
= 155;
56 private int buttonWidth
= 60;
58 private final int valueColumn
= 168;
60 private final int valueWidth
= 320;
62 private final int specWidth
= 420;
64 private int shortValueWidth
= valueWidth
- (buttonWidth
+ 5);
66 private final int oneRowHeight
= 20;
68 private final int threeRowHeight
= 60;
70 private final int fourRowHeight
= 80;
72 private final int rowSep
= 5;
74 private final int rowOne
= 12;
76 private final int rowTwo
= rowOne
+ oneRowHeight
+ rowSep
;
78 private final int rowThree
= rowTwo
+ oneRowHeight
+ rowSep
;
80 private final int rowFour
= rowThree
+ oneRowHeight
+ rowSep
;
82 private final int rowFive
= rowFour
+ threeRowHeight
+ rowSep
;
84 private final int rowSix
= rowFive
+ fourRowHeight
+ rowSep
;
86 private final int rowSeven
= rowSix
+ oneRowHeight
+ rowSep
;
88 private final int rowEight
= rowSeven
+ oneRowHeight
+ rowSep
;
90 private final int rowNine
= rowEight
+ fourRowHeight
+ rowSep
;
92 private final int rowTen
= rowNine
+ oneRowHeight
+ rowSep
;
94 private int dialogHeight
= rowTen
+ threeRowHeight
;
97 /// Define class Serial Version UID
99 private static final long serialVersionUID
= -8152099582923006900L;
102 //Define class members
104 private IInternalFrame topFrame
;
106 private JPanel jContentPane
= null;
108 private JLabel jPackageNameLabel
= null;
110 private JTextField jPackageNameTextField
= null;
112 private JLabel jGuidLabel
= null;
114 private JTextField jGuidTextField
= null;
116 private JLabel jVersionLabel
= null;
118 private JTextField jVersionTextField
= null;
120 private JButton jGenerateGuidButton
= null;
122 private JLabel jLicenseLabel
= null;
124 private JTextArea jLicenseTextArea
= null;
126 private JLabel jLabelCopyright
= null;
128 private JLabel jDescriptionLabel
= null;
130 private JTextArea jDescriptionTextArea
= null;
132 private JTextField jSpecificationTextField
= null;
134 private JScrollPane jLicenseScrollPane
= null;
136 private JScrollPane jDescriptionScrollPane
= null;
138 private JScrollPane jCopyrightScrollPane
= null;
140 private JLabel jAbstractLabel
= null;
142 private JTextField jAbstractTextField
= null;
144 private StarLabel jStarLabel1
= null;
146 private StarLabel jStarLabel2
= null;
148 private StarLabel jStarLabel3
= null;
150 private StarLabel jStarLabel4
= null;
152 private StarLabel jStarLabel5
= null;
154 private StarLabel jStarLabel6
= null;
156 private StarLabel jStarLabel7
= null;
158 private StarLabel jStarLabel8
= null;
160 private StarLabel jStarLabel9
= null;
162 private SpdFileContents sfc
= null;
164 private OpeningPackageType docConsole
= null;
166 private JTextArea jCopyrightTextArea
= null;
168 private JScrollPane topScrollPane
= null;
170 private JLabel jUrlLabel
= null;
172 private JTextField jUrlTextField
= null;
174 private JCheckBox jCheckBoxRdOnly
= null;
176 private JCheckBox jCheckBoxRePkg
= null;
179 This method initializes jPackageNameTextField
181 @return javax.swing.JTextField jPackageNameTextField
184 private JTextField
getJPackageNameTextField() {
185 if (jPackageNameTextField
== null) {
186 jPackageNameTextField
= new JTextField();
187 jPackageNameTextField
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowOne
, valueWidth
, oneRowHeight
));
188 jPackageNameTextField
.setPreferredSize(new java
.awt
.Dimension(valueWidth
, oneRowHeight
));
189 jPackageNameTextField
.getDocument().addDocumentListener(this);
190 jPackageNameTextField
.addFocusListener(new FocusAdapter() {
191 public void focusLost(FocusEvent e
) {
192 if (!DataValidation
.isUiNameType(jPackageNameTextField
.getText())) {
193 JOptionPane
.showMessageDialog(topFrame
, "Package Name must start with a letter.");
196 if (jPackageNameTextField
.getText().equals(sfc
.getSpdHdrPkgName())) {
199 sfc
.setSpdHdrPkgName(jPackageNameTextField
.getText());
203 return jPackageNameTextField
;
207 This method initializes jGuidTextField
209 @return javax.swing.JTextField jGuidTextField
212 private JTextField
getJGuidTextField() {
213 if (jGuidTextField
== null) {
214 jGuidTextField
= new JTextField();
215 jGuidTextField
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowTwo
, shortValueWidth
, oneRowHeight
));
216 jGuidTextField
.setPreferredSize(new java
.awt
.Dimension(shortValueWidth
, oneRowHeight
));
217 jGuidTextField
.getDocument().addDocumentListener(this);
218 jGuidTextField
.addFocusListener(new FocusAdapter() {
219 public void focusLost(FocusEvent e
) {
220 if (!DataValidation
.isGuid(jGuidTextField
.getText())) {
221 JOptionPane
.showMessageDialog(topFrame
, "Guid must be in registry (8-4-4-4-12) format.");
224 if (jGuidTextField
.getText().equals(sfc
.getSpdHdrGuidValue())) {
227 sfc
.setSpdHdrGuidValue(jGuidTextField
.getText());
231 return jGuidTextField
;
235 This method initializes jVersionTextField
237 @return javax.swing.JTextField jVersionTextField
240 private JTextField
getJVersionTextField() {
241 if (jVersionTextField
== null) {
242 jVersionTextField
= new JTextField();
243 jVersionTextField
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowThree
, valueWidth
, oneRowHeight
));
244 jVersionTextField
.setPreferredSize(new java
.awt
.Dimension(valueWidth
, oneRowHeight
));
245 jVersionTextField
.getDocument().addDocumentListener(this);
246 jVersionTextField
.addFocusListener(new FocusAdapter() {
247 public void focusLost(FocusEvent e
) {
248 if (!DataValidation
.isVersion(jVersionTextField
.getText())) {
249 JOptionPane
.showMessageDialog(topFrame
, "Version must start with a number.");
252 if (jVersionTextField
.getText().equals(sfc
.getSpdHdrVer())) {
255 sfc
.setSpdHdrVer(jVersionTextField
.getText());
259 return jVersionTextField
;
263 This method initializes jGenerateGuidButton
265 @return javax.swing.JButton jGenerateGuidButton
268 private JButton
getJGenerateGuidButton() {
269 if (jGenerateGuidButton
== null) {
270 jGenerateGuidButton
= new JButton();
271 jGenerateGuidButton
.setBounds(new java
.awt
.Rectangle(valueColumn
+ shortValueWidth
+ 5, rowTwo
, buttonWidth
, oneRowHeight
));
272 jGenerateGuidButton
.setText("GEN");
273 jGenerateGuidButton
.addActionListener(this);
275 return jGenerateGuidButton
;
279 This method initializes jLicenseTextArea
281 @return javax.swing.JTextArea jLicenseTextArea
284 private JTextArea
getJLicenseTextArea() {
285 if (jLicenseTextArea
== null) {
286 jLicenseTextArea
= new JTextArea();
287 jLicenseTextArea
.setLineWrap(true);
288 jLicenseTextArea
.getDocument().addDocumentListener(this);
289 jLicenseTextArea
.addFocusListener(new FocusAdapter() {
290 public void focusLost(FocusEvent e
) {
291 if (jLicenseTextArea
.getText().length() == 0) {
292 JOptionPane
.showMessageDialog(topFrame
, "License is a required field.");
295 if (jLicenseTextArea
.getText().equals(sfc
.getSpdHdrLicense())) {
298 sfc
.setSpdHdrLicense(jLicenseTextArea
.getText());
302 return jLicenseTextArea
;
306 This method initializes jDescriptionTextArea
308 @return javax.swing.JTextArea jDescriptionTextArea
311 private JTextArea
getJDescriptionTextArea() {
312 if (jDescriptionTextArea
== null) {
313 jDescriptionTextArea
= new JTextArea();
314 jDescriptionTextArea
.setLineWrap(true);
315 jDescriptionTextArea
.getDocument().addDocumentListener(this);
316 jDescriptionTextArea
.addFocusListener(new FocusAdapter() {
317 public void focusLost(FocusEvent e
) {
318 if (jDescriptionTextArea
.getText().length() == 0) {
320 .showMessageDialog(topFrame
,
321 "Description is a required field, and should reflect the contents of the package.");
324 if (jDescriptionTextArea
.getText().equals(sfc
.getSpdHdrDescription())) {
327 sfc
.setSpdHdrDescription(jDescriptionTextArea
.getText());
331 return jDescriptionTextArea
;
335 This method initializes jSpecificationTextField
337 @return javax.swing.JTextField jSpecificationTextField
340 private JTextField
getJSpecificationTextField() {
341 if (jSpecificationTextField
== null) {
342 jSpecificationTextField
= new JTextField();
343 jSpecificationTextField
.setBounds(new java
.awt
.Rectangle(labelColumn
, dialogHeight
- 40, specWidth
, oneRowHeight
));
344 jSpecificationTextField
.setEditable(false);
345 jSpecificationTextField
.setPreferredSize(new java
.awt
.Dimension(specWidth
, oneRowHeight
));
346 jSpecificationTextField
.setLocation(new java
.awt
.Point(2, dialogHeight
- oneRowHeight
));
347 jSpecificationTextField
.setBorder(null);
349 // jSpecificationTextField.addFocusListener(new FocusAdapter(){
350 // public void focusLost(FocusEvent e){
351 // sfc.setSpdHdrSpec(jSpecificationTextField.getText());
355 return jSpecificationTextField
;
359 This method initializes jLicenseScrollPane
361 @return javax.swing.JScrollPane jLicenseScrollPane
364 private JScrollPane
getJLicenseScrollPane() {
365 if (jLicenseScrollPane
== null) {
366 jLicenseScrollPane
= new JScrollPane();
367 jLicenseScrollPane
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowFive
, valueWidth
, fourRowHeight
));
368 jLicenseScrollPane
.setHorizontalScrollBarPolicy(javax
.swing
.JScrollPane
.HORIZONTAL_SCROLLBAR_NEVER
);
369 jLicenseScrollPane
.setPreferredSize(new java
.awt
.Dimension(valueWidth
, fourRowHeight
));
370 jLicenseScrollPane
.setViewportView(getJLicenseTextArea());
372 return jLicenseScrollPane
;
376 This method initializes jDescriptionScrollPane
378 @return javax.swing.JScrollPane jDescriptionScrollPane
381 private JScrollPane
getJDescriptionScrollPane() {
382 if (jDescriptionScrollPane
== null) {
383 jDescriptionScrollPane
= new JScrollPane();
384 jDescriptionScrollPane
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowEight
, valueWidth
, fourRowHeight
));
385 jDescriptionScrollPane
.setHorizontalScrollBarPolicy(javax
.swing
.JScrollPane
.HORIZONTAL_SCROLLBAR_NEVER
);
386 jDescriptionScrollPane
.setPreferredSize(new java
.awt
.Dimension(valueWidth
, fourRowHeight
));
387 jDescriptionScrollPane
.setViewportView(getJDescriptionTextArea());
389 return jDescriptionScrollPane
;
393 This method initializes jAbstractTextField
395 @return javax.swing.JTextField jAbstractTextField
398 private JTextField
getJAbstractTextField() {
399 if (jAbstractTextField
== null) {
400 jAbstractTextField
= new JTextField();
401 jAbstractTextField
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowSeven
, valueWidth
, oneRowHeight
));
402 jAbstractTextField
.setPreferredSize(new java
.awt
.Dimension(valueWidth
, oneRowHeight
));
403 jAbstractTextField
.getDocument().addDocumentListener(this);
404 jAbstractTextField
.addFocusListener(new FocusAdapter() {
405 public void focusLost(FocusEvent e
) {
406 if (!DataValidation
.isAbstract(jAbstractTextField
.getText())) {
407 JOptionPane
.showMessageDialog(topFrame
, "Abstract could NOT be empty.");
410 if (jAbstractTextField
.getText().equals(sfc
.getSpdHdrAbs())) {
413 sfc
.setSpdHdrAbs(jAbstractTextField
.getText());
417 return jAbstractTextField
;
420 private JScrollPane
getCopyrightScrollPane() {
421 if (jCopyrightScrollPane
== null) {
422 jCopyrightScrollPane
= new JScrollPane();
423 jCopyrightScrollPane
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowFour
, valueWidth
, threeRowHeight
));
424 jCopyrightScrollPane
.setHorizontalScrollBarPolicy(javax
.swing
.JScrollPane
.HORIZONTAL_SCROLLBAR_NEVER
);
425 jCopyrightScrollPane
.setPreferredSize(new java
.awt
.Dimension(valueWidth
, threeRowHeight
));
426 jCopyrightScrollPane
.setViewportView(getJCopyrightTextArea());
428 return jCopyrightScrollPane
;
431 This method initializes jTextFieldCopyright
433 @return javax.swing.JTextField jTextFieldCopyright
436 private JTextArea
getJCopyrightTextArea() {
437 if (jCopyrightTextArea
== null) {
438 jCopyrightTextArea
= new JTextArea();
439 jCopyrightTextArea
.setWrapStyleWord(true);
440 jCopyrightTextArea
.setLineWrap(true);
441 jCopyrightTextArea
.getDocument().addDocumentListener(this);
442 jCopyrightTextArea
.addFocusListener(new FocusAdapter() {
443 public void focusLost(FocusEvent e
) {
444 if (!DataValidation
.isCopyright(jCopyrightTextArea
.getText())) {
445 JOptionPane
.showMessageDialog(topFrame
, "Copyright must be entered.");
448 if (jCopyrightTextArea
.getText().equals(sfc
.getSpdHdrCopyright())) {
451 sfc
.setSpdHdrCopyright(jCopyrightTextArea
.getText());
455 return jCopyrightTextArea
;
459 * This method initializes jTextField
461 * @return javax.swing.JTextField
463 private JTextField
getJUrlTextField() {
464 if (jUrlTextField
== null) {
465 jUrlTextField
= new JTextField();
466 jUrlTextField
.setBounds(new java
.awt
.Rectangle(valueColumn
, rowSix
, valueWidth
, oneRowHeight
));
467 jUrlTextField
.setPreferredSize(new java
.awt
.Dimension(valueWidth
, oneRowHeight
));
468 jUrlTextField
.getDocument().addDocumentListener(this);
469 jUrlTextField
.addFocusListener(new FocusAdapter() {
470 public void focusLost(FocusEvent e
) {
471 if (jUrlTextField
.getText().length() == 0 && sfc
.getSpdHdrUrl() == null) {
474 if (jUrlTextField
.getText().equals(sfc
.getSpdHdrUrl())) {
477 sfc
.setSpdHdrLicense(jLicenseTextArea
.getText());
478 sfc
.setSpdHdrUrl(jUrlTextField
.getText());
482 return jUrlTextField
;
486 * This method initializes jCheckBoxRdOnly
488 * @return javax.swing.JCheckBox
490 private JCheckBox
getJCheckBoxRdOnly() {
491 if (jCheckBoxRdOnly
== null) {
492 jCheckBoxRdOnly
= new JCheckBox();
493 jCheckBoxRdOnly
.setText("Read Only");
494 jCheckBoxRdOnly
.setLocation(new java
.awt
.Point(labelColumn
, rowNine
));
495 jCheckBoxRdOnly
.setSize(new java
.awt
.Dimension(labelWidth
, oneRowHeight
));
496 jCheckBoxRdOnly
.addItemListener(new java
.awt
.event
.ItemListener() {
497 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
498 if (docConsole
!= null) {
499 docConsole
.setSaved(false);
501 sfc
.setSpdPkgDefsRdOnly(jCheckBoxRdOnly
.isSelected()+"");
506 return jCheckBoxRdOnly
;
510 * This method initializes jCheckBoxRePkg
512 * @return javax.swing.JCheckBox
514 private JCheckBox
getJCheckBoxRePkg() {
515 if (jCheckBoxRePkg
== null) {
516 jCheckBoxRePkg
= new JCheckBox();
517 jCheckBoxRePkg
.setLocation(new java
.awt
.Point(labelColumn
, rowTen
));
518 jCheckBoxRePkg
.setText("RePackagable");
519 jCheckBoxRePkg
.setSize(new java
.awt
.Dimension(labelWidth
, oneRowHeight
));
520 jCheckBoxRePkg
.addItemListener(new java
.awt
.event
.ItemListener() {
521 public void itemStateChanged(java
.awt
.event
.ItemEvent e
) {
522 if (docConsole
!= null) {
523 docConsole
.setSaved(false);
525 sfc
.setSpdPkgDefsRePkg(jCheckBoxRePkg
.isSelected()+"");
529 return jCheckBoxRePkg
;
532 public static void main(String
[] args
) {
533 new SpdHeader().setVisible(true);
537 This is the default constructor
543 this.setVisible(true);
547 This is the override edit constructor
549 @param inspdHeader The input data of spdHeaderDocument.spdHeader
552 public SpdHeader(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
) {
554 sfc
= new SpdFileContents(inPsa
);
558 public SpdHeader(OpeningPackageType opt
) {
559 this(opt
.getXmlSpd());
566 This method initializes this
569 private void init() {
570 this.setContentPane(getTopScrollPane());
571 this.setTitle("Package Surface Area Header");
575 This method initializes this
576 Fill values to all fields if these values are not empty
578 @param inspdHeader The input data of spdHeaderDocument.spdHeader
581 private void init(SpdFileContents sfc
) {
582 if (sfc
.getSpdHdrPkgName() != null) {
583 jPackageNameTextField
.setText(sfc
.getSpdHdrPkgName());
585 if (sfc
.getSpdHdrGuidValue() != null) {
586 jGuidTextField
.setText(sfc
.getSpdHdrGuidValue());
588 if (sfc
.getSpdHdrVer() != null) {
589 jVersionTextField
.setText(sfc
.getSpdHdrVer());
591 if (sfc
.getSpdHdrLicense() != null) {
592 jLicenseTextArea
.setText(sfc
.getSpdHdrLicense());
594 if (sfc
.getSpdHdrUrl() != null) {
595 jUrlTextField
.setText(sfc
.getSpdHdrUrl());
597 if (sfc
.getSpdHdrCopyright() != null) {
598 jCopyrightTextArea
.setText(sfc
.getSpdHdrCopyright());
600 if (sfc
.getSpdHdrAbs() != null) {
601 jAbstractTextField
.setText(sfc
.getSpdHdrAbs());
603 if (sfc
.getSpdHdrDescription() != null) {
604 jDescriptionTextArea
.setText(sfc
.getSpdHdrDescription());
606 if (sfc
.getSpdHdrSpec() != null) {
607 jSpecificationTextField
.setText(sfc
.getSpdHdrSpec());
609 sfc
.setSpdHdrSpec(jSpecificationTextField
.getText());
611 if (!sfc
.getSpdPkgDefsRdOnly().equals("true")) {
612 sfc
.setSpdPkgDefsRdOnly("false");
613 jCheckBoxRdOnly
.setSelected(false);
615 jCheckBoxRdOnly
.setSelected(true);
617 if (!sfc
.getSpdPkgDefsRePkg().equals("true")) {
618 sfc
.setSpdPkgDefsRePkg("false");
619 jCheckBoxRePkg
.setSelected(false);
621 jCheckBoxRePkg
.setSelected(true);
627 This method initializes jContentPane
629 @return javax.swing.JPanel jContentPane
632 private JPanel
getJContentPane() {
633 if (jContentPane
== null) {
634 jStarLabel1
= new StarLabel();
635 jStarLabel1
.setLocation(new java
.awt
.Point(2, rowOne
));
636 jStarLabel2
= new StarLabel();
637 jStarLabel2
.setLocation(new java
.awt
.Point(2, rowTwo
));
638 jStarLabel3
= new StarLabel();
639 jStarLabel3
.setLocation(new java
.awt
.Point(2, rowThree
));
640 jStarLabel4
= new StarLabel();
641 jStarLabel4
.setLocation(new java
.awt
.Point(2, rowFour
));
642 jStarLabel5
= new StarLabel();
643 jStarLabel5
.setLocation(new java
.awt
.Point(2, rowFive
));
644 jStarLabel6
= new StarLabel();
645 jStarLabel6
.setLocation(new java
.awt
.Point(2, rowSeven
));
646 jStarLabel7
= new StarLabel();
647 jStarLabel7
.setLocation(new java
.awt
.Point(2, rowEight
));
648 jStarLabel8
= new StarLabel();
649 jStarLabel8
.setLocation(new java
.awt
.Point(2, rowNine
));
650 jStarLabel8
.setVisible(false);
651 jStarLabel9
= new StarLabel();
652 jStarLabel9
.setLocation(new java
.awt
.Point(2, rowTen
));
654 jStarLabel9
.setVisible(false);
655 jPackageNameLabel
= new JLabel();
656 jPackageNameLabel
.setText("Package Name");
657 jPackageNameLabel
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowOne
, labelWidth
, oneRowHeight
));
658 jGuidLabel
= new JLabel();
659 jGuidLabel
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowTwo
, labelWidth
, oneRowHeight
));
660 jGuidLabel
.setText("Guid");
661 jVersionLabel
= new JLabel();
662 jVersionLabel
.setText("Version");
663 jVersionLabel
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowThree
, labelWidth
, oneRowHeight
));
664 jLabelCopyright
= new JLabel();
665 jLabelCopyright
.setText("Copyright");
666 jLabelCopyright
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFour
, labelWidth
, oneRowHeight
));
667 jLicenseLabel
= new JLabel();
668 jLicenseLabel
.setText("License");
669 jLicenseLabel
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFive
, labelWidth
, oneRowHeight
));
670 jUrlLabel
= new JLabel();
671 jUrlLabel
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowSix
, labelWidth
, oneRowHeight
));
672 jUrlLabel
.setText("URL");
673 jAbstractLabel
= new JLabel();
674 jAbstractLabel
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowSeven
, labelWidth
, oneRowHeight
));
675 jAbstractLabel
.setText("Abstract");
676 jDescriptionLabel
= new JLabel();
677 jDescriptionLabel
.setText("Description");
678 jDescriptionLabel
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowEight
, labelWidth
, oneRowHeight
));
680 jContentPane
= new JPanel();
681 jContentPane
.setLayout(null);
682 jContentPane
.setLocation(new java
.awt
.Point(0, 0));
683 jContentPane
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
- 20, dialogHeight
- 20));
685 jContentPane
.add(jStarLabel1
, null);
686 jContentPane
.add(jStarLabel2
, null);
687 jContentPane
.add(jStarLabel3
, null);
688 jContentPane
.add(jStarLabel4
, null);
689 jContentPane
.add(jStarLabel5
, null);
690 jContentPane
.add(jStarLabel6
, null);
691 jContentPane
.add(jStarLabel7
, null);
692 jContentPane
.add(jStarLabel8
, null);
693 jContentPane
.add(jStarLabel9
, null);
695 jContentPane
.add(jPackageNameLabel
, null);
696 jContentPane
.add(getJPackageNameTextField(), null);
697 jContentPane
.add(jGuidLabel
, null);
698 jContentPane
.add(getJGuidTextField(), null);
699 jContentPane
.add(jVersionLabel
, null);
700 jContentPane
.add(getJVersionTextField(), null);
701 jContentPane
.add(getJGenerateGuidButton(), null);
702 jContentPane
.add(jLabelCopyright
, null);
703 jContentPane
.add(getCopyrightScrollPane(), null);
704 jContentPane
.add(jLicenseLabel
, null);
705 jContentPane
.add(getJLicenseScrollPane(), null);
706 jContentPane
.add(jUrlLabel
, null);
707 jContentPane
.add(getJUrlTextField(), null);
708 jContentPane
.add(jAbstractLabel
, null);
709 jContentPane
.add(getJAbstractTextField(), null);
710 jContentPane
.add(jDescriptionLabel
, null);
711 jContentPane
.add(getJDescriptionScrollPane(), null);
713 // jContentPane.add(getJButtonOk(), null);
714 // jContentPane.add(getJButtonCancel(), null);
716 jContentPane
.add(getJCheckBoxRdOnly(), null);
717 jContentPane
.add(getJCheckBoxRePkg(), null);
718 jContentPane
.add(getJSpecificationTextField(), null);
725 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
727 * Override actionPerformed to listen all actions
730 public void actionPerformed(ActionEvent arg0
) {
732 if (arg0
.getSource() == jGenerateGuidButton
) {
733 //ToDo: invoke GuidValueEditor
734 jGuidTextField
.setText(Tools
.generateUuidString());
735 sfc
.setSpdHdrGuidValue(jGuidTextField
.getText());
740 This method initializes Package type and Compontent type
743 private void initFrame() {
744 boolean editable
= true;
745 if (sfc
.getSpdPkgDefsRdOnly().equals("true")) {
748 jPackageNameTextField
.setEditable(editable
);
749 jGuidTextField
.setEditable(editable
);
750 jGenerateGuidButton
.setEnabled(editable
);
751 jVersionTextField
.setEditable(editable
);
752 jCopyrightTextArea
.setEditable(editable
);
753 jLicenseTextArea
.setEditable(editable
);
754 jUrlTextField
.setEditable(editable
);
755 jAbstractTextField
.setEditable(editable
);
756 jDescriptionTextArea
.setEditable(editable
);
757 jCheckBoxRePkg
.setEnabled(editable
);
761 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
763 * Override componentResized to resize all components when frame's size is changed
765 public void componentResized(ComponentEvent arg0
) {
766 int intPreferredWidth
= dialogWidth
;
767 int intCurrentWidth
= this.getJContentPane().getWidth();
769 // Tools.resizeComponentWidth(this.jPackageNameTextField, intCurrentWidth, intPreferredWidth);
770 // Tools.resizeComponentWidth(this.jGuidTextField, intCurrentWidth, intPreferredWidth);
771 // Tools.resizeComponentWidth(this.jVersionTextField, intCurrentWidth, intPreferredWidth);
772 Tools
.resizeComponentWidth(this.jUrlTextField
, intCurrentWidth
, intPreferredWidth
);
773 Tools
.resizeComponentWidth(this.jLicenseScrollPane
, intCurrentWidth
, intPreferredWidth
);
774 Tools
.resizeComponentWidth(this.jCopyrightTextArea
, intCurrentWidth
, intPreferredWidth
);
775 Tools
.resizeComponentWidth(this.jDescriptionScrollPane
, intCurrentWidth
, intPreferredWidth
);
776 // Tools.resizeComponentWidth(this.jSpecificationTextField, intCurrentWidth,intPreferredWidth);
777 Tools
.resizeComponentWidth(this.jAbstractTextField
, intCurrentWidth
, intPreferredWidth
);
778 // Tools.relocateComponentX(this.jGenerateGuidButton, intCurrentWidth, jGenerateGuidButton.getWidth(), 30);
781 private JScrollPane
getTopScrollPane() {
782 if (topScrollPane
== null) {
783 topScrollPane
= new JScrollPane();
784 topScrollPane
.setViewportView(getJContentPane());
786 return topScrollPane
;
790 * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
792 public void changedUpdate(DocumentEvent arg0
) {
793 // TODO Auto-generated method stub
798 * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
800 public void insertUpdate(DocumentEvent arg0
) {
801 // TODO Auto-generated method stub
802 if (docConsole
!= null) {
803 docConsole
.setSaved(false);
808 * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
810 public void removeUpdate(DocumentEvent arg0
) {
811 // TODO Auto-generated method stub
812 if (docConsole
!= null) {
813 docConsole
.setSaved(false);