]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@671 6f19259b...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / ModuleDataHubs.java
1 /** @file
2
3 The file is used to create, update DataHub 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
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.ItemEvent;
21 import java.util.Vector;
22
23 import javax.swing.JButton;
24 import javax.swing.JComboBox;
25 import javax.swing.JLabel;
26 import javax.swing.JPanel;
27 import javax.swing.JScrollPane;
28 import javax.swing.JTextArea;
29 import javax.swing.JTextField;
30
31 import org.tianocore.DataHubUsage;
32 import org.tianocore.DataHubsDocument;
33 import org.tianocore.DataHubsDocument.DataHubs;
34 import org.tianocore.DataHubsDocument.DataHubs.DataHubRecord;
35 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
36 import org.tianocore.frameworkwizard.common.DataType;
37 import org.tianocore.frameworkwizard.common.DataValidation;
38 import org.tianocore.frameworkwizard.common.EnumerationData;
39 import org.tianocore.frameworkwizard.common.Log;
40 import org.tianocore.frameworkwizard.common.OpeningModuleType;
41 import org.tianocore.frameworkwizard.common.Tools;
42 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
43 import org.tianocore.frameworkwizard.common.ui.StarLabel;
44 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
45 import org.tianocore.frameworkwizard.module.Identification.DataHubs.DataHubsIdentification;
46 import org.tianocore.frameworkwizard.module.Identification.DataHubs.DataHubsVector;
47
48 /**
49 The class is used to create, update DataHub of MSA/MBD file
50 It extends IInternalFrame
51
52
53
54 **/
55 public class ModuleDataHubs extends IInternalFrame {
56
57 ///
58 /// Define class Serial Version UID
59 ///
60 private static final long serialVersionUID = -3667906991966638892L;
61
62 //
63 //Define class members
64 //
65 private JPanel jContentPane = null;
66
67 private JLabel jLabelUsage = null;
68
69 private JComboBox jComboBoxUsage = null;
70
71 private JLabel jLabelDataHubRecord = null;
72
73 private JTextField jTextFieldDataHubRecord = null;
74
75 private StarLabel jStarLabel1 = null;
76
77 private StarLabel jStarLabel2 = null;
78
79 private JLabel jLabelFeatureFlag = null;
80
81 private JTextField jTextFieldFeatureFlag = null;
82
83 private JLabel jLabelArch = null;
84
85 private JTextArea jTextAreaList = null;
86
87 private JComboBox jComboBoxList = null;
88
89 private JButton jButtonAdd = null;
90
91 private JButton jButtonRemove = null;
92
93 private JButton jButtonUpdate = null;
94
95 private JScrollPane jScrollPane = null;
96
97 private JScrollPane jScrollPaneList = null;
98
99 private ICheckBoxList iCheckBoxListArch = null;
100
101 private JScrollPane jScrollPaneArch = null;
102
103 private JLabel jLabelHelpText = null;
104
105 private JTextField jTextFieldHelpText = null;
106
107 //
108 // Not used by UI
109 //
110 private int intSelectedItemId = 0;
111
112 private OpeningModuleType omt = null;
113
114 private ModuleSurfaceArea msa = null;
115
116 private DataHubsDocument.DataHubs dataHubs = null;
117
118 private DataHubsIdentification id = null;
119
120 private DataHubsVector vid = new DataHubsVector();
121
122 private EnumerationData ed = new EnumerationData();
123
124 /**
125 This method initializes jComboBoxUsage
126
127 @return javax.swing.JComboBox jComboBoxUsage
128
129 **/
130 private JComboBox getJComboBoxUsage() {
131 if (jComboBoxUsage == null) {
132 jComboBoxUsage = new JComboBox();
133 jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
134 jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
135 }
136 return jComboBoxUsage;
137 }
138
139 /**
140 This method initializes jTextFieldDataHubRecord
141
142 @return javax.swing.JTextField jTextFieldDataHubRecord
143
144 **/
145 private JTextField getJTextFieldDataHubRecord() {
146 if (jTextFieldDataHubRecord == null) {
147 jTextFieldDataHubRecord = new JTextField();
148 jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
149 jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20));
150 }
151 return jTextFieldDataHubRecord;
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 iCheckBoxListArch
280
281 @return ICheckBoxList
282 **/
283 private ICheckBoxList getICheckBoxListSupportedArchitectures() {
284 if (iCheckBoxListArch == null) {
285 iCheckBoxListArch = new ICheckBoxList();
286 iCheckBoxListArch.addFocusListener(this);
287 iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
288 }
289 return iCheckBoxListArch;
290 }
291
292 /**
293 This method initializes jScrollPaneArch
294
295 @return javax.swing.JScrollPane
296
297 **/
298 private JScrollPane getJScrollPaneArch() {
299 if (jScrollPaneArch == null) {
300 jScrollPaneArch = new JScrollPane();
301 jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));
302 jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
303 jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
304 }
305 return jScrollPaneArch;
306 }
307
308 /**
309 This method initializes jTextFieldHelpText
310
311 @return javax.swing.JTextField
312
313 **/
314 private JTextField getJTextFieldHelpText() {
315 if (jTextFieldHelpText == null) {
316 jTextFieldHelpText = new JTextField();
317 jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
318 jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
319 }
320 return jTextFieldHelpText;
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("Data Hubs");
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(DataHubs inDataHubs) {
347 init();
348 this.dataHubs = inDataHubs;
349
350 if (this.dataHubs != null) {
351 if (this.dataHubs.getDataHubRecordList().size() > 0) {
352 for (int index = 0; index < this.dataHubs.getDataHubRecordList().size(); index++) {
353 String arg0 = dataHubs.getDataHubRecordList().get(index).getDataHubCName();
354 String arg1 = null;
355 if (dataHubs.getDataHubRecordList().get(index).getUsage() != null) {
356 arg1 = dataHubs.getDataHubRecordList().get(index).getUsage().toString();
357 }
358
359 String arg2 = dataHubs.getDataHubRecordList().get(index).getFeatureFlag();
360 Vector<String> arg3 = Tools.convertListToVector(dataHubs.getDataHubRecordList().get(index)
361 .getSupArchList());
362 String arg4 = dataHubs.getDataHubRecordList().get(index).getHelpText();
363
364 id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
365 vid.addDataHubs(id);
366 }
367 }
368 }
369 //
370 // Update the list
371 //
372 Tools.generateComboBoxByVector(jComboBoxList, vid.getDataHubsName());
373 reloadListArea();
374 }
375
376 /**
377 This is the default constructor
378
379 **/
380 public ModuleDataHubs() {
381 super();
382 init();
383 this.setVisible(true);
384 }
385
386 /**
387 This is the override edit constructor
388
389 @param inDataHubs The input DataHubsDocument.DataHubs
390
391 **/
392 public ModuleDataHubs(OpeningModuleType inOmt) {
393 super();
394 this.omt = inOmt;
395 this.msa = omt.getXmlMsa();
396 init(msa.getDataHubs());
397 this.setVisible(true);
398 }
399
400 /**
401 Disable all components when the mode is view
402
403 @param isView true - The view mode; false - The non-view mode
404
405 **/
406 public void setViewMode(boolean isView) {
407 if (isView) {
408 this.jTextFieldDataHubRecord.setEnabled(!isView);
409 this.jComboBoxUsage.setEnabled(!isView);
410 }
411 }
412
413 /**
414 This method initializes jContentPane
415
416 @return javax.swing.JPanel jContentPane
417
418 **/
419 private JPanel getJContentPane() {
420 if (jContentPane == null) {
421 jLabelDataHubRecord = new JLabel();
422 jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
423 jLabelDataHubRecord.setText("Data Hub Record");
424 jLabelUsage = new JLabel();
425 jLabelUsage.setText("Usage");
426 jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
427 jLabelArch = new JLabel();
428 jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
429 jLabelArch.setText("Arch");
430 jLabelFeatureFlag = new JLabel();
431 jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
432 jLabelFeatureFlag.setText("Feature Flag");
433 jLabelHelpText = new JLabel();
434 jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
435 jLabelHelpText.setText("Help Text");
436
437 jContentPane = new JPanel();
438 jContentPane.setLayout(null);
439 jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));
440
441 jContentPane.add(jLabelDataHubRecord, null);
442 jContentPane.add(jLabelUsage, null);
443 jContentPane.add(jLabelFeatureFlag, null);
444 jContentPane.add(jLabelArch, null);
445
446 jContentPane.add(getJTextFieldDataHubRecord(), null);
447 jContentPane.add(getJComboBoxUsage(), null);
448 jContentPane.add(getJTextFieldFeatureFlag(), null);
449
450 jStarLabel1 = new StarLabel();
451 jStarLabel1.setLocation(new java.awt.Point(0, 10));
452 jStarLabel2 = new StarLabel();
453 jStarLabel2.setLocation(new java.awt.Point(0, 35));
454
455 jContentPane.add(jStarLabel1, null);
456 jContentPane.add(jStarLabel2, null);
457
458 jContentPane.add(getJComboBoxList(), null);
459 jContentPane.add(getJButtonAdd(), null);
460 jContentPane.add(getJButtonRemove(), null);
461 jContentPane.add(getJButtonUpdate(), null);
462 jContentPane.add(getJScrollPaneList(), null);
463 jContentPane.add(getJScrollPaneArch(), null);
464 jContentPane.add(jLabelHelpText, null);
465 jContentPane.add(getJTextFieldHelpText(), null);
466 }
467 return jContentPane;
468 }
469
470 /**
471 This method initializes Usage type
472
473 **/
474 private void initFrame() {
475 Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage());
476 this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
477 }
478
479 /* (non-Javadoc)
480 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
481 *
482 * Override actionPerformed to listen all actions
483 *
484 */
485 public void actionPerformed(ActionEvent arg0) {
486 if (arg0.getSource() == jButtonAdd) {
487 if (!checkAdd()) {
488 return;
489 }
490 addToList();
491 }
492 if (arg0.getSource() == jButtonRemove) {
493 removeFromList();
494 }
495 if (arg0.getSource() == jButtonUpdate) {
496 if (!checkAdd()) {
497 return;
498 }
499 updateForList();
500 }
501 }
502
503 /**
504 Data validation for all fields
505
506 @retval true - All datas are valid
507 @retval false - At least one data is invalid
508
509 **/
510 public boolean checkAdd() {
511 //
512 // Check if all fields have correct data types
513 //
514
515 //
516 // Check DataHubRecord
517 //
518 if (isEmpty(this.jTextFieldDataHubRecord.getText())) {
519 Log.err("Data Hub Record couldn't be empty");
520 return false;
521 }
522
523 if (!isEmpty(this.jTextFieldDataHubRecord.getText())) {
524 if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) {
525 Log.err("Incorrect data type for Data Hub Record");
526 return false;
527 }
528 }
529
530 //
531 // Check FeatureFlag
532 //
533 if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
534 if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
535 Log.err("Incorrect data type for Feature Flag");
536 return false;
537 }
538 }
539
540 return true;
541 }
542
543 /**
544 Save all components of DataHubs
545 if exists dataHubs, set the value directly
546 if not exists dataHubs, new an instance first
547
548 **/
549 public void save() {
550 try {
551 int count = this.vid.size();
552
553 this.dataHubs = DataHubs.Factory.newInstance();
554 if (count > 0) {
555 for (int index = 0; index < count; index++) {
556 DataHubRecord p = DataHubRecord.Factory.newInstance();
557 if (!isEmpty(vid.getDataHubs(index).getName())) {
558 p.setDataHubCName(vid.getDataHubs(index).getName());
559 }
560 if (!isEmpty(vid.getDataHubs(index).getUsage())) {
561 p.setUsage(DataHubUsage.Enum.forString(vid.getDataHubs(index).getUsage()));
562 }
563 if (!isEmpty(vid.getDataHubs(index).getFeatureFlag())) {
564 p.setFeatureFlag(vid.getDataHubs(index).getFeatureFlag());
565 }
566 if (vid.getDataHubs(index).getSupArchList() != null
567 && vid.getDataHubs(index).getSupArchList().size() > 0) {
568 p.setSupArchList(vid.getDataHubs(index).getSupArchList());
569 }
570 if (!isEmpty(vid.getDataHubs(index).getHelp())) {
571 p.setHelpText(vid.getDataHubs(index).getHelp());
572 }
573 this.dataHubs.addNewDataHubRecord();
574 this.dataHubs.setDataHubRecordArray(dataHubs.getDataHubRecordList().size() - 1, p);
575 }
576 }
577
578 this.msa.setDataHubs(dataHubs);
579 this.omt.setSaved(false);
580 } catch (Exception e) {
581 Log.err("Update Data Hubs", e.getMessage());
582 }
583 }
584
585 /* (non-Javadoc)
586 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
587 *
588 * Override componentResized to resize all components when frame's size is changed
589 */
590 public void componentResized(ComponentEvent arg0) {
591 int intCurrentWidth = this.getJContentPane().getWidth();
592 int intCurrentHeight = this.getJContentPane().getHeight();
593 int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
594 int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
595
596 resizeComponentWidth(jTextFieldDataHubRecord, intCurrentWidth, intPreferredWidth);
597 resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);
598 resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);
599 resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);
600 resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);
601
602 resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);
603 resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);
604
605 relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);
606 relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);
607 relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);
608 }
609
610 private DataHubsIdentification getCurrentDataHubs() {
611 String arg0 = this.jTextFieldDataHubRecord.getText();
612 String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
613
614 String arg2 = this.jTextFieldFeatureFlag.getText();
615 Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();
616 String arg4 = this.jTextFieldHelpText.getText();
617
618 id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
619 return id;
620 }
621
622 /**
623 Add current item to Vector
624
625 **/
626 private void addToList() {
627 intSelectedItemId = vid.size();
628
629 vid.addDataHubs(getCurrentDataHubs());
630
631 jComboBoxList.addItem(id.getName());
632 jComboBoxList.setSelectedItem(id.getName());
633
634 //
635 // Reset select item index
636 //
637 intSelectedItemId = vid.size();
638
639 //
640 // Reload all fields of selected item
641 //
642 reloadFromList();
643
644 //
645 // Save to memory
646 //
647 save();
648 }
649
650 /**
651 Remove current item from Vector
652
653 **/
654 private void removeFromList() {
655 //
656 // Check if exist items
657 //
658 if (this.vid.size() < 1) {
659 return;
660 }
661
662 int intTempIndex = intSelectedItemId;
663
664 jComboBoxList.removeItemAt(intSelectedItemId);
665
666 vid.removeDataHubs(intTempIndex);
667
668 //
669 // Reload all fields of selected item
670 //
671 reloadFromList();
672
673 //
674 // Save to memory
675 //
676 save();
677 }
678
679 /**
680 Update current item of Vector
681
682 **/
683 private void updateForList() {
684 //
685 // Check if exist items
686 //
687 if (this.vid.size() < 1) {
688 return;
689 }
690
691 //
692 // Backup selected item index
693 //
694 int intTempIndex = intSelectedItemId;
695
696 vid.updateDataHubs(getCurrentDataHubs(), intTempIndex);
697
698 jComboBoxList.removeAllItems();
699 for (int index = 0; index < vid.size(); index++) {
700 jComboBoxList.addItem(vid.getDataHubs(index).getName());
701 }
702
703 //
704 // Restore selected item index
705 //
706 intSelectedItemId = intTempIndex;
707
708 //
709 // Reset select item index
710 //
711 jComboBoxList.setSelectedIndex(intSelectedItemId);
712
713 //
714 // Reload all fields of selected item
715 //
716 reloadFromList();
717
718 //
719 // Save to memory
720 //
721 save();
722 }
723
724 /**
725 Refresh all fields' values of selected item of Vector
726
727 **/
728 private void reloadFromList() {
729 if (vid.size() > 0) {
730 //
731 // Get selected item index
732 //
733 intSelectedItemId = jComboBoxList.getSelectedIndex();
734
735 this.jTextFieldDataHubRecord.setText(vid.getDataHubs(intSelectedItemId).getName());
736 this.jComboBoxUsage.setSelectedItem(vid.getDataHubs(intSelectedItemId).getUsage());
737 this.jTextFieldHelpText.setText(vid.getDataHubs(intSelectedItemId).getHelp());
738
739 jTextFieldFeatureFlag.setText(vid.getDataHubs(intSelectedItemId).getFeatureFlag());
740 iCheckBoxListArch.setAllItemsUnchecked();
741 iCheckBoxListArch.initCheckedItem(true, vid.getDataHubs(intSelectedItemId).getSupArchList());
742
743 } else {
744 }
745
746 reloadListArea();
747 }
748
749 /**
750 Update list area pane via the elements of Vector
751
752 **/
753 private void reloadListArea() {
754 String strListItem = "";
755 for (int index = 0; index < vid.size(); index++) {
756 strListItem = strListItem + vid.getDataHubs(index).getName() + DataType.UNIX_LINE_SEPARATOR;
757 }
758 this.jTextAreaList.setText(strListItem);
759 }
760
761 /* (non-Javadoc)
762 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
763 *
764 * Reflesh the frame when selected item changed
765 *
766 */
767 public void itemStateChanged(ItemEvent arg0) {
768 if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {
769 reloadFromList();
770 }
771 }
772 }