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