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