9cf0d380e0244fd1ee3ada129b8d7657657ae039
[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 jTextFieldGuid.requestFocus();
932 jButtonGenerateGuid.requestFocus();
933 }
934 }
935
936 /**
937 Data validation for all fields
938
939 @retval true - All datas are valid
940 @retval false - At least one data is invalid
941
942 **/
943 public boolean check() {
944 //
945 // Check if all required fields are not empty
946 // and check if all data fields values are valid
947 //
948
949 //
950 // Check Base Name
951 //
952 if (isEmpty(this.jTextFieldBaseName.getText())) {
953 Log.wrn("Update Msa Header", "Name must be entered!");
954 //this.jTextFieldBaseName.requestFocus();
955 return false;
956 }
957 if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
958 Log.wrn("Update Msa Header", "Incorrect data type for Name, it must start with an alpha character!");
959 //this.jTextFieldBaseName.requestFocus();
960 return false;
961 }
962
963 //
964 // Check Guid
965 //
966 if (isEmpty(this.jTextFieldGuid.getText())) {
967 Log.wrn("Update Msa Header", "The Guid Value must be entered!");
968 //this.jTextFieldGuid.requestFocus();
969 return false;
970 }
971 if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
972 Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format, 8-4-4-4-12");
973 //this.jTextFieldGuid.requestFocus();
974 return false;
975 }
976
977 //
978 // Check Version
979 //
980 if (isEmpty(this.jTextFieldVersion.getText())) {
981 Log.wrn("Update Msa Header", "Version must be entered!");
982 //this.jTextFieldVersion.requestFocus();
983 return false;
984 }
985 if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
986 Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
987 //this.jTextFieldVersion.requestFocus();
988 return false;
989 }
990
991 //
992 // Check Abstact
993 //
994 if (isEmpty(this.jTextFieldAbstract.getText())) {
995 Log.wrn("Update Msa Header", "Abstract must be entered!");
996 //this.jTextFieldAbstract.requestFocus();
997 return false;
998 }
999 if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
1000 Log.wrn("Update Msa Header", "Incorrect data type for Abstract, is should be a sentence describing the module.");
1001 //this.jTextFieldAbstract.requestFocus();
1002 return false;
1003 }
1004
1005 //
1006 // Check Description
1007 //
1008 if (isEmpty(this.jTextAreaDescription.getText())) {
1009 Log.wrn("Update Msa Header", "Description must be entered!");
1010 //this.jTextAreaDescription.requestFocus();
1011 return false;
1012 }
1013
1014 //
1015 // Check Copyright
1016 //
1017 if (isEmpty(this.jTextAreaCopyright.getText())) {
1018 Log.wrn("Update Msa Header", "Copyright must be entered!");
1019 //this.jTextFieldCopyright.requestFocus();
1020 return false;
1021 }
1022
1023 //
1024 // Check License
1025 //
1026 if (isEmpty(this.jTextAreaLicense.getText())) {
1027 Log.wrn("Update Msa Header", "License must be entered!");
1028 //this.jTextAreaLicense.requestFocus();
1029 return false;
1030 }
1031
1032 //
1033 // Check Specification
1034 //
1035 if (isEmpty(this.jTextFieldSpecification.getText())) {
1036 Log.wrn("Update Msa Header", "Specification must exist.");
1037 //this.jTextFieldSpecification.requestFocus();
1038 return false;
1039 }
1040 if (!DataValidation.isSpecification(this.jTextFieldSpecification.getText())) {
1041 // TODO Add code to check the specification number.
1042 // Future releases of Schema may require that we process these files
1043 // differently.
1044 Log.wrn("Update Msa Header", "Incorrect data type for Specification");
1045 //this.jTextFieldSpecification.requestFocus();
1046 return false;
1047 }
1048
1049 return true;
1050 }
1051
1052 /**
1053 Save all components of Msa Header
1054 if exists msaHeader, set the value directly
1055 if not exists msaHeader, new an instance first
1056
1057 **/
1058 public void save() {
1059 try {
1060 msaHeader.setSpecification(this.jTextFieldSpecification.getText());
1061 msa.setMsaHeader(msaHeader);
1062 msa.setModuleDefinitions(md);
1063 this.omt.setSaved(false);
1064 } catch (Exception e) {
1065 Log.wrn("Save Module", e.getMessage());
1066 Log.err("Save Module", e.getMessage());
1067 }
1068 }
1069
1070 /**
1071 This method initializes Module type and Compontent type
1072
1073 **/
1074 private void initFrame() {
1075 EnumerationData ed = new EnumerationData();
1076 Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());
1077 Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());
1078 this.setSelectedItems(ed.getVSupportedArchitectures());
1079 }
1080
1081 /**
1082 Get MsaHeaderDocument.MsaHeader
1083
1084 @return MsaHeaderDocument.MsaHeader
1085
1086 **/
1087 public MsaHeaderDocument.MsaHeader getMsaHeader() {
1088 return msaHeader;
1089 }
1090
1091 /**
1092 Set MsaHeaderDocument.MsaHeader
1093
1094 @param msaHeader The input data of MsaHeaderDocument.MsaHeader
1095
1096 **/
1097 public void setMsaHeader(MsaHeaderDocument.MsaHeader msaHeader) {
1098 this.msaHeader = msaHeader;
1099 }
1100
1101 /* (non-Javadoc)
1102 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
1103 *
1104 * Override componentResized to resize all components when frame's size is changed
1105 */
1106 public void componentResized(ComponentEvent arg0) {
1107 int intCurrentWidth = this.getJContentPane().getWidth();
1108 int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
1109
1110 Tools.resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth, intPreferredWidth);
1111 Tools.resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth, intPreferredWidth);
1112 Tools.resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth);
1113 Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
1114 Tools.resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);
1115 Tools.resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth);
1116 Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
1117 Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);
1118 Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
1119 Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);
1120 Tools.resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth);
1121 Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);
1122
1123 Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
1124 DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
1125 }
1126
1127 public void focusLost(FocusEvent arg0) {
1128 if (this.msaHeader == null) {
1129 msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
1130 }
1131
1132 //
1133 // Check BaseName
1134 //
1135 if (arg0.getSource() == this.jTextFieldBaseName) {
1136 if (isEmpty(this.jTextFieldBaseName.getText())) {
1137 Log.wrn("Update Msa Header", "The Name must be entered!");
1138 //this.jTextFieldBaseName.requestFocus();
1139 return;
1140 }
1141 if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
1142 Log.wrn("Update Msa Header", "Incorrect data type for Name, it must begin with an alpha character.");
1143 //this.jTextFieldBaseName.requestFocus();
1144 return;
1145 }
1146 if (!this.jTextFieldBaseName.getText().equals(msaHeader.getModuleName())) {
1147 this.msaHeader.setModuleName(this.jTextFieldBaseName.getText());
1148 } else {
1149 return;
1150 }
1151 }
1152
1153 //
1154 // Check Module Type
1155 //
1156 if (arg0.getSource() == this.jComboBoxModuleType) {
1157 if (!jComboBoxModuleType.getSelectedItem().toString().equals(msaHeader.getModuleType().toString())) {
1158 msaHeader.setModuleType(ModuleTypeDef.Enum.forString(jComboBoxModuleType.getSelectedItem().toString()));
1159 } else {
1160 return;
1161 }
1162 }
1163
1164 //
1165 // Check Guid
1166 //
1167 if (arg0.getSource() == this.jTextFieldGuid) {
1168 if (isEmpty(this.jTextFieldGuid.getText())) {
1169 Log.wrn("Update Msa Header", "Guid must be entered!");
1170 //this.jTextFieldGuid.requestFocus();
1171 return;
1172 }
1173 if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
1174 Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format. (8-4-4-4-12)");
1175 //this.jTextFieldGuid.requestFocus();
1176 return;
1177 }
1178 if (!this.jTextFieldGuid.getText().equals(msaHeader.getGuidValue())) {
1179 this.msaHeader.setGuidValue(this.jTextFieldGuid.getText());
1180 } else {
1181 return;
1182 }
1183 }
1184
1185 //
1186 // Check Version
1187 //
1188 if (arg0.getSource() == this.jTextFieldVersion) {
1189 if (isEmpty(this.jTextFieldVersion.getText())) {
1190 Log.wrn("Update Msa Header", "Version must be entered!");
1191 //this.jTextFieldVersion.requestFocus();
1192 return;
1193 }
1194 if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
1195 Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
1196 //this.jTextFieldVersion.requestFocus();
1197 return;
1198 }
1199 if (!this.jTextFieldVersion.getText().equals(msaHeader.getVersion())) {
1200 this.msaHeader.setVersion(this.jTextFieldVersion.getText());
1201 } else {
1202 return;
1203 }
1204 }
1205
1206 //
1207 // Check Abstact
1208 //
1209 if (arg0.getSource() == this.jTextFieldAbstract) {
1210 if (isEmpty(this.jTextFieldAbstract.getText())) {
1211 Log.wrn("Update Msa Header", "Abstract must be entered!");
1212 //this.jTextFieldAbstract.requestFocus();
1213 return;
1214 }
1215 if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
1216 Log.wrn("Update Msa Header", "Incorrect data type for Abstract, it must be sentence.");
1217 //this.jTextFieldAbstract.requestFocus();
1218 return;
1219 }
1220 if (!this.jTextFieldAbstract.getText().equals(msaHeader.getAbstract())) {
1221 this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());
1222 } else {
1223 return;
1224 }
1225 }
1226
1227 //
1228 // Check Description
1229 //
1230 if (arg0.getSource() == this.jTextAreaDescription) {
1231 if (isEmpty(this.jTextAreaDescription.getText())) {
1232 Log.wrn("Update Msa Header", "Description must be entered!");
1233 //this.jTextAreaDescription.requestFocus();
1234 return;
1235 }
1236 if (!this.jTextAreaDescription.getText().equals(msaHeader.getDescription())) {
1237 this.msaHeader.setDescription(this.jTextAreaDescription.getText());
1238 } else {
1239 return;
1240 }
1241 }
1242
1243 //
1244 // Check Copyright
1245 //
1246 if (arg0.getSource() == this.jTextAreaCopyright) {
1247 if (isEmpty(this.jTextAreaCopyright.getText())) {
1248 Log.wrn("Update Msa Header", "Copyright must be entered!");
1249 //this.jTextFieldCopyright.requestFocus();
1250 return;
1251 }
1252 if (!this.jTextAreaCopyright.getText().equals(msaHeader.getCopyright())) {
1253 this.msaHeader.setCopyright(this.jTextAreaCopyright.getText());
1254 } else {
1255 return;
1256 }
1257 }
1258
1259 //
1260 // Check License
1261 //
1262 if (arg0.getSource() == this.jTextAreaLicense) {
1263 if (isEmpty(this.jTextAreaLicense.getText())) {
1264 Log.wrn("Update Msa Header", "License must be entered!");
1265 //this.jTextAreaLicense.requestFocus();
1266 return;
1267 }
1268 if (this.msaHeader.getLicense() != null) {
1269 if (!this.jTextAreaLicense.getText().equals(msaHeader.getLicense().getStringValue())) {
1270 this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
1271 } else {
1272 return;
1273 }
1274 } else {
1275 License mLicense = License.Factory.newInstance();
1276 mLicense.setStringValue(this.jTextAreaLicense.getText());
1277 this.msaHeader.setLicense(mLicense);
1278 }
1279 }
1280
1281 //
1282 // Check License URL
1283 //
1284 if (arg0.getSource() == this.jTextFieldURL) {
1285 if (!isEmpty(this.jTextFieldURL.getText())) {
1286 if (this.msaHeader.getLicense() == null) {
1287 License mLicense = License.Factory.newInstance();
1288 mLicense.setURL(this.jTextFieldURL.getText());
1289 this.msaHeader.setLicense(mLicense);
1290 } else {
1291 if (!this.jTextFieldURL.getText().equals(msaHeader.getLicense().getURL())) {
1292 this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText());
1293 } else {
1294 return;
1295 }
1296 }
1297 }
1298 }
1299
1300 //
1301 // Check Output File Basename
1302 //
1303 if (arg0.getSource() == this.jTextFieldOutputFileBasename) {
1304 if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {
1305 Log.wrn("Update Msa Header", "Output File Basename must be entered!");
1306 // jTextFieldOutputFileBasename.removeFocusListener(this);
1307 // jTextFieldOutputFileBasename.requestFocus();
1308 // jTextFieldOutputFileBasename.addFocusListener(this);
1309 return;
1310 }
1311 if (!this.jTextFieldOutputFileBasename.getText().equals(md.getOutputFileBasename())) {
1312 this.md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText());
1313 } else {
1314 return;
1315 }
1316 }
1317
1318 //
1319 // Check Binary Module Type
1320 //
1321 if (arg0.getSource() == this.jComboBoxBinaryModule) {
1322 if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.TRUE)) {
1323 if (md.getBinaryModule()) {
1324 return;
1325 } else {
1326 md.setBinaryModule(true);
1327 }
1328 } else if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.FALSE)) {
1329 if (md.getBinaryModule()) {
1330 md.setBinaryModule(false);
1331 } else {
1332 return;
1333 }
1334 }
1335 }
1336
1337 //
1338 // Check Supported Arch
1339 //
1340 if (arg0.getSource() == this.jCheckBoxArm || arg0.getSource() == this.jCheckBoxEbc
1341 || arg0.getSource() == this.jCheckBoxIa32 || arg0.getSource() == this.jCheckBoxIpf
1342 || arg0.getSource() == this.jCheckBoxPpc || arg0.getSource() == this.jCheckBoxX64) {
1343 if (!this.getSelectedItemsString().equals(md.getSupportedArchitectures().toString())) {
1344 md.setSupportedArchitectures(this.getSelectedItemsVector());
1345 } else {
1346 return;
1347 }
1348 }
1349
1350 this.save();
1351 }
1352
1353 private Vector<String> getSelectedItemsVector() {
1354 Vector<String> v = new Vector<String>();
1355 if (this.jCheckBoxIa32.isSelected()) {
1356 v.addElement(jCheckBoxIa32.getText());
1357 }
1358 if (this.jCheckBoxX64.isSelected()) {
1359 v.addElement(jCheckBoxX64.getText());
1360 }
1361 if (this.jCheckBoxIpf.isSelected()) {
1362 v.addElement(jCheckBoxIpf.getText());
1363 }
1364 if (this.jCheckBoxEbc.isSelected()) {
1365 v.addElement(jCheckBoxEbc.getText());
1366 }
1367 if (this.jCheckBoxArm.isSelected()) {
1368 v.addElement(jCheckBoxArm.getText());
1369 }
1370 if (this.jCheckBoxPpc.isSelected()) {
1371 v.addElement(jCheckBoxPpc.getText());
1372 }
1373 return v;
1374 }
1375
1376 private String getSelectedItemsString() {
1377 String s = "";
1378 if (this.jCheckBoxIa32.isSelected()) {
1379 s = s + jCheckBoxIa32.getText() + " ";
1380 }
1381 if (this.jCheckBoxX64.isSelected()) {
1382 s = s + jCheckBoxX64.getText() + " ";
1383 }
1384 if (this.jCheckBoxIpf.isSelected()) {
1385 s = s + jCheckBoxIpf.getText() + " ";
1386 }
1387 if (this.jCheckBoxEbc.isSelected()) {
1388 s = s + jCheckBoxEbc.getText() + " ";
1389 }
1390 if (this.jCheckBoxArm.isSelected()) {
1391 s = s + jCheckBoxArm.getText() + " ";
1392 }
1393 if (this.jCheckBoxPpc.isSelected()) {
1394 s = s + jCheckBoxPpc.getText() + " ";
1395 }
1396 return s.trim();
1397 }
1398
1399 private void setAllItemsSelected(boolean isSelected) {
1400 this.jCheckBoxIa32.setSelected(isSelected);
1401 this.jCheckBoxX64.setSelected(isSelected);
1402 this.jCheckBoxIpf.setSelected(isSelected);
1403 this.jCheckBoxEbc.setSelected(isSelected);
1404 this.jCheckBoxArm.setSelected(isSelected);
1405 this.jCheckBoxPpc.setSelected(isSelected);
1406 }
1407
1408 private void setSelectedItems(Vector<String> v) {
1409 setAllItemsSelected(false);
1410 if (v != null) {
1411 for (int index = 0; index < v.size(); index++) {
1412 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
1413 this.jCheckBoxIa32.setSelected(true);
1414 continue;
1415 }
1416 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
1417 this.jCheckBoxIpf.setSelected(true);
1418 continue;
1419 }
1420 if (v.get(index).equals(this.jCheckBoxX64.getText())) {
1421 this.jCheckBoxX64.setSelected(true);
1422 continue;
1423 }
1424 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
1425 this.jCheckBoxEbc.setSelected(true);
1426 continue;
1427 }
1428 if (v.get(index).equals(this.jCheckBoxArm.getText())) {
1429 this.jCheckBoxArm.setSelected(true);
1430 continue;
1431 }
1432 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
1433 this.jCheckBoxPpc.setSelected(true);
1434 continue;
1435 }
1436 }
1437 }
1438 }
1439 }