Fixed a spelling error and changed the Package Headers Tab title to be Package Header...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / ModulePackageDependencies.java
index beefb87..e994242 100644 (file)
  **/\r
 package org.tianocore.frameworkwizard.module.ui;\r
 \r
+import java.awt.Dimension;\r
 import java.awt.event.ActionEvent;\r
 import java.awt.event.ComponentEvent;\r
-import java.awt.event.ItemEvent;\r
-import java.awt.event.ItemListener;\r
+import java.awt.event.MouseEvent;\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
+import javax.swing.JTable;\r
+import javax.swing.ListSelectionModel;\r
+import javax.swing.event.ListSelectionEvent;\r
 \r
-import org.tianocore.PackageDependenciesDocument;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.PackageDependenciesDocument.PackageDependencies;\r
 import org.tianocore.PackageDependenciesDocument.PackageDependencies.Package;\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.IDefaultTableModel;\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.Identifications.OpeningModuleType;\r
+import org.tianocore.frameworkwizard.common.ui.IFrame;\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.PackageDependencies.PackageDependenciesIdentification;\r
-import org.tianocore.frameworkwizard.module.Identification.PackageDependencies.PackageDependenciesVector;\r
+import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesVector;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.PackageDepDlg;\r
 import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
 \r
@@ -53,7 +50,7 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
 \r
 \r
  **/\r
