1. Modify start script to
[mirror_edk2.git] / Tools / Source / ModuleEditor / src / org / tianocore / packaging / module / ui / MsaHeader.java
1 /** @file
2
3 The file is used to create, update MsaHeader of MSA 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.packaging.module.ui;
17
18 import java.awt.event.ActionEvent;
19
20 import javax.swing.JButton;
21 import javax.swing.JComboBox;
22 import javax.swing.JLabel;
23 import javax.swing.JPanel;
24 import javax.swing.JScrollPane;
25 import javax.swing.JTextArea;
26 import javax.swing.JTextField;
27
28 import org.tianocore.AbstractDocument;
29 import org.tianocore.BaseNameDocument;
30 import org.tianocore.FrameworkComponentTypes;
31 import org.tianocore.GuidDocument;
32 import org.tianocore.LicenseDocument;
33 import org.tianocore.ModuleTypeDef;
34 import org.tianocore.MsaHeaderDocument;
35 import org.tianocore.SpecificationDocument;
36 import org.tianocore.common.DataValidation;
37 import org.tianocore.common.Log;
38 import org.tianocore.common.Tools;
39 import org.tianocore.packaging.common.ui.IInternalFrame;
40 import org.tianocore.packaging.common.ui.StarLabel;
41
42 /**
43 The class is used to create, update MsaHeader of MSA file
44 It extends IInternalFrame
45
46 @since ModuleEditor 1.0
47
48 **/
49 public class MsaHeader extends IInternalFrame {
50
51 ///
52 /// Define class Serial Version UID
53 ///
54 private static final long serialVersionUID = -8152099582923006900L;
55
56 //
57 //Define class members
58 //
59 private JPanel jContentPane = null;
60
61 private JLabel jLabelBaseName = null;
62
63 private JTextField jTextFieldBaseName = null;
64
65 private JLabel jLabelGuid = null;
66
67 private JTextField jTextFieldGuid = null;
68
69 private JLabel jLabelVersion = null;
70
71 private JTextField jTextFieldVersion = null;
72
73 private JButton jButtonGenerateGuid = null;
74
75 private JLabel jLabelLicense = null;
76
77 private JTextArea jTextAreaLicense = null;
78
79 private JLabel jLabelCopyright = null;
80
81 private JLabel jLabelDescription = null;
82
83 private JTextArea jTextAreaDescription = null;
84
85 private JLabel jLabelSpecification = null;
86
87 private JTextField jTextFieldSpecification = null;
88
89 private JButton jButtonOk = null;
90
91 private JButton jButtonCancel = null;
92
93 private JScrollPane jScrollPaneLicense = null;
94
95 private JScrollPane jScrollPaneDescription = null;
96
97 private JLabel jLabelAbstract = null;
98
99 private JTextField jTextFieldAbstract = null;
100
101 private JLabel jLabelModuleType = null;
102
103 private JLabel jLabelCompontentType = null;
104
105 private JComboBox jComboBoxCompontentType = null;
106
107 private JComboBox jComboBoxModuleType = null;
108
109 private StarLabel jStarLabel1 = null;
110
111 private StarLabel jStarLabel2 = null;
112
113 private StarLabel jStarLabel3 = null;
114
115 private StarLabel jStarLabel4 = null;
116
117 private StarLabel jStarLabel5 = null;
118
119 private StarLabel jStarLabel6 = null;
120
121 private StarLabel jStarLabel7 = null;
122
123 private StarLabel jStarLabel8 = null;
124
125 private StarLabel jStarLabel9 = null;
126
127 private MsaHeaderDocument.MsaHeader msaHeader = null;
128
129 private JLabel jLabelURL = null;
130
131 private JTextField jTextFieldAbstractURL = null;
132
133 private JTextField jTextFieldCopyright = null;
134
135 /**
136 This method initializes jTextFieldBaseName
137
138 @return javax.swing.JTextField jTextFieldBaseName
139
140 **/
141 private JTextField getJTextFieldBaseName() {
142 if (jTextFieldBaseName == null) {
143 jTextFieldBaseName = new JTextField();
144 jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
145 }
146 return jTextFieldBaseName;
147 }
148
149 /**
150 This method initializes jTextFieldGuid
151
152 @return javax.swing.JTextField jTextFieldGuid
153
154 **/
155 private JTextField getJTextFieldGuid() {
156 if (jTextFieldGuid == null) {
157 jTextFieldGuid = new JTextField();
158 jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20));
159 }
160 return jTextFieldGuid;
161 }
162
163 /**
164 This method initializes jTextFieldVersion
165
166 @return javax.swing.JTextField jTextFieldVersion
167
168 **/
169 private JTextField getJTextFieldVersion() {
170 if (jTextFieldVersion == null) {
171 jTextFieldVersion = new JTextField();
172 jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
173 }
174 return jTextFieldVersion;
175 }
176
177 /**
178 This method initializes jButtonGenerateGuid
179
180 @return javax.swing.JButton jButtonGenerateGuid
181
182 **/
183 private JButton getJButtonGenerateGuid() {
184 if (jButtonGenerateGuid == null) {
185 jButtonGenerateGuid = new JButton();
186 jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));
187 jButtonGenerateGuid.setText("GEN");
188 jButtonGenerateGuid.addActionListener(this);
189 }
190 return jButtonGenerateGuid;
191 }
192
193 /**
194 This method initializes jTextAreaLicense
195
196 @return javax.swing.JTextArea jTextAreaLicense
197
198 **/
199 private JTextArea getJTextAreaLicense() {
200 if (jTextAreaLicense == null) {
201 jTextAreaLicense = new JTextArea();
202 jTextAreaLicense.setText("");
203 jTextAreaLicense.setLineWrap(true);
204 }
205 return jTextAreaLicense;
206 }
207
208 /**
209 This method initializes jTextAreaDescription
210
211 @return javax.swing.JTextArea jTextAreaDescription
212
213 **/
214 private JTextArea getJTextAreaDescription() {
215 if (jTextAreaDescription == null) {
216 jTextAreaDescription = new JTextArea();
217 jTextAreaDescription.setLineWrap(true);
218 }
219 return jTextAreaDescription;
220 }
221
222 /**
223 This method initializes jTextFieldSpecification
224
225 @return javax.swing.JTextField jTextFieldSpecification
226
227 **/
228 private JTextField getJTextFieldSpecification() {
229 if (jTextFieldSpecification == null) {
230 jTextFieldSpecification = new JTextField();
231 jTextFieldSpecification.setBounds(new java.awt.Rectangle(160, 280, 320, 20));
232 }
233 return jTextFieldSpecification;
234 }
235
236 /**
237 This method initializes jButtonOk
238
239 @return javax.swing.JButton jButtonOk
240
241 **/
242 private JButton getJButtonOk() {
243 if (jButtonOk == null) {
244 jButtonOk = new JButton();
245 jButtonOk.setText("OK");
246 jButtonOk.setBounds(new java.awt.Rectangle(290, 445, 90, 20));
247 jButtonOk.addActionListener(this);
248 }
249 return jButtonOk;
250 }
251
252 /**
253 This method initializes jButtonCancel
254
255 @return javax.swing.JButton jButtonCancel
256
257 **/
258 private JButton getJButtonCancel() {
259 if (jButtonCancel == null) {
260 jButtonCancel = new JButton();
261 jButtonCancel.setText("Cancel");
262 jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));
263 jButtonCancel.addActionListener(this);
264 }
265 return jButtonCancel;
266 }
267
268 /**
269 This method initializes jScrollPaneLicense
270
271 @return javax.swing.JScrollPane jScrollPaneLicense
272
273 **/
274 private JScrollPane getJScrollPaneLicense() {
275 if (jScrollPaneLicense == null) {
276 jScrollPaneLicense = new JScrollPane();
277 jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80));
278 jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
279 jScrollPaneLicense.setViewportView(getJTextAreaLicense());
280 }
281 return jScrollPaneLicense;
282 }
283
284 /**
285 This method initializes jScrollPaneDescription
286
287 @return javax.swing.JScrollPane jScrollPaneDescription
288
289 **/
290 private JScrollPane getJScrollPaneDescription() {
291 if (jScrollPaneDescription == null) {
292 jScrollPaneDescription = new JScrollPane();
293 jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 195, 320, 80));
294 jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
295 jScrollPaneDescription.setViewportView(getJTextAreaDescription());
296 }
297 return jScrollPaneDescription;
298 }
299
300 /**
301 This method initializes jTextFieldAbstract
302
303 @return javax.swing.JTextField jTextFieldAbstract
304
305 **/
306 private JTextField getJTextFieldAbstract() {
307 if (jTextFieldAbstract == null) {
308 jTextFieldAbstract = new JTextField();
309 jTextFieldAbstract.setBounds(new java.awt.Rectangle(160, 305, 320, 20));
310 }
311 return jTextFieldAbstract;
312 }
313
314 /**
315 This method initializes jComboBoxCompontentType
316
317 @return javax.swing.JComboBox jComboBoxCompontentType
318
319 **/
320 private JComboBox getJComboBoxCompontentType() {
321 if (jComboBoxCompontentType == null) {
322 jComboBoxCompontentType = new JComboBox();
323 jComboBoxCompontentType.setBounds(new java.awt.Rectangle(160, 380, 320, 20));
324 }
325 return jComboBoxCompontentType;
326 }
327
328 /**
329 This method initializes jComboBoxModuleType
330
331 @return javax.swing.JComboBox jComboBoxModuleType
332
333 **/
334 private JComboBox getJComboBoxModuleType() {
335 if (jComboBoxModuleType == null) {
336 jComboBoxModuleType = new JComboBox();
337 jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 355, 320, 20));
338 }
339 return jComboBoxModuleType;
340 }
341
342 /**
343 This method initializes jTextFieldAbstractURL
344
345 @return javax.swing.JTextField jTextFieldAbstractURL
346
347 **/
348 private JTextField getJTextFieldAbstractURL() {
349 if (jTextFieldAbstractURL == null) {
350 jTextFieldAbstractURL = new JTextField();
351 jTextFieldAbstractURL.setBounds(new java.awt.Rectangle(160, 330, 320, 20));
352 }
353 return jTextFieldAbstractURL;
354 }
355
356 /**
357 This method initializes jTextFieldCopyright
358
359 @return javax.swing.JTextField jTextFieldCopyright
360
361 **/
362 private JTextField getJTextFieldCopyright() {
363 if (jTextFieldCopyright == null) {
364 jTextFieldCopyright = new JTextField();
365 jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,170,320, 20));
366 }
367 return jTextFieldCopyright;
368 }
369
370 public static void main(String[] args) {
371
372 }
373
374 /**
375 This is the default constructor
376
377 **/
378 public MsaHeader() {
379 super();
380 init();
381 this.setVisible(true);
382 }
383
384 /**
385 This is the override edit constructor
386
387 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
388
389 **/
390 public MsaHeader(MsaHeaderDocument.MsaHeader inMsaHeader) {
391 super();
392 init(inMsaHeader);
393 this.setVisible(true);
394 this.setViewMode(false);
395 }
396
397 /**
398 Disable all components when the mode is view
399
400 @param isView true - The view mode; false - The non-view mode
401
402 **/
403 public void setViewMode(boolean isView) {
404 this.jButtonOk.setVisible(false);
405 this.jButtonCancel.setVisible(false);
406 if (isView) {
407 this.jTextFieldBaseName.setEnabled(!isView);
408 this.jTextFieldGuid.setEnabled(!isView);
409 this.jTextFieldVersion.setEnabled(!isView);
410 this.jTextAreaLicense.setEnabled(!isView);
411 this.jTextFieldCopyright.setEnabled(!isView);
412 this.jTextAreaDescription.setEnabled(!isView);
413 this.jTextFieldSpecification.setEnabled(!isView);
414 this.jTextFieldAbstract.setEnabled(!isView);
415 this.jTextFieldAbstractURL.setEnabled(!isView);
416 this.jComboBoxModuleType.setEnabled(!isView);
417 this.jComboBoxCompontentType.setEnabled(!isView);
418 this.jButtonCancel.setEnabled(!isView);
419 this.jButtonGenerateGuid.setEnabled(!isView);
420 this.jButtonOk.setEnabled(!isView);
421 }
422 }
423
424 /**
425 This method initializes this
426
427 **/
428 private void init() {
429 this.setSize(500, 515);
430 this.setContentPane(getJContentPane());
431 this.setTitle("Module Surface Area Header");
432 initFrame();
433 }
434
435 /**
436 This method initializes this
437 Fill values to all fields if these values are not empty
438
439 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
440
441 **/
442 private void init(MsaHeaderDocument.MsaHeader inMsaHeader) {
443 init();
444 if (inMsaHeader != null) {
445 setMsaHeader(inMsaHeader);
446 if (this.msaHeader.getBaseName() != null) {
447 this.jTextFieldBaseName.setText(this.msaHeader.getBaseName().getStringValue());
448 }
449 if (this.msaHeader.getGuid() != null) {
450 this.jTextFieldGuid.setText(this.msaHeader.getGuid().getStringValue());
451 }
452 if (this.msaHeader.getVersion() != null) {
453 this.jTextFieldVersion.setText(this.msaHeader.getVersion());
454 }
455 if (this.msaHeader.getLicense() != null) {
456 this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue());
457 }
458 if (this.msaHeader.getCopyright() != null) {
459 this.jTextFieldCopyright.setText(this.msaHeader.getCopyright());
460 }
461 if (this.msaHeader.getDescription() != null) {
462 this.jTextAreaDescription.setText(this.msaHeader.getDescription());
463 }
464 if (this.msaHeader.getSpecification() != null) {
465 this.jTextFieldSpecification.setText(this.msaHeader.getSpecification().getStringValue());
466 }
467 if (this.msaHeader.getAbstract() != null) {
468 this.jTextFieldAbstract.setText(this.msaHeader.getAbstract().getStringValue());
469 this.jTextFieldAbstractURL.setText(this.msaHeader.getAbstract().getURL());
470 }
471 if (this.msaHeader.getModuleType() != null) {
472 this.jComboBoxModuleType.setSelectedItem(this.msaHeader.getModuleType().toString());
473 }
474 if (this.msaHeader.getComponentType() != null) {
475 this.jComboBoxCompontentType.setSelectedItem(this.msaHeader.getComponentType().toString());
476 }
477 }
478 }
479
480 /**
481 This method initializes jContentPane
482
483 @return javax.swing.JPanel jContentPane
484
485 **/
486 private JPanel getJContentPane() {
487 if (jContentPane == null) {
488 jLabelURL = new JLabel();
489 jLabelURL.setBounds(new java.awt.Rectangle(15,330,140,20));
490 jLabelURL.setText("URL");
491 jLabelCompontentType = new JLabel();
492 jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 380, 140, 20));
493 jLabelCompontentType.setText("Compontent Type");
494 jLabelModuleType = new JLabel();
495 jLabelModuleType.setBounds(new java.awt.Rectangle(15, 355, 140, 20));
496 jLabelModuleType.setText("Module Type");
497 jLabelAbstract = new JLabel();
498 jLabelAbstract.setBounds(new java.awt.Rectangle(15, 305, 140, 20));
499 jLabelAbstract.setText("Abstract");
500 jLabelSpecification = new JLabel();
501 jLabelSpecification.setText("Specification");
502 jLabelSpecification.setBounds(new java.awt.Rectangle(15, 280, 140, 20));
503 jLabelDescription = new JLabel();
504 jLabelDescription.setText("Description");
505 jLabelDescription.setBounds(new java.awt.Rectangle(15, 195, 140, 20));
506 jLabelCopyright = new JLabel();
507 jLabelCopyright.setText("Copyright");
508 jLabelCopyright.setBounds(new java.awt.Rectangle(15, 170, 140, 20));
509 jLabelLicense = new JLabel();
510 jLabelLicense.setText("License");
511 jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
512 jLabelVersion = new JLabel();
513 jLabelVersion.setText("Version");
514 jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
515 jLabelGuid = new JLabel();
516 jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));
517 jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
518 jLabelGuid.setText("Guid");
519 jLabelBaseName = new JLabel();
520 jLabelBaseName.setText("Base Name");
521 jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
522 jContentPane = new JPanel();
523 jContentPane.setLayout(null);
524 jContentPane.setLocation(new java.awt.Point(0, 0));
525 jContentPane.setSize(new java.awt.Dimension(500, 524));
526 jContentPane.add(jLabelBaseName, null);
527 jContentPane.add(getJTextFieldBaseName(), null);
528 jContentPane.add(jLabelGuid, null);
529 jContentPane.add(getJTextFieldGuid(), null);
530 jContentPane.add(jLabelVersion, null);
531 jContentPane.add(getJTextFieldVersion(), null);
532 jContentPane.add(getJButtonGenerateGuid(), null);
533 jContentPane.add(jLabelLicense, null);
534 jContentPane.add(jLabelCopyright, null);
535 jContentPane.add(jLabelDescription, null);
536 jContentPane.add(jLabelSpecification, null);
537 jContentPane.add(getJTextFieldSpecification(), null);
538 jContentPane.add(getJButtonOk(), null);
539 jContentPane.add(getJButtonCancel(), null);
540 jContentPane.add(getJScrollPaneLicense(), null);
541 jContentPane.add(getJScrollPaneDescription(), null);
542 jContentPane.add(jLabelAbstract, null);
543 jContentPane.add(getJTextFieldAbstract(), null);
544 jContentPane.add(jLabelModuleType, null);
545 jContentPane.add(jLabelCompontentType, null);
546 jContentPane.add(getJComboBoxCompontentType(), null);
547 jContentPane.add(getJComboBoxModuleType(), null);
548
549 jStarLabel1 = new StarLabel();
550 jStarLabel1.setLocation(new java.awt.Point(0, 10));
551 jStarLabel2 = new StarLabel();
552 jStarLabel2.setLocation(new java.awt.Point(0, 35));
553 jStarLabel3 = new StarLabel();
554 jStarLabel3.setLocation(new java.awt.Point(0, 60));
555 jStarLabel4 = new StarLabel();
556 jStarLabel4.setLocation(new java.awt.Point(0, 85));
557 jStarLabel5 = new StarLabel();
558 jStarLabel5.setLocation(new java.awt.Point(0, 170));
559 jStarLabel6 = new StarLabel();
560 jStarLabel6.setLocation(new java.awt.Point(0, 195));
561 jStarLabel7 = new StarLabel();
562 jStarLabel7.setLocation(new java.awt.Point(0, 305));
563 jStarLabel8 = new StarLabel();
564 jStarLabel8.setLocation(new java.awt.Point(0, 355));
565 jStarLabel9 = new StarLabel();
566 jStarLabel9.setLocation(new java.awt.Point(0, 380));
567
568 jContentPane.add(jStarLabel1, null);
569 jContentPane.add(jStarLabel2, null);
570 jContentPane.add(jStarLabel3, null);
571 jContentPane.add(jStarLabel4, null);
572 jContentPane.add(jStarLabel5, null);
573 jContentPane.add(jStarLabel6, null);
574 jContentPane.add(jStarLabel7, null);
575 jContentPane.add(jStarLabel8, null);
576 jContentPane.add(jStarLabel9, null);
577 jContentPane.add(jLabelURL, null);
578 jContentPane.add(getJTextFieldAbstractURL(), null);
579 jContentPane.add(getJTextFieldCopyright(), null);
580 }
581 return jContentPane;
582 }
583
584 /* (non-Javadoc)
585 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
586 *
587 * Override actionPerformed to listen all actions
588 *
589 */
590 public void actionPerformed(ActionEvent arg0) {
591 if (arg0.getSource() == jButtonOk) {
592 this.save();
593 this.setEdited(true);
594 }
595 if (arg0.getSource() == jButtonCancel) {
596 this.setEdited(false);
597 }
598 if (arg0.getSource() == jButtonGenerateGuid) {
599 jTextFieldGuid.setText(Tools.generateUuidString());
600 }
601 }
602
603 /**
604 Data validation for all fields
605
606 @retval true - All datas are valid
607 @retval false - At least one data is invalid
608
609 **/
610 public boolean check() {
611 //
612 // Check if all required fields are not empty
613 //
614 if (isEmpty(this.jTextFieldBaseName.getText())) {
615 Log.err("Base Name couldn't be empty");
616 return false;
617 }
618 if (isEmpty(this.jTextFieldGuid.getText())) {
619 Log.err("Guid couldn't be empty");
620 return false;
621 }
622 if (isEmpty(this.jTextFieldVersion.getText())) {
623 Log.err("Version couldn't be empty");
624 return false;
625 }
626 if (isEmpty(this.jTextAreaLicense.getText())) {
627 Log.err("License couldn't be empty");
628 return false;
629 }
630 if (isEmpty(this.jTextFieldCopyright.getText())) {
631 Log.err("Copyright couldn't be empty");
632 return false;
633 }
634 if (isEmpty(this.jTextAreaDescription.getText())) {
635 Log.err("Description couldn't be empty");
636 return false;
637 }
638 if (isEmpty(this.jTextFieldAbstract.getText())) {
639 Log.err("Abstract couldn't be empty");
640 return false;
641 }
642
643 //
644 // Check if all fields have correct data types
645 //
646 if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
647 Log.err("Incorrect data type for Base Name");
648 return false;
649 }
650 if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
651 Log.err("Incorrect data type for Guid");
652 return false;
653 }
654 if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
655 Log.err("Incorrect data type for Abstract");
656 return false;
657 }
658 if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {
659 Log.err("Incorrect data type for Copyright");
660 return false;
661 }
662 return true;
663 }
664
665 /**
666 Save all components of Msa Header
667 if exists msaHeader, set the value directly
668 if not exists msaHeader, new an instance first
669
670 **/
671 public void save() {
672 try {
673 if (this.msaHeader == null) {
674 msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
675 }
676 if (this.msaHeader.getBaseName() != null) {
677 this.msaHeader.getBaseName().setStringValue(this.jTextFieldBaseName.getText());
678 } else {
679 BaseNameDocument.BaseName mBaseName = BaseNameDocument.BaseName.Factory.newInstance();
680 mBaseName.setStringValue(this.jTextFieldBaseName.getText());
681 this.msaHeader.setBaseName(mBaseName);
682 }
683
684 if (this.msaHeader.getGuid() != null) {
685 this.msaHeader.getGuid().setStringValue(this.jTextFieldGuid.getText());
686 } else {
687 GuidDocument.Guid mGuid = GuidDocument.Guid.Factory.newInstance();
688 mGuid.setStringValue(this.jTextFieldGuid.getText());
689 this.msaHeader.setGuid(mGuid);
690 }
691
692 this.msaHeader.setVersion(this.jTextFieldVersion.getText());
693
694 if (this.msaHeader.getLicense() != null) {
695 this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
696 } else {
697 LicenseDocument.License mLicense = LicenseDocument.License.Factory.newInstance();
698 mLicense.setStringValue(this.jTextAreaLicense.getText());
699 this.msaHeader.setLicense(mLicense);
700 }
701
702 this.msaHeader.setCopyright(this.jTextFieldCopyright.getText());
703 this.msaHeader.setDescription(this.jTextAreaDescription.getText());
704
705 if (this.msaHeader.getSpecification() != null) {
706 this.msaHeader.getSpecification().setStringValue(this.jTextFieldSpecification.getText());
707 } else {
708 SpecificationDocument.Specification mSpecification = SpecificationDocument.Specification.Factory
709 .newInstance();
710 mSpecification.setStringValue(this.jTextFieldSpecification.getText());
711 this.msaHeader.setSpecification(mSpecification);
712 }
713
714 if (this.msaHeader.getAbstract() != null) {
715 this.msaHeader.getAbstract().setStringValue(this.jTextFieldAbstract.getText());
716 this.msaHeader.getAbstract().setURL(this.jTextFieldAbstractURL.getText());
717 } else {
718 AbstractDocument.Abstract mAbstract = AbstractDocument.Abstract.Factory.newInstance();
719 mAbstract.setStringValue(this.jTextFieldAbstract.getText());
720 mAbstract.setURL(this.jTextFieldAbstractURL.getText());
721 this.msaHeader.setAbstract(mAbstract);
722 }
723 this.msaHeader.setModuleType(ModuleTypeDef.Enum.forString(this.jComboBoxModuleType.getSelectedItem()
724 .toString()));
725 this.msaHeader
726 .setComponentType(FrameworkComponentTypes.Enum
727 .forString(this.jComboBoxCompontentType
728 .getSelectedItem()
729 .toString()));
730 if (this.msaHeader.getCreated() == null) {
731 this.msaHeader.setCreated(Tools.getCurrentDateTime());
732 } else {
733 this.msaHeader.setUpdated(Tools.getCurrentDateTime());
734 }
735
736 } catch (Exception e) {
737 Log.err("Save Module", e.getMessage());
738 }
739 }
740
741 /**
742 This method initializes Module type and Compontent type
743
744 **/
745 private void initFrame() {
746 jComboBoxModuleType.addItem("BASE");
747 jComboBoxModuleType.addItem("SEC");
748 jComboBoxModuleType.addItem("PEI_CORE");
749 jComboBoxModuleType.addItem("PEIM");
750 jComboBoxModuleType.addItem("DXE_CORE");
751 jComboBoxModuleType.addItem("DXE_DRIVER");
752 jComboBoxModuleType.addItem("DXE_RUNTIME_DRIVER");
753 jComboBoxModuleType.addItem("DXE_SAL_DRIVER");
754 jComboBoxModuleType.addItem("DXE_SMM_DRIVER");
755 jComboBoxModuleType.addItem("TOOLS");
756 jComboBoxModuleType.addItem("UEFI_DRIVER");
757 jComboBoxModuleType.addItem("UEFI_APPLICATION");
758 jComboBoxModuleType.addItem("USER_DEFINED");
759
760 jComboBoxCompontentType.addItem("APRIORI");
761 jComboBoxCompontentType.addItem("LIBRARY");
762 jComboBoxCompontentType.addItem("FV_IMAGE_FILE");
763 jComboBoxCompontentType.addItem("BS_DRIVER");
764 jComboBoxCompontentType.addItem("RT_DRIVER");
765 jComboBoxCompontentType.addItem("SAL_RT_DRIVER");
766 jComboBoxCompontentType.addItem("PE32_PEIM");
767 jComboBoxCompontentType.addItem("PIC_PEIM");
768 jComboBoxCompontentType.addItem("COMBINED_PEIM_DRIVER");
769 jComboBoxCompontentType.addItem("PEI_CORE");
770 jComboBoxCompontentType.addItem("DXE_CORE");
771 jComboBoxCompontentType.addItem("APPLICATION");
772 jComboBoxCompontentType.addItem("BS_DRIVER_EFI");
773 jComboBoxCompontentType.addItem("SHELLAPP");
774 }
775
776 /**
777 Get MsaHeaderDocument.MsaHeader
778
779 @return MsaHeaderDocument.MsaHeader
780
781 **/
782 public MsaHeaderDocument.MsaHeader getMsaHeader() {
783 return msaHeader;
784 }
785
786 /**
787 Set MsaHeaderDocument.MsaHeader
788
789 @param msaHeader The input data of MsaHeaderDocument.MsaHeader
790
791 **/
792 public void setMsaHeader(MsaHeaderDocument.MsaHeader msaHeader) {
793 this.msaHeader = msaHeader;
794 }
795 }