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