-public class ModulePackageDependencies extends IInternalFrame implements ItemListener {\r
+public class ModulePackageDependencies extends IInternalFrame {\r
 \r
     ///\r
     /// Define class Serial Version UID\r
@@ -65,30 +62,6 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabelPackageName = null;\r
-\r
-    private StarLabel jStarLabel1 = null;\r
-\r
-    private JComboBox jComboBoxPackageName = null;\r
-\r
-    private JLabel jLabelPackageGuid = null;\r
-\r
-    private JTextField jTextFieldPackageGuid = null;\r
-\r
-    private JButton jButtonGenerateGuid = null;\r
-\r
-    private JLabel jLabelPackageVersion = null;\r
-\r
-    private JTextField jTextFieldPackageVersion = null;\r
-\r
-    private JLabel jLabelFeatureFlag = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = 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
@@ -97,127 +70,30 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
 \r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JScrollPane jScrollPaneList = null;\r
+    private JScrollPane jScrollPaneTable = null;\r
 \r
-    private JLabel jLabelArch = null;\r
-\r
-    private ICheckBoxList iCheckBoxListArch = null;\r
-\r
-    private JScrollPane jScrollPaneArch = null;\r
+    private JTable jTable = 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 PackageDependenciesIdentification id = null;\r
+    private PackageDependencies pd = null;\r
 \r
-    private PackageDependenciesVector vid = new PackageDependenciesVector();\r
+    private PackageDependenciesIdentification pdid = null;\r
 \r
-    private PackageDependenciesDocument.PackageDependencies packageDependencies = null;\r
+    private PackageDependenciesVector vid = new PackageDependenciesVector();\r
 \r
     private WorkspaceTools wt = new WorkspaceTools();\r
 \r
     private Vector<PackageIdentification> vPackage = wt.getAllPackages();\r
 \r
-    /**\r
-     * This method initializes jComboBoxPackageName    \r
-     *         \r
-     * @return javax.swing.JComboBox   \r
-     */\r
-    private JComboBox getJComboBoxPackageName() {\r
-        if (jComboBoxPackageName == null) {\r
-            jComboBoxPackageName = new JComboBox();\r
-            jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
-            jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jComboBoxPackageName.setToolTipText("If your Module requires a package list that here.");\r
-            jComboBoxPackageName.addItemListener(this);\r
-        }\r
-        return jComboBoxPackageName;\r
-    }\r
-\r
-    /**\r
-     * This method initializes jTextFieldPackageGuid   \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
-    private JTextField getJTextFieldPackageGuid() {\r
-        if (jTextFieldPackageGuid == null) {\r
-            jTextFieldPackageGuid = new JTextField();\r
-            jTextFieldPackageGuid.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jTextFieldPackageGuid.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jTextFieldPackageGuid.setEditable(false);\r
-        }\r
-        return jTextFieldPackageGuid;\r
-    }\r
-\r
-    /**\r
-     * This method initializes jButtonGenerateGuid     \r
-     *         \r
-     * @return javax.swing.JButton     \r
-     */\r
-    private JButton getJButtonGenerateGuid() {\r
-        if (jButtonGenerateGuid == null) {\r
-            jButtonGenerateGuid = new JButton();\r
-            jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));\r
-            jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));\r
-            jButtonGenerateGuid.setText("GEN");\r
-            jButtonGenerateGuid.addActionListener(this);\r
-            jButtonGenerateGuid.setVisible(false);\r
-        }\r
-        return jButtonGenerateGuid;\r
-    }\r
-\r
-    /**\r
-     * This method initializes jTextFieldPackageVersion        \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
-    private JTextField getJTextFieldPackageVersion() {\r
-        if (jTextFieldPackageVersion == null) {\r
-            jTextFieldPackageVersion = new JTextField();\r
-            jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
-            jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jTextFieldPackageVersion\r
-                                    .setToolTipText("If this module depends on a specific version of a package, enter the package version here.  If the module can use the latest version that does not break backward compatibility, leave this field blank");\r
-        }\r
-        return jTextFieldPackageVersion;\r
-    }\r
+    private IDefaultTableModel model = null;\r
 \r
-    /**\r
-     * This method initializes jTextFieldFeatureFlag    \r
-     *  \r
-     * @return javax.swing.JTextField   \r
-     */\r
-    private JTextField getJTextFieldFeatureFlag() {\r
-        if (jTextFieldFeatureFlag == null) {\r
-            jTextFieldFeatureFlag = new JTextField();\r
-            jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));\r
-            jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jTextFieldFeatureFlag;\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, 195, 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
+    private int selectedRow = -1;\r
 \r
     /**\r
      This method initializes jButtonAdd \r
@@ -228,7 +104,7 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
     private JButton getJButtonAdd() {\r
         if (jButtonAdd == null) {\r
             jButtonAdd = new JButton();\r
-            jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 80, 20));\r
+            jButtonAdd.setBounds(new java.awt.Rectangle(230, 445, 80, 20));\r
             jButtonAdd.setText("Add");\r
             jButtonAdd.addActionListener(this);\r
             jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 20));\r
@@ -245,7 +121,7 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
     private JButton getJButtonRemove() {\r
         if (jButtonRemove == null) {\r
             jButtonRemove = new JButton();\r
-            jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 80, 20));\r
+            jButtonRemove.setBounds(new java.awt.Rectangle(400, 445, 80, 20));\r
             jButtonRemove.setText("Remove");\r
             jButtonRemove.addActionListener(this);\r
             jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 20));\r
@@ -262,29 +138,14 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
     private JButton getJButtonUpdate() {\r
         if (jButtonUpdate == null) {\r
             jButtonUpdate = new JButton();\r
-            jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 80, 20));\r
+            jButtonUpdate.setBounds(new java.awt.Rectangle(315, 445, 80, 20));\r
             jButtonUpdate.setPreferredSize(new java.awt.Dimension(80, 20));\r
-            jButtonUpdate.setText("Update");\r
+            jButtonUpdate.setText("Edit");\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, 220, 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
@@ -299,50 +160,69 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
     }\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
+     This method initializes jScrollPaneTable    \r
+     \r
+     @return javax.swing.JScrollPane \r
+     **/\r
+    private JScrollPane getJScrollPaneTable() {\r
+        if (jScrollPaneTable == null) {\r
+            jScrollPaneTable = new JScrollPane();\r
+            jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));\r
+            jScrollPaneTable.setPreferredSize(new Dimension(470, 420));\r
+            jScrollPaneTable.setViewportView(getJTable());\r
         }\r
-        return jTextAreaList;\r
+        return jScrollPaneTable;\r
     }\r
 \r
     /**\r
-     This method initializes iCheckBoxListArch   \r
+     This method initializes jTable  \r
      \r
-     @return ICheckBoxList   \r
+     @return javax.swing.JTable  \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
+    private JTable getJTable() {\r
+        if (jTable == null) {\r
+            jTable = new JTable();\r
+            model = new IDefaultTableModel();\r
+            jTable = new JTable(model);\r
+            jTable.setRowHeight(20);\r
+\r
+            model.addColumn("Package Name");\r
+            model.addColumn("Package Version");\r
+\r
+            jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            jTable.getSelectionModel().addListSelectionListener(this);\r
+            jTable.getModel().addTableModelListener(this);\r
+            jTable.addMouseListener(this);\r
         }\r
-        return iCheckBoxListArch;\r
+        return jTable;\r
+    }\r
+\r
+    public static void main(String[] args) {\r
+\r
     }\r
 \r
     /**\r
-     This method initializes jScrollPaneArch \r
-     \r
-     @return javax.swing.JScrollPane \r
+     This is the default constructor\r
      \r
      **/\r
