Fixed wording for Legacy FlashMap.h Header question
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / 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.frameworkwizard.module.ui;
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ComponentEvent;
20 import java.awt.event.FocusEvent;
21 import java.util.Vector;
22
23 import javax.swing.ButtonGroup;
24 import javax.swing.JButton;
25 import javax.swing.JCheckBox;
26 import javax.swing.JComboBox;
27 import javax.swing.JLabel;
28 import javax.swing.JPanel;
29 import javax.swing.JScrollPane;
30 import javax.swing.JTextArea;
31 import javax.swing.JTextField;
32
33 import org.tianocore.ExternsDocument;
34 import org.tianocore.ModuleDefinitionsDocument;
35 import org.tianocore.ModuleSurfaceAreaDocument;
36 import org.tianocore.ModuleTypeDef;
37 import org.tianocore.MsaHeaderDocument;
38 import org.tianocore.PcdDriverTypes;
39 import org.tianocore.LicenseDocument.License;
40 import org.tianocore.frameworkwizard.common.DataType;
41 import org.tianocore.frameworkwizard.common.DataValidation;
42 import org.tianocore.frameworkwizard.common.EnumerationData;
43 import org.tianocore.frameworkwizard.common.Log;
44 import org.tianocore.frameworkwizard.common.Tools;
45 import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
46 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
47 import org.tianocore.frameworkwizard.common.ui.StarLabel;
48 import javax.swing.JRadioButton;
49
50 /**
51 The class is used to create, update MsaHeader of MSA file
52 It extends IInternalFrame
53
54
55
56 **/
57 public class MsaHeader extends IInternalFrame {
58
59 ///
60 /// Define class Serial Version UID
61 ///
62 private static final long serialVersionUID = -8152099582923006900L;
63
64 private int dialogWidth = 500;
65
66 private int dialogHeight = 630;
67
68 private final int labelWidth = 155;
69
70 private int valueWidth = 320;
71
72 private final int labelCol = 12;
73
74 private final int valueCol = 168;
75 //
76 //Define class members
77 //
78 private JPanel jContentPane = null;
79
80 private JLabel jLabelBaseName = null;
81
82 private JTextField jTextFieldBaseName = null;
83
84 private JLabel jLabelGuid = null;
85
86 private JTextField jTextFieldGuid = null;
87
88 private JLabel jLabelVersion = null;
89
90 private JTextField jTextFieldVersion = null;
91
92 private JButton jButtonGenerateGuid = null;
93
94 private JLabel jLabelLicense = null;
95
96 private JTextArea jTextAreaLicense = null;
97
98 private JLabel jLabelCopyright = null;
99
100 private JLabel jLabelDescription = null;
101
102 private JTextArea jTextAreaDescription = null;
103
104 private JLabel jLabelSpecification = null;
105
106 private JTextField jTextFieldSpecification = null;
107
108 private JButton jButtonOk = null;
109
110 private JButton jButtonCancel = null;
111
112 private JScrollPane jScrollPaneLicense = null;
113
114 private JScrollPane jScrollPaneDescription = null;
115
116 private JLabel jLabelAbstract = null;
117
118 private JTextField jTextFieldAbstract = null;
119
120 private JLabel jLabelModuleType = null;
121
122 private JComboBox jComboBoxModuleType = null;
123
124 private JLabel jLabelArch = null;
125
126 private JLabel jLabelBinaryModule = null;
127
128 private JLabel jLabelOutputFileBasename = null;
129
130 private JTextField jTextFieldOutputFileBasename = null;
131
132 private JScrollPane jScrollPaneCopyright = null;
133
134 private JTextArea jTextAreaCopyright = null;
135
136 private JLabel jLabelURL = null;
137
138 private JTextField jTextFieldURL = null;
139
140 private JScrollPane jScrollPane = null;
141
142 private StarLabel jStarLabel1 = null;
143
144 private StarLabel jStarLabel2 = null;
145
146 private StarLabel jStarLabel4 = null;
147
148 private StarLabel jStarLabel5 = null;
149
150 private StarLabel jStarLabel6 = null;
151
152 private StarLabel jStarLabel7 = null;
153
154 private StarLabel jStarLabel8 = null;
155
156 private StarLabel jStarLabel10 = null;
157
158 private StarLabel jStarLabel12 = null;
159
160 private StarLabel jStarLabel13 = null;
161
162 private StarLabel jStarLabel14 = null;
163
164 private JCheckBox jCheckBoxIa32 = null;
165
166 private JCheckBox jCheckBoxX64 = null;
167
168 private JCheckBox jCheckBoxIpf = null;
169
170 private JCheckBox jCheckBoxEbc = null;
171
172 private JCheckBox jCheckBoxArm = null;
173
174 private JCheckBox jCheckBoxPpc = null;
175
176 private JComboBox jComboBoxPcdIsDriver = null;
177
178 private JCheckBox jCheckBoxPcd = null;
179
180 private JCheckBox jCheckBoxFlashMap = null;
181
182 //
183 // Not used for UI
184 //
185 private MsaHeaderDocument.MsaHeader msaHeader = null;
186
187 private ModuleDefinitionsDocument.ModuleDefinitions md = null;
188
189 private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
190
191 private ExternsDocument.Externs ex = null;
192
193 private OpeningModuleType omt = null;
194
195 private EnumerationData ed = new EnumerationData();
196
197 private JRadioButton jRadioButtonBinaryModuleTrue = null;
198
199 private JRadioButton jRadioButtonBinaryModuleFalse = null;
200
201 /**
202 * This method initializes jCheckBoxIa32
203 *
204 * @return javax.swing.JCheckBox
205 */
206 private JCheckBox getJCheckBoxIa32() {
207 if (jCheckBoxIa32 == null) {
208 jCheckBoxIa32 = new JCheckBox();
209 jCheckBoxIa32.setBounds(new java.awt.Rectangle(valueCol, 505, 55, 20));
210 jCheckBoxIa32.setText("IA32");
211 jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
212 jCheckBoxIa32.addFocusListener(this);
213 }
214 return jCheckBoxIa32;
215 }
216
217 /**
218 * This method initializes jCheckBoxX64
219 *
220 * @return javax.swing.JCheckBox
221 */
222 private JCheckBox getJCheckBoxX64() {
223 if (jCheckBoxX64 == null) {
224 jCheckBoxX64 = new JCheckBox();
225 jCheckBoxX64.setBounds(new java.awt.Rectangle(valueCol + 55, 505, 53, 20));
226 jCheckBoxX64.setText("X64");
227 jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
228 jCheckBoxX64.addFocusListener(this);
229 }
230 return jCheckBoxX64;
231 }
232
233 /**
234 * This method initializes jCheckBoxIpf
235 *
236 * @return javax.swing.JCheckBox
237 */
238 private JCheckBox getJCheckBoxIpf() {
239 if (jCheckBoxIpf == null) {
240 jCheckBoxIpf = new JCheckBox();
241 jCheckBoxIpf.setBounds(new java.awt.Rectangle(valueCol + 110, 505, 52, 20));
242 jCheckBoxIpf.setText("IPF");
243 jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
244 jCheckBoxIpf.addFocusListener(this);
245 }
246 return jCheckBoxIpf;
247 }
248
249 /**
250 * This method initializes jCheckBoxEbc
251 *
252 * @return javax.swing.JCheckBox
253 */
254 private JCheckBox getJCheckBoxEbc() {
255 if (jCheckBoxEbc == null) {
256 jCheckBoxEbc = new JCheckBox();
257 jCheckBoxEbc.setBounds(new java.awt.Rectangle(valueCol + 165, 505, 53, 20));
258 jCheckBoxEbc.setText("EBC");
259 jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
260 jCheckBoxEbc.addFocusListener(this);
261 }
262 return jCheckBoxEbc;
263 }
264
265 /**
266 * This method initializes jCheckBoxArm
267 *
268 * @return javax.swing.JCheckBox
269 */
270 private JCheckBox getJCheckBoxArm() {
271 if (jCheckBoxArm == null) {
272 jCheckBoxArm = new JCheckBox();
273 jCheckBoxArm.setBounds(new java.awt.Rectangle(valueCol + 220, 505, 54, 20));
274 jCheckBoxArm.setText("ARM");
275 jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
276 jCheckBoxArm.addFocusListener(this);
277 }
278 return jCheckBoxArm;
279 }
280
281 /**
282 * This method initializes jCheckBoxPpc
283 *
284 * @return javax.swing.JCheckBox
285 */
286 private JCheckBox getJCheckBoxPpc() {
287 if (jCheckBoxPpc == null) {
288 jCheckBoxPpc = new JCheckBox();
289 jCheckBoxPpc.setBounds(new java.awt.Rectangle(valueCol + 285, 505, 53, 20));
290 jCheckBoxPpc.setText("PPC");
291 jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
292 jCheckBoxPpc.addFocusListener(this);
293 }
294 return jCheckBoxPpc;
295 }
296
297 /**
298 This method initializes jTextFieldBaseName
299
300 @return javax.swing.JTextField jTextFieldBaseName
301
302 **/
303 private JTextField getJTextFieldBaseName() {
304 if (jTextFieldBaseName == null) {
305 jTextFieldBaseName = new JTextField();
306 jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueCol, 10, valueWidth, 20));
307 jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320, 20));
308 jTextFieldBaseName.addFocusListener(this);
309 jTextFieldBaseName.setToolTipText("A brief Identifier, such as USB I/O Library, of the module");
310 }
311 return jTextFieldBaseName;
312 }
313
314 /**
315 This method initializes jTextFieldGuid
316
317 @return javax.swing.JTextField jTextFieldGuid
318
319 **/
320 private JTextField getJTextFieldGuid() {
321 if (jTextFieldGuid == null) {
322 jTextFieldGuid = new JTextField();
323 jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250, 20));
324 jTextFieldGuid.setLocation(new java.awt.Point(valueCol, 60));
325 jTextFieldGuid.setSize(new java.awt.Dimension(250, 20));
326 jTextFieldGuid.addFocusListener(this);
327 jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number, Registry Format (8-4-4-4-12)");
328 }
329 return jTextFieldGuid;
330 }
331
332 /**
333 This method initializes jTextFieldVersion
334
335 @return javax.swing.JTextField jTextFieldVersion
336
337 **/
338 private JTextField getJTextFieldVersion() {
339 if (jTextFieldVersion == null) {
340 jTextFieldVersion = new JTextField();
341 jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
342 jTextFieldVersion.setLocation(new java.awt.Point(valueCol, 85));
343 jTextFieldVersion.setSize(new java.awt.Dimension(valueWidth, 20));
344 jTextFieldVersion.addFocusListener(this);
345 jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01, 1.0.1");
346 }
347 return jTextFieldVersion;
348 }
349
350 /**
351 This method initializes jButtonGenerateGuid
352
353 @return javax.swing.JButton jButtonGenerateGuid
354
355 **/
356 private JButton getJButtonGenerateGuid() {
357 if (jButtonGenerateGuid == null) {
358 int genGuidCol = valueCol + 285;
359 jButtonGenerateGuid = new JButton();
360 jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
361 jButtonGenerateGuid.setSize(new java.awt.Dimension(65, 20));
362 jButtonGenerateGuid.setLocation(new java.awt.Point(genGuidCol, 60));
363 jButtonGenerateGuid.setText("GEN");
364 jButtonGenerateGuid.addActionListener(this);
365 }
366 return jButtonGenerateGuid;
367 }
368
369 /**
370 This method initializes jTextAreaLicense
371
372 @return javax.swing.JTextArea jTextAreaLicense
373
374 **/
375 private JTextArea getJTextAreaLicense() {
376 if (jTextAreaLicense == null) {
377 jTextAreaLicense = new JTextArea();
378 jTextAreaLicense.setText("");
379 jTextAreaLicense.setLineWrap(true);
380 jTextAreaLicense.addFocusListener(this);
381 jTextAreaLicense.setWrapStyleWord(true);
382 jTextAreaLicense.setSelectionStart(0);
383 jTextAreaLicense.setSelectionEnd(0);
384 jTextAreaLicense.setToolTipText("The License for this Module.");
385 }
386 return jTextAreaLicense;
387 }
388
389 /**
390 This method initializes jTextAreaDescription
391
392 @return javax.swing.JTextArea jTextAreaDescription
393
394 **/
395 private JTextArea getJTextAreaDescription() {
396 if (jTextAreaDescription == null) {
397 jTextAreaDescription = new JTextArea();
398 jTextAreaDescription.setLineWrap(true);
399 jTextAreaDescription.addFocusListener(this);
400 jTextAreaDescription.setToolTipText("A verbose description of the module.");
401 jTextAreaDescription.setWrapStyleWord(true);
402 jTextAreaDescription.setSelectionStart(0);
403 jTextAreaDescription.setSelectionEnd(0);
404 }
405 return jTextAreaDescription;
406 }
407
408 /**
409 This method initializes jTextFieldSpecification
410
411 @return javax.swing.JTextField jTextFieldSpecification
412
413 **/
414 private JTextField getJTextFieldSpecification() {
415 if (jTextFieldSpecification == null) {
416 int specWidth = valueWidth + 50;
417 jTextFieldSpecification = new JTextField();
418
419 jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth, 20));
420 jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
421 jTextFieldSpecification.setBorder(null);
422
423 jTextFieldSpecification.setSize(new java.awt.Dimension(specWidth, 20));
424 jTextFieldSpecification.setLocation(new java.awt.Point(labelCol, dialogHeight - 30));
425 jTextFieldSpecification.setEditable(false);
426 jTextFieldSpecification.addFocusListener(this);
427 }
428 return jTextFieldSpecification;
429 }
430
431 /**
432 This method initializes jButtonOk
433
434 @return javax.swing.JButton jButtonOk
435
436 **/
437 private JButton getJButtonOk() {
438 if (jButtonOk == null) {
439 jButtonOk = new JButton();
440 jButtonOk.setText("OK");
441 jButtonOk.setPreferredSize(new java.awt.Dimension(90, 20));
442 jButtonOk.setBounds(new java.awt.Rectangle(390, 455, 90, 20));
443 jButtonOk.addActionListener(this);
444 jButtonOk.setVisible(false);
445 }
446 return jButtonOk;
447 }
448
449 /**
450 This method initializes jButtonCancel
451
452 @return javax.swing.JButton jButtonCancel
453
454 **/
455 private JButton getJButtonCancel() {
456 if (jButtonCancel == null) {
457 jButtonCancel = new JButton();
458 jButtonCancel.setText("Cancel");
459 jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));
460 jButtonCancel.addActionListener(this);
461 jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
462 jButtonCancel.setVisible(false);
463 }
464 return jButtonCancel;
465 }
466
467 /**
468 This method initializes jScrollPaneLicense
469
470 @return javax.swing.JScrollPane jScrollPaneLicense
471
472 **/
473 private JScrollPane getJScrollPaneLicense() {
474 if (jScrollPaneLicense == null) {
475 jScrollPaneLicense = new JScrollPane();
476 jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
477 jScrollPaneLicense.setSize(new java.awt.Dimension(valueWidth, 120));
478 jScrollPaneLicense.setLocation(new java.awt.Point(valueCol, 305));
479 jScrollPaneLicense.setViewportView(getJTextAreaLicense());
480 jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth, 120));
481 }
482 return jScrollPaneLicense;
483 }
484
485 /**
486 This method initializes jScrollPaneDescription
487
488 @return javax.swing.JScrollPane jScrollPaneDescription
489
490 **/
491 private JScrollPane getJScrollPaneDescription() {
492 if (jScrollPaneDescription == null) {
493 jScrollPaneDescription = new JScrollPane();
494 jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
495 jScrollPaneDescription.setSize(new java.awt.Dimension(valueWidth, 120));
496 jScrollPaneDescription.setLocation(new java.awt.Point(valueCol, 135));
497 jScrollPaneDescription.setViewportView(getJTextAreaDescription());
498 jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, 120));
499 }
500 return jScrollPaneDescription;
501 }
502
503 /**
504 This method initializes jTextFieldAbstract
505
506 @return javax.swing.JTextField jTextFieldAbstract
507
508 **/
509 private JTextField getJTextFieldAbstract() {
510 if (jTextFieldAbstract == null) {
511 jTextFieldAbstract = new JTextField();
512 jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
513 jTextFieldAbstract.setLocation(new java.awt.Point(valueCol, 110));
514 jTextFieldAbstract.setSize(new java.awt.Dimension(valueWidth, 20));
515 jTextFieldAbstract.addFocusListener(this);
516 jTextFieldAbstract.setToolTipText("A one sentence description of this module.");
517 }
518 return jTextFieldAbstract;
519 }
520
521 /**
522 This method initializes jComboBoxModuleType
523
524 @return javax.swing.JComboBox jComboBoxModuleType
525
526 **/
527 private JComboBox getJComboBoxModuleType() {
528 if (jComboBoxModuleType == null) {
529 jComboBoxModuleType = new JComboBox();
530 jComboBoxModuleType.setBounds(new java.awt.Rectangle(valueCol, 35, valueWidth, 20));
531 jComboBoxModuleType.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
532 jComboBoxModuleType.addFocusListener(this);
533 }
534 return jComboBoxModuleType;
535 }
536
537 /**
538 This method initializes jTextFieldURL
539
540 @return javax.swing.JTextField
541
542 **/
543 private JTextField getJTextFieldURL() {
544 if (jTextFieldURL == null) {
545 jTextFieldURL = new JTextField();
546 jTextFieldURL.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
547 jTextFieldURL.setLocation(new java.awt.Point(valueCol, 430));
548 jTextFieldURL.setSize(new java.awt.Dimension(valueWidth, 20));
549 jTextFieldURL.addFocusListener(this);
550 jTextFieldURL.setToolTipText("A URL for the latest version of the license.");
551 }
552 return jTextFieldURL;
553 }
554
555 /**
556 This method initializes jScrollPane
557
558 @return javax.swing.JScrollPane
559
560 **/
561 private JScrollPane getJScrollPane() {
562 if (jScrollPane == null) {
563 jScrollPane = new JScrollPane();
564 jScrollPane.setViewportView(getJContentPane());
565 }
566 return jScrollPane;
567 }
568
569 /**
570 This method initializes jScrollPaneCopyright
571
572 @return javax.swing.JScrollPane
573
574 **/
575 private JScrollPane getJScrollPaneCopyright() {
576 if (jScrollPaneCopyright == null) {
577 jScrollPaneCopyright = new JScrollPane();
578 jScrollPaneCopyright.setBounds(new java.awt.Rectangle(valueCol, 260, valueWidth, 40));
579 jScrollPaneCopyright.setPreferredSize(new java.awt.Dimension(valueWidth, 40));
580 jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());
581 jScrollPaneCopyright.setSize(new java.awt.Dimension(valueWidth, 40));
582 }
583 return jScrollPaneCopyright;
584 }
585
586 /**
587 This method initializes jTextAreaCopyright
588
589 @return javax.swing.JTextArea
590
591 **/
592 private JTextArea getJTextAreaCopyright() {
593 if (jTextAreaCopyright == null) {
594 jTextAreaCopyright = new JTextArea();
595 jTextAreaCopyright.setLineWrap(true);
596 jTextAreaCopyright.addFocusListener(this);
597 jTextAreaCopyright.setWrapStyleWord(true);
598 jTextAreaCopyright.setSelectionStart(0);
599 jTextAreaCopyright.setSelectionEnd(0);
600 jTextAreaCopyright.setBounds(new java.awt.Rectangle(0, 0, valueWidth, 40));
601 jTextAreaCopyright.setToolTipText("One or more copyright lines.");
602 }
603 return jTextAreaCopyright;
604 }
605
606 /**
607 * This method initializes jTextFieldOutputFileBasename
608 *
609 * @return javax.swing.JTextField
610 */
611 private JTextField getJTextFieldOutputFileBasename() {
612 if (jTextFieldOutputFileBasename == null) {
613 jTextFieldOutputFileBasename = new JTextField();
614 jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(valueCol, 455, valueWidth, 20));
615 jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
616 jTextFieldOutputFileBasename.addFocusListener(this);
617 jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names.");
618 }
619 return jTextFieldOutputFileBasename;
620 }
621
622 /**
623 * This method initializes jComboBoxPcdIsDriver
624 *
625 * @return javax.swing.JComboBox
626 */
627 private JComboBox getJComboBoxPcdIsDriver() {
628 if (jComboBoxPcdIsDriver == null) {
629 jComboBoxPcdIsDriver = new JComboBox();
630 jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
631 jComboBoxPcdIsDriver.setBounds(new java.awt.Rectangle(valueCol, 530, valueWidth, 20));
632 jComboBoxPcdIsDriver.addItemListener(this);
633 jComboBoxPcdIsDriver.addFocusListener(this);
634 jComboBoxPcdIsDriver.setEnabled(false);
635 Tools.generateComboBoxByVector(jComboBoxPcdIsDriver, ed.getVPcdDriverTypes());
636 jComboBoxPcdIsDriver.setVisible(false);
637 }
638 return jComboBoxPcdIsDriver;
639 }
640
641 /**
642 This is the default constructor
643
644 **/
645 public MsaHeader() {
646 super();
647 init();
648 this.setVisible(true);
649 }
650
651 /**
652 This is the override edit constructor
653
654 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
655
656 **/
657 public MsaHeader(OpeningModuleType inMsa) {
658 super();
659 this.omt = inMsa;
660 this.msa = omt.getXmlMsa();
661
662 //
663 // Set module definitions default value
664 //
665 if (msa.getModuleDefinitions() == null) {
666 ModuleDefinitionsDocument.ModuleDefinitions md = ModuleDefinitionsDocument.ModuleDefinitions.Factory
667 .newInstance();
668 md.setOutputFileBasename(msa.getMsaHeader().getModuleName());
669 md.setBinaryModule(false);
670 md.setSupportedArchitectures(ed.getVSupportedArchitectures());
671 msa.setModuleDefinitions(md);
672 }
673
674 //
675 // Init items of Header, Definitions and Externs
676 //
677 init(msa.getMsaHeader());
678 init(msa.getModuleDefinitions());
679 init(msa.getExterns());
680
681 this.setVisible(true);
682 this.setViewMode(false);
683 }
684
685 /**
686 Disable all components when the mode is view
687
688 @param isView true - The view mode; false - The non-view mode
689
690 **/
691 public void setViewMode(boolean isView) {
692 if (isView) {
693 this.jTextFieldBaseName.setEnabled(!isView);
694 this.jTextFieldGuid.setEnabled(!isView);
695 this.jTextFieldVersion.setEnabled(!isView);
696 this.jTextAreaLicense.setEnabled(!isView);
697 this.jTextAreaCopyright.setEnabled(!isView);
698 this.jTextAreaDescription.setEnabled(!isView);
699 this.jTextFieldSpecification.setEnabled(!isView);
700 this.jTextFieldAbstract.setEnabled(!isView);
701 this.jComboBoxModuleType.setEnabled(!isView);
702 this.jButtonCancel.setEnabled(!isView);
703 this.jButtonGenerateGuid.setEnabled(!isView);
704 this.jButtonOk.setEnabled(!isView);
705 }
706 }
707
708 /**
709 This method initializes this
710
711 **/
712 private void init() {
713 this.setSize(dialogWidth, dialogHeight);
714 this.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
715 this.setContentPane(getJScrollPane());
716 this.setTitle("Module Surface Area Header");
717 initFrame();
718 }
719
720 /**
721 This method initializes this
722 Fill values to all fields if these values are not empty
723
724 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
725
726 **/
727 private void init(MsaHeaderDocument.MsaHeader inMsaHeader) {
728 init();
729 if (inMsaHeader != null) {
730 setMsaHeader(inMsaHeader);
731 if (this.msaHeader.getModuleName() != null) {
732 this.jTextFieldBaseName.setText(this.msaHeader.getModuleName());
733 }
734 if (this.msaHeader.getModuleType() != null) {
735 this.jComboBoxModuleType.setSelectedItem(this.msaHeader.getModuleType().toString());
736 }
737 if (this.msaHeader.getGuidValue() != null) {
738 this.jTextFieldGuid.setText(this.msaHeader.getGuidValue());
739 }
740 if (this.msaHeader.getVersion() != null) {
741 this.jTextFieldVersion.setText(this.msaHeader.getVersion());
742 }
743 if (this.msaHeader.getAbstract() != null) {
744 this.jTextFieldAbstract.setText(this.msaHeader.getAbstract());
745 }
746 if (this.msaHeader.getDescription() != null) {
747 this.jTextAreaDescription.setText(this.msaHeader.getDescription());
748 jTextAreaDescription.setSelectionStart(0);
749 jTextAreaDescription.setSelectionEnd(0);
750 }
751 if (this.msaHeader.getCopyright() != null) {
752 this.jTextAreaCopyright.setText(this.msaHeader.getCopyright());
753 }
754 if (this.msaHeader.getLicense() != null) {
755 this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue());
756 jTextAreaLicense.setSelectionStart(0);
757 jTextAreaLicense.setSelectionEnd(0);
758 }
759 if (this.msaHeader.getLicense() != null && this.msaHeader.getLicense().getURL() != null) {
760 this.jTextFieldURL.setText(this.msaHeader.getLicense().getURL());
761 }
762 if (this.msaHeader.getSpecification() != null) {
763 this.jTextFieldSpecification.setText(this.msaHeader.getSpecification());
764 }
765 }
766 }
767
768 /**
769 This method initializes this
770 Fill values to all fields if these values are not empty
771
772 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
773
774 **/
775 private void init(ModuleDefinitionsDocument.ModuleDefinitions inMd) {
776 if (inMd != null) {
777 this.md = inMd;
778 if (md.getSupportedArchitectures() != null) {
779 this.setSelectedItems(Tools.convertListToVector(md.getSupportedArchitectures()));
780 }
781 if (md.getBinaryModule()) {
782 this.jRadioButtonBinaryModuleTrue.setSelected(true);
783 } else {
784 this.jRadioButtonBinaryModuleFalse.setSelected(true);
785 }
786 if (md.getOutputFileBasename() != null) {
787 this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());
788 }
789 }
790 }
791
792 /**
793 This method initializes this
794 Fill values to all fields if these values are not empty
795
796 @param inEx The input data of ExternsDocument.Externs
797
798 **/
799 private void init(ExternsDocument.Externs inEx) {
800 if (inEx != null) {
801 this.ex = inEx;
802 if (ex.getPcdIsDriver() != null) {
803 this.jCheckBoxPcd.setSelected(true);
804 this.jComboBoxPcdIsDriver.setEnabled(true);
805 this.jComboBoxPcdIsDriver.setSelectedItem(ex.getPcdIsDriver());
806 // TODO: If the module type is DXE_DRIVER, set PCD_DXE_DRIVER
807 // If the module type is PEIM, set PCD_PEI_DRIVER
808 // If the module type is anything else, unset this!
809 }
810 this.jCheckBoxFlashMap.setSelected(ex.getTianoR8FlashMapH());
811 }
812 }
813
814 /**
815 This method initializes jContentPane
816
817 @return javax.swing.JPanel jContentPane
818
819 **/
820 private JPanel getJContentPane() {
821 if (jContentPane == null) {
822
823 jLabelURL = new JLabel();
824 jLabelURL.setText("License URL");
825 jLabelURL.setLocation(new java.awt.Point(labelCol, 430));
826 jLabelURL.setSize(new java.awt.Dimension(labelWidth, 20));
827 jLabelBaseName = new JLabel();
828 jLabelBaseName.setText("Module Name");
829 jLabelBaseName.setBounds(new java.awt.Rectangle(labelCol, 10, labelWidth, 20));
830 jLabelModuleType = new JLabel();
831 jLabelModuleType.setBounds(new java.awt.Rectangle(labelCol, 35, labelWidth, 20));
832 jLabelModuleType.setText("Module Type");
833 jLabelGuid = new JLabel();
834 jLabelGuid.setText("Guid Value");
835 jLabelGuid.setLocation(new java.awt.Point(labelCol, 60));
836 jLabelGuid.setSize(new java.awt.Dimension(labelWidth, 20));
837 jLabelVersion = new JLabel();
838 jLabelVersion.setText("Version");
839 jLabelVersion.setLocation(new java.awt.Point(labelCol, 85));
840 jLabelVersion.setSize(new java.awt.Dimension(labelWidth, 20));
841 jLabelAbstract = new JLabel();
842 jLabelAbstract.setText("Abstract");
843 jLabelAbstract.setLocation(new java.awt.Point(labelCol, 110));
844 jLabelAbstract.setSize(new java.awt.Dimension(labelWidth, 20));
845 jLabelDescription = new JLabel();
846 jLabelDescription.setText("Description");
847 jLabelDescription.setLocation(new java.awt.Point(labelCol, 135));
848 jLabelDescription.setSize(new java.awt.Dimension(labelWidth, 20));
849 jLabelCopyright = new JLabel();
850 jLabelCopyright.setText("Copyright");
851 jLabelCopyright.setLocation(new java.awt.Point(labelCol, 260));
852 jLabelCopyright.setSize(new java.awt.Dimension(labelWidth, 20));
853 jLabelLicense = new JLabel();
854 jLabelLicense.setText("License");
855 jLabelLicense.setLocation(new java.awt.Point(labelCol, 305));
856 jLabelLicense.setSize(new java.awt.Dimension(labelWidth, 20));
857 jLabelOutputFileBasename = new JLabel();
858 jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(labelCol, 455, labelWidth, 20));
859 jLabelOutputFileBasename.setText("Output File Basename");
860 jLabelBinaryModule = new JLabel();
861 jLabelBinaryModule.setBounds(new java.awt.Rectangle(labelCol, 480, labelWidth, 20));
862 jLabelBinaryModule.setText("Binary Module");
863 jLabelArch = new JLabel();
864 jLabelArch.setBounds(new java.awt.Rectangle(labelCol, 505, labelWidth, 20));
865 jLabelArch.setText("Supported Architectures");
866 jLabelSpecification = new JLabel();
867 jLabelSpecification.setText("Specification");
868 jLabelSpecification.setLocation(new java.awt.Point(labelCol, 530));
869 jLabelSpecification.setSize(new java.awt.Dimension(labelWidth, 20));
870
871 jContentPane = new JPanel();
872 jContentPane.setLayout(null);
873 jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 10, dialogHeight - 10));
874
875 jContentPane.addFocusListener(this);
876
877 jContentPane.add(jLabelBaseName, null);
878 jContentPane.add(getJTextFieldBaseName(), null);
879 jContentPane.add(jLabelGuid, null);
880 jContentPane.add(getJTextFieldGuid(), null);
881 jContentPane.add(jLabelVersion, null);
882 jContentPane.add(getJTextFieldVersion(), null);
883 jContentPane.add(getJButtonGenerateGuid(), null);
884 jContentPane.add(jLabelLicense, null);
885 jContentPane.add(jLabelCopyright, null);
886 jContentPane.add(jLabelDescription, null);
887 jContentPane.add(getJTextFieldSpecification(), null);
888 jContentPane.add(getJButtonOk(), null);
889 jContentPane.add(getJButtonCancel(), null);
890 jContentPane.add(getJScrollPaneLicense(), null);
891 jContentPane.add(getJScrollPaneDescription(), null);
892 jContentPane.add(jLabelAbstract, null);
893 jContentPane.add(getJTextFieldAbstract(), null);
894 jContentPane.add(jLabelModuleType, null);
895 jContentPane.add(getJComboBoxModuleType(), null);
896 jContentPane.add(jLabelURL, null);
897 jContentPane.add(getJTextFieldURL(), null);
898 jContentPane.add(jLabelOutputFileBasename, null);
899 jContentPane.add(getJTextFieldOutputFileBasename(), null);
900 jContentPane.add(jLabelBinaryModule, null);
901 jContentPane.add(jLabelArch, null);
902
903 jStarLabel1 = new StarLabel();
904 jStarLabel1.setLocation(new java.awt.Point(0, 10));
905 jStarLabel2 = new StarLabel();
906 jStarLabel2.setLocation(new java.awt.Point(0, 35));
907 jStarLabel4 = new StarLabel();
908 jStarLabel4.setLocation(new java.awt.Point(0, 60));
909 jStarLabel5 = new StarLabel();
910 jStarLabel5.setLocation(new java.awt.Point(0, 85));
911 jStarLabel6 = new StarLabel();
912 jStarLabel6.setLocation(new java.awt.Point(0, 135));
913 jStarLabel7 = new StarLabel();
914 jStarLabel7.setLocation(new java.awt.Point(0, 260));
915 jStarLabel8 = new StarLabel();
916 jStarLabel8.setLocation(new java.awt.Point(0, 305));
917 jStarLabel10 = new StarLabel();
918 jStarLabel10.setLocation(new java.awt.Point(0, 110));
919 jStarLabel12 = new StarLabel();
920 jStarLabel12.setLocation(new java.awt.Point(0, 455));
921 jStarLabel13 = new StarLabel();
922 jStarLabel13.setLocation(new java.awt.Point(0, 480));
923 jStarLabel14 = new StarLabel();
924 jStarLabel14.setLocation(new java.awt.Point(0, 505));
925
926 jContentPane.add(jStarLabel1, null);
927 jContentPane.add(jStarLabel2, null);
928 jContentPane.add(jStarLabel4, null);
929 jContentPane.add(jStarLabel5, null);
930 jContentPane.add(jStarLabel6, null);
931 jContentPane.add(jStarLabel7, null);
932 jContentPane.add(jStarLabel8, null);
933 jContentPane.add(jStarLabel10, null);
934 jContentPane.add(jStarLabel12, null);
935 jContentPane.add(jStarLabel13, null);
936 jContentPane.add(jStarLabel14, null);
937 jContentPane.add(getJScrollPaneCopyright(), null);
938
939 jContentPane.add(getJCheckBoxIa32(), null);
940 jContentPane.add(getJCheckBoxX64(), null);
941 jContentPane.add(getJCheckBoxIpf(), null);
942 jContentPane.add(getJCheckBoxEbc(), null);
943 jContentPane.add(getJCheckBoxArm(), null);
944 jContentPane.add(getJCheckBoxPpc(), null);
945
946 jContentPane.add(getJCheckBoxPcd(), null);
947 jContentPane.add(getJComboBoxPcdIsDriver(), null);
948 jContentPane.add(getJCheckBoxFlashMap(), null);
949
950 ButtonGroup bg = new ButtonGroup();
951 jContentPane.add(getJRadioButtonBinaryModuleTrue(), null);
952 jContentPane.add(getJRadioButtonBinaryModuleFalse(), null);
953 bg.add(getJRadioButtonBinaryModuleTrue());
954 bg.add(getJRadioButtonBinaryModuleFalse());
955 }
956 return jContentPane;
957 }
958
959 /* (non-Javadoc)
960 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
961 *
962 * Override actionPerformed to listen all actions
963 *
964 */
965 public void actionPerformed(ActionEvent arg0) {
966 if (arg0.getSource() == jButtonOk) {
967 if (this.check()) {
968 this.save();
969 } else {
970 return;
971 }
972 this.setEdited(true);
973 this.dispose();
974 }
975
976 if (arg0.getSource() == jButtonCancel) {
977 this.setEdited(false);
978 }
979
980 if (arg0.getSource() == jButtonGenerateGuid) {
981 jTextFieldGuid.setText(Tools.generateUuidString());
982 jTextFieldGuid.requestFocus();
983 jButtonGenerateGuid.requestFocus();
984 }
985
986 if (arg0.getSource() == this.jCheckBoxPcd) {
987 this.jComboBoxPcdIsDriver.setEnabled(this.jCheckBoxPcd.isSelected());
988 }
989 }
990
991 /**
992 Data validation for all fields
993
994 @retval true - All datas are valid
995 @retval false - At least one data is invalid
996
997 **/
998 public boolean check() {
999 //
1000 // Check if all required fields are not empty
1001 // and check if all data fields values are valid
1002 //
1003
1004 //
1005 // Check Base Name
1006 //
1007 if (isEmpty(this.jTextFieldBaseName.getText())) {
1008 Log.wrn("Update Msa Header", "Name must be entered!");
1009 //this.jTextFieldBaseName.requestFocus();
1010 return false;
1011 }
1012 if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
1013 Log.wrn("Update Msa Header", "Incorrect data type for Name, it must start with an alpha character!");
1014 //this.jTextFieldBaseName.requestFocus();
1015 return false;
1016 }
1017
1018 //
1019 // Check Guid
1020 //
1021 if (isEmpty(this.jTextFieldGuid.getText())) {
1022 Log.wrn("Update Msa Header", "The Guid Value must be entered!");
1023 //this.jTextFieldGuid.requestFocus();
1024 return false;
1025 }
1026 if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
1027 Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format, 8-4-4-4-12");
1028 //this.jTextFieldGuid.requestFocus();
1029 return false;
1030 }
1031
1032 //
1033 // Check Version
1034 //
1035 if (isEmpty(this.jTextFieldVersion.getText())) {
1036 Log.wrn("Update Msa Header", "Version must be entered!");
1037 //this.jTextFieldVersion.requestFocus();
1038 return false;
1039 }
1040 if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
1041 Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
1042 //this.jTextFieldVersion.requestFocus();
1043 return false;
1044 }
1045
1046 //
1047 // Check Abstact
1048 //
1049 if (isEmpty(this.jTextFieldAbstract.getText())) {
1050 Log.wrn("Update Msa Header", "Abstract must be entered!");
1051 //this.jTextFieldAbstract.requestFocus();
1052 return false;
1053 }
1054 if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
1055 Log.wrn("Update Msa Header",
1056 "Incorrect data type for Abstract, is should be a sentence describing the module.");
1057 //this.jTextFieldAbstract.requestFocus();
1058 return false;
1059 }
1060
1061 //
1062 // Check Description
1063 //
1064 if (isEmpty(this.jTextAreaDescription.getText())) {
1065 Log.wrn("Update Msa Header", "Description must be entered!");
1066 //this.jTextAreaDescription.requestFocus();
1067 return false;
1068 }
1069
1070 //
1071 // Check Copyright
1072 //
1073 if (isEmpty(this.jTextAreaCopyright.getText())) {
1074 Log.wrn("Update Msa Header", "Copyright must be entered!");
1075 //this.jTextFieldCopyright.requestFocus();
1076 return false;
1077 }
1078
1079 //
1080 // Check License
1081 //
1082 if (isEmpty(this.jTextAreaLicense.getText())) {
1083 Log.wrn("Update Msa Header", "License must be entered!");
1084 //this.jTextAreaLicense.requestFocus();
1085 return false;
1086 }
1087
1088 //
1089 // Check Specification
1090 //
1091 if (isEmpty(this.jTextFieldSpecification.getText())) {
1092 Log.wrn("Update Msa Header", "Specification must exist.");
1093 //this.jTextFieldSpecification.requestFocus();
1094 return false;
1095 }
1096 if (!DataValidation.isSpecification(this.jTextFieldSpecification.getText())) {
1097 // TODO Add code to check the specification number.
1098 // Future releases of Schema may require that we process these files
1099 // differently.
1100 Log.wrn("Update Msa Header", "Incorrect data type for Specification");
1101 //this.jTextFieldSpecification.requestFocus();
1102 return false;
1103 }
1104
1105 return true;
1106 }
1107
1108 /**
1109 Save all components of Msa Header
1110 if exists msaHeader, set the value directly
1111 if not exists msaHeader, new an instance first
1112
1113 **/
1114 public void save() {
1115 try {
1116 msaHeader.setSpecification(this.jTextFieldSpecification.getText());
1117 msa.setMsaHeader(msaHeader);
1118 msa.setModuleDefinitions(md);
1119 this.omt.setSaved(false);
1120 } catch (Exception e) {
1121 Log.wrn("Save Module", e.getMessage());
1122 Log.err("Save Module", e.getMessage());
1123 }
1124 }
1125
1126 /**
1127 This method initializes Module type and Compontent type
1128
1129 **/
1130 private void initFrame() {
1131 EnumerationData ed = new EnumerationData();
1132 Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());
1133 this.setSelectedItems(ed.getVSupportedArchitectures());
1134 }
1135
1136 /**
1137 Get MsaHeaderDocument.MsaHeader
1138
1139 @return MsaHeaderDocument.MsaHeader
1140
1141 **/
1142 public MsaHeaderDocument.MsaHeader getMsaHeader() {
1143 return msaHeader;
1144 }
1145
1146 /**
1147 Set MsaHeaderDocument.MsaHeader
1148
1149 @param msaHeader The input data of MsaHeaderDocument.MsaHeader
1150
1151 **/
1152 public void setMsaHeader(MsaHeaderDocument.MsaHeader msaHeader) {
1153 this.msaHeader = msaHeader;
1154 }
1155
1156 /* (non-Javadoc)
1157 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
1158 *
1159 * Override componentResized to resize all components when frame's size is changed
1160 */
1161 public void componentResized(ComponentEvent arg0) {
1162 int intCurrentWidth = this.getJContentPane().getWidth();
1163 int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
1164
1165 Tools.resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth, intPreferredWidth);
1166 Tools.resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth, intPreferredWidth);
1167 Tools.resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth);
1168 Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
1169 Tools.resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);
1170 Tools.resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth);
1171 Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
1172 Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);
1173 Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
1174 Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);
1175 Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);
1176 Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);
1177
1178 Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
1179 DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
1180 }
1181
1182 public void focusLost(FocusEvent arg0) {
1183 if (this.msaHeader == null) {
1184 msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
1185 }
1186
1187 //
1188 // Check BaseName
1189 //
1190 if (arg0.getSource() == this.jTextFieldBaseName) {
1191 if (isEmpty(this.jTextFieldBaseName.getText())) {
1192 Log.wrn("Update Msa Header", "The Name must be entered!");
1193 //this.jTextFieldBaseName.requestFocus();
1194 return;
1195 }
1196 if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
1197 Log.wrn("Update Msa Header", "Incorrect data type for Name, it must begin with an alpha character.");
1198 //this.jTextFieldBaseName.requestFocus();
1199 return;
1200 }
1201 if (!this.jTextFieldBaseName.getText().equals(msaHeader.getModuleName())) {
1202 this.msaHeader.setModuleName(this.jTextFieldBaseName.getText());
1203 } else {
1204 return;
1205 }
1206 }
1207
1208 //
1209 // Check Module Type
1210 //
1211 if (arg0.getSource() == this.jComboBoxModuleType) {
1212 if (!jComboBoxModuleType.getSelectedItem().toString().equals(msaHeader.getModuleType().toString())) {
1213 msaHeader.setModuleType(ModuleTypeDef.Enum.forString(jComboBoxModuleType.getSelectedItem().toString()));
1214 } else {
1215 return;
1216 }
1217 }
1218
1219 //
1220 // Check Guid
1221 //
1222 if (arg0.getSource() == this.jTextFieldGuid) {
1223 if (isEmpty(this.jTextFieldGuid.getText())) {
1224 Log.wrn("Update Msa Header", "Guid must be entered!");
1225 //this.jTextFieldGuid.requestFocus();
1226 return;
1227 }
1228 if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
1229 Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format. (8-4-4-4-12)");
1230 //this.jTextFieldGuid.requestFocus();
1231 return;
1232 }
1233 if (!this.jTextFieldGuid.getText().equals(msaHeader.getGuidValue())) {
1234 this.msaHeader.setGuidValue(this.jTextFieldGuid.getText());
1235 } else {
1236 return;
1237 }
1238 }
1239
1240 //
1241 // Check Version
1242 //
1243 if (arg0.getSource() == this.jTextFieldVersion) {
1244 if (isEmpty(this.jTextFieldVersion.getText())) {
1245 Log.wrn("Update Msa Header", "Version must be entered!");
1246 //this.jTextFieldVersion.requestFocus();
1247 return;
1248 }
1249 if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
1250 Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
1251 //this.jTextFieldVersion.requestFocus();
1252 return;
1253 }
1254 if (!this.jTextFieldVersion.getText().equals(msaHeader.getVersion())) {
1255 this.msaHeader.setVersion(this.jTextFieldVersion.getText());
1256 } else {
1257 return;
1258 }
1259 }
1260
1261 //
1262 // Check Abstact
1263 //
1264 if (arg0.getSource() == this.jTextFieldAbstract) {
1265 if (isEmpty(this.jTextFieldAbstract.getText())) {
1266 Log.wrn("Update Msa Header", "Abstract must be entered!");
1267 //this.jTextFieldAbstract.requestFocus();
1268 return;
1269 }
1270 if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
1271 Log.wrn("Update Msa Header", "Incorrect data type for Abstract, it must be sentence.");
1272 //this.jTextFieldAbstract.requestFocus();
1273 return;
1274 }
1275 if (!this.jTextFieldAbstract.getText().equals(msaHeader.getAbstract())) {
1276 this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());
1277 } else {
1278 return;
1279 }
1280 }
1281
1282 //
1283 // Check Description
1284 //
1285 if (arg0.getSource() == this.jTextAreaDescription) {
1286 if (isEmpty(this.jTextAreaDescription.getText())) {
1287 Log.wrn("Update Msa Header", "Description must be entered!");
1288 //this.jTextAreaDescription.requestFocus();
1289 return;
1290 }
1291 if (!this.jTextAreaDescription.getText().equals(msaHeader.getDescription())) {
1292 this.msaHeader.setDescription(this.jTextAreaDescription.getText());
1293 } else {
1294 return;
1295 }
1296 }
1297
1298 //
1299 // Check Copyright
1300 //
1301 if (arg0.getSource() == this.jTextAreaCopyright) {
1302 if (isEmpty(this.jTextAreaCopyright.getText())) {
1303 Log.wrn("Update Msa Header", "Copyright must be entered!");
1304 //this.jTextFieldCopyright.requestFocus();
1305 return;
1306 }
1307 if (!this.jTextAreaCopyright.getText().equals(msaHeader.getCopyright())) {
1308 this.msaHeader.setCopyright(this.jTextAreaCopyright.getText());
1309 } else {
1310 return;
1311 }
1312 }
1313
1314 //
1315 // Check License
1316 //
1317 if (arg0.getSource() == this.jTextAreaLicense) {
1318 if (isEmpty(this.jTextAreaLicense.getText())) {
1319 Log.wrn("Update Msa Header", "License must be entered!");
1320 //this.jTextAreaLicense.requestFocus();
1321 return;
1322 }
1323 if (this.msaHeader.getLicense() != null) {
1324 if (!this.jTextAreaLicense.getText().equals(msaHeader.getLicense().getStringValue())) {
1325 this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
1326 } else {
1327 return;
1328 }
1329 } else {
1330 License mLicense = License.Factory.newInstance();
1331 mLicense.setStringValue(this.jTextAreaLicense.getText());
1332 this.msaHeader.setLicense(mLicense);
1333 }
1334 }
1335
1336 //
1337 // Check License URL
1338 //
1339 if (arg0.getSource() == this.jTextFieldURL) {
1340 if (!isEmpty(this.jTextFieldURL.getText())) {
1341 if (this.msaHeader.getLicense() == null) {
1342 License mLicense = License.Factory.newInstance();
1343 mLicense.setURL(this.jTextFieldURL.getText());
1344 this.msaHeader.setLicense(mLicense);
1345 } else {
1346 if (!this.jTextFieldURL.getText().equals(msaHeader.getLicense().getURL())) {
1347 this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText());
1348 } else {
1349 return;
1350 }
1351 }
1352 }
1353 }
1354
1355 //
1356 // Check Output File Basename
1357 //
1358 if (arg0.getSource() == this.jTextFieldOutputFileBasename) {
1359 if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {
1360 Log.wrn("Update Msa Header", "Output File Basename must be entered!");
1361 // jTextFieldOutputFileBasename.removeFocusListener(this);
1362 // jTextFieldOutputFileBasename.requestFocus();
1363 // jTextFieldOutputFileBasename.addFocusListener(this);
1364 return;
1365 }
1366 if (!this.jTextFieldOutputFileBasename.getText().equals(md.getOutputFileBasename())) {
1367 this.md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText());
1368 } else {
1369 return;
1370 }
1371 }
1372
1373 //
1374 // Check Binary Module Type
1375 //
1376 if (arg0.getSource() == this.jRadioButtonBinaryModuleTrue) {
1377 if (jRadioButtonBinaryModuleTrue.isSelected()) {
1378 if (md.getBinaryModule()) {
1379 return;
1380 } else {
1381 md.setBinaryModule(true);
1382 }
1383 }
1384 }
1385
1386 //
1387 // Check Binary Module Type
1388 //
1389 if (arg0.getSource() == this.jRadioButtonBinaryModuleFalse) {
1390 if (jRadioButtonBinaryModuleFalse.isSelected()) {
1391 if (md.getBinaryModule()) {
1392 md.setBinaryModule(false);
1393 } else {
1394 return;
1395 }
1396 }
1397 }
1398
1399 //
1400 // Check Supported Arch
1401 //
1402 if (arg0.getSource() == this.jCheckBoxArm || arg0.getSource() == this.jCheckBoxEbc
1403 || arg0.getSource() == this.jCheckBoxIa32 || arg0.getSource() == this.jCheckBoxIpf
1404 || arg0.getSource() == this.jCheckBoxPpc || arg0.getSource() == this.jCheckBoxX64) {
1405 if (!this.getSelectedItemsString().equals(md.getSupportedArchitectures().toString())) {
1406 md.setSupportedArchitectures(this.getSelectedItemsVector());
1407 } else {
1408 return;
1409 }
1410 }
1411
1412 //
1413 // Check Pcd is Driver
1414 //
1415 if (arg0.getSource() == this.jCheckBoxPcd || arg0.getSource() == this.jComboBoxPcdIsDriver) {
1416 if ((this.ex == null) && this.jCheckBoxPcd.isSelected()) {
1417 this.ex = ExternsDocument.Externs.Factory.newInstance();
1418 this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()
1419 .toString()));
1420 this.msa.setExterns(this.ex);
1421 } else if ((this.ex != null) && (this.ex.getPcdIsDriver() == null) && this.jCheckBoxPcd.isSelected()) {
1422 this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()
1423 .toString()));
1424 this.msa.setExterns(this.ex);
1425 } else if ((this.ex != null) && (this.ex.getPcdIsDriver() != null)) {
1426 if (this.jCheckBoxPcd.isSelected()
1427 && !this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals(
1428 this.ex.getPcdIsDriver()
1429 .toString())) {
1430 this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()
1431 .toString()));
1432 this.msa.setExterns(this.ex);
1433 }
1434 if (!this.jCheckBoxPcd.isSelected()) {
1435 ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
1436 if (this.ex.getExternList() != null) {
1437 for (int index = 0; index < this.ex.getExternList().size(); index++) {
1438 newEx.addNewExtern();
1439 newEx.setExternArray(index, this.ex.getExternArray(index));
1440 }
1441 }
1442 if (this.ex.getSpecificationList() != null) {
1443 for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
1444 newEx.addNewSpecification();
1445 newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
1446 }
1447 }
1448 if (this.ex.getTianoR8FlashMapH()) {
1449 newEx.setTianoR8FlashMapH(this.ex.getTianoR8FlashMapH());
1450 }
1451 this.ex = newEx;
1452 this.msa.setExterns(this.ex);
1453 }
1454 }
1455 }
1456
1457 //
1458 // Check Flash Map
1459 //
1460 if (arg0.getSource() == this.jCheckBoxFlashMap) {
1461 if ((this.ex == null) && this.jCheckBoxFlashMap.isSelected()) {
1462 this.ex = ExternsDocument.Externs.Factory.newInstance();
1463 this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
1464 this.msa.setExterns(this.ex);
1465 } else if ((this.ex != null) && this.jCheckBoxFlashMap.isSelected()) {
1466 this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
1467 this.msa.setExterns(this.ex);
1468 } else if ((this.ex != null) && !this.jCheckBoxFlashMap.isSelected()) {
1469 ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
1470 if (this.ex.getExternList() != null) {
1471 for (int index = 0; index < this.ex.getExternList().size(); index++) {
1472 newEx.addNewExtern();
1473 newEx.setExternArray(index, this.ex.getExternArray(index));
1474 }
1475 }
1476 if (this.ex.getSpecificationList() != null) {
1477 for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
1478 newEx.addNewSpecification();
1479 newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
1480 }
1481 }
1482 if (this.ex.getPcdIsDriver() != null) {
1483 newEx.setPcdIsDriver(this.ex.getPcdIsDriver());
1484 }
1485 this.ex = newEx;
1486 this.msa.setExterns(this.ex);
1487 }
1488 }
1489
1490 this.save();
1491 }
1492
1493 private Vector<String> getSelectedItemsVector() {
1494 Vector<String> v = new Vector<String>();
1495 if (this.jCheckBoxIa32.isSelected()) {
1496 v.addElement(jCheckBoxIa32.getText());
1497 }
1498 if (this.jCheckBoxX64.isSelected()) {
1499 v.addElement(jCheckBoxX64.getText());
1500 }
1501 if (this.jCheckBoxIpf.isSelected()) {
1502 v.addElement(jCheckBoxIpf.getText());
1503 }
1504 if (this.jCheckBoxEbc.isSelected()) {
1505 v.addElement(jCheckBoxEbc.getText());
1506 }
1507 if (this.jCheckBoxArm.isSelected()) {
1508 v.addElement(jCheckBoxArm.getText());
1509 }
1510 if (this.jCheckBoxPpc.isSelected()) {
1511 v.addElement(jCheckBoxPpc.getText());
1512 }
1513 return v;
1514 }
1515
1516 private String getSelectedItemsString() {
1517 String s = "";
1518 if (this.jCheckBoxIa32.isSelected()) {
1519 s = s + jCheckBoxIa32.getText() + " ";
1520 }
1521 if (this.jCheckBoxX64.isSelected()) {
1522 s = s + jCheckBoxX64.getText() + " ";
1523 }
1524 if (this.jCheckBoxIpf.isSelected()) {
1525 s = s + jCheckBoxIpf.getText() + " ";
1526 }
1527 if (this.jCheckBoxEbc.isSelected()) {
1528 s = s + jCheckBoxEbc.getText() + " ";
1529 }
1530 if (this.jCheckBoxArm.isSelected()) {
1531 s = s + jCheckBoxArm.getText() + " ";
1532 }
1533 if (this.jCheckBoxPpc.isSelected()) {
1534 s = s + jCheckBoxPpc.getText() + " ";
1535 }
1536 return s.trim();
1537 }
1538
1539 private void setAllItemsSelected(boolean isSelected) {
1540 this.jCheckBoxIa32.setSelected(isSelected);
1541 this.jCheckBoxX64.setSelected(isSelected);
1542 this.jCheckBoxIpf.setSelected(isSelected);
1543 this.jCheckBoxEbc.setSelected(isSelected);
1544 this.jCheckBoxArm.setSelected(isSelected);
1545 this.jCheckBoxPpc.setSelected(isSelected);
1546 }
1547
1548 private void setSelectedItems(Vector<String> v) {
1549 setAllItemsSelected(false);
1550 if (v != null) {
1551 for (int index = 0; index < v.size(); index++) {
1552 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
1553 this.jCheckBoxIa32.setSelected(true);
1554 continue;
1555 }
1556 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
1557 this.jCheckBoxIpf.setSelected(true);
1558 continue;
1559 }
1560 if (v.get(index).equals(this.jCheckBoxX64.getText())) {
1561 this.jCheckBoxX64.setSelected(true);
1562 continue;
1563 }
1564 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
1565 this.jCheckBoxEbc.setSelected(true);
1566 continue;
1567 }
1568 if (v.get(index).equals(this.jCheckBoxArm.getText())) {
1569 this.jCheckBoxArm.setSelected(true);
1570 continue;
1571 }
1572 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
1573 this.jCheckBoxPpc.setSelected(true);
1574 continue;
1575 }
1576 }
1577 }
1578 }
1579
1580 /**
1581 * This method initializes jCheckBoxPcd
1582 *
1583 * @return javax.swing.JCheckBox
1584 */
1585 private JCheckBox getJCheckBoxPcd() {
1586 if (jCheckBoxPcd == null) {
1587 jCheckBoxPcd = new JCheckBox();
1588 jCheckBoxPcd.setBounds(new java.awt.Rectangle(labelCol, 530, labelWidth, 20));
1589 jCheckBoxPcd.setText("Is this a PCD Driver?");
1590 jCheckBoxPcd.addFocusListener(this);
1591 jCheckBoxPcd.addActionListener(this);
1592 }
1593 return jCheckBoxPcd;
1594 }
1595
1596 /**
1597 * This method initializes jCheckBoxFlashMap
1598 *
1599 * @return javax.swing.JCheckBox
1600 */
1601 private JCheckBox getJCheckBoxFlashMap() {
1602 if (jCheckBoxFlashMap == null) {
1603 jCheckBoxFlashMap = new JCheckBox();
1604 jCheckBoxFlashMap.setBounds(new java.awt.Rectangle(labelCol, 555, 480, 20));
1605 jCheckBoxFlashMap.setText("Does this module require a legacy FlashMap header file?");
1606 jCheckBoxFlashMap.addFocusListener(this);
1607 }
1608 return jCheckBoxFlashMap;
1609 }
1610
1611 /**
1612 * This method initializes jRadioButtonBinaryModuleTrue
1613 *
1614 * @return javax.swing.JRadioButton
1615 */
1616 private JRadioButton getJRadioButtonBinaryModuleTrue() {
1617 if (jRadioButtonBinaryModuleTrue == null) {
1618 jRadioButtonBinaryModuleTrue = new JRadioButton();
1619 jRadioButtonBinaryModuleTrue.setBounds(new java.awt.Rectangle(valueCol, 480, 140, 20));
1620 jRadioButtonBinaryModuleTrue.setText("True");
1621 jRadioButtonBinaryModuleTrue.setSelected(true);
1622 jRadioButtonBinaryModuleTrue.addFocusListener(this);
1623 jRadioButtonBinaryModuleTrue.setToolTipText("<html>Modules are either source modules <br>"
1624 + "which can be compiled or binary <br>"
1625 + "modules which are linked. <br>"
1626 + "A module cannot contain both. <br>"
1627 + "The GUID numbers should be identical <br>"
1628 + "for a binary and source MSA, <br>"
1629 + "however the BINARY MSA should have <br>"
1630 + "a higher version number.</html>");
1631 }
1632 return jRadioButtonBinaryModuleTrue;
1633 }
1634
1635 /**
1636 * This method initializes jRadioButtonBinaryModuleFalse
1637 *
1638 * @return javax.swing.JRadioButton
1639 */
1640 private JRadioButton getJRadioButtonBinaryModuleFalse() {
1641 if (jRadioButtonBinaryModuleFalse == null) {
1642 jRadioButtonBinaryModuleFalse = new JRadioButton();
1643 jRadioButtonBinaryModuleFalse.setBounds(new java.awt.Rectangle(valueCol + 140, 480, 140, 20));
1644 jRadioButtonBinaryModuleFalse.setText("False");
1645 jRadioButtonBinaryModuleFalse.addFocusListener(this);
1646 jRadioButtonBinaryModuleFalse.setToolTipText("<html>Modules are either source modules <br>"
1647 + "which can be compiled or binary <br>"
1648 + "modules which are linked. <br>"
1649 + "A module cannot contain both. <br>"
1650 + "The GUID numbers should be identical <br>"
1651 + "for a binary and source MSA, <br>"
1652 + "however the BINARY MSA should have <br>"
1653 + "a higher version number.</html>");
1654 }
1655 return jRadioButtonBinaryModuleFalse;
1656 }
1657 }