58701918c913106ebe7ac2f7f41d8e0edbc0c898
[mirror_edk2.git] / Tools / Java / 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.setLineWrap(true);
441 jCopyrightTextArea.addFocusListener(new FocusAdapter() {
442 public void focusLost(FocusEvent e) {
443 if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
444 JOptionPane.showMessageDialog(frame, "Copyright must be entered.");
445 return;
446 }
447 if (jCopyrightTextArea.getText().equals(sfc.getSpdHdrCopyright())) {
448 return;
449 }
450 docConsole.setSaved(false);
451 sfc.setSpdHdrCopyright(jCopyrightTextArea.getText());
452 }
453 });
454 }
455 return jCopyrightTextArea;
456 }
457
458 /**
459 * This method initializes jTextField
460 *
461 * @return javax.swing.JTextField
462 */
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.addFocusListener(new FocusAdapter() {
469 public void focusLost(FocusEvent e) {
470 if (jUrlTextField.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {
471 return;
472 }
473 if (jUrlTextField.getText().equals(sfc.getSpdHdrUrl())) {
474 return;
475 }
476 sfc.setSpdHdrLicense(jLicenseTextArea.getText());
477 sfc.setSpdHdrUrl(jUrlTextField.getText());
478 docConsole.setSaved(false);
479 }
480 });
481 }
482 return jUrlTextField;
483 }
484
485 /**
486 * This method initializes jCheckBoxRdOnly
487 *
488 * @return javax.swing.JCheckBox
489 */
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);
500 }
501 sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected()+"");
502 initFrame();
503 }
504 });
505 }
506 return jCheckBoxRdOnly;
507 }
508
509 /**
510 * This method initializes jCheckBoxRePkg
511 *
512 * @return javax.swing.JCheckBox
513 */
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);
524 }
525 sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected()+"");
526 }
527 });
528 }
529 return jCheckBoxRePkg;
530 }
531
532 public static void main(String[] args) {
533 new SpdHeader().setVisible(true);
534 }
535
536 /**
537 This is the default constructor
538
539 **/
540 public SpdHeader() {
541 super();
542 init();
543 this.setVisible(true);
544 }
545
546 /**
547 This is the override edit constructor
548
549 @param inspdHeader The input data of spdHeaderDocument.spdHeader
550
551 **/
552 public SpdHeader(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
553 this();
554 sfc = new SpdFileContents(inPsa);
555 init(sfc);
556 }
557
558 public SpdHeader(OpeningPackageType opt) {
559 this(opt.getXmlSpd());
560 docConsole = opt;
561 initFrame();
562 }
563
564 /**
565 This method initializes this
566
567 **/
568 private void init() {
569 this.setContentPane(getTopScrollPane());
570 this.setTitle("Package Surface Area Header");
571 }
572
573 /**
574 This method initializes this
575 Fill values to all fields if these values are not empty
576
577 @param inspdHeader The input data of spdHeaderDocument.spdHeader
578
579 **/
580 private void init(SpdFileContents sfc) {
581 if (sfc.getSpdHdrPkgName() != null) {
582 jPackageNameTextField.setText(sfc.getSpdHdrPkgName());
583 }
584 if (sfc.getSpdHdrGuidValue() != null) {
585 jGuidTextField.setText(sfc.getSpdHdrGuidValue());
586 }
587 if (sfc.getSpdHdrVer() != null) {
588 jVersionTextField.setText(sfc.getSpdHdrVer());
589 }
590 if (sfc.getSpdHdrLicense() != null) {
591 jLicenseTextArea.setText(sfc.getSpdHdrLicense());
592 }
593 if (sfc.getSpdHdrUrl() != null) {
594 jUrlTextField.setText(sfc.getSpdHdrUrl());
595 }
596 if (sfc.getSpdHdrCopyright() != null) {
597 jCopyrightTextArea.setText(sfc.getSpdHdrCopyright());
598 }
599 if (sfc.getSpdHdrAbs() != null) {
600 jAbstractTextField.setText(sfc.getSpdHdrAbs());
601 }
602 if (sfc.getSpdHdrDescription() != null) {
603 jDescriptionTextArea.setText(sfc.getSpdHdrDescription());
604 }
605 if (sfc.getSpdHdrSpec() != null) {
606 jSpecificationTextField.setText(sfc.getSpdHdrSpec());
607 }
608 sfc.setSpdHdrSpec(jSpecificationTextField.getText());
609
610 if (!sfc.getSpdPkgDefsRdOnly().equals("true")) {
611 sfc.setSpdPkgDefsRdOnly("false");
612 jCheckBoxRdOnly.setSelected(false);
613 } else {
614 jCheckBoxRdOnly.setSelected(true);
615 }
616 if (!sfc.getSpdPkgDefsRePkg().equals("true")) {
617 sfc.setSpdPkgDefsRePkg("false");
618 jCheckBoxRePkg.setSelected(false);
619 } else {
620 jCheckBoxRePkg.setSelected(true);
621 }
622
623 }
624
625 /**
626 This method initializes jContentPane
627
628 @return javax.swing.JPanel jContentPane
629
630 **/
631 private JPanel getJContentPane() {
632 if (jContentPane == null) {
633 jStarLabel1 = new StarLabel();
634 jStarLabel1.setLocation(new java.awt.Point(2, rowOne));
635 jStarLabel2 = new StarLabel();
636 jStarLabel2.setLocation(new java.awt.Point(2, rowTwo));
637 jStarLabel3 = new StarLabel();
638 jStarLabel3.setLocation(new java.awt.Point(2, rowThree));
639 jStarLabel4 = new StarLabel();
640 jStarLabel4.setLocation(new java.awt.Point(2, rowFour));
641 jStarLabel5 = new StarLabel();
642 jStarLabel5.setLocation(new java.awt.Point(2, rowFive));
643 jStarLabel6 = new StarLabel();
644 jStarLabel6.setLocation(new java.awt.Point(2, rowSeven));
645 jStarLabel7 = new StarLabel();
646 jStarLabel7.setLocation(new java.awt.Point(2, rowEight));
647 jStarLabel8 = new StarLabel();
648 jStarLabel8.setLocation(new java.awt.Point(2, rowNine));
649 jStarLabel8.setVisible(false);
650 jStarLabel9 = new StarLabel();
651 jStarLabel9.setLocation(new java.awt.Point(2, rowTen));
652
653 jStarLabel9.setVisible(false);
654 jPackageNameLabel = new JLabel();
655 jPackageNameLabel.setText("Package Name");
656 jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
657 jGuidLabel = new JLabel();
658 jGuidLabel.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
659 jGuidLabel.setText("Guid");
660 jVersionLabel = new JLabel();
661 jVersionLabel.setText("Version");
662 jVersionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
663 jLabelCopyright = new JLabel();
664 jLabelCopyright.setText("Copyright");
665 jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
666 jLicenseLabel = new JLabel();
667 jLicenseLabel.setText("License");
668 jLicenseLabel.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
669 jUrlLabel = new JLabel();
670 jUrlLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
671 jUrlLabel.setText("URL");
672 jAbstractLabel = new JLabel();
673 jAbstractLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSeven, labelWidth, oneRowHeight));
674 jAbstractLabel.setText("Abstract");
675 jDescriptionLabel = new JLabel();
676 jDescriptionLabel.setText("Description");
677 jDescriptionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowEight, labelWidth, oneRowHeight));
678
679 jContentPane = new JPanel();
680 jContentPane.setLayout(null);
681 jContentPane.setLocation(new java.awt.Point(0, 0));
682 jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 20, dialogHeight - 20));
683
684 jContentPane.add(jStarLabel1, null);
685 jContentPane.add(jStarLabel2, null);
686 jContentPane.add(jStarLabel3, null);
687 jContentPane.add(jStarLabel4, null);
688 jContentPane.add(jStarLabel5, null);
689 jContentPane.add(jStarLabel6, null);
690 jContentPane.add(jStarLabel7, null);
691 jContentPane.add(jStarLabel8, null);
692 jContentPane.add(jStarLabel9, null);
693
694 jContentPane.add(jPackageNameLabel, null);
695 jContentPane.add(getJPackageNameTextField(), null);
696 jContentPane.add(jGuidLabel, null);
697 jContentPane.add(getJGuidTextField(), null);
698 jContentPane.add(jVersionLabel, null);
699 jContentPane.add(getJVersionTextField(), null);
700 jContentPane.add(getJGenerateGuidButton(), null);
701 jContentPane.add(jLabelCopyright, null);
702 jContentPane.add(getCopyrightScrollPane(), null);
703 jContentPane.add(jLicenseLabel, null);
704 jContentPane.add(getJLicenseScrollPane(), null);
705 jContentPane.add(jUrlLabel, null);
706 jContentPane.add(getJUrlTextField(), null);
707 jContentPane.add(jAbstractLabel, null);
708 jContentPane.add(getJAbstractTextField(), null);
709 jContentPane.add(jDescriptionLabel, null);
710 jContentPane.add(getJDescriptionScrollPane(), null);
711
712 // jContentPane.add(getJButtonOk(), null);
713 // jContentPane.add(getJButtonCancel(), null);
714
715 jContentPane.add(getJCheckBoxRdOnly(), null);
716 jContentPane.add(getJCheckBoxRePkg(), null);
717 jContentPane.add(getJSpecificationTextField(), null);
718
719 }
720 return jContentPane;
721 }
722
723 /* (non-Javadoc)
724 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
725 *
726 * Override actionPerformed to listen all actions
727 *
728 */
729 public void actionPerformed(ActionEvent arg0) {
730
731 if (arg0.getSource() == jGenerateGuidButton) {
732 //ToDo: invoke GuidValueEditor
733 jGuidTextField.setText(Tools.generateUuidString());
734 docConsole.setSaved(false);
735 sfc.setSpdHdrGuidValue(jGuidTextField.getText());
736 }
737 }
738
739 /**
740 This method initializes Package type and Compontent type
741
742 **/
743 private void initFrame() {
744 boolean editable = true;
745 if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
746 editable = false;
747 }
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);
758 }
759
760 /* (non-Javadoc)
761 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
762 *
763 * Override componentResized to resize all components when frame's size is changed
764 */
765 public void componentResized(ComponentEvent arg0) {
766 int intPreferredWidth = dialogWidth;
767 int intCurrentWidth = this.getJContentPane().getWidth();
768
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);
779 }
780
781 private JScrollPane getTopScrollPane() {
782 if (topScrollPane == null) {
783 topScrollPane = new JScrollPane();
784 topScrollPane.setViewportView(getJContentPane());
785 }
786 return topScrollPane;
787 }
788 }