-    private JScrollPane getJScrollPaneArch() {\r
-        if (jScrollPaneArch == null) {\r
-            jScrollPaneArch = new JScrollPane();\r
-            jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 110, 320, 80));\r
-            jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));\r
-            jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());\r
-        }\r
-        return jScrollPaneArch;\r
+    public ModulePackageDependencies() {\r
+        super();\r
+        init();\r
+        this.setVisible(true);\r
     }\r
 \r
-    public static void main(String[] args) {\r
-\r
+    /**\r
+     This is the override edit constructor\r
+     \r
+     @param \r
+     \r
+     **/\r
+    public ModulePackageDependencies(OpeningModuleType inOmt) {\r
+        super();\r
+        this.omt = inOmt;\r
+        this.msa = omt.getXmlMsa();\r
+        init(msa.getPackageDependencies());\r
+        this.setVisible(true);\r
     }\r
 \r
     /**\r
@@ -352,9 +232,7 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
     private void init() {\r
         this.setSize(500, 515);\r
         this.setContentPane(getJScrollPane());\r
-        this.setTitle("Includes");\r
-        initFrame();\r
-        this.setViewMode(false);\r
+        this.setTitle("Package Dependencies");\r
     }\r
 \r
     /**\r
@@ -366,14 +244,14 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
      **/\r
     private void init(PackageDependencies inPackageDependencies) {\r
         init();\r
-        this.packageDependencies = inPackageDependencies;\r
+        this.pd = inPackageDependencies;\r
 \r
-        if (this.packageDependencies != null) {\r
-            if (this.packageDependencies.getPackageList().size() > 0) {\r
-                for (int index = 0; index < this.packageDependencies.getPackageList().size(); index++) {\r
+        if (this.pd != null) {\r
+            if (this.pd.getPackageList().size() > 0) {\r
+                for (int index = 0; index < this.pd.getPackageList().size(); index++) {\r
                     String arg0 = "";\r
-                    String arg1 = packageDependencies.getPackageList().get(index).getPackageVersion();\r
-                    String arg2 = packageDependencies.getPackageList().get(index).getPackageGuid();\r
+                    String arg1 = pd.getPackageList().get(index).getPackageVersion();\r
+                    String arg2 = pd.getPackageList().get(index).getPackageGuid();\r
                     //\r
                     // If no guid, skip current item\r
                     //\r
@@ -385,56 +263,14 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
                             arg0 = vPackage.get(indexJ).getName();\r
                         }\r
                     }\r
-                    String arg3 = packageDependencies.getPackageList().get(index).getFeatureFlag();\r
-                    Vector<String> arg4 = Tools.convertListToVector(packageDependencies.getPackageList().get(index)\r
-                                                                                       .getSupArchList());\r
-                    id = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);\r
-                    vid.addPackageDependencies(id);\r
+                    String arg3 = pd.getPackageList().get(index).getFeatureFlag();\r
+                    Vector<String> arg4 = Tools.convertListToVector(pd.getPackageList().get(index).getSupArchList());\r
+                    pdid = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);\r
+                    vid.addPackageDependencies(pdid);\r
                 }\r
             }\r
         }\r
-        //\r
-        // Update the list\r
-        //\r
-        Tools.generateComboBoxByVector(jComboBoxList, vid.getPackageDependenciesName());\r
-        reloadListArea();\r
-    }\r
-\r
-    /**\r
-     This is the default constructor\r
-     \r
-     **/\r
-    public ModulePackageDependencies() {\r
-        super();\r
-        init();\r
-        this.setVisible(true);\r
-    }\r
-\r
-    /**\r
-     This is the override constructor\r
-     \r
-     **/\r
-    public ModulePackageDependencies(OpeningModuleType inOmt) {\r
-        super();\r
-        this.omt = inOmt;\r
-        this.msa = omt.getXmlMsa();\r
-        init(msa.getPackageDependencies());\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.jComboBoxPackageName.setEnabled(!isView);\r
-            this.jButtonAdd.setEnabled(!isView);\r
-            this.jButtonUpdate.setEnabled(!isView);\r
-            this.jButtonRemove.setEnabled(!isView);\r
-        }\r
+        showTable();\r
     }\r
 \r
     /**\r
@@ -445,146 +281,96 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
      **/\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
