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