]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java
1. Fix EDKT214 "Framework Wizard is not synchronized with FrameworkDatabase.db when...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / packaging / ui / SpdHeader.java
1 /** @file
2
3 The file is used to create, update spdHeader of Spd file
4
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
10
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.
13
14 **/
15
16 package org.tianocore.frameworkwizard.packaging.ui;
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ComponentEvent;
20 import java.awt.event.FocusAdapter;
21 import java.awt.event.FocusEvent;
22
23 import javax.swing.JButton;
24 import javax.swing.JFrame;
25 import javax.swing.JLabel;
26 import javax.swing.JOptionPane;
27 import javax.swing.JPanel;
28 import javax.swing.JScrollPane;
29 import javax.swing.JTextArea;
30 import javax.swing.JTextField;
31
32 import org.tianocore.PackageSurfaceAreaDocument;
33 import org.tianocore.frameworkwizard.common.DataValidation;
34 import org.tianocore.frameworkwizard.common.Tools;
35 import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
36 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
37 import org.tianocore.frameworkwizard.common.ui.StarLabel;
38 import javax.swing.JCheckBox;
39
40 /**
41 The class is used to create, update spdHeader of Spd file
42 It extends IInternalFrame
43
44 @since PackageEditor 1.0
45
46 **/
47 public class SpdHeader extends IInternalFrame {
48
49 private int dialogWidth = 560;
50
51 private int labelColumn = 12;
52
53 private int labelWidth = 155;
54
55 private int buttonWidth = 60;
56
57 private final int valueColumn = 168;
58
59 private final int valueWidth = 320;
60
61 private final int specWidth = 420;
62
63 private int shortValueWidth = valueWidth - (buttonWidth + 5);
64
65 private final int oneRowHeight = 20;
66
67 private final int threeRowHeight = 60;
68
69 private final int fourRowHeight = 80;
70
71 private final int rowSep = 5;
72
73 private final int rowOne = 12;
74
75 private final int rowTwo = rowOne + oneRowHeight + rowSep;
76
77 private final int rowThree = rowTwo + oneRowHeight + rowSep;
78
79 private final int rowFour = rowThree + oneRowHeight + rowSep;
80
81 private final int rowFive = rowFour + threeRowHeight + rowSep;
82
83 private final int rowSix = rowFive + fourRowHeight + rowSep;
84
85 private final int rowSeven = rowSix + oneRowHeight + rowSep;
86
87 private final int rowEight = rowSeven + oneRowHeight + rowSep;
88
89 private final int rowNine = rowEight + fourRowHeight + rowSep;
90
91 private final int rowTen = rowNine + oneRowHeight + rowSep;
92
93 private int dialogHeight = rowTen + threeRowHeight;
94
95 ///
96 /// Define class Serial Version UID
97 ///
98 private static final long serialVersionUID = -8152099582923006900L;
99
100 //
101 //Define class members
102 //
103 static JFrame frame;
104
105 private JPanel jContentPane = null;
106
107 private JLabel jPackageNameLabel = null;
108
109 private JTextField jPackageNameTextField = null;
110
111 private JLabel jGuidLabel = null;
112
113 private JTextField jGuidTextField = null;
114
115 private JLabel jVersionLabel = null;
116
117 private JTextField jVersionTextField = null;
118
119 private JButton jGenerateGuidButton = null;
120
121 private JLabel jLicenseLabel = null;
122
123 private JTextArea jLicenseTextArea = null;
124
125 private JLabel jLabelCopyright = null;
126
127 private JLabel jDescriptionLabel = null;
128
129 private JTextArea jDescriptionTextArea = null;
130
131 private JTextField jSpecificationTextField = null;
132
133 private JScrollPane jLicenseScrollPane = null;
134
135 private JScrollPane jDescriptionScrollPane = null;
136
137 private JScrollPane jCopyrightScrollPane = null;
138
139 private JLabel jAbstractLabel = null;
140
141 private JTextField jAbstractTextField = null;
142
143 private StarLabel jStarLabel1 = null;
144
145 private StarLabel jStarLabel2 = null;
146
147 private StarLabel jStarLabel3 = null;
148
149 private StarLabel jStarLabel4 = null;
150
151 private StarLabel jStarLabel5 = null;
152
153 private StarLabel jStarLabel6 = null;
154
155 private StarLabel jStarLabel7 = null;
156
157 private StarLabel jStarLabel8 = null;
158
159 private StarLabel jStarLabel9 = null;
160
161 private SpdFileContents sfc = null;
162
163 private OpeningPackageType docConsole = null;
164
165 private JTextArea jCopyrightTextArea = null;
166
167 private JScrollPane topScrollPane = null;
168
169 private JLabel jUrlLabel = null;
170
171 private JTextField jUrlTextField = null;
172
173 private JCheckBox jCheckBoxRdOnly = null;
174
175 private JCheckBox jCheckBoxRePkg = null;
176
177 /**
178 This method initializes jPackageNameTextField
179
180 @return javax.swing.JTextField jPackageNameTextField
181
182 **/
183 private JTextField getJPackageNameTextField() {
184 if (jPackageNameTextField == null) {
185 jPackageNameTextField = new JTextField();
186 jPackageNameTextField.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
187 jPackageNameTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
188 jPackageNameTextField.addFocusListener(new FocusAdapter() {
189 public void focusLost(FocusEvent e) {
190 if (!DataValidation.isUiNameType(jPackageNameTextField.getText())) {
191 JOptionPane.showMessageDialog(frame, "Package Name must start with a letter.");
192 return;
193 }
194 if (jPackageNameTextField.getText().equals(sfc.getSpdHdrPkgName())) {
195 return;
196 }
197 docConsole.setSaved(false);
198 sfc.setSpdHdrPkgName(jPackageNameTextField.getText());
199 }
200 });
201 }
202 return jPackageNameTextField;
203 }
204
205 /**
206 This method initializes jGuidTextField
207
208 @return javax.swing.JTextField jGuidTextField
209
210 **/
211 private JTextField getJGuidTextField() {
212 if (jGuidTextField == null) {
213 jGuidTextField = new JTextField();
214 jGuidTextField.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
215 jGuidTextField.setPreferredSize(new java.awt.Dimension(shortValueWidth, oneRowHeight));
216 jGuidTextField.addFocusListener(new FocusAdapter() {
217 public void focusLost(FocusEvent e) {
218 if (!DataValidation.isGuid(jGuidTextField.getText())) {
219 JOptionPane.showMessageDialog(frame, "Guid must be in registry (8-4-4-4-12) format.");
220 return;
221 }
222 if (jGuidTextField.getText().equals(sfc.getSpdHdrGuidValue())) {
223 return;
224 }
225 docConsole.setSaved(false);
226 sfc.setSpdHdrGuidValue(jGuidTextField.getText());
227 }
228 });
229 }
230 return jGuidTextField;
231 }
232
233 /**
234 This method initializes jVersionTextField
235
236 @return javax.swing.JTextField jVersionTextField
237
238 **/
239 private JTextField getJVersionTextField() {
240 if (jVersionTextField == null) {
241 jVersionTextField = new JTextField();
242 jVersionTextField.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
243 jVersionTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
244 jVersionTextField.addFocusListener(new FocusAdapter() {
245 public void focusLost(FocusEvent e) {
246 if (!DataValidation.isVersion(jVersionTextField.getText())) {
247 JOptionPane.showMessageDialog(frame, "Version must start with a number.");
248 return;
249 }
250 if (jVersionTextField.getText().equals(sfc.getSpdHdrVer())) {
251 return;
252 }
253 docConsole.setSaved(false);
254 sfc.setSpdHdrVer(jVersionTextField.getText());
255 }
256 });
257 }
258 return jVersionTextField;
259 }
260
261 /**
262 This method initializes jGenerateGuidButton
263
264 @return javax.swing.JButton jGenerateGuidButton
265
266 **/
267 private JButton getJGenerateGuidButton() {
268 if (jGenerateGuidButton == null) {
269 jGenerateGuidButton = new JButton();
270 jGenerateGuidButton.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
271 jGenerateGuidButton.setText("GEN");
272 jGenerateGuidButton.addActionListener(this);
273 }
274 return jGenerateGuidButton;
275 }
276
277 /**
278 This method initializes jLicenseTextArea
279
280 @return javax.swing.JTextArea jLicenseTextArea
281
282 **/
283 private JTextArea getJLicenseTextArea() {
284 if (jLicenseTextArea == null) {
285 jLicenseTextArea = new JTextArea();
286 // jLicenseTextArea.setText("");
287 jLicenseTextArea.setLineWrap(true);
288 jLicenseTextArea.addFocusListener(new FocusAdapter() {
289 public void focusLost(FocusEvent e) {
290 if (jLicenseTextArea.getText().length() == 0) {
291 JOptionPane.showMessageDialog(frame, "License is a required field.");
292 return;
293 }
294 if (jLicenseTextArea.getText().equals(sfc.getSpdHdrLicense())) {
295 return;
296 }
297 docConsole.setSaved(false);
298 sfc.setSpdHdrLicense(jLicenseTextArea.getText());
299 }
300 });
301 }
302 return jLicenseTextArea;
303 }
304
305 /**
306 This method initializes jDescriptionTextArea
307
308 @return javax.swing.JTextArea jDescriptionTextArea
309
310 **/
311 private JTextArea getJDescriptionTextArea() {
312 if (jDescriptionTextArea == null) {
313 jDescriptionTextArea = new JTextArea();
314 jDescriptionTextArea.setLineWrap(true);
315 jDescriptionTextArea.addFocusListener(new FocusAdapter() {
316 public void focusLost(FocusEvent e) {
317 if (jDescriptionTextArea.getText().length() == 0) {
318 JOptionPane
319 .showMessageDialog(frame,
320 "Description is a required field, and should reflect the contents of the package.");
321 return;
322 }
323 if (jDescriptionTextArea.getText().equals(sfc.getSpdHdrDescription())) {
324 return;
325 }
326 docConsole.setSaved(false);
327 sfc.setSpdHdrDescription(jDescriptionTextArea.getText());
328 }
329 });
330 }
331 return jDescriptionTextArea;
332 }
333
334 /**
335 This method initializes jSpecificationTextField
336
337 @return javax.swing.JTextField jSpecificationTextField
338
339 **/
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);
348
349 // jSpecificationTextField.addFocusListener(new FocusAdapter(){
350 // public void focusLost(FocusEvent e){
351 // sfc.setSpdHdrSpec(jSpecificationTextField.getText());
352 // }
353 // });
354 }
355 return jSpecificationTextField;
356 }
357
358 /**
359 This method initializes jLicenseScrollPane
360
361 @return javax.swing.JScrollPane jLicenseScrollPane
362
363 **/
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());
371 }
372 return jLicenseScrollPane;
373 }
374
375 /**
376 This method initializes jDescriptionScrollPane
377
378 @return javax.swing.JScrollPane jDescriptionScrollPane
379
380 **/
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());
388 }
389 return jDescriptionScrollPane;
390 }
391
392 /**
393 This method initializes jAbstractTextField
394
395 @return javax.swing.JTextField jAbstractTextField
396
397 **/
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.addFocusListener(new FocusAdapter() {
404 public void focusLost(FocusEvent e) {
405 if (!DataValidation.isAbstract(jAbstractTextField.getText())) {
406 JOptionPane.showMessageDialog(frame, "Abstract could NOT be empty.");
407 return;
408 }
409 if (jAbstractTextField.getText().equals(sfc.getSpdHdrAbs())) {
410 return;
411 }
412 docConsole.setSaved(false);
413 sfc.setSpdHdrAbs(jAbstractTextField.getText());
414 }
415 });
416 }
417 return jAbstractTextField;
418 }
419
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());
427 }
428 return jCopyrightScrollPane;
429 }
430 /**
431 This method initializes jTextFieldCopyright
432
433 @return javax.swing.JTextField jTextFieldCopyright
434
435 **/
436 private JTextArea getJCopyrightTextArea() {
437 if (jCopyrightTextArea == null) {
438 jCopyrightTextArea = new JTextArea();
439 jCopyrightTextArea.setWrapStyleWord(true);
440 jCopyrightTextArea.addFocusListener(new FocusAdapter() {
441 public void focusLost(FocusEvent e) {
442 if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
443 JOptionPane.showMessageDialog(frame, "Copyright must be entered.");
444 return;
445 }
446 if (jCopyrightTextArea.getText().equals(sfc.getSpdHdrCopyright())) {
447 return;
448 }
449 docConsole.setSaved(false);
450 sfc.setSpdHdrCopyright(jCopyrightTextArea.getText());
451 }
452 });
453 }
454 return jCopyrightTextArea;
455 }
456
457 /**
458 * This method initializes jTextField
459 *
460 * @return javax.swing.JTextField
461 */
462 private JTextField getJUrlTextField() {
463 if (jUrlTextField == null) {
464 jUrlTextField = new JTextField();
465 jUrlTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSix, valueWidth, oneRowHeight));
466 jUrlTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
467 jUrlTextField.addFocusListener(new FocusAdapter() {
468 public void focusLost(FocusEvent e) {
469 if (jUrlTextField.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {
470 return;
471 }
472 if (jUrlTextField.getText().equals(sfc.getSpdHdrUrl())) {
473 return;
474 }
475 sfc.setSpdHdrLicense(jLicenseTextArea.getText());
476 sfc.setSpdHdrUrl(jUrlTextField.getText());
477 docConsole.setSaved(false);
478 }
479 });
480 }
481 return jUrlTextField;
482 }
483
484 /**
485 * This method initializes jCheckBoxRdOnly
486 *
487 * @return javax.swing.JCheckBox
488 */
489 private JCheckBox getJCheckBoxRdOnly() {
490 if (jCheckBoxRdOnly == null) {
491 jCheckBoxRdOnly = new JCheckBox();
492 jCheckBoxRdOnly.setText("Read Only");
493 jCheckBoxRdOnly.setLocation(new java.awt.Point(labelColumn, rowNine));
494 jCheckBoxRdOnly.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
495 // jCheckBoxRdOnly.setPreferredSize(new java.awt.Dimension(150, 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);
500 }
501 sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected() + "");
502 }
503 });
504 }
505 return jCheckBoxRdOnly;
506 }
507
508 /**
509 * This method initializes jCheckBoxRePkg
510 *
511 * @return javax.swing.JCheckBox
512 */
513 private JCheckBox getJCheckBoxRePkg() {
514 if (jCheckBoxRePkg == null) {
515 jCheckBoxRePkg = new JCheckBox();
516 jCheckBoxRePkg.setLocation(new java.awt.Point(labelColumn, rowTen));
517 jCheckBoxRePkg.setText("RePackagable");
518 jCheckBoxRePkg.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
519 jCheckBoxRePkg.addItemListener(new java.awt.event.ItemListener() {
520 public void itemStateChanged(java.awt.event.ItemEvent e) {
521 if (docConsole != null) {
522 docConsole.setSaved(false);
523 }
524 sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected() + "");
525 }
526 });
527 }
528 return jCheckBoxRePkg;
529 }
530
531 public static void main(String[] args) {
532 new SpdHeader().setVisible(true);
533 }
534
535 /**
536 This is the default constructor
537
538 **/
539 public SpdHeader() {
540 super();
541 init();
542 this.setVisible(true);
543 }
544
545 /**
546 This is the override edit constructor
547
548 @param inspdHeader The input data of spdHeaderDocument.spdHeader
549
550 **/
551 public SpdHeader(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
552 this();
553 sfc = new SpdFileContents(inPsa);
554 init(sfc);
555 }
556
557 public SpdHeader(OpeningPackageType opt) {
558 this(opt.getXmlSpd());
559 docConsole = opt;
560 }
561
562 /**
563 This method initializes this
564
565 **/
566 private void init() {
567 this.setContentPane(getTopScrollPane());
568 this.setTitle("Package Surface Area Header");
569 initFrame();
570 }
571
572 /**
573 This method initializes this
574 Fill values to all fields if these values are not empty
575
576 @param inspdHeader The input data of spdHeaderDocument.spdHeader
577
578 **/
579 private void init(SpdFileContents sfc) {
580 if (sfc.getSpdHdrPkgName() != null) {
581 jPackageNameTextField.setText(sfc.getSpdHdrPkgName());
582 }
583 if (sfc.getSpdHdrGuidValue() != null) {
584 jGuidTextField.setText(sfc.getSpdHdrGuidValue());
585 }
586 if (sfc.getSpdHdrVer() != null) {
587 jVersionTextField.setText(sfc.getSpdHdrVer());
588 }
589 if (sfc.getSpdHdrLicense() != null) {
590 jLicenseTextArea.setText(sfc.getSpdHdrLicense());
591 }
592 if (sfc.getSpdHdrUrl() != null) {
593 jUrlTextField.setText(sfc.getSpdHdrUrl());
594 }
595 if (sfc.getSpdHdrCopyright() != null) {
596 jCopyrightTextArea.setText(sfc.getSpdHdrCopyright());
597 }
598 if (sfc.getSpdHdrAbs() != null) {
599 jAbstractTextField.setText(sfc.getSpdHdrAbs());
600 }
601 if (sfc.getSpdHdrDescription() != null) {
602 jDescriptionTextArea.setText(sfc.getSpdHdrDescription());
603 }
604 if (sfc.getSpdHdrSpec() != null) {
605 jSpecificationTextField.setText(sfc.getSpdHdrSpec());
606 }
607 sfc.setSpdHdrSpec(jSpecificationTextField.getText());
608
609 if (!sfc.getSpdPkgDefsRdOnly().equals("true")) {
610 sfc.setSpdPkgDefsRdOnly("false");
611 jCheckBoxRdOnly.setSelected(false);
612 } else {
613 jCheckBoxRdOnly.setSelected(true);
614 }
615 if (!sfc.getSpdPkgDefsRePkg().equals("true")) {
616 sfc.setSpdPkgDefsRePkg("false");
617 jCheckBoxRePkg.setSelected(false);
618 } else {
619 jCheckBoxRePkg.setSelected(true);
620 }
621
622 }
623
624 /**
625 This method initializes jContentPane
626
627 @return javax.swing.JPanel jContentPane
628
629 **/
630 private JPanel getJContentPane() {
631 if (jContentPane == null) {
632 jStarLabel1 = new StarLabel();
633 jStarLabel1.setLocation(new java.awt.Point(2, rowOne));
634 jStarLabel2 = new StarLabel();
635 jStarLabel2.setLocation(new java.awt.Point(2, rowTwo));
636 jStarLabel3 = new StarLabel();
637 jStarLabel3.setLocation(new java.awt.Point(2, rowThree));
638 jStarLabel4 = new StarLabel();
639 jStarLabel4.setLocation(new java.awt.Point(2, rowFour));
640 jStarLabel5 = new StarLabel();
641 jStarLabel5.setLocation(new java.awt.Point(2, rowFive));
642 jStarLabel6 = new StarLabel();
643 jStarLabel6.setLocation(new java.awt.Point(2, rowSeven));
644 jStarLabel7 = new StarLabel();
645 jStarLabel7.setLocation(new java.awt.Point(2, rowEight));
646 jStarLabel8 = new StarLabel();
647 jStarLabel8.setLocation(new java.awt.Point(2, rowNine));
648 jStarLabel9 = new StarLabel();
649 jStarLabel9.setLocation(new java.awt.Point(2, rowTen));
650
651 jPackageNameLabel = new JLabel();
652 jPackageNameLabel.setText("Package Name");
653 jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
654 jGuidLabel = new JLabel();
655 jGuidLabel.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
656 jGuidLabel.setText("Guid");
657 jVersionLabel = new JLabel();
658 jVersionLabel.setText("Version");
659 jVersionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
660 jLabelCopyright = new JLabel();
661 jLabelCopyright.setText("Copyright");
662 jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
663 jLicenseLabel = new JLabel();
664 jLicenseLabel.setText("License");
665 jLicenseLabel.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
666 jUrlLabel = new JLabel();
667 jUrlLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
668 jUrlLabel.setText("URL");
669 jAbstractLabel = new JLabel();
670 jAbstractLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSeven, labelWidth, oneRowHeight));
671 jAbstractLabel.setText("Abstract");
672 jDescriptionLabel = new JLabel();
673 jDescriptionLabel.setText("Description");
674 jDescriptionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowEight, labelWidth, oneRowHeight));
675
676 jContentPane = new JPanel();
677 jContentPane.setLayout(null);
678 jContentPane.setLocation(new java.awt.Point(0, 0));
679 jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 20, dialogHeight - 20));
680
681 jContentPane.add(jStarLabel1, null);
682 jContentPane.add(jStarLabel2, null);
683 jContentPane.add(jStarLabel3, null);
684 jContentPane.add(jStarLabel4, null);
685 jContentPane.add(jStarLabel5, null);
686 jContentPane.add(jStarLabel6, null);
687 jContentPane.add(jStarLabel7, null);
688 jContentPane.add(jStarLabel8, null);
689 jContentPane.add(jStarLabel9, null);
690
691 jContentPane.add(jPackageNameLabel, null);
692 jContentPane.add(getJPackageNameTextField(), null);
693 jContentPane.add(jGuidLabel, null);
694 jContentPane.add(getJGuidTextField(), null);
695 jContentPane.add(jVersionLabel, null);
696 jContentPane.add(getJVersionTextField(), null);
697 jContentPane.add(getJGenerateGuidButton(), null);
698 jContentPane.add(jLabelCopyright, null);
699 jContentPane.add(getCopyrightScrollPane(), null);
700 jContentPane.add(jLicenseLabel, null);
701 jContentPane.add(getJLicenseScrollPane(), null);
702 jContentPane.add(jUrlLabel, null);
703 jContentPane.add(getJUrlTextField(), null);
704 jContentPane.add(jAbstractLabel, null);
705 jContentPane.add(getJAbstractTextField(), null);
706 jContentPane.add(jDescriptionLabel, null);
707 jContentPane.add(getJDescriptionScrollPane(), null);
708
709 // jContentPane.add(getJButtonOk(), null);
710 // jContentPane.add(getJButtonCancel(), null);
711
712 jContentPane.add(getJCheckBoxRdOnly(), null);
713 jContentPane.add(getJCheckBoxRePkg(), null);
714 jContentPane.add(getJSpecificationTextField(), null);
715
716 }
717 return jContentPane;
718 }
719
720 /* (non-Javadoc)
721 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
722 *
723 * Override actionPerformed to listen all actions
724 *
725 */
726 public void actionPerformed(ActionEvent arg0) {
727
728 if (arg0.getSource() == jGenerateGuidButton) {
729 //ToDo: invoke GuidValueEditor
730 jGuidTextField.setText(Tools.generateUuidString());
731 docConsole.setSaved(false);
732 sfc.setSpdHdrGuidValue(jGuidTextField.getText());
733 }
734 }
735
736 /**
737 This method initializes Package type and Compontent type
738
739 **/
740 private void initFrame() {
741
742 }
743
744 /* (non-Javadoc)
745 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
746 *
747 * Override componentResized to resize all components when frame's size is changed
748 */
749 public void componentResized(ComponentEvent arg0) {
750 int intPreferredWidth = dialogWidth;
751 int intCurrentWidth = this.getJContentPane().getWidth();
752
753 // Tools.resizeComponentWidth(this.jPackageNameTextField, intCurrentWidth, intPreferredWidth);
754 // Tools.resizeComponentWidth(this.jGuidTextField, intCurrentWidth, intPreferredWidth);
755 // Tools.resizeComponentWidth(this.jVersionTextField, intCurrentWidth, intPreferredWidth);
756 Tools.resizeComponentWidth(this.jUrlTextField, intCurrentWidth, intPreferredWidth);
757 Tools.resizeComponentWidth(this.jLicenseScrollPane, intCurrentWidth, intPreferredWidth);
758 Tools.resizeComponentWidth(this.jCopyrightTextArea, intCurrentWidth, intPreferredWidth);
759 Tools.resizeComponentWidth(this.jDescriptionScrollPane, intCurrentWidth, intPreferredWidth);
760 // Tools.resizeComponentWidth(this.jSpecificationTextField, intCurrentWidth,intPreferredWidth);
761 Tools.resizeComponentWidth(this.jAbstractTextField, intCurrentWidth, intPreferredWidth);
762 // Tools.relocateComponentX(this.jGenerateGuidButton, intCurrentWidth, jGenerateGuidButton.getWidth(), 30);
763 }
764
765 private JScrollPane getTopScrollPane() {
766 if (topScrollPane == null) {
767 topScrollPane = new JScrollPane();
768 topScrollPane.setViewportView(getJContentPane());
769 }
770 return topScrollPane;
771 }
772 }