-            jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
-            jLabelArch.setText("Sup Arch List");\r
-            jLabelPackageVersion = new JLabel();\r
-            jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
-            jLabelPackageVersion.setText("Package Version");\r
-            jLabelPackageGuid = new JLabel();\r
-            jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelPackageGuid.setText("Package Guid");\r
-            jLabelPackageName = new JLabel();\r
-            jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelPackageName.setText("Package Name");\r
-\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 470));\r
-\r
-            jContentPane.add(jLabelPackageName, null);\r
-            jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 35));\r
-\r
-            jContentPane.add(jStarLabel1, null);\r
-            jContentPane.add(getJComboBoxPackageName(), null);\r
-            jContentPane.add(jLabelPackageGuid, null);\r
-            jContentPane.add(getJTextFieldPackageGuid(), null);\r
-            jContentPane.add(getJButtonGenerateGuid(), null);\r
-            jContentPane.add(jLabelPackageVersion, null);\r
-            jContentPane.add(getJTextFieldPackageVersion(), null);\r
-\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
-\r
-            jContentPane.add(getJComboBoxList(), null);\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));\r
+\r
             jContentPane.add(getJButtonAdd(), null);\r
             jContentPane.add(getJButtonRemove(), null);\r
             jContentPane.add(getJButtonUpdate(), null);\r
-            jContentPane.add(getJScrollPaneList(), null);\r
-            jContentPane.add(jLabelArch, null);\r
-            jContentPane.add(getJScrollPaneArch(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
         }\r
         return jContentPane;\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
+    private void showEdit(int index) {\r
+        PackageDepDlg pdd = new PackageDepDlg(vid.getPackageDependencies(index), new IFrame());\r
+        int result = pdd.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addPackageDependencies(pdd.getPdid());\r
+            } else {\r
+                this.vid.setPackageDependencies(pdd.getPdid(), index);\r
             }\r
-            addToList();\r
+            this.showTable();\r
+            this.save();\r
+            pdd.dispose();\r
         }\r
-        if (arg0.getSource() == jButtonRemove) {\r
-            removeFromList();\r
-        }\r
-        if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
-                return;\r
-            }\r
-            updateForList();\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            pdd.dispose();\r
         }\r
     }\r
 \r
     /**\r
-     This method initializes Usage type, Package type and Arch type\r
+     Clear all table rows\r
      \r
      **/\r
