]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.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 / ModuleProtocols.java
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
new file mode 100644 (file)
index 0000000..e591292
--- /dev/null
@@ -0,0 +1,852 @@
+/** @file\r
\r
+ The file is used to create, update Protocol of MSA/MBD file\r
\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
+ **/\r
+\r
+package org.tianocore.frameworkwizard.module.ui;\r
+\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ComponentEvent;\r
+import java.awt.event.ItemEvent;\r
+import java.util.Vector;\r
+\r
+import javax.swing.JButton;\r
+import javax.swing.JComboBox;\r
+import javax.swing.JLabel;\r
+import javax.swing.JPanel;\r
+import javax.swing.JScrollPane;\r
+import javax.swing.JTextArea;\r
+import javax.swing.JTextField;\r
+\r
+import org.tianocore.ProtocolNotifyUsage;\r
+import org.tianocore.ProtocolUsage;\r
+import org.tianocore.ProtocolsDocument;\r
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
+import org.tianocore.ProtocolsDocument.Protocols;\r
+import org.tianocore.ProtocolsDocument.Protocols.Protocol;\r
+import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;\r
+import org.tianocore.frameworkwizard.common.DataType;\r
+import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.EnumerationData;\r
+import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.OpeningModuleType;\r
+import org.tianocore.frameworkwizard.common.Tools;\r
+import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
+import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
+import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
+import org.tianocore.frameworkwizard.module.Identification.Protocols.ProtocolsIdentification;\r
+import org.tianocore.frameworkwizard.module.Identification.Protocols.ProtocolsVector;\r
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+\r
+/**\r
+ The class is used to create, update Protocol of MSA/MBD file\r
+ It extends IInternalFrame\r
\r
+\r
+\r
+ **/\r
+public class ModuleProtocols extends IInternalFrame {\r
+\r
+    ///\r
+    /// Define class Serial Version UID\r
+    ///\r
+    private static final long serialVersionUID = -9084913640747858848L;\r
+\r
+    //\r
+    //Define class members\r
+    //\r
+    private JPanel jContentPane = null;\r
+\r
+    private JLabel jLabelC_Name = null;\r
+\r
+    private JLabel jLabelFeatureFlag = null;\r
+\r
+    private JTextField jTextFieldFeatureFlag = null;\r
+\r
+    private JLabel jLabelUsage = null;\r
+\r
+    private JComboBox jComboBoxUsage = null;\r
+\r
+    private StarLabel jStarLabel1 = null;\r
+\r
+    private StarLabel jStarLabel2 = null;\r
+\r
+    private JLabel jLabelProtocolType = null;\r
+\r
+    private JLabel jLabelArch = null;\r
+\r
+    private JTextArea jTextAreaList = null;\r
+\r
+    private JComboBox jComboBoxList = null;\r
+\r
+    private JButton jButtonAdd = null;\r
+\r
+    private JButton jButtonRemove = null;\r
+\r
+    private JButton jButtonUpdate = null;\r
+\r
+    private JScrollPane jScrollPane = null;\r
+\r
+    private JScrollPane jScrollPaneList = null;\r
+\r
+    private JComboBox jComboBoxProtocolType = null;\r
+\r
+    private JComboBox jComboBoxCName = null;\r
+\r
+    private ICheckBoxList iCheckBoxListArch = null;\r
+\r
+    private JScrollPane jScrollPaneArch = null;\r
+    \r
+    private JLabel jLabelHelpText = null;\r
+\r
+    private JTextField jTextFieldHelpText = null;\r
+\r
+    //\r
+    // Not used by UI\r
+    //\r
+    private int intSelectedItemId = 0;\r
+\r
+    private OpeningModuleType omt = null;\r
+\r
+    private ModuleSurfaceArea msa = null;\r
+\r
+    private ProtocolsDocument.Protocols protocols = null;\r
+\r
+    private ProtocolsIdentification id = null;\r
+\r
+    private ProtocolsVector vid = new ProtocolsVector();\r
+\r
+    private WorkspaceTools wt = new WorkspaceTools();\r
+\r
+    private EnumerationData ed = new EnumerationData();\r
+\r
+    /**\r
+     This method initializes jTextFieldFeatureFlag \r
+     \r
+     @return javax.swing.JTextField jTextFieldFeatureFlag\r
+     \r
+     **/\r
+    private JTextField getJTextFieldFeatureFlag() {\r
+        if (jTextFieldFeatureFlag == null) {\r
+            jTextFieldFeatureFlag = new JTextField();\r
+            jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
+            jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
+        }\r
+        return jTextFieldFeatureFlag;\r
+    }\r
+\r
+    /**\r
+     This method initializes jComboBoxUsage \r
+     \r
+     @return javax.swing.JComboBox jComboBoxUsage\r
+     \r
+     **/\r
+    private JComboBox getJComboBoxProtocolUsage() {\r
+        if (jComboBoxUsage == null) {\r
+            jComboBoxUsage = new JComboBox();\r
+            jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
+            jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r
+        }\r
+        return jComboBoxUsage;\r
+    }\r
+\r
+    /**\r
+     This method initializes jComboBoxFileList \r
+     \r
+     @return javax.swing.JComboBox jComboBoxFileList\r
+     \r
+     **/\r
+    private JComboBox getJComboBoxList() {\r
+        if (jComboBoxList == null) {\r
+            jComboBoxList = new JComboBox();\r
+            jComboBoxList.setBounds(new java.awt.Rectangle(15, 220, 210, 20));\r
+            jComboBoxList.addItemListener(this);\r
+            jComboBoxList.addActionListener(this);\r
+            jComboBoxList.setPreferredSize(new java.awt.Dimension(210, 20));\r
+        }\r
+        return jComboBoxList;\r
+    }\r
+\r
+    /**\r
+     This method initializes jButtonAdd \r
+     \r
+     @return javax.swing.JButton jButtonAdd\r
+     \r
+     **/\r
+    private JButton getJButtonAdd() {\r
+        if (jButtonAdd == null) {\r
+            jButtonAdd = new JButton();\r
+            jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 80, 20));\r
+            jButtonAdd.setText("Add");\r
+            jButtonAdd.addActionListener(this);\r
+            jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));\r
+        }\r
+        return jButtonAdd;\r
+    }\r
+\r
+    /**\r
+     This method initializes jButtonRemove \r
+     \r
+     @return javax.swing.JButton jButtonRemove\r
+     \r
+     **/\r
+    private JButton getJButtonRemove() {\r
+        if (jButtonRemove == null) {\r
+            jButtonRemove = new JButton();\r
+            jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 80, 20));\r
+            jButtonRemove.setText("Remove");\r
+            jButtonRemove.addActionListener(this);\r
+            jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));\r
+        }\r
+        return jButtonRemove;\r
+    }\r
+\r
+    /**\r
+     This method initializes jButtonUpdate \r
+     \r
+     @return javax.swing.JButton jButtonUpdate\r
+     \r
+     **/\r
+    private JButton getJButtonUpdate() {\r
+        if (jButtonUpdate == null) {\r
+            jButtonUpdate = new JButton();\r
+            jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 80, 20));\r
+            jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));\r
+            jButtonUpdate.setText("Update");\r
+            jButtonUpdate.addActionListener(this);\r
+        }\r
+        return jButtonUpdate;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jScrollPaneFileList   \r
+     *   \r
+     * @return javax.swing.JScrollPane   \r
+     */\r
+    private JScrollPane getJScrollPaneList() {\r
+        if (jScrollPaneList == null) {\r
+            jScrollPaneList = new JScrollPane();\r
+            jScrollPaneList.setBounds(new java.awt.Rectangle(15, 245, 465, 240));\r
+            jScrollPaneList.setViewportView(getJTextAreaList());\r
+            jScrollPaneList.setPreferredSize(new java.awt.Dimension(465, 240));\r
+        }\r
+        return jScrollPaneList;\r
+    }\r
+\r
+    /**\r
+     This method initializes jScrollPane  \r
+     \r
+     @return javax.swing.JScrollPane  \r
+     */\r
+    private JScrollPane getJScrollPane() {\r
+        if (jScrollPane == null) {\r
+            jScrollPane = new JScrollPane();\r
+            jScrollPane.setViewportView(getJContentPane());\r
+        }\r
+        return jScrollPane;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jTextAreaFileList \r
+     *   \r
+     * @return javax.swing.JTextArea \r
+     */\r
+    private JTextArea getJTextAreaList() {\r
+        if (jTextAreaList == null) {\r
+            jTextAreaList = new JTextArea();\r
+            jTextAreaList.setEditable(false);\r
+\r
+        }\r
+        return jTextAreaList;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jComboBoxProtocolType   \r
+     *         \r
+     * @return javax.swing.JComboBox   \r
+     */\r
+    private JComboBox getJComboBoxProtocolType() {\r
+        if (jComboBoxProtocolType == null) {\r
+            jComboBoxProtocolType = new JComboBox();\r
+            jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
+            jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));\r
+            jComboBoxProtocolType.addItemListener(this);\r
+        }\r
+        return jComboBoxProtocolType;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jComboBoxCName  \r
+     *         \r
+     * @return javax.swing.JComboBox   \r
+     */\r
+    private JComboBox getJComboBoxCName() {\r
+        if (jComboBoxCName == null) {\r
+            jComboBoxCName = new JComboBox();\r
+            jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
+            jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));\r
+\r
+        }\r
+        return jComboBoxCName;\r
+    }\r
+\r
+    /**\r
+     This method initializes iCheckBoxListArch   \r
+     \r
+     @return ICheckBoxList   \r
+     **/\r
+    private ICheckBoxList getICheckBoxListSupportedArchitectures() {\r
+        if (iCheckBoxListArch == null) {\r
+            iCheckBoxListArch = new ICheckBoxList();\r
+            iCheckBoxListArch.addFocusListener(this);\r
+            iCheckBoxListArch.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
+        }\r
+        return iCheckBoxListArch;\r
+    }\r
+\r
+    /**\r
+     This method initializes jScrollPaneArch \r
+     \r
+     @return javax.swing.JScrollPane \r
+     \r
+     **/\r
+    private JScrollPane getJScrollPaneArch() {\r
+        if (jScrollPaneArch == null) {\r
+            jScrollPaneArch = new JScrollPane();\r
+            jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 135, 320, 80));\r
+            jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));\r
+            jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());\r
+        }\r
+        return jScrollPaneArch;\r
+    }\r
+    \r
+    /**\r
+    This method initializes jTextFieldHelpText  \r
+    \r
+    @return javax.swing.JTextField  \r
+    \r
+    **/\r
+   private JTextField getJTextFieldHelpText() {\r
+       if (jTextFieldHelpText == null) {\r
+           jTextFieldHelpText = new JTextField();\r
+           jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
+           jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));\r
+       }\r
+       return jTextFieldHelpText;\r
+   }\r
+\r
+    public static void main(String[] args) {\r
+\r
+    }\r
+\r
+    /**\r
+     This method initializes this\r
+     \r
+     **/\r
+    private void init() {\r
+        this.setSize(500, 515);\r
+        this.setContentPane(getJScrollPane());\r
+        this.setTitle("Protocols");\r
+        initFrame();\r
+        this.setViewMode(false);\r
+    }\r
+\r
+    /**\r
+     This method initializes this\r
+     Fill values to all fields if these values are not empty\r
+     \r
+     @param inPackageDependencies\r
+\r
+     **/\r
+    private void init(Protocols inProtocols) {\r
+        init();\r
+        this.protocols = inProtocols;\r
+\r
+        if (this.protocols != null) {\r
+            if (this.protocols.getProtocolList().size() > 0) {\r
+                for (int index = 0; index < this.protocols.getProtocolList().size(); index++) {\r
+                    String arg0 = protocols.getProtocolList().get(index).getProtocolCName();\r
+                    String arg1 = ed.getVProtocolType().get(0);\r
+                    String arg2 = null;\r
+                    if (protocols.getProtocolList().get(index).getUsage() != null) {\r
+                        arg2 = protocols.getProtocolList().get(index).getUsage().toString();    \r
+                    }\r
+                    \r
+                    String arg3 = protocols.getProtocolList().get(index).getFeatureFlag();\r
+                    Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolList().get(index)\r
+                                                                             .getSupArchList());\r
+                    String arg5 = protocols.getProtocolList().get(index).getHelpText();\r
+                    id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
+                    vid.addProtocols(id);\r
+                }\r
+            }\r
+            if (this.protocols.getProtocolNotifyList().size() > 0) {\r
+                for (int index = 0; index < this.protocols.getProtocolNotifyList().size(); index++) {\r
+                    String arg0 = protocols.getProtocolNotifyList().get(index).getProtocolNotifyCName();\r
+                    String arg1 = ed.getVProtocolType().get(1);\r
+                    String arg2 = null;\r
+                    if (protocols.getProtocolNotifyList().get(index).getUsage() != null) {\r
+                        arg2 = protocols.getProtocolNotifyList().get(index).getUsage().toString();    \r
+                    }\r
+                    \r
+                    String arg3 = protocols.getProtocolNotifyList().get(index).getFeatureFlag();\r
+                    Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolNotifyList().get(index)\r
+                                                                             .getSupArchList());\r
+                    String arg5 = protocols.getProtocolNotifyList().get(index).getHelpText();\r
+                    id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
+                    vid.addProtocols(id);\r
+                }\r
+            }\r
+        }\r
+        //\r
+        // Update the list\r
+        //\r
+        Tools.generateComboBoxByVector(jComboBoxList, vid.getProtocolsName());\r
+        reloadListArea();\r
+    }\r
+\r
+    /**\r
+     This is the default constructor\r
+     \r
+     **/\r
+    public ModuleProtocols() {\r
+        super();\r
+        init();\r
+        this.setVisible(true);\r
+    }\r
+\r
+    /**\r
+     This is the override edit constructor\r
+     \r
+     @param inProtocol The input data of ProtocolsDocument.Protocols\r
+     \r
+     **/\r
+    public ModuleProtocols(OpeningModuleType inOmt) {\r
+        super();\r
+        this.omt = inOmt;\r
+        this.msa = omt.getXmlMsa();\r
+        init(msa.getProtocols());\r
+        this.setVisible(true);\r
+    }\r
+\r
+    /**\r
+     Disable all components when the mode is view\r
+     \r
+     @param isView true - The view mode; false - The non-view mode\r
+     \r
+     **/\r
+    public void setViewMode(boolean isView) {\r
+        if (isView) {\r
+            this.jComboBoxUsage.setEnabled(!isView);\r
+            this.jTextFieldFeatureFlag.setEnabled(!isView);\r
+        }\r
+    }\r
+\r
+    /**\r
+     This method initializes jContentPane\r
+     \r
+     @return javax.swing.JPanel jContentPane\r
+     \r
+     **/\r
+    private JPanel getJContentPane() {\r
+        if (jContentPane == null) {\r
+            jLabelHelpText = new JLabel();\r
+            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));\r
+            jLabelHelpText.setText("Help Text");\r
+            jLabelArch = new JLabel();\r
+            jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
+            jLabelArch.setText("Arch Type");\r
+            jLabelProtocolType = new JLabel();\r
+            jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
+            jLabelProtocolType.setText("Protocol Type");\r
+            jLabelUsage = new JLabel();\r
+            jLabelUsage.setText("Usage");\r
+            jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
+            jLabelFeatureFlag = new JLabel();\r
+            jLabelFeatureFlag.setText("Feature Flag");\r
+            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
+            jLabelC_Name = new JLabel();\r
+            jLabelC_Name.setText("C_Name Type");\r
+            jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
+\r
+            jContentPane = new JPanel();\r
+            jContentPane.setLayout(null);\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(490, 495));\r
+\r
+            jContentPane.add(jLabelC_Name, null);\r
+            jContentPane.add(jLabelFeatureFlag, null);\r
+            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
+            jContentPane.add(jLabelUsage, null);\r
+            jContentPane.add(getJComboBoxProtocolUsage(), null);\r
+            jContentPane.add(jLabelProtocolType, null);\r
+\r
+            jStarLabel1 = new StarLabel();\r
+            jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));\r
+            jStarLabel2 = new StarLabel();\r
+            jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));\r
+\r
+            jContentPane.add(jStarLabel1, null);\r
+            jContentPane.add(jStarLabel2, null);\r
+            jContentPane.add(jLabelArch, null);\r
+            jContentPane.add(getJComboBoxList(), null);\r
+            jContentPane.add(getJButtonAdd(), null);\r
+            jContentPane.add(getJButtonRemove(), null);\r
+            jContentPane.add(getJButtonUpdate(), null);\r
+            jContentPane.add(getJScrollPaneList(), null);\r
+\r
+            jContentPane.add(getJComboBoxProtocolType(), null);\r
+            jContentPane.add(getJComboBoxCName(), null);\r
+            jContentPane.add(getJScrollPaneArch(), null);\r
+            jContentPane.add(jLabelHelpText, null);\r
+            jContentPane.add(getJTextFieldHelpText(), null);\r
+        }\r
+        return jContentPane;\r
+    }\r
+\r
+    /**\r
+     This method initializes Usage type\r
+     \r
+     **/\r
+    private void initFrame() {\r
+        Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());\r
+        Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace());\r
+        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());\r
+\r
+        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
+     *\r
+     * Override actionPerformed to listen all actions\r
+     * \r
+     */\r
+    public void actionPerformed(ActionEvent arg0) {\r
+        if (arg0.getSource() == jButtonAdd) {\r
+            if (!checkAdd()) {\r
+                return;\r
+            }\r
+            addToList();\r
+        }\r
+        if (arg0.getSource() == jButtonRemove) {\r
+            removeFromList();\r
+        }\r
+        if (arg0.getSource() == jButtonUpdate) {\r
+            if (!checkAdd()) {\r
+                return;\r
+            }\r
+            updateForList();\r
+        }\r
+    }\r
+\r
+    /**\r
+     Data validation for all fields\r
+     \r
+     @retval true - All datas are valid\r
+     @retval false - At least one data is invalid\r
+     \r
+     **/\r
+    public boolean checkAdd() {\r
+        //\r
+        // Check if all fields have correct data types \r
+        //\r
+\r
+        //\r
+        // Check Name \r
+        //\r
+        if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {\r
+            if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {\r
+                Log.err("Incorrect data type for Protocol/ProtocolNotify Name");\r
+                return false;\r
+            }\r
+        }\r
+        \r
+        //\r
+        // Check FeatureFlag\r
+        //\r
+        if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r
+            if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r
+                Log.err("Incorrect data type for Feature Flag");\r
+                return false;\r
+            }\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
+    /**\r
+     Save all components of Protocols\r
+     if exists protocols, set the value directly\r
+     if not exists protocols, new an instance first\r
+     \r
+     **/\r
+    public void save() {\r
+        try {\r
+            int count = this.vid.size();\r
+\r
+            this.protocols = Protocols.Factory.newInstance();\r
+            if (count > 0) {\r
+                for (int index = 0; index < count; index++) {\r
+                    if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(0))) {\r
+                        Protocol p = Protocol.Factory.newInstance();\r
+                        if (!isEmpty(vid.getProtocols(index).getName())) {\r
+                            p.setProtocolCName(vid.getProtocols(index).getName());\r
+                        }\r
+                        if (!isEmpty(vid.getProtocols(index).getUsage())) {\r
+                            p.setUsage(ProtocolUsage.Enum.forString(vid.getProtocols(index).getUsage()));\r
+                        }\r
+                        if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {\r
+                            p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());\r
+                        }\r
+                        if (vid.getProtocols(index).getSupArchList() != null\r
+                            && vid.getProtocols(index).getSupArchList().size() > 0) {\r
+                            p.setSupArchList(vid.getProtocols(index).getSupArchList());\r
+                        }\r
+                        if (!isEmpty(vid.getProtocols(index).getHelp())) {\r
+                            p.setHelpText(vid.getProtocols(index).getHelp());\r
+                        }\r
+                        this.protocols.addNewProtocol();\r
+                        this.protocols.setProtocolArray(protocols.getProtocolList().size() - 1, p);\r
+                    }\r
+                    if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(1))) {\r
+                        ProtocolNotify p = ProtocolNotify.Factory.newInstance();\r
+                        if (!isEmpty(vid.getProtocols(index).getName())) {\r
+                            p.setProtocolNotifyCName(vid.getProtocols(index).getName());\r
+                        }\r
+                        if (!isEmpty(vid.getProtocols(index).getUsage())) {\r
+                            p.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getProtocols(index).getUsage()));\r
+                        }\r
+                        if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {\r
+                            p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());\r
+                        }\r
+                        if (vid.getProtocols(index).getSupArchList() != null\r
+                            && vid.getProtocols(index).getSupArchList().size() > 0) {\r
+                            p.setSupArchList(vid.getProtocols(index).getSupArchList());\r
+                        }\r
+                        if (!isEmpty(vid.getProtocols(index).getHelp())) {\r
+                            p.setHelpText(vid.getProtocols(index).getHelp());\r
+                        }\r
+                        this.protocols.addNewProtocolNotify();\r
+                        this.protocols.setProtocolNotifyArray(protocols.getProtocolNotifyList().size() - 1, p);\r
+                    }\r
+                }\r
+            }\r
+\r
+            this.msa.setProtocols(protocols);\r
+            this.omt.setSaved(false);\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+            Log.err("Update Protocols", e.getMessage());\r
+        }\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r
+     * \r
+     * Override componentResized to resize all components when frame's size is changed\r
+     */\r
+    public void componentResized(ComponentEvent arg0) {\r
+        int intCurrentWidth = this.getJContentPane().getWidth();\r
+        int intCurrentHeight = this.getJContentPane().getHeight();\r
+        int intPreferredWidth = this.getJContentPane().getPreferredSize().width;\r
+        int intPreferredHeight = this.getJContentPane().getPreferredSize().height;\r
+\r
+        resizeComponentWidth(this.jComboBoxProtocolType, intCurrentWidth, intPreferredWidth);\r
+        resizeComponentWidth(this.jComboBoxCName, intCurrentWidth, intPreferredWidth);\r
+        resizeComponentWidth(this.jComboBoxUsage, intCurrentWidth, intPreferredWidth);\r
+        resizeComponentWidth(this.jTextFieldHelpText, intCurrentWidth, intPreferredWidth);\r
+        resizeComponentWidth(this.jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
+        resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
+\r
+        resizeComponentWidth(this.jComboBoxList, intCurrentWidth, intPreferredWidth);\r
+        resizeComponent(this.jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
+\r
+        relocateComponentX(this.jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);\r
+        relocateComponentX(this.jButtonRemove, intCurrentWidth, intPreferredWidth,\r
+                           DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);\r
+        relocateComponentX(this.jButtonUpdate, intCurrentWidth, intPreferredWidth,\r
+                           DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);\r
+    }\r
+\r
+    private ProtocolsIdentification getCurrentProtocols() {\r
+        String arg0 = this.jComboBoxCName.getSelectedItem().toString();\r
+        String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString();\r
+        String arg2 = this.jComboBoxUsage.getSelectedItem().toString();\r
+\r
+        String arg3 = this.jTextFieldFeatureFlag.getText();\r
+        Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();\r
+        String arg5 = this.jTextFieldHelpText.getText();\r
+        id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
+        return id;\r
+    }\r
+\r
+    /**\r
+     Add current item to Vector\r
+     \r
+     **/\r
+    private void addToList() {\r
+        intSelectedItemId = vid.size();\r
+\r
+        vid.addProtocols(getCurrentProtocols());\r
+\r
+        jComboBoxList.addItem(id.getName());\r
+        jComboBoxList.setSelectedItem(id.getName());\r
+\r
+        //\r
+        // Reset select item index\r
+        //\r
+        intSelectedItemId = vid.size();\r
+\r
+        //\r
+        // Reload all fields of selected item\r
+        //\r
+        reloadFromList();\r
+\r
+        // \r
+        // Save to memory\r
+        //\r
+        save();\r
+    }\r
+\r
+    /**\r
+     Remove current item from Vector\r
+     \r
+     **/\r
+    private void removeFromList() {\r
+        //\r
+        // Check if exist items\r
+        //\r
+        if (this.vid.size() < 1) {\r
+            return;\r
+        }\r
+\r
+        int intTempIndex = intSelectedItemId;\r
+\r
+        jComboBoxList.removeItemAt(intSelectedItemId);\r
+\r
+        vid.removeProtocols(intTempIndex);\r
+\r
+        //\r
+        // Reload all fields of selected item\r
+        //\r
+        reloadFromList();\r
+\r
+        // \r
+        // Save to memory\r
+        //\r
+        save();\r
+    }\r
+\r
+    /**\r
+     Update current item of Vector\r
+     \r
+     **/\r
+    private void updateForList() {\r
+        //\r
+        // Check if exist items\r
+        //\r
+        if (this.vid.size() < 1) {\r
+            return;\r
+        }\r
+\r
+        //\r
+        // Backup selected item index\r
+        //\r
+        int intTempIndex = intSelectedItemId;\r
+\r
+        vid.updateProtocols(getCurrentProtocols(), intTempIndex);\r
+\r
+        jComboBoxList.removeAllItems();\r
+        for (int index = 0; index < vid.size(); index++) {\r
+            jComboBoxList.addItem(vid.getProtocols(index).getName());\r
+        }\r
+\r
+        //\r
+        // Restore selected item index\r
+        //\r
+        intSelectedItemId = intTempIndex;\r
+\r
+        //\r
+        // Reset select item index\r
+        //\r
+        jComboBoxList.setSelectedIndex(intSelectedItemId);\r
+\r
+        //\r
+        // Reload all fields of selected item\r
+        //\r
+        reloadFromList();\r
+\r
+        // \r
+        // Save to memory\r
+        //\r
+        save();\r
+    }\r
+\r
+    /**\r
+     Refresh all fields' values of selected item of Vector\r
+     \r
+     **/\r
+    private void reloadFromList() {\r
+        if (vid.size() > 0) {\r
+            //\r
+            // Get selected item index\r
+            //\r
+            intSelectedItemId = jComboBoxList.getSelectedIndex();\r
+\r
+            this.jComboBoxCName.setSelectedItem(vid.getProtocols(intSelectedItemId).getName());\r
+            this.jComboBoxProtocolType.setSelectedItem(vid.getProtocols(intSelectedItemId).getType());\r
+            this.jComboBoxUsage.setSelectedItem(vid.getProtocols(intSelectedItemId).getUsage());\r
+            this.jTextFieldHelpText.setText(vid.getProtocols(intSelectedItemId).getHelp());\r
+            \r
+            jTextFieldFeatureFlag.setText(vid.getProtocols(intSelectedItemId).getFeatureFlag());\r
+            iCheckBoxListArch.setAllItemsUnchecked();\r
+            iCheckBoxListArch.initCheckedItem(true, vid.getProtocols(intSelectedItemId).getSupArchList());\r
+            \r
+\r
+        } else {\r
+        }\r
+\r
+        reloadListArea();\r
+    }\r
+\r
+    /**\r
+     Update list area pane via the elements of Vector\r
+     \r
+     **/\r
+    private void reloadListArea() {\r
+        String strListItem = "";\r
+        for (int index = 0; index < vid.size(); index++) {\r
+            strListItem = strListItem + vid.getProtocols(index).getName() + DataType.UNIX_LINE_SEPARATOR;\r
+        }\r
+        this.jTextAreaList.setText(strListItem);\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)\r
+     *\r
+     * Reflesh the frame when selected item changed\r
+     * \r
+     */\r
+    public void itemStateChanged(ItemEvent arg0) {\r
+        if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {\r
+            reloadFromList();\r
+        }\r
+        if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) {\r
+            if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) {\r
+                Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolUsage());\r
+            } else {\r
+                Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolNotifyUsage());\r
+            }\r
+        }\r
+    }\r
+}\r