5b5b4dfcee7aef98aa8d44dafd24513eb5699d9c
[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 JLabel jLabelSpecification = null;
132
133 private JTextField jSpecificationTextField = null;
134
135 private JButton jButtonOk = null;
136
137 private JButton jButtonCancel = null;
138
139 private JScrollPane jLicenseScrollPane = null;
140
141 private JScrollPane jDescriptionScrollPane = null;
142
143 private JScrollPane jCopyrightScrollPane = null;
144
145 private JLabel jAbstractLabel = null;
146
147 private JTextField jAbstractTextField = null;
148
149 private StarLabel jStarLabel1 = null;
150
151 private StarLabel jStarLabel2 = null;
152
153 private StarLabel jStarLabel3 = null;
154
155 private StarLabel jStarLabel4 = null;
156
157 private StarLabel jStarLabel5 = null;
158
159 private StarLabel jStarLabel6 = null;
160
161 private StarLabel jStarLabel7 = null;
162
163 private StarLabel jStarLabel8 = null;
164
165 private StarLabel jStarLabel9 = null;
166
167 private SpdFileContents sfc = null;
168
169 private OpeningPackageType docConsole = null;
170
171 private JTextArea jCopyrightTextArea = null;
172
173 private JScrollPane topScrollPane = null;
174
175 private JLabel jUrlLabel = null;
176
177 private JTextField jUrlTextField = null;
178
179 private JCheckBox jCheckBoxRdOnly = null;
180
181 private JCheckBox jCheckBoxRePkg = null;
182
183 /**
184 This method initializes jPackageNameTextField
185
186 @return javax.swing.JTextField jPackageNameTextField
187
188 **/
189 private JTextField getJPackageNameTextField() {
190 if (jPackageNameTextField == null) {
191 jPackageNameTextField = new JTextField();
192 jPackageNameTextField.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
193 jPackageNameTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
194 jPackageNameTextField.addFocusListener(new FocusAdapter() {
195 public void focusLost(FocusEvent e) {
196 if (!DataValidation.isUiNameType(jPackageNameTextField.getText())) {
197 JOptionPane.showMessageDialog(frame, "Package Name must start with a letter.");
198 return;
199 }
200 if (jPackageNameTextField.getText().equals(sfc.getSpdHdrPkgName())) {
201 return;
202 }
203 docConsole.setSaved(false);
204 sfc.setSpdHdrPkgName(jPackageNameTextField.getText());
205 }
206 });
207 }
208 return jPackageNameTextField;
209 }
210
211 /**
212 This method initializes jGuidTextField
213
214 @return javax.swing.JTextField jGuidTextField
215
216 **/
217 private JTextField getJGuidTextField() {
218 if (jGuidTextField == null) {
219 jGuidTextField = new JTextField();
220 jGuidTextField.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
221 jGuidTextField.setPreferredSize(new java.awt.Dimension(shortValueWidth, oneRowHeight));
222 jGuidTextField.addFocusListener(new FocusAdapter() {
223 public void focusLost(FocusEvent e) {
224 if (!DataValidation.isGuid(jGuidTextField.getText())) {
225 JOptionPane.showMessageDialog(frame, "Guid must be in registry (8-4-4-4-12) format.");
226 return;
227 }
228 if (jGuidTextField.getText().equals(sfc.getSpdHdrGuidValue())) {
229 return;
230 }
231 docConsole.setSaved(false);
232 sfc.setSpdHdrGuidValue(jGuidTextField.getText());
233 }
234 });
235 }
236 return jGuidTextField;
237 }
238
239 /**
240 This method initializes jVersionTextField
241
242 @return javax.swing.JTextField jVersionTextField
243
244 **/
245 private JTextField getJVersionTextField() {
246 if (jVersionTextField == null) {
247 jVersionTextField = new JTextField();
248 jVersionTextField.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
249 jVersionTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
250 jVersionTextField.addFocusListener(new FocusAdapter() {
251 public void focusLost(FocusEvent e) {
252 if (!DataValidation.isVersion(jVersionTextField.getText())) {
253 JOptionPane.showMessageDialog(frame, "Version must start with a number.");
254 return;
255 }
256 if (jVersionTextField.getText().equals(sfc.getSpdHdrVer())) {
257 return;
258 }
259 docConsole.setSaved(false);
260 sfc.setSpdHdrVer(jVersionTextField.getText());
261 }
262 });
263 }
264 return jVersionTextField;
265 }
266
267 /**
268 This method initializes jGenerateGuidButton
269
270 @return javax.swing.JButton jGenerateGuidButton
271
272 **/
273 private JButton getJGenerateGuidButton() {
274 if (jGenerateGuidButton == null) {
275 jGenerateGuidButton = new JButton();
276 jGenerateGuidButton.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
277 jGenerateGuidButton.setText("GEN");
278 jGenerateGuidButton.addActionListener(this);
279 }
280 return jGenerateGuidButton;
281 }
282
283 /**
284 This method initializes jLicenseTextArea
285
286 @return javax.swing.JTextArea jLicenseTextArea
287
288 **/
289 private JTextArea getJLicenseTextArea() {
290 if (jLicenseTextArea == null) {
291 jLicenseTextArea = new JTextArea();
292 // jLicenseTextArea.setText("");
293 jLicenseTextArea.setLineWrap(true);
294 jLicenseTextArea.addFocusListener(new FocusAdapter() {
295 public void focusLost(FocusEvent e) {
296 if (jLicenseTextArea.getText().length() == 0) {
297 JOptionPane.showMessageDialog(frame, "License is a required field.");
298 return;
299 }
300 if (jLicenseTextArea.getText().equals(sfc.getSpdHdrLicense())) {
301 return;
302 }
303 docConsole.setSaved(false);
304 sfc.setSpdHdrLicense(jLicenseTextArea.getText());
305 }
306 });
307 }
308 return jLicenseTextArea;
309 }
310
311 /**
312 This method initializes jDescriptionTextArea
313
314 @return javax.swing.JTextArea jDescriptionTextArea
315
316 **/
317 private JTextArea getJDescriptionTextArea() {
318 if (jDescriptionTextArea == null) {
319 jDescriptionTextArea = new JTextArea();
320 jDescriptionTextArea.setLineWrap(true);
321 jDescriptionTextArea.addFocusListener(new FocusAdapter() {
322 public void focusLost(FocusEvent e) {
323 if (jDescriptionTextArea.getText().length() == 0) {
324 JOptionPane
325 .showMessageDialog(frame,
326 "Description is a required field, and should reflect the contents of the package.");
327 return;
328 }
329 if (jDescriptionTextArea.getText().equals(sfc.getSpdHdrDescription())) {
330 return;
331 }
332 docConsole.setSaved(false);
333 sfc.setSpdHdrDescription(jDescriptionTextArea.getText());
334 }
335 });
336 }
337 return jDescriptionTextArea;
338 }
339
340 /**
341 This method initializes jSpecificationTextField
342
343 @return javax.swing.JTextField jSpecificationTextField
344
345 **/
346 private JTextField getJSpecificationTextField() {
347 if (jSpecificationTextField == null) {
348 jSpecificationTextField = new JTextField();
349 jSpecificationTextField.setBounds(new java.awt.Rectangle(labelColumn, dialogHeight - 40, specWidth, oneRowHeight));
350 jSpecificationTextField.setEditable(false);
351 jSpecificationTextField.setPreferredSize(new java.awt.Dimension(specWidth, oneRowHeight));
352 jSpecificationTextField.setLocation(new java.awt.Point(2, dialogHeight - oneRowHeight));
353 jSpecificationTextField.setBorder(null);
354
355 // jSpecificationTextField.addFocusListener(new FocusAdapter(){
356 // public void focusLost(FocusEvent e){
357 // sfc.setSpdHdrSpec(jSpecificationTextField.getText());
358 // }
359 // });
360 }
361 return jSpecificationTextField;
362 }
363
364 /**
365 This method initializes jButtonOk
366
367 @return javax.swing.JButton jButtonOk
368
369 **/
370 private JButton getJButtonOk() {
371 if (jButtonOk == null) {
372 jButtonOk = new JButton();
373 jButtonOk.setText("OK");
374 jButtonOk.setBounds(new java.awt.Rectangle(290, 445, 90, oneRowHeight));
375 jButtonOk.setVisible(false);
376 jButtonOk.addActionListener(this);
377 }
378 return jButtonOk;
379 }
380
381 /**
382 This method initializes jButtonCancel
383
384 @return javax.swing.JButton jButtonCancel
385
386 **/
387 private JButton getJButtonCancel() {
388 if (jButtonCancel == null) {
389 jButtonCancel = new JButton();
390 jButtonCancel.setText("Cancel");
391 jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, oneRowHeight));
392 jButtonCancel.setVisible(false);
393 jButtonCancel.addActionListener(this);
394 }
395 return jButtonCancel;
396 }
397
398 /**
399 This method initializes jLicenseScrollPane
400
401 @return javax.swing.JScrollPane jLicenseScrollPane
402
403 **/
404 private JScrollPane getJLicenseScrollPane() {
405 if (jLicenseScrollPane == null) {
406 jLicenseScrollPane = new JScrollPane();
407 jLicenseScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFive, valueWidth, fourRowHeight));
408 jLicenseScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
409 jLicenseScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
410 jLicenseScrollPane.setViewportView(getJLicenseTextArea());
411 }
412 return jLicenseScrollPane;
413 }
414
415 /**
416 This method initializes jDescriptionScrollPane
417
418 @return javax.swing.JScrollPane jDescriptionScrollPane
419
420 **/
421 private JScrollPane getJDescriptionScrollPane() {
422 if (jDescriptionScrollPane == null) {
423 jDescriptionScrollPane = new JScrollPane();
424 jDescriptionScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowEight, valueWidth, fourRowHeight));
425 jDescriptionScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
426 jDescriptionScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
427 jDescriptionScrollPane.setViewportView(getJDescriptionTextArea());
428 }
429 return jDescriptionScrollPane;
430 }
431
432 /**
433 This method initializes jAbstractTextField
434
435 @return javax.swing.JTextField jAbstractTextField
436
437 **/
438 private JTextField getJAbstractTextField() {
439 if (jAbstractTextField == null) {
440 jAbstractTextField = new JTextField();
441 jAbstractTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
442 jAbstractTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
443 jAbstractTextField.addFocusListener(new FocusAdapter() {
444 public void focusLost(FocusEvent e) {
445 if (!DataValidation.isAbstract(jAbstractTextField.getText())) {
446 JOptionPane.showMessageDialog(frame, "Abstract could NOT be empty.");
447 return;
448 }
449 if (jAbstractTextField.getText().equals(sfc.getSpdHdrAbs())) {
450 return;
451 }
452 docConsole.setSaved(false);
453 sfc.setSpdHdrAbs(jAbstractTextField.getText());
454 }
455 });
456 }
457 return jAbstractTextField;
458 }
459
460 private JScrollPane getCopyrightScrollPane() {
461 if (jCopyrightScrollPane == null) {
462 jCopyrightScrollPane = new JScrollPane();
463 jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));
464 jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
465 jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
466 jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());
467 }
468 return jCopyrightScrollPane;
469 }
470 /**
471 This method initializes jTextFieldCopyright
472
473 @return javax.swing.JTextField jTextFieldCopyright
474
475 **/
476 private JTextArea getJCopyrightTextArea() {
477 if (jCopyrightTextArea == null) {
478 jCopyrightTextArea = new JTextArea();
479 jCopyrightTextArea.setWrapStyleWord(true);
480 jCopyrightTextArea.addFocusListener(new FocusAdapter() {
481 public void focusLost(FocusEvent e) {
482 if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
483 JOptionPane.showMessageDialog(frame, "Copyright must be entered.");
484 return;
485 }
486 if (jCopyrightTextArea.getText().equals(sfc.getSpdHdrCopyright())) {
487 return;
488 }
489 docConsole.setSaved(false);
490 sfc.setSpdHdrCopyright(jCopyrightTextArea.getText());
491 }
492 });
493 }
494 return jCopyrightTextArea;
495 }
496
497 /**
498 * This method initializes jTextField
499 *
500 * @return javax.swing.JTextField
501 */
502 private JTextField getJUrlTextField() {
503 if (jUrlTextField == null) {
504 jUrlTextField = new JTextField();
505 jUrlTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSix, valueWidth, oneRowHeight));
506 jUrlTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
507 jUrlTextField.addFocusListener(new FocusAdapter() {
508 public void focusLost(FocusEvent e) {
509 if (jUrlTextField.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {
510 return;
511 }
512 if (jUrlTextField.getText().equals(sfc.getSpdHdrUrl())) {
513 return;
514 }
515 sfc.setSpdHdrLicense(jLicenseTextArea.getText());
516 sfc.setSpdHdrUrl(jUrlTextField.getText());
517 docConsole.setSaved(false);
518 }
519 });
520 }
521 return jUrlTextField;
522 }
523
524 /**
525 * This method initializes jCheckBoxRdOnly
526 *
527 * @return javax.swing.JCheckBox
528 */
529 private JCheckBox getJCheckBoxRdOnly() {
530 if (jCheckBoxRdOnly == null) {
531 jCheckBoxRdOnly = new JCheckBox();
532 jCheckBoxRdOnly.setText("Read Only");
533 jCheckBoxRdOnly.setLocation(new java.awt.Point(labelColumn, rowNine));
534 jCheckBoxRdOnly.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
535 // jCheckBoxRdOnly.setPreferredSize(new java.awt.Dimension(150, oneRowHeight));
536 jCheckBoxRdOnly.addItemListener(new java.awt.event.ItemListener() {
537 public void itemStateChanged(java.awt.event.ItemEvent e) {
538 if (docConsole != null) {
539 docConsole.setSaved(false);
540 }
541 sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected() + "");
542 }
543 });
544 }
545 return jCheckBoxRdOnly;
546 }
547
548 /**
549 * This method initializes jCheckBoxRePkg
550 *
551 * @return javax.swing.JCheckBox
552 */
553 private JCheckBox getJCheckBoxRePkg() {
554 if (jCheckBoxRePkg == null) {
555 jCheckBoxRePkg = new JCheckBox();
556 jCheckBoxRePkg.setLocation(new java.awt.Point(labelColumn, rowTen));
557 jCheckBoxRePkg.setText("RePackagable");
558 jCheckBoxRePkg.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
559 jCheckBoxRePkg.addItemListener(new java.awt.event.ItemListener() {
560 public void itemStateChanged(java.awt.event.ItemEvent e) {
561 if (docConsole != null) {
562 docConsole.setSaved(false);
563 }
564 sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected() + "");
565 }
566 });
567 }
568 return jCheckBoxRePkg;
569 }
570
571 public static void main(String[] args) {
572 new SpdHeader().setVisible(true);
573 }
574
575 /**
576 This is the default constructor
577
578 **/
579 public SpdHeader() {
580 super();
581 init();
582 this.setVisible(true);
583 }
584
585 /**
586 This is the override edit constructor
587
588 @param inspdHeader The input data of spdHeaderDocument.spdHeader
589
590 **/
591 public SpdHeader(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
592 this();
593 sfc = new SpdFileContents(inPsa);
594 init(sfc);
595 }
596
597 public SpdHeader(OpeningPackageType opt) {
598 this(opt.getXmlSpd());
599 docConsole = opt;
600 }
601
602 /**
603 This method initializes this
604
605 **/
606 private void init() {
607 this.setContentPane(getTopScrollPane());
608 this.setTitle("Package Surface Area Header");
609 initFrame();
610 }
611
612 /**
613 This method initializes this
614 Fill values to all fields if these values are not empty
615
616 @param inspdHeader The input data of spdHeaderDocument.spdHeader
617
618 **/
619 private void init(SpdFileContents sfc) {
620 if (sfc.getSpdHdrPkgName() != null) {
621 jPackageNameTextField.setText(sfc.getSpdHdrPkgName());
622 }
623 if (sfc.getSpdHdrGuidValue() != null) {
624 jGuidTextField.setText(sfc.getSpdHdrGuidValue());
625 }
626 if (sfc.getSpdHdrVer() != null) {
627 jVersionTextField.setText(sfc.getSpdHdrVer());
628 }
629 if (sfc.getSpdHdrLicense() != null) {
630 jLicenseTextArea.setText(sfc.getSpdHdrLicense());
631 }
632 if (sfc.getSpdHdrUrl() != null) {
633 jUrlTextField.setText(sfc.getSpdHdrUrl());
634 }
635 if (sfc.getSpdHdrCopyright() != null) {
636 jCopyrightTextArea.setText(sfc.getSpdHdrCopyright());
637 }
638 if (sfc.getSpdHdrAbs() != null) {
639 jAbstractTextField.setText(sfc.getSpdHdrAbs());
640 }
641 if (sfc.getSpdHdrDescription() != null) {
642 jDescriptionTextArea.setText(sfc.getSpdHdrDescription());
643 }
644 if (sfc.getSpdHdrSpec() != null) {
645 jSpecificationTextField.setText(sfc.getSpdHdrSpec());
646 }
647 sfc.setSpdHdrSpec(jSpecificationTextField.getText());
648
649 if (!sfc.getSpdPkgDefsRdOnly().equals("true")) {
650 sfc.setSpdPkgDefsRdOnly("false");
651 jCheckBoxRdOnly.setSelected(false);
652 } else {
653 jCheckBoxRdOnly.setSelected(true);
654 }
655 if (!sfc.getSpdPkgDefsRePkg().equals("true")) {
656 sfc.setSpdPkgDefsRePkg("false");
657 jCheckBoxRePkg.setSelected(false);
658 } else {
659 jCheckBoxRePkg.setSelected(true);
660 }
661
662 }
663
664 /**
665 This method initializes jContentPane
666
667 @return javax.swing.JPanel jContentPane
668
669 **/
670 private JPanel getJContentPane() {
671 if (jContentPane == null) {
672 jStarLabel1 = new StarLabel();
673 jStarLabel1.setLocation(new java.awt.Point(2, rowOne));
674 jStarLabel2 = new StarLabel();
675 jStarLabel2.setLocation(new java.awt.Point(2, rowTwo));
676 jStarLabel3 = new StarLabel();
677 jStarLabel3.setLocation(new java.awt.Point(2, rowThree));
678 jStarLabel4 = new StarLabel();
679 jStarLabel4.setLocation(new java.awt.Point(2, rowFour));
680 jStarLabel5 = new StarLabel();
681 jStarLabel5.setLocation(new java.awt.Point(2, rowFive));
682 jStarLabel6 = new StarLabel();
683 jStarLabel6.setLocation(new java.awt.Point(2, rowSeven));
684 jStarLabel7 = new StarLabel();
685 jStarLabel7.setLocation(new java.awt.Point(2, rowEight));
686 jStarLabel8 = new StarLabel();
687 jStarLabel8.setLocation(new java.awt.Point(2, rowNine));
688 jStarLabel9 = new StarLabel();
689 jStarLabel9.setLocation(new java.awt.Point(2, rowTen));
690
691 jPackageNameLabel = new JLabel();
692 jPackageNameLabel.setText("Package Name");
693 jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
694 jGuidLabel = new JLabel();
695 jGuidLabel.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
696 jGuidLabel.setText("Guid");
697 jVersionLabel = new JLabel();
698 jVersionLabel.setText("Version");
699 jVersionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
700 jLabelCopyright = new JLabel();
701 jLabelCopyright.setText("Copyright");
702 jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
703 jLicenseLabel = new JLabel();
704 jLicenseLabel.setText("License");
705 jLicenseLabel.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
706 jUrlLabel = new JLabel();
707 jUrlLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
708 jUrlLabel.setText("URL");
709 jAbstractLabel = new JLabel();
710 jAbstractLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSeven, labelWidth, oneRowHeight));
711 jAbstractLabel.setText("Abstract");
712 jDescriptionLabel = new JLabel();
713 jDescriptionLabel.setText("Description");
714 jDescriptionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowEight, labelWidth, oneRowHeight));
715
716 jContentPane = new JPanel();
717 jContentPane.setLayout(null);
718 jContentPane.setLocation(new java.awt.Point(0, 0));
719 jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 20, dialogHeight - 20));
720
721 jContentPane.add(jStarLabel1, null);
722 jContentPane.add(jStarLabel2, null);
723 jContentPane.add(jStarLabel3, null);
724 jContentPane.add(jStarLabel4, null);
725 jContentPane.add(jStarLabel5, null);
726 jContentPane.add(jStarLabel6, null);
727 jContentPane.add(jStarLabel7, null);
728 jContentPane.add(jStarLabel8, null);
729 jContentPane.add(jStarLabel9, null);
730
731 jContentPane.add(jPackageNameLabel, null);
732 jContentPane.add(getJPackageNameTextField(), null);
733 jContentPane.add(jGuidLabel, null);
734 jContentPane.add(getJGuidTextField(), null);
735 jContentPane.add(jVersionLabel, null);
736 jContentPane.add(getJVersionTextField(), null);
737 jContentPane.add(getJGenerateGuidButton(), null);
738 jContentPane.add(jLabelCopyright, null);
739 jContentPane.add(getCopyrightScrollPane(), null);
740 jContentPane.add(jLicenseLabel, null);
741 jContentPane.add(getJLicenseScrollPane(), null);
742 jContentPane.add(jUrlLabel, null);
743 jContentPane.add(getJUrlTextField(), null);
744 jContentPane.add(jAbstractLabel, null);
745 jContentPane.add(getJAbstractTextField(), null);
746 jContentPane.add(jDescriptionLabel, null);
747 jContentPane.add(getJDescriptionScrollPane(), null);
748
749 // jContentPane.add(getJButtonOk(), null);
750 // jContentPane.add(getJButtonCancel(), null);
751
752 jContentPane.add(getJCheckBoxRdOnly(), null);
753 jContentPane.add(getJCheckBoxRePkg(), null);
754 jContentPane.add(getJSpecificationTextField(), null);
755
756 }
757 return jContentPane;
758 }
759
760 /* (non-Javadoc)
761 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
762 *
763 * Override actionPerformed to listen all actions
764 *
765 */
766 public void actionPerformed(ActionEvent arg0) {
767
768 if (arg0.getSource() == jGenerateGuidButton) {
769 //ToDo: invoke GuidValueEditor
770 jGuidTextField.setText(Tools.generateUuidString());
771 docConsole.setSaved(false);
772 sfc.setSpdHdrGuidValue(jGuidTextField.getText());
773 }
774 }
775
776 /**
777 This method initializes Package type and Compontent type
778
779 **/
780 private void initFrame() {
781
782 }
783
784 /* (non-Javadoc)
785 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
786 *
787 * Override componentResized to resize all components when frame's size is changed
788 */
789 public void componentResized(ComponentEvent arg0) {
790 int intPreferredWidth = dialogWidth;
791 int intCurrentWidth = this.getJContentPane().getWidth();
792
793 // Tools.resizeComponentWidth(this.jPackageNameTextField, intCurrentWidth, intPreferredWidth);
794 // Tools.resizeComponentWidth(this.jGuidTextField, intCurrentWidth, intPreferredWidth);
795 // Tools.resizeComponentWidth(this.jVersionTextField, intCurrentWidth, intPreferredWidth);
796 Tools.resizeComponentWidth(this.jUrlTextField, intCurrentWidth, intPreferredWidth);
797 Tools.resizeComponentWidth(this.jLicenseScrollPane, intCurrentWidth, intPreferredWidth);
798 Tools.resizeComponentWidth(this.jCopyrightTextArea, intCurrentWidth, intPreferredWidth);
799 Tools.resizeComponentWidth(this.jDescriptionScrollPane, intCurrentWidth, intPreferredWidth);
800 // Tools.resizeComponentWidth(this.jSpecificationTextField, intCurrentWidth,intPreferredWidth);
801 Tools.resizeComponentWidth(this.jAbstractTextField, intCurrentWidth, intPreferredWidth);
802 // Tools.relocateComponentX(this.jGenerateGuidButton, intCurrentWidth, jGenerateGuidButton.getWidth(), 30);
803 }
804
805 private JScrollPane getTopScrollPane() {
806 if (topScrollPane == null) {
807 topScrollPane = new JScrollPane();
808 topScrollPane.setViewportView(getJContentPane());
809 }
810 return topScrollPane;
811 }
812 }