-    private void initFrame() {\r
-        EnumerationData ed = new EnumerationData();\r
-\r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\r
-\r
-        for (int index = 0; index < vPackage.size(); index++) {\r
-            jComboBoxPackageName.addItem(vPackage.elementAt(index).getName());\r
+    private void clearAll() {\r
+        if (model != null) {\r
+            for (int index = model.getRowCount() - 1; index >= 0; index--) {\r
+                model.removeRow(index);\r
+            }\r
         }\r
-        //jComboBoxPackageName.addItemListener(this);\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
+     Read content of vector and put then into table\r
      \r
      **/\r
-    public boolean check() {\r
-        return true;\r
-    }\r
+    private void showTable() {\r
+        clearAll();\r
 \r
-    /**\r
-     Data validation for all fields before add current item to Vector\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 PackageGuid \r
-        //\r
-        if (!isEmpty(this.jTextFieldPackageGuid.getText())) {\r
-            if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {\r
-                Log.err("Incorrect data type for Package Guid");\r
-                return false;\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
             }\r
         }\r
-        \r
-        //\r
-        // Check PackageVersion \r
-        //\r
-        if (!isEmpty(this.jTextFieldPackageVersion.getText())) {\r
-            if (!DataValidation.isVersion(this.jTextFieldPackageVersion.getText())) {\r
-                Log.err("Incorrect data type for Package Version");\r
-                return false;\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
+        //this.jScrollPane.setViewportView(this.jTable);\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
+            showEdit(-1);\r
+        }\r
+        if (arg0.getSource() == jButtonUpdate) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\r
+                return;\r
             }\r
+            showEdit(selectedRow);\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
+        if (arg0.getSource() == jButtonRemove) {\r
+            if (jTable.isEditing()) {\r
+                jTable.getCellEditor().stopCellEditing();\r
+            }\r
+            if (selectedRow > -1) {\r
+                this.model.removeRow(selectedRow);\r
+                this.vid.removePackageDependencies(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-        \r
-        return true;\r
     }\r
+\r
     /**\r
      Save all components of Includes\r
      if exists includes, set the value directly\r
@@ -598,7 +384,7 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
             //\r
             int count = this.vid.size();\r
 \r
-            this.packageDependencies = PackageDependencies.Factory.newInstance();\r
+            this.pd = PackageDependencies.Factory.newInstance();\r
             if (count > 0) {\r
                 for (int index = 0; index < count; index++) {\r
                     Package p = Package.Factory.newInstance();\r
@@ -617,11 +403,11 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
                         p.setSupArchList(vid.getPackageDependencies(index).getSupArchList());\r
                     }\r
 \r
-                    this.packageDependencies.addNewPackage();\r
-                    this.packageDependencies.setPackageArray(index, p);\r
+                    this.pd.addNewPackage();\r
+                    this.pd.setPackageArray(index, p);\r
                 }\r
             }\r
-            this.msa.setPackageDependencies(packageDependencies);\r
+            this.msa.setPackageDependencies(pd);\r
             this.omt.setSaved(false);\r
         } catch (Exception e) {\r
             e.printStackTrace();\r
@@ -630,198 +416,52 @@ public class ModulePackageDependencies extends IInternalFrame implements ItemLis
     }\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
+     * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)\r
+     *\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.jComboBoxPackageName, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(this.jTextFieldPackageGuid, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(this.jTextFieldPackageVersion, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(this.jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
-\r
-        resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);\r
-        resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
-        relocateComponentX(jButtonAdd, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON);\r
-        relocateComponentX(jButtonRemove, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON);\r
-        relocateComponentX(jButtonUpdate, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON);\r
-        relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,\r
-                           DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);\r
-    }\r
-\r
-    private PackageDependenciesIdentification getCurrentPackageDependencies() {\r
-        String arg0 = this.jComboBoxPackageName.getSelectedItem().toString();\r
-        String arg1 = this.jTextFieldPackageVersion.getText();\r
-        String arg2 = this.jTextFieldPackageGuid.getText();\r
-\r
-        String arg3 = this.jTextFieldFeatureFlag.getText();\r
-        Vector<String> arg4 = this.iCheckBoxListArch.getAllCheckedItemsString();\r
-        id = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);\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.addPackageDependencies(getCurrentPackageDependencies());\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
+    public void valueChanged(ListSelectionEvent arg0) {\r
+        if (arg0.getValueIsAdjusting()) {\r
             return;\r
         }\r
-\r
-        int intTempIndex = intSelectedItemId;\r
-\r
-        jComboBoxList.removeItemAt(intSelectedItemId);\r
-\r
-        vid.removePackageDependencies(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
+        ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();\r
+        if (lsm.isSelectionEmpty()) {\r
             return;\r
-        }\r
-\r
-        //\r
-        // Backup selected item index\r
-        //\r
-        int intTempIndex = intSelectedItemId;\r
-\r
-        vid.updatePackageDependencies(getCurrentPackageDependencies(), intTempIndex);\r
-\r
-        jComboBoxList.removeAllItems();\r
-        for (int index = 0; index < vid.size(); index++) {\r
-            jComboBoxList.addItem(vid.getPackageDependencies(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.jComboBoxPackageName.setSelectedItem(vid.getPackageDependencies(intSelectedItemId).getName());\r
-            this.jTextFieldPackageVersion.setText(vid.getPackageDependencies(intSelectedItemId).getVersion());\r
-            this.jTextFieldPackageGuid.setText(vid.getPackageDependencies(intSelectedItemId).getGuid());\r
-\r
-            jTextFieldFeatureFlag.setText(vid.getPackageDependencies(intSelectedItemId).getFeatureFlag());\r
-            iCheckBoxListArch.setAllItemsUnchecked();\r
-            iCheckBoxListArch.initCheckedItem(true, vid.getPackageDependencies(intSelectedItemId).getSupArchList());\r
-\r
         } else {\r
+            selectedRow = lsm.getMinSelectionIndex();\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.getPackageDependencies(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
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\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.jComboBoxPackageName && arg0.getStateChange() == ItemEvent.SELECTED) {\r
-            for (int index = 0; index < vPackage.size(); index++) {\r
-                if (this.jComboBoxPackageName.getSelectedItem().toString().equals(vPackage.get(index).getName())) {\r
-                    this.jTextFieldPackageGuid.setText(vPackage.get(index).getGuid());\r
-                }\r
+    public void mouseClicked(MouseEvent arg0) {\r
+        if (arg0.getClickCount() == 2) {\r
+            if (this.selectedRow < 0) {\r
+                return;\r
+            } else {\r
+                showEdit(selectedRow);\r
             }\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
+        resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
+        relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight,\r
+                          DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON, DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);\r
+        relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight,\r
+                          DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON, DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);\r
+        relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight,\r
+                          DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON, DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);\r
+    }\r
 }\r