3 The file is used to create, update MsaHeader of MSA file
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
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.
16 package org
.tianocore
.frameworkwizard
.module
.ui
;
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
;
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
;
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
;
52 The class is used to create, update MsaHeader of MSA file
53 It extends IInternalFrame
58 public class MsaHeader
extends IInternalFrame
{
61 /// Define class Serial Version UID
63 private static final long serialVersionUID
= -8152099582923006900L;
65 private int dialogWidth
= 500;
67 private int dialogHeight
= 630;
69 private final int labelWidth
= 155;
71 private int valueWidth
= 320;
73 private final int labelCol
= 12;
75 private final int valueCol
= 168;
78 //Define class members
80 private JPanel jContentPane
= null;
82 private JLabel jLabelBaseName
= null;
84 private JTextField jTextFieldBaseName
= null;
86 private JLabel jLabelGuid
= null;
88 private JTextField jTextFieldGuid
= null;
90 private JLabel jLabelVersion
= null;
92 private JTextField jTextFieldVersion
= null;
94 private JButton jButtonGenerateGuid
= null;
96 private JLabel jLabelLicense
= null;
98 private JTextArea jTextAreaLicense
= null;
100 private JLabel jLabelCopyright
= null;
102 private JLabel jLabelDescription
= null;
104 private JTextArea jTextAreaDescription
= null;
106 private JLabel jLabelSpecification
= null;
108 private JTextField jTextFieldSpecification
= null;
110 private JButton jButtonOk
= null;
112 private JButton jButtonCancel
= null;
114 private JScrollPane jScrollPaneLicense
= null;
116 private JScrollPane jScrollPaneDescription
= null;
118 private JLabel jLabelAbstract
= null;
120 private JTextField jTextFieldAbstract
= null;
122 private JLabel jLabelModuleType
= null;
124 private JComboBox jComboBoxModuleType
= null;
126 private JLabel jLabelArch
= null;
128 private JLabel jLabelBinaryModule
= null;
130 private JLabel jLabelOutputFileBasename
= null;
132 private JTextField jTextFieldOutputFileBasename
= null;
134 private JScrollPane jScrollPaneCopyright
= null;
136 private JTextArea jTextAreaCopyright
= null;
138 private JLabel jLabelURL
= null;
140 private JTextField jTextFieldURL
= null;
142 private JScrollPane jScrollPane
= null;
144 private StarLabel jStarLabel1
= null;
146 private StarLabel jStarLabel2
= null;
148 private StarLabel jStarLabel4
= null;
150 private StarLabel jStarLabel5
= null;
152 private StarLabel jStarLabel6
= null;
154 private StarLabel jStarLabel7
= null;
156 private StarLabel jStarLabel8
= null;
158 private StarLabel jStarLabel10
= null;
160 private StarLabel jStarLabel12
= null;
162 private StarLabel jStarLabel13
= null;
164 private StarLabel jStarLabel14
= null;
166 private JCheckBox jCheckBoxIa32
= null;
168 private JCheckBox jCheckBoxX64
= null;
170 private JCheckBox jCheckBoxIpf
= null;
172 private JCheckBox jCheckBoxEbc
= null;
174 private JCheckBox jCheckBoxArm
= null;
176 private JCheckBox jCheckBoxPpc
= null;
178 private JTextField jComboBoxPcdIsDriver
= null;
180 private JCheckBox jCheckBoxPcd
= null;
182 private JCheckBox jCheckBoxFlashMap
= null;
187 private MsaHeaderDocument
.MsaHeader msaHeader
= null;
189 private ModuleDefinitionsDocument
.ModuleDefinitions md
= null;
191 private ModuleSurfaceAreaDocument
.ModuleSurfaceArea msa
= null;
193 private ExternsDocument
.Externs ex
= null;
195 private OpeningModuleType omt
= null;
197 private EnumerationData ed
= new EnumerationData();
199 private JRadioButton jRadioButtonBinaryModuleTrue
= null;
201 private JRadioButton jRadioButtonBinaryModuleFalse
= null;
204 * This method initializes jCheckBoxIa32
206 * @return javax.swing.JCheckBox
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);
217 return jCheckBoxIa32
;
221 * This method initializes jCheckBoxX64
223 * @return javax.swing.JCheckBox
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);
238 * This method initializes jCheckBoxIpf
240 * @return javax.swing.JCheckBox
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);
255 * This method initializes jCheckBoxEbc
257 * @return javax.swing.JCheckBox
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);
272 * This method initializes jCheckBoxArm
274 * @return javax.swing.JCheckBox
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);
289 * This method initializes jCheckBoxPpc
291 * @return javax.swing.JCheckBox
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);
306 This method initializes jTextFieldBaseName
308 @return javax.swing.JTextField jTextFieldBaseName
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");
319 return jTextFieldBaseName
;
323 This method initializes jTextFieldGuid
325 @return javax.swing.JTextField jTextFieldGuid
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)");
337 return jTextFieldGuid
;
341 This method initializes jTextFieldVersion
343 @return javax.swing.JTextField jTextFieldVersion
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");
355 return jTextFieldVersion
;
359 This method initializes jButtonGenerateGuid
361 @return javax.swing.JButton jButtonGenerateGuid
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);
374 return jButtonGenerateGuid
;
378 This method initializes jTextAreaLicense
380 @return javax.swing.JTextArea jTextAreaLicense
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.");
394 return jTextAreaLicense
;
398 This method initializes jTextAreaDescription
400 @return javax.swing.JTextArea jTextAreaDescription
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);
413 return jTextAreaDescription
;
417 This method initializes jTextFieldSpecification
419 @return javax.swing.JTextField jTextFieldSpecification
422 private JTextField
getJTextFieldSpecification() {
423 if (jTextFieldSpecification
== null) {
424 int specWidth
= valueWidth
+ 50;
425 jTextFieldSpecification
= new JTextField();
427 jTextFieldSpecification
.setPreferredSize(new java
.awt
.Dimension(specWidth
, 20));
428 jTextFieldSpecification
.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
429 jTextFieldSpecification
.setBorder(null);
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);
436 return jTextFieldSpecification
;
440 This method initializes jButtonOk
442 @return javax.swing.JButton jButtonOk
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);
458 This method initializes jButtonCancel
460 @return javax.swing.JButton jButtonCancel
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);
472 return jButtonCancel
;
476 This method initializes jScrollPaneLicense
478 @return javax.swing.JScrollPane jScrollPaneLicense
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));
490 return jScrollPaneLicense
;
494 This method initializes jScrollPaneDescription
496 @return javax.swing.JScrollPane jScrollPaneDescription
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));
508 return jScrollPaneDescription
;
512 This method initializes jTextFieldAbstract
514 @return javax.swing.JTextField jTextFieldAbstract
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.");
526 return jTextFieldAbstract
;
530 This method initializes jComboBoxModuleType
532 @return javax.swing.JComboBox jComboBoxModuleType
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);
543 return jComboBoxModuleType
;
547 This method initializes jTextFieldURL
549 @return javax.swing.JTextField
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.");
561 return jTextFieldURL
;
565 This method initializes jScrollPane
567 @return javax.swing.JScrollPane
570 private JScrollPane
getJScrollPane() {
571 if (jScrollPane
== null) {
572 jScrollPane
= new JScrollPane();
573 jScrollPane
.setViewportView(getJContentPane());
579 This method initializes jScrollPaneCopyright
581 @return javax.swing.JScrollPane
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));
592 return jScrollPaneCopyright
;
596 This method initializes jTextAreaCopyright
598 @return javax.swing.JTextArea
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.");
612 return jTextAreaCopyright
;
616 * This method initializes jTextFieldOutputFileBasename
618 * @return javax.swing.JTextField
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.");
628 return jTextFieldOutputFileBasename
;
632 * This method initializes jComboBoxPcdIsDriver
634 * @return javax.swing.JComboBox
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);
647 return jComboBoxPcdIsDriver
;
651 This is the default constructor
657 this.setVisible(true);
661 This is the override edit constructor
663 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
666 public MsaHeader(OpeningModuleType inMsa
) {
669 this.msa
= omt
.getXmlMsa();
672 // Set module definitions default value
674 if (msa
.getModuleDefinitions() == null) {
675 ModuleDefinitionsDocument
.ModuleDefinitions md
= ModuleDefinitionsDocument
.ModuleDefinitions
.Factory
677 md
.setOutputFileBasename(msa
.getMsaHeader().getModuleName());
678 md
.setBinaryModule(false);
679 md
.setSupportedArchitectures(ed
.getVSupportedArchitectures());
680 msa
.setModuleDefinitions(md
);
684 // Init items of Header, Definitions and Externs
686 init(msa
.getMsaHeader());
687 init(msa
.getModuleDefinitions());
688 init(msa
.getExterns());
690 this.setVisible(true);
691 this.setViewMode(false);
695 Disable all components when the mode is view
697 @param isView true - The view mode; false - The non-view mode
700 public void setViewMode(boolean 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
);
718 This method initializes this
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");
730 This method initializes this
731 Fill values to all fields if these values are not empty
733 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
736 private void init(MsaHeaderDocument
.MsaHeader inMsaHeader
) {
738 if (inMsaHeader
!= null) {
739 setMsaHeader(inMsaHeader
);
740 if (this.msaHeader
.getModuleName() != null) {
741 this.jTextFieldBaseName
.setText(this.msaHeader
.getModuleName());
743 if (this.msaHeader
.getModuleType() != null) {
744 this.jComboBoxModuleType
.setSelectedItem(this.msaHeader
.getModuleType().toString());
746 if (this.msaHeader
.getGuidValue() != null) {
747 this.jTextFieldGuid
.setText(this.msaHeader
.getGuidValue());
749 if (this.msaHeader
.getVersion() != null) {
750 this.jTextFieldVersion
.setText(this.msaHeader
.getVersion());
752 if (this.msaHeader
.getAbstract() != null) {
753 this.jTextFieldAbstract
.setText(this.msaHeader
.getAbstract());
755 if (this.msaHeader
.getDescription() != null) {
756 this.jTextAreaDescription
.setText(this.msaHeader
.getDescription());
757 jTextAreaDescription
.setSelectionStart(0);
758 jTextAreaDescription
.setSelectionEnd(0);
760 if (this.msaHeader
.getCopyright() != null) {
761 this.jTextAreaCopyright
.setText(this.msaHeader
.getCopyright());
763 if (this.msaHeader
.getLicense() != null) {
764 this.jTextAreaLicense
.setText(this.msaHeader
.getLicense().getStringValue());
765 jTextAreaLicense
.setSelectionStart(0);
766 jTextAreaLicense
.setSelectionEnd(0);
768 if (this.msaHeader
.getLicense() != null && this.msaHeader
.getLicense().getURL() != null) {
769 this.jTextFieldURL
.setText(this.msaHeader
.getLicense().getURL());
771 if (this.msaHeader
.getSpecification() != null) {
772 this.jTextFieldSpecification
.setText(this.msaHeader
.getSpecification());
778 This method initializes this
779 Fill values to all fields if these values are not empty
781 @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
784 private void init(ModuleDefinitionsDocument
.ModuleDefinitions inMd
) {
787 if (md
.getSupportedArchitectures() != null) {
788 this.setSelectedItems(Tools
.convertListToVector(md
.getSupportedArchitectures()));
790 if (md
.getBinaryModule()) {
791 this.jRadioButtonBinaryModuleTrue
.setSelected(true);
793 this.jRadioButtonBinaryModuleFalse
.setSelected(true);
795 if (md
.getOutputFileBasename() != null) {
796 this.jTextFieldOutputFileBasename
.setText(md
.getOutputFileBasename());
802 This method initializes this
803 Fill values to all fields if these values are not empty
805 @param inEx The input data of ExternsDocument.Externs
808 private void init(ExternsDocument
.Externs inEx
) {
811 if (ex
.getPcdIsDriver() != null) {
812 this.jCheckBoxPcd
.setSelected(true);
813 this.jCheckBoxPcd
.setEnabled(true);
815 this.jCheckBoxFlashMap
.setSelected(ex
.getTianoR8FlashMapH());
820 This method initializes jContentPane
822 @return javax.swing.JPanel jContentPane
825 private JPanel
getJContentPane() {
826 if (jContentPane
== null) {
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));
876 jContentPane
= new JPanel();
877 jContentPane
.setLayout(null);
878 jContentPane
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
- 10, dialogHeight
- 10));
880 jContentPane
.addFocusListener(this);
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);
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));
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);
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);
951 jContentPane
.add(getJCheckBoxPcd(), null);
952 jContentPane
.add(getJComboBoxPcdIsDriver(), null);
953 jContentPane
.add(getJCheckBoxFlashMap(), null);
955 ButtonGroup bg
= new ButtonGroup();
956 jContentPane
.add(getJRadioButtonBinaryModuleTrue(), null);
957 jContentPane
.add(getJRadioButtonBinaryModuleFalse(), null);
958 bg
.add(getJRadioButtonBinaryModuleTrue());
959 bg
.add(getJRadioButtonBinaryModuleFalse());
965 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
967 * Override actionPerformed to listen all actions
970 public void actionPerformed(ActionEvent arg0
) {
971 if (arg0
.getSource() == jButtonGenerateGuid
) {
972 jTextFieldGuid
.setText(Tools
.generateUuidString());
973 jTextFieldGuid
.requestFocus();
974 jButtonGenerateGuid
.requestFocus();
979 Data validation for all fields
981 @retval true - All datas are valid
982 @retval false - At least one data is invalid
985 public boolean check() {
987 // Check if all required fields are not empty
988 // and check if all data fields values are valid
994 if (isEmpty(this.jTextFieldBaseName
.getText())) {
995 Log
.wrn("Update Msa Header", "Name must be entered!");
996 //this.jTextFieldBaseName.requestFocus();
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();
1008 if (isEmpty(this.jTextFieldGuid
.getText())) {
1009 Log
.wrn("Update Msa Header", "The Guid Value must be entered!");
1010 //this.jTextFieldGuid.requestFocus();
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();
1022 if (isEmpty(this.jTextFieldVersion
.getText())) {
1023 Log
.wrn("Update Msa Header", "Version must be entered!");
1024 //this.jTextFieldVersion.requestFocus();
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();
1036 if (isEmpty(this.jTextFieldAbstract
.getText())) {
1037 Log
.wrn("Update Msa Header", "Abstract must be entered!");
1038 //this.jTextFieldAbstract.requestFocus();
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();
1049 // Check Description
1051 if (isEmpty(this.jTextAreaDescription
.getText())) {
1052 Log
.wrn("Update Msa Header", "Description must be entered!");
1053 //this.jTextAreaDescription.requestFocus();
1060 if (isEmpty(this.jTextAreaCopyright
.getText())) {
1061 Log
.wrn("Update Msa Header", "Copyright must be entered!");
1062 //this.jTextFieldCopyright.requestFocus();
1069 if (isEmpty(this.jTextAreaLicense
.getText())) {
1070 Log
.wrn("Update Msa Header", "License must be entered!");
1071 //this.jTextAreaLicense.requestFocus();
1076 // Check Specification
1078 if (isEmpty(this.jTextFieldSpecification
.getText())) {
1079 Log
.wrn("Update Msa Header", "Specification must exist.");
1080 //this.jTextFieldSpecification.requestFocus();
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
1087 Log
.wrn("Update Msa Header", "Incorrect data type for Specification");
1088 //this.jTextFieldSpecification.requestFocus();
1096 Save all components of Msa Header
1097 if exists msaHeader, set the value directly
1098 if not exists msaHeader, new an instance first
1101 public void save() {
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());
1114 This method initializes Module type and Compontent type
1117 private void initFrame() {
1118 EnumerationData ed
= new EnumerationData();
1119 Tools
.generateComboBoxByVector(jComboBoxModuleType
, ed
.getVModuleType());
1120 this.setSelectedItems(ed
.getVSupportedArchitectures());
1124 Get MsaHeaderDocument.MsaHeader
1126 @return MsaHeaderDocument.MsaHeader
1129 public MsaHeaderDocument
.MsaHeader
getMsaHeader() {
1134 Set MsaHeaderDocument.MsaHeader
1136 @param msaHeader The input data of MsaHeaderDocument.MsaHeader
1139 public void setMsaHeader(MsaHeaderDocument
.MsaHeader msaHeader
) {
1140 this.msaHeader
= msaHeader
;
1144 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
1146 * Override componentResized to resize all components when frame's size is changed
1148 public void componentResized(ComponentEvent arg0
) {
1149 int intCurrentWidth
= this.getJContentPane().getWidth();
1150 int intPreferredWidth
= this.getJContentPane().getPreferredSize().width
;
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
);
1165 Tools
.relocateComponentX(this.jButtonGenerateGuid
, intCurrentWidth
, intPreferredWidth
,
1166 DataType
.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON
);
1169 public void focusLost(FocusEvent arg0
) {
1170 if (this.msaHeader
== null) {
1171 msaHeader
= MsaHeaderDocument
.MsaHeader
.Factory
.newInstance();
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();
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();
1188 if (!this.jTextFieldBaseName
.getText().equals(msaHeader
.getModuleName())) {
1189 this.msaHeader
.setModuleName(this.jTextFieldBaseName
.getText());
1196 // Check Module Type
1198 if (arg0
.getSource() == this.jComboBoxModuleType
) {
1199 if (!jComboBoxModuleType
.getSelectedItem().toString().equals(msaHeader
.getModuleType().toString())) {
1200 msaHeader
.setModuleType(ModuleTypeDef
.Enum
.forString(jComboBoxModuleType
.getSelectedItem().toString()));
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();
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();
1220 if (!this.jTextFieldGuid
.getText().equals(msaHeader
.getGuidValue())) {
1221 this.msaHeader
.setGuidValue(this.jTextFieldGuid
.getText());
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();
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();
1241 if (!this.jTextFieldVersion
.getText().equals(msaHeader
.getVersion())) {
1242 this.msaHeader
.setVersion(this.jTextFieldVersion
.getText());
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();
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();
1262 if (!this.jTextFieldAbstract
.getText().equals(msaHeader
.getAbstract())) {
1263 this.msaHeader
.setAbstract(this.jTextFieldAbstract
.getText());
1270 // Check Description
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();
1278 if (!this.jTextAreaDescription
.getText().equals(msaHeader
.getDescription())) {
1279 this.msaHeader
.setDescription(this.jTextAreaDescription
.getText());
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();
1294 if (!this.jTextAreaCopyright
.getText().equals(msaHeader
.getCopyright())) {
1295 this.msaHeader
.setCopyright(this.jTextAreaCopyright
.getText());
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();
1310 if (this.msaHeader
.getLicense() != null) {
1311 if (!this.jTextAreaLicense
.getText().equals(msaHeader
.getLicense().getStringValue())) {
1312 this.msaHeader
.getLicense().setStringValue(this.jTextAreaLicense
.getText());
1317 License mLicense
= License
.Factory
.newInstance();
1318 mLicense
.setStringValue(this.jTextAreaLicense
.getText());
1319 this.msaHeader
.setLicense(mLicense
);
1324 // Check License URL
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
);
1333 if (!this.jTextFieldURL
.getText().equals(msaHeader
.getLicense().getURL())) {
1334 this.msaHeader
.getLicense().setURL(this.jTextFieldURL
.getText());
1343 // Check Output File Basename
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);
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");
1360 if (!this.jTextFieldOutputFileBasename
.getText().equals(md
.getOutputFileBasename())) {
1361 this.md
.setOutputFileBasename(this.jTextFieldOutputFileBasename
.getText());
1368 // Check Binary Module Type
1370 if (arg0
.getSource() == this.jRadioButtonBinaryModuleTrue
) {
1371 if (jRadioButtonBinaryModuleTrue
.isSelected()) {
1372 if (md
.getBinaryModule()) {
1375 md
.setBinaryModule(true);
1381 // Check Binary Module Type
1383 if (arg0
.getSource() == this.jRadioButtonBinaryModuleFalse
) {
1384 if (jRadioButtonBinaryModuleFalse
.isSelected()) {
1385 if (md
.getBinaryModule()) {
1386 md
.setBinaryModule(false);
1394 // Check Supported Arch
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());
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
));
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
));
1431 if (this.ex
.getPcdIsDriver() != null) {
1432 newEx
.setPcdIsDriver(this.ex
.getPcdIsDriver());
1435 this.msa
.setExterns(this.ex
);
1442 private Vector
<String
> getSelectedItemsVector() {
1443 Vector
<String
> v
= new Vector
<String
>();
1444 if (this.jCheckBoxIa32
.isSelected()) {
1445 v
.addElement(jCheckBoxIa32
.getText());
1447 if (this.jCheckBoxX64
.isSelected()) {
1448 v
.addElement(jCheckBoxX64
.getText());
1450 if (this.jCheckBoxIpf
.isSelected()) {
1451 v
.addElement(jCheckBoxIpf
.getText());
1453 if (this.jCheckBoxEbc
.isSelected()) {
1454 v
.addElement(jCheckBoxEbc
.getText());
1456 if (this.jCheckBoxArm
.isSelected()) {
1457 v
.addElement(jCheckBoxArm
.getText());
1459 if (this.jCheckBoxPpc
.isSelected()) {
1460 v
.addElement(jCheckBoxPpc
.getText());
1465 private String
getSelectedItemsString() {
1467 if (this.jCheckBoxIa32
.isSelected()) {
1468 s
= s
+ jCheckBoxIa32
.getText() + " ";
1470 if (this.jCheckBoxX64
.isSelected()) {
1471 s
= s
+ jCheckBoxX64
.getText() + " ";
1473 if (this.jCheckBoxIpf
.isSelected()) {
1474 s
= s
+ jCheckBoxIpf
.getText() + " ";
1476 if (this.jCheckBoxEbc
.isSelected()) {
1477 s
= s
+ jCheckBoxEbc
.getText() + " ";
1479 if (this.jCheckBoxArm
.isSelected()) {
1480 s
= s
+ jCheckBoxArm
.getText() + " ";
1482 if (this.jCheckBoxPpc
.isSelected()) {
1483 s
= s
+ jCheckBoxPpc
.getText() + " ";
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
);
1497 private void setSelectedItems(Vector
<String
> v
) {
1498 setAllItemsSelected(false);
1499 boolean isIA32Selected
= false;
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;
1507 if (v
.get(index
).equals(this.jCheckBoxIpf
.getText())) {
1508 this.jCheckBoxIpf
.setSelected(true);
1511 if (v
.get(index
).equals(this.jCheckBoxX64
.getText())) {
1512 this.jCheckBoxX64
.setSelected(true);
1515 if (v
.get(index
).equals(this.jCheckBoxEbc
.getText())) {
1516 this.jCheckBoxEbc
.setSelected(true);
1519 if (v
.get(index
).equals(this.jCheckBoxArm
.getText())) {
1520 this.jCheckBoxArm
.setSelected(true);
1523 if (v
.get(index
).equals(this.jCheckBoxPpc
.getText())) {
1524 this.jCheckBoxPpc
.setSelected(true);
1528 if (!isIA32Selected
) {
1529 this.jCheckBoxIa32
.setSelected(false);
1535 * This method initializes jCheckBoxPcd
1537 * @return javax.swing.JCheckBox
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);
1549 return jCheckBoxPcd
;
1553 * This method initializes jCheckBoxFlashMap
1555 * @return javax.swing.JCheckBox
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);
1564 return jCheckBoxFlashMap
;
1568 * This method initializes jRadioButtonBinaryModuleTrue
1570 * @return javax.swing.JRadioButton
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>");
1588 return jRadioButtonBinaryModuleTrue
;
1592 * This method initializes jRadioButtonBinaryModuleFalse
1594 * @return javax.swing.JRadioButton
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>");
1611 return jRadioButtonBinaryModuleFalse
;
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()) {
1622 .wrn("At lease one Supportted Architecture should be selected! IA32 is selected as default value!");
1623 this.jCheckBoxIa32
.setSelected(true);
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);
1636 this.jCheckBoxPcd
.setEnabled(false);
1637 this.jCheckBoxPcd
.setSelected(false);
1642 // Check Pcd is Driver
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);
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
);
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
));
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
));
1682 if (this.ex
.getTianoR8FlashMapH()) {
1683 newEx
.setTianoR8FlashMapH(this.ex
.getTianoR8FlashMapH());
1686 this.msa
.setExterns(this.ex
);