1. Modify start script to
[mirror_edk2.git] / Tools / Source / ModuleEditor / src / org / tianocore / packaging / module / ui / MsaLibHeader.java
1 /** @file
2
3 The file is used to create, update MsaLibHeader of a 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.MsaLibHeaderDocument;
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 MsaLibHeader of a MSA file
44 It extends IInternalFrame
45
46 @since ModuleEditor 1.0
47
48 **/
49 public class MsaLibHeader extends IInternalFrame {
50
51 ///
52 /// Define class Serial Version UID
53 ///
54 private static final long serialVersionUID = 5526729363068526262L;
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 MsaLibHeaderDocument.MsaLibHeader msaLibHeader = 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
360 */
361 private JTextField getJTextFieldCopyright() {
362 if (jTextFieldCopyright == null) {
363 jTextFieldCopyright = new JTextField();
364 jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,170,320,20));
365 }
366 return jTextFieldCopyright;
367 }
368
369 public static void main(String[] args) {
370
371 }
372
373 /**
374 This is the default constructor
375
376 **/
377 public MsaLibHeader() {
378 super();
379 init();
380 this.setVisible(true);
381 }
382
383 /**
384 This is the override edit constructor
385
386 @param inMsaLibHeader The input data of MsaLibHeaderDocument.MsaLibHeader
387
388 **/
389 public MsaLibHeader(MsaLibHeaderDocument.MsaLibHeader inMsaLibHeader) {
390 super();
391 init(inMsaLibHeader);
392 this.setVisible(true);
393 this.setViewMode(false);
394 }
395
396 /**
397 This method initializes this
398
399 **/
400 private void init() {
401 this.setSize(500, 515);
402 this.setContentPane(getJContentPane());
403 this.setTitle("Library Module");
404 initFrame();
405 }
406
407 /**
408 This method initializes this
409 Fill values to all fields if these values are not empty
410
411 @param inMsaLibHeader The input data of MsaLibHeaderDocument.MsaLibHeader
412
413 **/
414 private void init(MsaLibHeaderDocument.MsaLibHeader inMsaLibHeader) {
415 init();
416 this.setMsaLibHeader(inMsaLibHeader);
417 if (inMsaLibHeader != null) {
418 if (this.msaLibHeader.getBaseName() != null) {
419 this.jTextFieldBaseName.setText(this.msaLibHeader.getBaseName().getStringValue());
420 }
421 if (this.msaLibHeader.getGuid() != null) {
422 this.jTextFieldGuid.setText(this.msaLibHeader.getGuid().getStringValue());
423 }
424 if (this.msaLibHeader.getVersion() != null) {
425 this.jTextFieldVersion.setText(this.msaLibHeader.getVersion());
426 }
427 if (this.msaLibHeader.getLicense() != null) {
428 this.jTextAreaLicense.setText(this.msaLibHeader.getLicense().getStringValue());
429 }
430 if (this.msaLibHeader.getCopyright() != null) {
431 this.jTextFieldCopyright.setText(this.msaLibHeader.getCopyright());
432 }
433 if (this.msaLibHeader.getDescription() != null) {
434 this.jTextAreaDescription.setText(this.msaLibHeader.getDescription());
435 }
436 if (this.msaLibHeader.getSpecification() != null) {
437 this.jTextFieldSpecification.setText(this.msaLibHeader.getSpecification().getStringValue());
438 }
439 if (this.msaLibHeader.getAbstract() != null) {
440 this.jTextFieldAbstract.setText(this.msaLibHeader.getAbstract().getStringValue());
441 this.jTextFieldAbstractURL.setText(this.msaLibHeader.getAbstract().getURL());
442 }
443 if (this.msaLibHeader.getModuleType() != null) {
444 this.jComboBoxModuleType.setSelectedItem(this.msaLibHeader.getModuleType().toString());
445 }
446 if (this.msaLibHeader.getComponentType() != null) {
447 this.jComboBoxCompontentType.setSelectedItem(this.msaLibHeader.getComponentType().toString());
448 }
449 }
450 }
451
452 /**
453 Disable all components when the mode is view
454
455 @param isView true - The view mode; false - The non-view mode
456
457 **/
458 public void setViewMode(boolean isView) {
459 this.jButtonOk.setVisible(false);
460 this.jButtonCancel.setVisible(false);
461 if (isView) {
462 this.jTextFieldBaseName.setEnabled(!isView);
463 this.jTextFieldGuid.setEnabled(!isView);
464 this.jTextFieldVersion.setEnabled(!isView);
465 this.jTextAreaLicense.setEnabled(!isView);
466 this.jTextFieldCopyright.setEnabled(!isView);
467 this.jTextAreaDescription.setEnabled(!isView);
468 this.jTextFieldSpecification.setEnabled(!isView);
469 this.jTextFieldAbstract.setEnabled(!isView);
470 this.jTextFieldAbstractURL.setEnabled(!isView);
471 this.jComboBoxModuleType.setEnabled(!isView);
472 this.jComboBoxCompontentType.setEnabled(!isView);
473 this.jButtonCancel.setEnabled(!isView);
474 this.jButtonGenerateGuid.setEnabled(!isView);
475 this.jButtonOk.setEnabled(!isView);
476 }
477 }
478
479 /**
480 This method initializes jContentPane
481
482 @return javax.swing.JPanel jContentPane
483
484 **/
485 private JPanel getJContentPane() {
486 if (jContentPane == null) {
487 jLabelURL = new JLabel();
488 jLabelURL.setBounds(new java.awt.Rectangle(15,330,140,20));
489 jLabelURL.setText("URL");
490 jLabelCompontentType = new JLabel();
491 jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 380, 140, 20));
492 jLabelCompontentType.setText("Compontent Type");
493 jLabelModuleType = new JLabel();
494 jLabelModuleType.setBounds(new java.awt.Rectangle(15, 355, 140, 20));
495 jLabelModuleType.setText("Module Type");
496 jLabelAbstract = new JLabel();
497 jLabelAbstract.setBounds(new java.awt.Rectangle(15, 305, 140, 20));
498 jLabelAbstract.setText("Abstract");
499 jLabelSpecification = new JLabel();
500 jLabelSpecification.setText("Specification");
501 jLabelSpecification.setBounds(new java.awt.Rectangle(15, 280, 140, 20));
502 jLabelDescription = new JLabel();
503 jLabelDescription.setText("Description");
504 jLabelDescription.setBounds(new java.awt.Rectangle(15, 195, 140, 20));
505 jLabelCopyright = new JLabel();
506 jLabelCopyright.setText("Copyright");
507 jLabelCopyright.setBounds(new java.awt.Rectangle(15, 170, 140, 20));
508 jLabelLicense = new JLabel();
509 jLabelLicense.setText("License");
510 jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
511 jLabelVersion = new JLabel();
512 jLabelVersion.setText("Version");
513 jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
514 jLabelGuid = new JLabel();
515 jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15));
516 jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
517 jLabelGuid.setText("Guid");
518 jLabelBaseName = new JLabel();
519 jLabelBaseName.setText("Base Name");
520 jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
521 jContentPane = new JPanel();
522 jContentPane.setLayout(null);
523 jContentPane.setLocation(new java.awt.Point(0, 0));
524 jContentPane.setSize(new java.awt.Dimension(500, 524));
525 jContentPane.add(jLabelBaseName, null);
526 jContentPane.add(getJTextFieldBaseName(), null);
527 jContentPane.add(jLabelGuid, null);
528 jContentPane.add(getJTextFieldGuid(), null);
529 jContentPane.add(jLabelVersion, null);
530 jContentPane.add(getJTextFieldVersion(), null);
531 jContentPane.add(getJButtonGenerateGuid(), null);
532 jContentPane.add(jLabelLicense, null);
533 jContentPane.add(jLabelCopyright, null);
534 jContentPane.add(jLabelDescription, null);
535 jContentPane.add(jLabelSpecification, null);
536 jContentPane.add(getJTextFieldSpecification(), null);
537 jContentPane.add(getJButtonOk(), null);
538 jContentPane.add(getJButtonCancel(), null);
539 jContentPane.add(getJScrollPaneLicense(), null);
540 jContentPane.add(getJScrollPaneDescription(), null);
541 jContentPane.add(jLabelAbstract, null);
542 jContentPane.add(getJTextFieldAbstract(), null);
543 jContentPane.add(jLabelModuleType, null);
544 jContentPane.add(jLabelCompontentType, null);
545 jContentPane.add(getJComboBoxCompontentType(), null);
546 jContentPane.add(getJComboBoxModuleType(), null);
547
548 jStarLabel1 = new StarLabel();
549 jStarLabel1.setLocation(new java.awt.Point(0, 10));
550 jStarLabel2 = new StarLabel();
551 jStarLabel2.setLocation(new java.awt.Point(0, 35));
552 jStarLabel3 = new StarLabel();
553 jStarLabel3.setLocation(new java.awt.Point(0, 60));
554 jStarLabel4 = new StarLabel();
555 jStarLabel4.setLocation(new java.awt.Point(0, 85));
556 jStarLabel5 = new StarLabel();
557 jStarLabel5.setLocation(new java.awt.Point(0, 170));
558 jStarLabel6 = new StarLabel();
559 jStarLabel6.setLocation(new java.awt.Point(0, 195));
560 jStarLabel7 = new StarLabel();
561 jStarLabel7.setLocation(new java.awt.Point(0, 305));
562 jStarLabel8 = new StarLabel();
563 jStarLabel8.setLocation(new java.awt.Point(0, 355));
564 jStarLabel9 = new StarLabel();
565 jStarLabel9.setLocation(new java.awt.Point(0, 380));
566
567 jContentPane.add(jStarLabel1, null);
568 jContentPane.add(jStarLabel2, null);
569 jContentPane.add(jStarLabel3, null);
570 jContentPane.add(jStarLabel4, null);
571 jContentPane.add(jStarLabel5, null);
572 jContentPane.add(jStarLabel6, null);
573 jContentPane.add(jStarLabel7, null);
574 jContentPane.add(jStarLabel8, null);
575 jContentPane.add(jStarLabel9, null);
576 jContentPane.add(jLabelURL, null);
577 jContentPane.add(getJTextFieldAbstractURL(), null);
578 jContentPane.add(getJTextFieldCopyright(), null);
579 }
580 return jContentPane;
581 }
582
583 /* (non-Javadoc)
584 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
585 *
586 * Override actionPerformed to listen all actions
587 *
588 */
589 public void actionPerformed(ActionEvent arg0) {
590 if (arg0.getSource() == jButtonOk) {
591 this.dispose();
592 this.save();
593 this.setEdited(true);
594 }
595 if (arg0.getSource() == jButtonCancel) {
596 this.dispose();
597 this.setEdited(false);
598 }
599 if (arg0.getSource() == jButtonGenerateGuid) {
600 jTextFieldGuid.setText(Tools.generateUuidString());
601 }
602 }
603
604 /**
605 Data validation for all fields
606
607 @retval true - All datas are valid
608 @retval false - At least one data is invalid
609
610 **/
611 public boolean check() {
612 //
613 // Check if all required fields are not empty
614 //
615 if (isEmpty(this.jTextFieldBaseName.getText())) {
616 Log.err("Base Name couldn't be empty");
617 return false;
618 }
619 if (isEmpty(this.jTextFieldGuid.getText())) {
620 Log.err("Guid couldn't be empty");
621 return false;
622 }
623 if (isEmpty(this.jTextFieldVersion.getText())) {
624 Log.err("Version couldn't be empty");
625 return false;
626 }
627 if (isEmpty(this.jTextAreaLicense.getText())) {
628 Log.err("License couldn't be empty");
629 return false;
630 }
631 if (isEmpty(this.jTextFieldCopyright.getText())) {
632 Log.err("Copyright couldn't be empty");
633 return false;
634 }
635 if (isEmpty(this.jTextAreaDescription.getText())) {
636 Log.err("Description couldn't be empty");
637 return false;
638 }
639 if (isEmpty(this.jTextFieldAbstract.getText())) {
640 Log.err("Abstract couldn't be empty");
641 return false;
642 }
643
644 //
645 // Check if all fields have correct data types
646 //
647 if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
648 Log.err("Incorrect data type for Base Name");
649 return false;
650 }
651 if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
652 Log.err("Incorrect data type for Guid");
653 return false;
654 }
655 if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
656 Log.err("Incorrect data type for Abstract");
657 return false;
658 }
659 if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {
660 Log.err("Incorrect data type for Copyright");
661 return false;
662 }
663 return true;
664 }
665
666 /**
667 Save all components of Msa Lib Header
668 if exists msaLibHeader, set the value directly
669 if not exists msaLibHeader, new an instance first
670
671 **/
672 public void save() {
673 try {
674 if (this.msaLibHeader == null) {
675 msaLibHeader = MsaLibHeaderDocument.MsaLibHeader.Factory.newInstance();
676 }
677 if (this.msaLibHeader.getBaseName() != null) {
678 this.msaLibHeader.getBaseName().setStringValue(this.jTextFieldBaseName.getText());
679 } else {
680 BaseNameDocument.BaseName mBaseName = BaseNameDocument.BaseName.Factory.newInstance();
681 mBaseName.setStringValue(this.jTextFieldBaseName.getText());
682 this.msaLibHeader.setBaseName(mBaseName);
683 }
684
685 if (this.msaLibHeader.getGuid() != null) {
686 this.msaLibHeader.getGuid().setStringValue(this.jTextFieldGuid.getText());
687 } else {
688 GuidDocument.Guid mGuid = GuidDocument.Guid.Factory.newInstance();
689 mGuid.setStringValue(this.jTextFieldGuid.getText());
690 this.msaLibHeader.setGuid(mGuid);
691 }
692
693 this.msaLibHeader.setVersion(this.jTextFieldVersion.getText());
694
695 if (this.msaLibHeader.getLicense() != null) {
696 this.msaLibHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
697 } else {
698 LicenseDocument.License mLicense = LicenseDocument.License.Factory.newInstance();
699 mLicense.setStringValue(this.jTextAreaLicense.getText());
700 this.msaLibHeader.setLicense(mLicense);
701 }
702
703 this.msaLibHeader.setCopyright(this.jTextFieldCopyright.getText());
704 this.msaLibHeader.setDescription(this.jTextAreaDescription.getText());
705
706 if (this.msaLibHeader.getSpecification() != null) {
707 this.msaLibHeader.getSpecification().setStringValue(this.jTextFieldSpecification.getText());
708 } else {
709 SpecificationDocument.Specification mSpecification = SpecificationDocument.Specification.Factory
710 .newInstance();
711 mSpecification.setStringValue(this.jTextFieldSpecification.getText());
712 this.msaLibHeader.setSpecification(mSpecification);
713 }
714
715 if (this.msaLibHeader.getAbstract() != null) {
716 this.msaLibHeader.getAbstract().setStringValue(this.jTextFieldAbstract.getText());
717 this.msaLibHeader.getAbstract().setURL(this.jTextFieldAbstractURL.getText());
718 } else {
719 AbstractDocument.Abstract mAbstract = AbstractDocument.Abstract.Factory.newInstance();
720 mAbstract.setStringValue(this.jTextFieldAbstract.getText());
721 mAbstract.setURL(this.jTextFieldAbstractURL.getText());
722 this.msaLibHeader.setAbstract(mAbstract);
723 }
724
725 this.msaLibHeader.setModuleType(ModuleTypeDef.Enum.forString(this.jComboBoxModuleType.getSelectedItem()
726 .toString()));
727 this.msaLibHeader
728 .setComponentType(FrameworkComponentTypes.Enum
729 .forString(this.jComboBoxCompontentType
730 .getSelectedItem()
731 .toString()));
732
733 if (this.msaLibHeader.getCreated() == null) {
734 this.msaLibHeader.setCreated(Tools.getCurrentDateTime());
735 } else {
736 this.msaLibHeader.setUpdated(Tools.getCurrentDateTime());
737 }
738 } catch (Exception e) {
739 Log.err("Save Module", e.getMessage());
740 }
741 }
742
743 /**
744 This method initializes module type and compontent type
745
746 **/
747 private void initFrame() {
748 jComboBoxModuleType.addItem("BASE");
749 jComboBoxModuleType.addItem("SEC");
750 jComboBoxModuleType.addItem("PEI_CORE");
751 jComboBoxModuleType.addItem("PEIM");
752 jComboBoxModuleType.addItem("DXE_CORE");
753 jComboBoxModuleType.addItem("DXE_DRIVER");
754 jComboBoxModuleType.addItem("DXE_RUNTIME_DRIVER");
755 jComboBoxModuleType.addItem("DXE_SMM_DRIVER");
756 jComboBoxModuleType.addItem("DXE_SAL_DRIVER");
757 jComboBoxModuleType.addItem("UEFI_DRIVER");
758 jComboBoxModuleType.addItem("UEFI_APPLICATION");
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 MsaLibHeaderDocument.MsaLibHeader
778
779 @return MsaLibHeaderDocument.MsaLibHeader
780
781 **/
782 public MsaLibHeaderDocument.MsaLibHeader getMsaLibHeader() {
783 return msaLibHeader;
784 }
785
786 /**
787 Set MsaLibHeaderDocument.MsaLibHeader
788
789 @param msaLibHeader The input data of MsaLibHeaderDocument.MsaLibHeader
790
791 **/
792 public void setMsaLibHeader(MsaLibHeaderDocument.MsaLibHeader msaLibHeader) {
793 this.msaLibHeader = msaLibHeader;
794 }
795
796 }