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