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