aefeba500f7c48e1d9508405a45db588705dea8f
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / ModuleHiiPackages.java
1 /** @file
2
3 The file is used to create, update Formset of MSA/MBD 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 package org.tianocore.frameworkwizard.module.ui;
16
17 import java.awt.event.ActionEvent;
18 import java.awt.event.ComponentEvent;
19 import java.awt.event.ItemEvent;
20 import java.util.Vector;
21
22 import javax.swing.JButton;
23 import javax.swing.JComboBox;
24 import javax.swing.JLabel;
25 import javax.swing.JPanel;
26 import javax.swing.JScrollPane;
27 import javax.swing.JTextArea;
28 import javax.swing.JTextField;
29
30 import org.tianocore.HiiPackageUsage;
31 import org.tianocore.HiiPackagesDocument;
32 import org.tianocore.HiiPackagesDocument.HiiPackages;
33 import org.tianocore.HiiPackagesDocument.HiiPackages.HiiPackage;
34 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
35 import org.tianocore.frameworkwizard.common.DataType;
36 import org.tianocore.frameworkwizard.common.DataValidation;
37 import org.tianocore.frameworkwizard.common.EnumerationData;
38 import org.tianocore.frameworkwizard.common.Log;
39 import org.tianocore.frameworkwizard.common.Tools;
40 import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
41 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
42 import org.tianocore.frameworkwizard.common.ui.StarLabel;
43 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
44 import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesIdentification;
45 import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesVector;
46
47 /**
48 The class is used to create, update Formset of MSA/MBD file
49 It extends IInternalFrame
50
51
52
53 **/
54 public class ModuleHiiPackages extends IInternalFrame {
55
56 ///
57 /// Define class Serial Version UID
58 ///
59 private static final long serialVersionUID = -6851574146786158116L;
60
61 //
62 //Define class members
63 //
64 private JPanel jContentPane = null;
65
66 private JLabel jLabelName = null;
67
68 private JTextField jTextFieldName = null;
69
70 private JLabel jLabelUsage = null;
71
72 private JComboBox jComboBoxUsage = null;
73
74 private StarLabel jStarLabel1 = null;
75
76 private StarLabel jStarLabel2 = null;
77
78 private JLabel jLabelFeatureFlag = null;
79
80 private JTextField jTextFieldFeatureFlag = null;
81
82 private JLabel jLabelArch = null;
83
84 private JTextArea jTextAreaList = null;
85
86 private JComboBox jComboBoxList = null;
87
88 private JButton jButtonAdd = null;
89
90 private JButton jButtonRemove = null;
91
92 private JButton jButtonUpdate = null;
93
94 private JScrollPane jScrollPane = null;
95
96 private JScrollPane jScrollPaneList = null;
97
98 private ICheckBoxList iCheckBoxListArch = null;
99
100 private JScrollPane jScrollPaneArch = null;
101
102 private JLabel jLabelHelpText = null;
103
104 private JTextField jTextFieldHelpText = null;
105
106 //
107 // Not used by UI
108 //
109 private int intSelectedItemId = 0;
110
111 private OpeningModuleType omt = null;
112
113 private ModuleSurfaceArea msa = null;
114
115 private HiiPackagesDocument.HiiPackages hiiPackages = null;
116
117 private HiiPackagesIdentification id = null;
118
119 private HiiPackagesVector vid = new HiiPackagesVector();
120
121 private EnumerationData ed = new EnumerationData();
122
123 /**
124 This method initializes jTextFieldName
125
126 @return javax.swing.JTextField jTextFieldName
127
128 **/
129 private JTextField getJTextFieldName() {
130 if (jTextFieldName == null) {
131 jTextFieldName = new JTextField();
132 jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
133 jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20));
134 jTextFieldName.setToolTipText("Enter the C Name of the HII Package");
135 }
136 return jTextFieldName;
137 }
138
139 /**
140 This method initializes jComboBoxUsage
141
142 @return javax.swing.JComboBox jComboBoxUsage
143
144 **/
145 private JComboBox getJComboBoxUsage() {
146 if (jComboBoxUsage == null) {
147 jComboBoxUsage = new JComboBox();
148 jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
149 jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
150 }
151 return jComboBoxUsage;
152 }
153
154 /**
155 * This method initializes jTextFieldFeatureFlag
156 *
157 * @return javax.swing.JTextField
158 */
159 private JTextField getJTextFieldFeatureFlag() {
160 if (jTextFieldFeatureFlag == null) {
161 jTextFieldFeatureFlag = new JTextField();
162 jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
163 jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
164 }
165 return jTextFieldFeatureFlag;
166 }
167
168 /**
169 This method initializes jComboBoxFileList
170
171 @return javax.swing.JComboBox jComboBoxFileList
172
173 **/
174 private JComboBox getJComboBoxList() {
175 if (jComboBoxList == null) {
176 jComboBoxList = new JComboBox();
177 jComboBoxList.setBounds(new java.awt.Rectangle(15, 195, 210, 20));
178 jComboBoxList.addItemListener(this);
179 jComboBoxList.addActionListener(this);
180 jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));
181 }
182 return jComboBoxList;
183 }
184
185 /**
186 This method initializes jButtonAdd
187
188 @return javax.swing.JButton jButtonAdd
189
190 **/
191 private JButton getJButtonAdd() {
192 if (jButtonAdd == null) {
193 jButtonAdd = new JButton();
194 jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));
195 jButtonAdd.setText("Add");
196 jButtonAdd.addActionListener(this);
197 jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));
198 }
199 return jButtonAdd;
200 }
201
202 /**
203 This method initializes jButtonRemove
204
205 @return javax.swing.JButton jButtonRemove
206
207 **/
208 private JButton getJButtonRemove() {
209 if (jButtonRemove == null) {
210 jButtonRemove = new JButton();
211 jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));
212 jButtonRemove.setText("Remove");
213 jButtonRemove.addActionListener(this);
214 jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));
215 }
216 return jButtonRemove;
217 }
218
219 /**
220 This method initializes jButtonUpdate
221
222 @return javax.swing.JButton jButtonUpdate
223
224 **/
225 private JButton getJButtonUpdate() {
226 if (jButtonUpdate == null) {
227 jButtonUpdate = new JButton();
228 jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));
229 jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));
230 jButtonUpdate.setText("Update");
231 jButtonUpdate.addActionListener(this);
232 }
233 return jButtonUpdate;
234 }
235
236 /**
237 * This method initializes jScrollPaneFileList
238 *
239 * @return javax.swing.JScrollPane
240 */
241 private JScrollPane getJScrollPaneList() {
242 if (jScrollPaneList == null) {
243 jScrollPaneList = new JScrollPane();
244 jScrollPaneList.setBounds(new java.awt.Rectangle(15, 220, 465, 240));
245 jScrollPaneList.setViewportView(getJTextAreaList());
246 jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));
247 }
248 return jScrollPaneList;
249 }
250
251 /**
252 This method initializes jScrollPane
253
254 @return javax.swing.JScrollPane
255 */
256 private JScrollPane getJScrollPane() {
257 if (jScrollPane == null) {
258 jScrollPane = new JScrollPane();
259 jScrollPane.setViewportView(getJContentPane());
260 }
261 return jScrollPane;
262 }
263
264 /**
265 * This method initializes jTextAreaFileList
266 *
267 * @return javax.swing.JTextArea
268 */
269 private JTextArea getJTextAreaList() {
270 if (jTextAreaList == null) {
271 jTextAreaList = new JTextArea();
272 jTextAreaList.setEditable(false);
273
274 }
275 return jTextAreaList;
276 }
277
278 /**
279 This method initializes jTextFieldHelpText
280
281 @return javax.swing.JTextField
282
283 **/
284 private JTextField getJTextFieldHelpText() {
285 if (jTextFieldHelpText == null) {
286 jTextFieldHelpText = new JTextField();
287 jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
288 jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
289 }
290 return jTextFieldHelpText;
291 }
292
293 /**
294 This method initializes iCheckBoxListArch
295
296 @return ICheckBoxList
297 **/
298 private ICheckBoxList getICheckBoxListSupportedArchitectures() {
299 if (iCheckBoxListArch == null) {
300 iCheckBoxListArch = new ICheckBoxList();
301 iCheckBoxListArch.addFocusListener(this);
302 iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
303 }
304 return iCheckBoxListArch;
305 }
306
307 /**
308 This method initializes jScrollPaneArch
309
310 @return javax.swing.JScrollPane
311
312 **/
313 private JScrollPane getJScrollPaneArch() {
314 if (jScrollPaneArch == null) {
315 jScrollPaneArch = new JScrollPane();
316 jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
317 jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
318 jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
319 }
320 return jScrollPaneArch;
321 }
322
323 public static void main(String[] args) {
324
325 }
326
327 /**
328 This method initializes this
329
330 **/
331 private void init() {
332 this.setSize(500, 515);
333 this.setContentPane(getJScrollPane());
334 this.setTitle("Hii Packages");
335 initFrame();
336 this.setViewMode(false);
337 }
338
339 /**
340 This method initializes this
341 Fill values to all fields if these values are not empty
342
343 @param inPackageDependencies
344
345 **/
346 private void init(HiiPackages inHiiPackages) {
347 init();
348 this.hiiPackages = inHiiPackages;
349
350 if (this.hiiPackages != null) {
351 if (this.hiiPackages.getHiiPackageList().size() > 0) {
352 for (int index = 0; index < this.hiiPackages.getHiiPackageList().size(); index++) {
353 String arg0 = hiiPackages.getHiiPackageList().get(index).getHiiCName();
354 String arg1 = null;
355 if (hiiPackages.getHiiPackageList().get(index).getUsage() != null) {
356 arg1 = hiiPackages.getHiiPackageList().get(index).getUsage().toString();
357 }
358
359 String arg2 = hiiPackages.getHiiPackageList().get(index).getFeatureFlag();
360 Vector<String> arg3 = Tools.convertListToVector(hiiPackages.getHiiPackageList().get(index)
361 .getSupArchList());
362 String arg4 = hiiPackages.getHiiPackageList().get(index).getHelpText();
363
364 id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
365 vid.addHiiPackages(id);
366 }
367 }
368 }
369 //
370 // Update the list
371 //
372 Tools.generateComboBoxByVector(jComboBoxList, vid.getHiiPackagesName());
373 reloadListArea();
374 }
375
376 /**
377 This is the default constructor
378
379 **/
380 public ModuleHiiPackages() {
381 super();
382 init();
383 this.setVisible(true);
384 }
385
386 /**
387 *
388 */
389 /**
390 This is the override edit constructor
391
392 @param inFormsets The input data of HiiPackagesDocument.HiiPackages
393
394 **/
395 public ModuleHiiPackages(OpeningModuleType inOmt) {
396 super();
397 this.omt = inOmt;
398 this.msa = omt.getXmlMsa();
399 init(msa.getHiiPackages());
400 this.setVisible(true);
401 }
402
403 /**
404 Disable all components when the mode is view
405
406 @param isView true - The view mode; false - The non-view mode
407
408 **/
409 public void setViewMode(boolean isView) {
410 if (isView) {
411 this.jTextFieldName.setEnabled(!isView);
412 this.jComboBoxUsage.setEnabled(!isView);
413 }
414 }
415
416 /**
417 This method initializes jContentPane
418
419 @return javax.swing.JPanel jContentPane
420
421 **/
422 private JPanel getJContentPane() {
423 if (jContentPane == null) {
424 jLabelUsage = new JLabel();
425 jLabelUsage.setText("Usage");
426 jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
427 jLabelName = new JLabel();
428 jLabelName.setText("Name");
429 jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
430 jLabelArch = new JLabel();
431 jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
432 jLabelArch.setText("Arch");
433 jLabelFeatureFlag = new JLabel();
434 jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
435 jLabelFeatureFlag.setText("Feature Flag");
436 jLabelHelpText = new JLabel();
437 jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
438 jLabelHelpText.setText("Help Text");
439
440 jContentPane = new JPanel();
441 jContentPane.setLayout(null);
442 jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
443
444 jContentPane.add(jLabelName, null);
445 jContentPane.add(jLabelUsage, null);
446 jContentPane.add(getJTextFieldName(), null);
447 jContentPane.add(getJComboBoxUsage(), null);
448
449 jContentPane.add(jLabelFeatureFlag, null);
450 jContentPane.add(jLabelArch, null);
451 jContentPane.add(getJTextFieldFeatureFlag(), null);
452
453 jStarLabel1 = new StarLabel();
454 jStarLabel1.setLocation(new java.awt.Point(0, 10));
455 jStarLabel2 = new StarLabel();
456 jStarLabel2.setLocation(new java.awt.Point(0, 35));
457
458 jContentPane.add(jStarLabel1, null);
459 jContentPane.add(jStarLabel2, null);
460
461 jContentPane.add(getJComboBoxList(), null);
462 jContentPane.add(getJButtonAdd(), null);
463 jContentPane.add(getJButtonRemove(), null);
464 jContentPane.add(getJButtonUpdate(), null);
465 jContentPane.add(getJScrollPaneList(), null);
466 jContentPane.add(getJScrollPaneArch(), null);
467 jContentPane.add(jLabelHelpText, null);
468 jContentPane.add(getJTextFieldHelpText(), null);
469 }
470 return jContentPane;
471 }
472
473 /**
474 This method initializes Usage type
475
476 **/
477 private void initFrame() {
478 Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage());
479 this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
480 }
481
482 /* (non-Javadoc)
483 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
484 *
485 * Override actionPerformed to listen all actions
486 *
487 */
488 public void actionPerformed(ActionEvent arg0) {
489 if (arg0.getSource() == jButtonAdd) {
490 if (!checkAdd()) {
491 return;
492 }
493 addToList();
494 }
495 if (arg0.getSource() == jButtonRemove) {
496 removeFromList();
497 }
498 if (arg0.getSource() == jButtonUpdate) {
499 if (!checkAdd()) {
500 return;
501 }
502 updateForList();
503 }
504 }
505
506 /**
507 Data validation for all fields
508
509 @retval true - All datas are valid
510 @retval false - At least one data is invalid
511
512 **/
513 public boolean checkAdd() {
514 //
515 // Check if all fields have correct data types
516 //
517
518 //
519 // Check Hii Package Name
520 //
521 if (isEmpty(this.jTextFieldName.getText())) {
522 Log.err("Hii Package Name Record couldn't be empty");
523 return false;
524 }
525
526 if (!isEmpty(this.jTextFieldName.getText())) {
527 if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) {
528 Log.err("Incorrect data type for Hii Package Name");
529 return false;
530 }
531 }
532
533 //
534 // Check FeatureFlag
535 //
536 if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
537 if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
538 Log.err("Incorrect data type for Feature Flag");
539 return false;
540 }
541 }
542
543 return true;
544 }
545
546 /**
547 Save all components of hiiPackages
548 if exists formset, set the value directly
549 if not exists formset, new an instance first
550
551 **/
552 public void save() {
553 try {
554 int count = this.vid.size();
555
556 this.hiiPackages = HiiPackages.Factory.newInstance();
557 if (count > 0) {
558 for (int index = 0; index < count; index++) {
559 HiiPackage p = HiiPackage.Factory.newInstance();
560 if (!isEmpty(vid.getHiiPackages(index).getName())) {
561 p.setHiiCName(vid.getHiiPackages(index).getName());
562 }
563 if (!isEmpty(vid.getHiiPackages(index).getUsage())) {
564 p.setUsage(HiiPackageUsage.Enum.forString(vid.getHiiPackages(index).getUsage()));
565 }
566 if (!isEmpty(vid.getHiiPackages(index).getFeatureFlag())) {
567 p.setFeatureFlag(vid.getHiiPackages(index).getFeatureFlag());
568 }
569 if (vid.getHiiPackages(index).getSupArchList() != null
570 && vid.getHiiPackages(index).getSupArchList().size() > 0) {
571 p.setSupArchList(vid.getHiiPackages(index).getSupArchList());
572 }
573 if (!isEmpty(vid.getHiiPackages(index).getHelp())) {
574 p.setHelpText(vid.getHiiPackages(index).getHelp());
575 }
576 this.hiiPackages.addNewHiiPackage();
577 this.hiiPackages.setHiiPackageArray(hiiPackages.getHiiPackageList().size() - 1, p);
578 }
579 }
580
581 this.msa.setHiiPackages(hiiPackages);
582 this.omt.setSaved(false);
583 } catch (Exception e) {
584 Log.err("Update hiiPackages", e.getMessage());
585 }
586 }
587
588 /* (non-Javadoc)
589 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
590 *
591 * Override componentResized to resize all components when frame's size is changed
592 */
593 public void componentResized(ComponentEvent arg0) {
594 int intCurrentWidth = this.getJContentPane().getWidth();
595 int intCurrentHeight = this.getJContentPane().getHeight();
596 int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
597 int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
598
599 resizeComponentWidth(jTextFieldName, intCurrentWidth, intPreferredWidth);
600 resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
601 resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
602 resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
603 resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
604
605 resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
606 resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
607
608 relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
609 relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
610 relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
611 }
612
613 private HiiPackagesIdentification getCurrentHiiPackages() {
614 String arg0 = this.jTextFieldName.getText();
615 String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
616
617 String arg2 = this.jTextFieldFeatureFlag.getText();
618 Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
619 String arg4 = this.jTextFieldHelpText.getText();
620
621 id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
622 return id;
623 }
624
625 /**
626 Add current item to Vector
627
628 **/
629 private void addToList() {
630 intSelectedItemId = vid.size();
631
632 vid.addHiiPackages(getCurrentHiiPackages());
633
634 jComboBoxList.addItem(id.getName());
635 jComboBoxList.setSelectedItem(id.getName());
636
637 //
638 // Reset select item index
639 //
640 intSelectedItemId = vid.size();
641
642 //
643 // Reload all fields of selected item
644 //
645 reloadFromList();
646
647 //
648 // Save to memory
649 //
650 save();
651 }
652
653 /**
654 Remove current item from Vector
655
656 **/
657 private void removeFromList() {
658 //
659 // Check if exist items
660 //
661 if (this.vid.size() < 1) {
662 return;
663 }
664
665 int intTempIndex = intSelectedItemId;
666
667 jComboBoxList.removeItemAt(intSelectedItemId);
668
669 vid.removeHiiPackages(intTempIndex);
670
671 //
672 // Reload all fields of selected item
673 //
674 reloadFromList();
675
676 //
677 // Save to memory
678 //
679 save();
680 }
681
682 /**
683 Update current item of Vector
684
685 **/
686 private void updateForList() {
687 //
688 // Check if exist items
689 //
690 if (this.vid.size() < 1) {
691 return;
692 }
693
694 //
695 // Backup selected item index
696 //
697 int intTempIndex = intSelectedItemId;
698
699 vid.updateHiiPackages(getCurrentHiiPackages(), intTempIndex);
700
701 jComboBoxList.removeAllItems();
702 for (int index = 0; index < vid.size(); index++) {
703 jComboBoxList.addItem(vid.getHiiPackages(index).getName());
704 }
705
706 //
707 // Restore selected item index
708 //
709 intSelectedItemId = intTempIndex;
710
711 //
712 // Reset select item index
713 //
714 jComboBoxList.setSelectedIndex(intSelectedItemId);
715
716 //
717 // Reload all fields of selected item
718 //
719 reloadFromList();
720
721 //
722 // Save to memory
723 //
724 save();
725 }
726
727 /**
728 Refresh all fields' values of selected item of Vector
729
730 **/
731 private void reloadFromList() {
732 if (vid.size() > 0) {
733 //
734 // Get selected item index
735 //
736 intSelectedItemId = jComboBoxList.getSelectedIndex();
737
738 this.jTextFieldName.setText(vid.getHiiPackages(intSelectedItemId).getName());
739 this.jComboBoxUsage.setSelectedItem(vid.getHiiPackages(intSelectedItemId).getUsage());
740 this.jTextFieldHelpText.setText(vid.getHiiPackages(intSelectedItemId).getHelp());
741
742 jTextFieldFeatureFlag.setText(vid.getHiiPackages(intSelectedItemId).getFeatureFlag());
743 iCheckBoxListArch.setAllItemsUnchecked();
744 iCheckBoxListArch.initCheckedItem(true, vid.getHiiPackages(intSelectedItemId).getSupArchList());
745
746 } else {
747 }
748
749 reloadListArea();
750 }
751
752 /**
753 Update list area pane via the elements of Vector
754
755 **/
756 private void reloadListArea() {
757 String strListItem = "";
758 for (int index = 0; index < vid.size(); index++) {
759 strListItem = strListItem + vid.getHiiPackages(index).getName() + DataType.UNIX_LINE_SEPARATOR;
760 }
761 this.jTextAreaList.setText(strListItem);
762 }
763
764 /* (non-Javadoc)
765 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
766 *
767 * Reflesh the frame when selected item changed
768 *
769 */
770 public void itemStateChanged(ItemEvent arg0) {
771 if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
772 reloadFromList();
773 }
774 }
775 }