3 The file is used to create, update Ppi of MSA/MBD file
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
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.
15 package org
.tianocore
.frameworkwizard
.module
.ui
;
17 import java
.awt
.event
.ActionEvent
;
18 import java
.awt
.event
.ComponentEvent
;
19 import java
.awt
.event
.ItemEvent
;
20 import java
.util
.Vector
;
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
;
30 import org
.tianocore
.PPIsDocument
;
31 import org
.tianocore
.PpiNotifyUsage
;
32 import org
.tianocore
.PpiUsage
;
33 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
34 import org
.tianocore
.PPIsDocument
.PPIs
;
35 import org
.tianocore
.PPIsDocument
.PPIs
.Ppi
;
36 import org
.tianocore
.PPIsDocument
.PPIs
.PpiNotify
;
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 import org
.tianocore
.frameworkwizard
.common
.ui
.iCheckBoxList
.ICheckBoxList
;
46 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisIdentification
;
47 import org
.tianocore
.frameworkwizard
.module
.Identifications
.Ppis
.PpisVector
;
48 import org
.tianocore
.frameworkwizard
.workspace
.WorkspaceTools
;
51 The class is used to create, update Ppi of MSA/MBD file
52 It extends IInternalFrame
55 public class ModulePpis
extends IInternalFrame
{
58 /// Define class Serial Version UID
60 private static final long serialVersionUID
= -4284901202357037724L;
63 //Define class members
65 private JPanel jContentPane
= null;
67 private JLabel jLabelC_Name
= null;
69 private JComboBox jComboBoxCName
= null;
71 private JTextField jTextFieldFeatureFlag
= null;
73 private JLabel jLabelFeatureFlag
= null;
75 private JLabel jLabelUsage
= null;
77 private JComboBox jComboBoxUsage
= null;
79 private JLabel jLabelPpiType
= null;
81 private StarLabel jStarLabel1
= null;
83 private StarLabel jStarLabel2
= null;
85 private JComboBox jComboBoxPpiType
= null;
87 private JLabel jLabelArch
= null;
89 private JTextArea jTextAreaList
= null;
91 private JComboBox jComboBoxList
= null;
93 private JButton jButtonAdd
= null;
95 private JButton jButtonRemove
= null;
97 private JButton jButtonUpdate
= null;
99 private JScrollPane jScrollPane
= null;
101 private JScrollPane jScrollPaneList
= null;
103 private ICheckBoxList iCheckBoxListArch
= null;
105 private JScrollPane jScrollPaneArch
= null;
107 private JLabel jLabelHelpText
= null;
109 private JTextField jTextFieldHelpText
= null;
114 private int intSelectedItemId
= 0;
116 private OpeningModuleType omt
= null;
118 private ModuleSurfaceArea msa
= null;
120 private PPIsDocument
.PPIs ppis
= null;
122 private PpisIdentification id
= null;
124 private PpisVector vid
= new PpisVector();
126 private WorkspaceTools wt
= new WorkspaceTools();
128 private EnumerationData ed
= new EnumerationData();
131 This method initializes jTextFieldC_Name
133 @return javax.swing.JTextField jTextFieldC_Name
136 private JComboBox
getJComboBoxCName() {
137 if (jComboBoxCName
== null) {
138 jComboBoxCName
= new JComboBox();
139 jComboBoxCName
.setBounds(new java
.awt
.Rectangle(160, 35, 320, 20));
140 jComboBoxCName
.setPreferredSize(new java
.awt
.Dimension(320, 20));
142 return jComboBoxCName
;
146 This method initializes jTextFieldFeatureFlag
148 @return javax.swing.JTextField jTextFieldFeatureFlag
151 private JTextField
getJTextFieldFeatureFlag() {
152 if (jTextFieldFeatureFlag
== null) {
153 jTextFieldFeatureFlag
= new JTextField();
154 jTextFieldFeatureFlag
.setBounds(new java
.awt
.Rectangle(160, 110, 320, 20));
155 jTextFieldFeatureFlag
.setPreferredSize(new java
.awt
.Dimension(320, 20));
157 return jTextFieldFeatureFlag
;
161 This method initializes jComboBox
163 @return javax.swing.JComboBox jComboBoxUsage
166 private JComboBox
getJComboBox() {
167 if (jComboBoxUsage
== null) {
168 jComboBoxUsage
= new JComboBox();
169 jComboBoxUsage
.setBounds(new java
.awt
.Rectangle(160, 60, 320, 20));
170 jComboBoxUsage
.setPreferredSize(new java
.awt
.Dimension(320, 20));
172 return jComboBoxUsage
;
176 * This method initializes jComboBoxPpiType
178 * @return javax.swing.JComboBox
180 private JComboBox
getJComboBoxPpiType() {
181 if (jComboBoxPpiType
== null) {
182 jComboBoxPpiType
= new JComboBox();
183 jComboBoxPpiType
.setBounds(new java
.awt
.Rectangle(160, 10, 320, 20));
184 jComboBoxPpiType
.setPreferredSize(new java
.awt
.Dimension(320, 20));
185 jComboBoxPpiType
.addItemListener(this);
187 return jComboBoxPpiType
;
191 This method initializes jComboBoxFileList
193 @return javax.swing.JComboBox jComboBoxFileList
196 private JComboBox
getJComboBoxList() {
197 if (jComboBoxList
== null) {
198 jComboBoxList
= new JComboBox();
199 jComboBoxList
.setBounds(new java
.awt
.Rectangle(15, 220, 210, 20));
200 jComboBoxList
.addItemListener(this);
201 jComboBoxList
.addActionListener(this);
202 jComboBoxList
.setPreferredSize(new java
.awt
.Dimension(210, 20));
204 return jComboBoxList
;
208 This method initializes jButtonAdd
210 @return javax.swing.JButton jButtonAdd
213 private JButton
getJButtonAdd() {
214 if (jButtonAdd
== null) {
215 jButtonAdd
= new JButton();
216 jButtonAdd
.setBounds(new java
.awt
.Rectangle(230, 220, 80, 20));
217 jButtonAdd
.setText("Add");
218 jButtonAdd
.addActionListener(this);
219 jButtonAdd
.setPreferredSize(new java
.awt
.Dimension(80, 20));
225 This method initializes jButtonRemove
227 @return javax.swing.JButton jButtonRemove
230 private JButton
getJButtonRemove() {
231 if (jButtonRemove
== null) {
232 jButtonRemove
= new JButton();
233 jButtonRemove
.setBounds(new java
.awt
.Rectangle(400, 220, 80, 20));
234 jButtonRemove
.setText("Remove");
235 jButtonRemove
.addActionListener(this);
236 jButtonRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
238 return jButtonRemove
;
242 This method initializes jButtonUpdate
244 @return javax.swing.JButton jButtonUpdate
247 private JButton
getJButtonUpdate() {
248 if (jButtonUpdate
== null) {
249 jButtonUpdate
= new JButton();
250 jButtonUpdate
.setBounds(new java
.awt
.Rectangle(315, 220, 80, 20));
251 jButtonUpdate
.setPreferredSize(new java
.awt
.Dimension(80, 20));
252 jButtonUpdate
.setText("Update");
253 jButtonUpdate
.addActionListener(this);
255 return jButtonUpdate
;
259 * This method initializes jScrollPaneFileList
261 * @return javax.swing.JScrollPane
263 private JScrollPane
getJScrollPaneList() {
264 if (jScrollPaneList
== null) {
265 jScrollPaneList
= new JScrollPane();
266 jScrollPaneList
.setBounds(new java
.awt
.Rectangle(15, 245, 465, 240));
267 jScrollPaneList
.setViewportView(getJTextAreaList());
268 jScrollPaneList
.setPreferredSize(new java
.awt
.Dimension(465, 240));
270 return jScrollPaneList
;
274 This method initializes jScrollPane
276 @return javax.swing.JScrollPane
278 private JScrollPane
getJScrollPane() {
279 if (jScrollPane
== null) {
280 jScrollPane
= new JScrollPane();
281 jScrollPane
.setViewportView(getJContentPane());
287 * This method initializes jTextAreaFileList
289 * @return javax.swing.JTextArea
291 private JTextArea
getJTextAreaList() {
292 if (jTextAreaList
== null) {
293 jTextAreaList
= new JTextArea();
294 jTextAreaList
.setEditable(false);
297 return jTextAreaList
;
301 This method initializes iCheckBoxListArch
303 @return ICheckBoxList
305 private ICheckBoxList
getICheckBoxListSupportedArchitectures() {
306 if (iCheckBoxListArch
== null) {
307 iCheckBoxListArch
= new ICheckBoxList();
308 iCheckBoxListArch
.addFocusListener(this);
309 iCheckBoxListArch
.setToolTipText(DataType
.SUP_ARCH_LIST_HELP_TEXT
);
311 return iCheckBoxListArch
;
315 This method initializes jScrollPaneArch
317 @return javax.swing.JScrollPane
320 private JScrollPane
getJScrollPaneArch() {
321 if (jScrollPaneArch
== null) {
322 jScrollPaneArch
= new JScrollPane();
323 jScrollPaneArch
.setBounds(new java
.awt
.Rectangle(160, 135, 320, 80));
324 jScrollPaneArch
.setPreferredSize(new java
.awt
.Dimension(320, 80));
325 jScrollPaneArch
.setViewportView(getICheckBoxListSupportedArchitectures());
327 return jScrollPaneArch
;
331 This method initializes jTextFieldHelpText
333 @return javax.swing.JTextField
336 private JTextField
getJTextFieldHelpText() {
337 if (jTextFieldHelpText
== null) {
338 jTextFieldHelpText
= new JTextField();
339 jTextFieldHelpText
.setBounds(new java
.awt
.Rectangle(160, 85, 320, 20));
340 jTextFieldHelpText
.setPreferredSize(new java
.awt
.Dimension(320, 20));
342 return jTextFieldHelpText
;
345 public static void main(String
[] args
) {
350 This method initializes this
353 private void init() {
354 this.setSize(500, 515);
355 this.setContentPane(getJScrollPane());
356 this.setTitle("Ppis");
358 this.setViewMode(false);
362 This method initializes this
363 Fill values to all fields if these values are not empty
365 @param inPackageDependencies
368 private void init(PPIs inPpis
) {
372 if (this.ppis
!= null) {
373 if (this.ppis
.getPpiList().size() > 0) {
374 for (int index
= 0; index
< this.ppis
.getPpiList().size(); index
++) {
375 String arg0
= ppis
.getPpiList().get(index
).getPpiCName();
376 String arg1
= ed
.getVPpiType().get(0);
378 if (ppis
.getPpiList().get(index
).getUsage() != null) {
379 arg2
= ppis
.getPpiList().get(index
).getUsage().toString();
382 String arg3
= ppis
.getPpiList().get(index
).getFeatureFlag();
383 Vector
<String
> arg4
= Tools
.convertListToVector(ppis
.getPpiList().get(index
)
385 String arg5
= ppis
.getPpiList().get(index
).getHelpText();
387 id
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
391 if (this.ppis
.getPpiNotifyList().size() > 0) {
392 for (int index
= 0; index
< this.ppis
.getPpiNotifyList().size(); index
++) {
393 String arg0
= ppis
.getPpiNotifyList().get(index
).getPpiNotifyCName();
394 String arg1
= ed
.getVPpiType().get(1);
396 if (ppis
.getPpiNotifyList().get(index
).getUsage() != null) {
397 arg2
= ppis
.getPpiNotifyList().get(index
).getUsage().toString();
400 String arg3
= ppis
.getPpiNotifyList().get(index
).getFeatureFlag();
401 Vector
<String
> arg4
= Tools
.convertListToVector(ppis
.getPpiNotifyList().get(index
)
403 String arg5
= ppis
.getPpiNotifyList().get(index
).getHelpText();
405 id
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
413 Tools
.generateComboBoxByVector(jComboBoxList
, vid
.getPpisName());
418 This is the default constructor
421 public ModulePpis() {
424 this.setVisible(true);
428 This is the override edit constructor
430 @param inPpis The input data of PPIsDocument.PPIs
433 public ModulePpis(OpeningModuleType inOmt
) {
436 this.msa
= omt
.getXmlMsa();
438 this.setVisible(true);
442 Disable all components when the mode is view
444 @param isView true - The view mode; false - The non-view mode
447 public void setViewMode(boolean isView
) {
449 this.jComboBoxCName
.setEnabled(!isView
);
450 this.jComboBoxUsage
.setEnabled(!isView
);
451 this.jTextFieldFeatureFlag
.setEnabled(!isView
);
456 This method initializes jContentPane
458 @return javax.swing.JPanel jContentPane
461 private JPanel
getJContentPane() {
462 if (jContentPane
== null) {
463 jLabelArch
= new JLabel();
464 jLabelArch
.setBounds(new java
.awt
.Rectangle(15, 135, 140, 20));
465 jLabelArch
.setText("Arch");
466 jLabelPpiType
= new JLabel();
467 jLabelPpiType
.setBounds(new java
.awt
.Rectangle(15, 10, 140, 20));
468 jLabelPpiType
.setText("Ppi Type");
469 jLabelUsage
= new JLabel();
470 jLabelUsage
.setText("Usage");
471 jLabelUsage
.setBounds(new java
.awt
.Rectangle(15, 60, 140, 20));
472 jLabelFeatureFlag
= new JLabel();
473 jLabelFeatureFlag
.setText("Feature Flag");
474 jLabelFeatureFlag
.setBounds(new java
.awt
.Rectangle(15, 110, 140, 20));
475 jLabelC_Name
= new JLabel();
476 jLabelC_Name
.setText("C_Name Type");
477 jLabelC_Name
.setBounds(new java
.awt
.Rectangle(15, 35, 140, 20));
478 jLabelHelpText
= new JLabel();
479 jLabelHelpText
.setBounds(new java
.awt
.Rectangle(14, 85, 140, 20));
480 jLabelHelpText
.setText("Help Text");
482 jContentPane
= new JPanel();
483 jContentPane
.setLayout(null);
484 jContentPane
.setPreferredSize(new java
.awt
.Dimension(490, 495));
486 jContentPane
.add(jLabelC_Name
, null);
487 jContentPane
.add(getJComboBoxCName(), null);
488 jContentPane
.add(getJTextFieldFeatureFlag(), null);
489 jContentPane
.add(jLabelFeatureFlag
, null);
490 jContentPane
.add(jLabelUsage
, null);
491 jContentPane
.add(getJComboBox(), null);
492 jContentPane
.add(getJComboBoxPpiType(), null);
493 jContentPane
.add(jLabelArch
, null);
494 jContentPane
.add(jLabelPpiType
, null);
495 jStarLabel1
= new StarLabel();
496 jStarLabel1
.setBounds(new java
.awt
.Rectangle(0, 10, 10, 20));
497 jStarLabel2
= new StarLabel();
498 jStarLabel2
.setBounds(new java
.awt
.Rectangle(0, 35, 10, 20));
500 jContentPane
.add(jStarLabel1
, null);
501 jContentPane
.add(jStarLabel2
, null);
503 jContentPane
.add(getJComboBoxList(), null);
504 jContentPane
.add(getJButtonAdd(), null);
505 jContentPane
.add(getJButtonRemove(), null);
506 jContentPane
.add(getJButtonUpdate(), null);
507 jContentPane
.add(getJScrollPaneList(), null);
508 jContentPane
.add(getJScrollPaneArch(), null);
509 jContentPane
.add(jLabelHelpText
, null);
510 jContentPane
.add(getJTextFieldHelpText(), null);
516 This method initializes Usage type
519 private void initFrame() {
520 EnumerationData ed
= new EnumerationData();
522 Tools
.generateComboBoxByVector(jComboBoxCName
, wt
.getAllPpiDeclarationsFromWorkspace());
523 Tools
.generateComboBoxByVector(jComboBoxPpiType
, ed
.getVPpiType());
524 Tools
.generateComboBoxByVector(jComboBoxUsage
, ed
.getVPpiUsage());
526 this.iCheckBoxListArch
.setAllItems(ed
.getVSupportedArchitectures());
530 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
532 * Override actionPerformed to listen all actions
535 public void actionPerformed(ActionEvent arg0
) {
536 if (arg0
.getSource() == jButtonAdd
) {
542 if (arg0
.getSource() == jButtonRemove
) {
545 if (arg0
.getSource() == jButtonUpdate
) {
554 Data validation for all fields
556 @retval true - All datas are valid
557 @retval false - At least one data is invalid
560 public boolean checkAdd() {
562 // Check if all fields have correct data types
568 if (!isEmpty(this.jComboBoxCName
.getSelectedItem().toString())) {
569 if (!DataValidation
.isC_NameType(this.jComboBoxCName
.getSelectedItem().toString())) {
570 Log
.err("Incorrect data type for Ppi/PpiNotify Name");
578 if (!isEmpty(this.jTextFieldFeatureFlag
.getText())) {
579 if (!DataValidation
.isFeatureFlag(this.jTextFieldFeatureFlag
.getText())) {
580 Log
.err("Incorrect data type for Feature Flag");
589 Save all components of PPIs
590 if exists ppis, set the value directly
591 if not exists ppis, new an instance first
596 int count
= this.vid
.size();
598 this.ppis
= PPIs
.Factory
.newInstance();
600 for (int index
= 0; index
< count
; index
++) {
601 if (vid
.getPpis(index
).getType().equals(ed
.getVPpiType().get(0))) {
602 Ppi p
= Ppi
.Factory
.newInstance();
603 if (!isEmpty(vid
.getPpis(index
).getName())) {
604 p
.setPpiCName(vid
.getPpis(index
).getName());
606 if (!isEmpty(vid
.getPpis(index
).getUsage())) {
607 p
.setUsage(PpiUsage
.Enum
.forString(vid
.getPpis(index
).getUsage()));
609 if (!isEmpty(vid
.getPpis(index
).getFeatureFlag())) {
610 p
.setFeatureFlag(vid
.getPpis(index
).getFeatureFlag());
612 if (vid
.getPpis(index
).getSupArchList() != null
613 && vid
.getPpis(index
).getSupArchList().size() > 0) {
614 p
.setSupArchList(vid
.getPpis(index
).getSupArchList());
616 if (!isEmpty(vid
.getPpis(index
).getHelp())) {
617 p
.setHelpText(vid
.getPpis(index
).getHelp());
619 this.ppis
.addNewPpi();
620 this.ppis
.setPpiArray(ppis
.getPpiList().size() - 1, p
);
622 if (vid
.getPpis(index
).getType().equals(ed
.getVPpiType().get(1))) {
623 PpiNotify p
= PpiNotify
.Factory
.newInstance();
624 if (!isEmpty(vid
.getPpis(index
).getName())) {
625 p
.setPpiNotifyCName(vid
.getPpis(index
).getName());
627 if (!isEmpty(vid
.getPpis(index
).getUsage())) {
628 p
.setUsage(PpiNotifyUsage
.Enum
.forString(vid
.getPpis(index
).getUsage()));
630 if (!isEmpty(vid
.getPpis(index
).getFeatureFlag())) {
631 p
.setFeatureFlag(vid
.getPpis(index
).getFeatureFlag());
633 if (vid
.getPpis(index
).getSupArchList() != null
634 && vid
.getPpis(index
).getSupArchList().size() > 0) {
635 p
.setSupArchList(vid
.getPpis(index
).getSupArchList());
637 if (!isEmpty(vid
.getPpis(index
).getHelp())) {
638 p
.setHelpText(vid
.getPpis(index
).getHelp());
640 this.ppis
.addNewPpiNotify();
641 this.ppis
.setPpiNotifyArray(ppis
.getPpiNotifyList().size() - 1, p
);
646 this.msa
.setPPIs(ppis
);
647 this.omt
.setSaved(false);
648 } catch (Exception e
) {
650 Log
.err("Update Ppis", e
.getMessage());
655 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
657 * Override componentResized to resize all components when frame's size is changed
659 public void componentResized(ComponentEvent arg0
) {
660 int intCurrentWidth
= this.getJContentPane().getWidth();
661 int intCurrentHeight
= this.getJContentPane().getHeight();
662 int intPreferredWidth
= this.getJContentPane().getPreferredSize().width
;
663 int intPreferredHeight
= this.getJContentPane().getPreferredSize().height
;
665 resizeComponentWidth(jComboBoxPpiType
, intCurrentWidth
, intPreferredWidth
);
666 resizeComponentWidth(jComboBoxCName
, intCurrentWidth
, intPreferredWidth
);
667 resizeComponentWidth(jComboBoxUsage
, intCurrentWidth
, intPreferredWidth
);
668 resizeComponentWidth(jTextFieldHelpText
, intCurrentWidth
, intPreferredWidth
);
669 resizeComponentWidth(jTextFieldFeatureFlag
, intCurrentWidth
, intPreferredWidth
);
670 resizeComponentWidth(jScrollPaneArch
, intCurrentWidth
, intPreferredWidth
);
672 resizeComponentWidth(jComboBoxList
, intCurrentWidth
, intPreferredWidth
);
673 resizeComponent(jScrollPaneList
, intCurrentWidth
, intCurrentHeight
, intPreferredWidth
, intPreferredHeight
);
674 relocateComponentX(jButtonAdd
, intCurrentWidth
, intPreferredWidth
, DataType
.SPACE_TO_RIGHT_FOR_ADD_BUTTON
);
675 relocateComponentX(jButtonRemove
, intCurrentWidth
, intPreferredWidth
, DataType
.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON
);
676 relocateComponentX(jButtonUpdate
, intCurrentWidth
, intPreferredWidth
, DataType
.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON
);
679 private PpisIdentification
getCurrentPpis() {
680 String arg0
= this.jComboBoxCName
.getSelectedItem().toString();
681 String arg1
= this.jComboBoxPpiType
.getSelectedItem().toString();
682 String arg2
= this.jComboBoxUsage
.getSelectedItem().toString();
684 String arg3
= this.jTextFieldFeatureFlag
.getText();
685 Vector
<String
> arg4
= this.iCheckBoxListArch
.getAllCheckedItemsString();
686 String arg5
= this.jTextFieldHelpText
.getText();
688 id
= new PpisIdentification(arg0
, arg1
, arg2
, arg3
, arg4
, arg5
);
693 Add current item to Vector
696 private void addToList() {
697 intSelectedItemId
= vid
.size();
699 vid
.addPpis(getCurrentPpis());
701 jComboBoxList
.addItem(id
.getName());
702 jComboBoxList
.setSelectedItem(id
.getName());
705 // Reset select item index
707 intSelectedItemId
= vid
.size();
710 // Reload all fields of selected item
721 Remove current item from Vector
724 private void removeFromList() {
726 // Check if exist items
728 if (this.vid
.size() < 1) {
732 int intTempIndex
= intSelectedItemId
;
734 jComboBoxList
.removeItemAt(intSelectedItemId
);
736 vid
.removePpis(intTempIndex
);
739 // Reload all fields of selected item
750 Update current item of Vector
753 private void updateForList() {
755 // Check if exist items
757 if (this.vid
.size() < 1) {
762 // Backup selected item index
764 int intTempIndex
= intSelectedItemId
;
766 vid
.updatePpis(getCurrentPpis(), intTempIndex
);
768 jComboBoxList
.removeAllItems();
769 for (int index
= 0; index
< vid
.size(); index
++) {
770 jComboBoxList
.addItem(vid
.getPpis(index
).getName());
774 // Restore selected item index
776 intSelectedItemId
= intTempIndex
;
779 // Reset select item index
781 jComboBoxList
.setSelectedIndex(intSelectedItemId
);
784 // Reload all fields of selected item
795 Refresh all fields' values of selected item of Vector
798 private void reloadFromList() {
799 if (vid
.size() > 0) {
801 // Get selected item index
803 intSelectedItemId
= jComboBoxList
.getSelectedIndex();
805 this.jComboBoxCName
.setSelectedItem(vid
.getPpis(intSelectedItemId
).getName());
806 this.jComboBoxPpiType
.setSelectedItem(vid
.getPpis(intSelectedItemId
).getType());
807 this.jComboBoxUsage
.setSelectedItem(vid
.getPpis(intSelectedItemId
).getUsage());
808 this.jTextFieldHelpText
.setText(vid
.getPpis(intSelectedItemId
).getHelp());
810 jTextFieldFeatureFlag
.setText(vid
.getPpis(intSelectedItemId
).getFeatureFlag());
811 iCheckBoxListArch
.setAllItemsUnchecked();
812 iCheckBoxListArch
.initCheckedItem(true, vid
.getPpis(intSelectedItemId
).getSupArchList());
821 Update list area pane via the elements of Vector
824 private void reloadListArea() {
825 String strListItem
= "";
826 for (int index
= 0; index
< vid
.size(); index
++) {
827 strListItem
= strListItem
+ vid
.getPpis(index
).getName() + DataType
.UNIX_LINE_SEPARATOR
;
829 this.jTextAreaList
.setText(strListItem
);
833 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
835 * Reflesh the frame when selected item changed
838 public void itemStateChanged(ItemEvent arg0
) {
839 if (arg0
.getSource() == this.jComboBoxList
&& arg0
.getStateChange() == ItemEvent
.SELECTED
) {
842 if (arg0
.getSource() == this.jComboBoxPpiType
&& arg0
.getStateChange() == ItemEvent
.SELECTED
) {
843 if (this.jComboBoxPpiType
.getSelectedItem().toString().equals(ed
.getVPpiType().get(0))) {
844 Tools
.generateComboBoxByVector(this.jComboBoxUsage
, ed
.getVPpiUsage());
846 Tools
.generateComboBoxByVector(this.jComboBoxUsage
, ed
.getVPpiNotifyUsage());