Use table and popup window to add/edit all elements of module instead of original...
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Jul 2006 07:46:39 +0000 (07:46 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Jul 2006 07:46:39 +0000 (07:46 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@894 6f19259b-4bc3-4df7-8a09-765794883524

48 files changed:
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java [new file with mode: 0644]

index f32ff6e..ba50465 100644 (file)
@@ -17,7 +17,7 @@ package org.tianocore.frameworkwizard.common;
 /**\r
  The class is used to define all used final variables\r
 \r
-**/\r
+ **/\r
 public class DataType {\r
 \r
     /**\r
@@ -28,168 +28,200 @@ public class DataType {
     public static void main(String[] args) {\r
 \r
     }\r
-    \r
+\r
     //\r
     // Define all return types\r
     //\r
     public static final int RETURN_TYPE_OK = 1;\r
-    \r
+\r
     public static final int RETURN_TYPE_CANCEL = 2;\r
-    \r
+\r
     public static final int RETURN_TYPE_NEXT = 3;\r
-    \r
+\r
     public static final int RETURN_TYPE_BACK = 4;\r
-    \r
+\r
     public static final int RETURN_TYPE_MODULE_SURFACE_AREA = 11;\r
-    \r
+\r
     public static final int RETURN_TYPE_PACKAGE_SURFACE_AREA = 12;\r
-    \r
+\r
     public static final int RETURN_TYPE_PLATFORM_SURFACE_AREA = 13;\r
-    \r
+\r
     public static final int RETURN_TYPE_BUILD_XML = 14;\r
-    \r
+\r
     public static final int RETURN_TYPE_WORKSPACE = 15;\r
-    \r
+\r
     public static final int RETURN_TYPE_TEXT = 16;\r
-    \r
-    \r
+\r
     //\r
     // Define all used final variables\r
     //\r
     public static final String DOS_LINE_SEPARATOR = "\r\n";\r
 \r
     public static final String UNIX_LINE_SEPARATOR = "\n";\r
-    \r
+\r
     public static final String EMPTY_SELECT_ITEM = "----";\r
-    \r
+\r
     public static final String DOS_FILE_SEPARATOR = "\\";\r
-    \r
+\r
     public static final String UNIX_FILE_SEPARATOR = "/";\r
-    \r
+\r
     //\r
     // Define xml files ext\r
     //\r
     public static final String COPY_OF = "Copy of ";\r
-    \r
+\r
     public static final String FILE_EXT_SEPARATOR = ".";\r
-    \r
+\r
     public static final String WORKSPACE = "Workspace";\r
-    \r
+\r
     public static final String MODULE_SURFACE_AREA = "Module Surface Area Description";\r
-    \r
+\r
     public static final String MODULE_SURFACE_AREA_EXT = "msa";\r
-    \r
-    public static final String MODULE_SURFACE_AREA_EXT_DESCRIPTION = MODULE_SURFACE_AREA + " (*." + MODULE_SURFACE_AREA_EXT + ")";\r
-    \r
+\r
+    public static final String MODULE_SURFACE_AREA_EXT_DESCRIPTION = MODULE_SURFACE_AREA + " (*."\r
+                                                                     + MODULE_SURFACE_AREA_EXT + ")";\r
+\r
     public static final String PACKAGE_SURFACE_AREA = "Package Surface Area Description";\r
-    \r
+\r
     public static final String PACKAGE_SURFACE_AREA_EXT = "spd";\r
-    \r
-    public static final String PACKAGE_SURFACE_AREA_EXT_DESCRIPTION = PACKAGE_SURFACE_AREA + " (*." + PACKAGE_SURFACE_AREA_EXT + ")";\r
-    \r
+\r
+    public static final String PACKAGE_SURFACE_AREA_EXT_DESCRIPTION = PACKAGE_SURFACE_AREA + " (*."\r
+                                                                      + PACKAGE_SURFACE_AREA_EXT + ")";\r
+\r
     public static final String PLATFORM_SURFACE_AREA = "Platform Surface Area Description";\r
-    \r
+\r
     public static final String PLATFORM_SURFACE_AREA_EXT = "fpd";\r
-    \r
-    public static final String PLATFORM_SURFACE_AREA_EXT_DESCRIPTION = PLATFORM_SURFACE_AREA + " (*." + PLATFORM_SURFACE_AREA_EXT + ")";\r
-    \r
+\r
+    public static final String PLATFORM_SURFACE_AREA_EXT_DESCRIPTION = PLATFORM_SURFACE_AREA + " (*."\r
+                                                                       + PLATFORM_SURFACE_AREA_EXT + ")";\r
+\r
     public static final String ANT_BUILD_FILE = "ANT Build File";\r
-    \r
+\r
     public static final String ANT_BUILD_FILE_EXT = "xml";\r
-    \r
+\r
     public static final String ANT_BUILD_FILE_EXT_DESCRIPTION = ANT_BUILD_FILE + " (*." + ANT_BUILD_FILE_EXT + ")";\r
-    \r
+\r
     public static final String TEXT_FILE = "Text File";\r
-    \r
+\r
     public static final String TEXT_FILE_EXT = "txt";\r
-    \r
+\r
     public static final String TEXT_FILE_EXT_DESCRIPTION = TEXT_FILE + " (*." + TEXT_FILE_EXT + ")";\r
-    \r
+\r
     //\r
     // Define file separator for current OS\r
     //\r
     public static String FILE_SEPARATOR = System.getProperty("file.separator");\r
-            \r
+\r
     //\r
     // Defien all used frame, container component's sizes\r
     //\r
     public static final int MAIN_FRAME_PREFERRED_SIZE_WIDTH = 800;\r
+\r
     public static final int MAIN_FRAME_PREFERRED_SIZE_HEIGHT = 600;\r
+\r
     public static final int MAIN_FRAME_MAX_SIZE_WIDTH = 1920;\r
+\r
     public static final int MAIN_FRAME_MAX_SIZE_HEIGHT = 1200;\r
-    \r
+\r
     public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH = 790;\r
+\r
     public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT = 545;\r
-    \r
-    public static final int MAIN_FRAME_WIDTH_SPACING = MAIN_FRAME_PREFERRED_SIZE_WIDTH - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH;\r
-    public static final int MAIN_FRAME_HEIGHT_SPACING = MAIN_FRAME_PREFERRED_SIZE_HEIGHT - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT;\r
-    \r
+\r
+    public static final int MAIN_FRAME_WIDTH_SPACING = MAIN_FRAME_PREFERRED_SIZE_WIDTH\r
+                                                       - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH;\r
+\r
+    public static final int MAIN_FRAME_HEIGHT_SPACING = MAIN_FRAME_PREFERRED_SIZE_HEIGHT\r
+                                                        - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT;\r
+\r
     public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH = 273;\r
+\r
     public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT = 545;\r
-    \r
+\r
     public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH = 515;\r
+\r
     public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT = 545;\r
+\r
     public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_X = 260;\r
+\r
     public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_Y = 1;\r
-    \r
+\r
     public static final int SPACE_TO_RIGHT_FOR_GENERATE_BUTTON = 10;\r
+\r
     public static final int SPACE_TO_RIGHT_FOR_OK_BUTTON = 10;\r
+\r
     public static final int SPACE_TO_RIGHT_FOR_ADD_BUTTON = 180;\r
+\r
     public static final int SPACE_TO_RIGHT_FOR_REMOVE_BUTTON = 95;\r
+\r
     public static final int SPACE_TO_RIGHT_FOR_UPDATE_BUTTON = 10;\r
-    public static final int SPACE_TO_RIGHT_FOR_PROTOCOL_NOTIFY = 25;\r
     \r
+    public static final int SPACE_TO_BOTTOM_FOR_ADD_BUTTON = 30;\r
+\r
+    public static final int SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON = 30;\r
+\r
+    public static final int SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON = 30;\r
+\r
+    public static final int SPACE_TO_RIGHT_FOR_PROTOCOL_NOTIFY = 25;\r
+\r
     public static final int LEFT_WIDTH = 160;\r
+\r
     public static final int LEFT_HEIGHT = 20;\r
-    \r
+\r
     public static final int RIGHT_WIDTH = 320;\r
+\r
     public static final int RIGHT_HEIGHT = 20;\r
-    \r
+\r
     public static final int RIGHT_MULTIPLE_HEIGHT = 4 * RIGHT_HEIGHT;\r
-    \r
+\r
     public static final int BUTTON_GEN_WIDTH = 65;\r
+\r
     public static final int BUTTON_GEN_HEIGHT = 20;\r
-    \r
+\r
     public static final int BUTTON_BROWSE_WIDTH = 65;\r
+\r
     public static final int BUTTON_BROWSE_HEIGHT = 20;\r
-    \r
+\r
     public static final int BUTTON_ADD_WIDTH = 80;\r
+\r
     public static final int BUTTON_ADD_HEIGHT = 20;\r
-    \r
+\r
     public static final int BUTTON_UPDATE_WIDTH = 80;\r
+\r
     public static final int BUTTON_UPDATE_HEIGHT = 20;\r
-    \r
+\r
     public static final int BUTTON_REMOVE_WIDTH = 80;\r
+\r
     public static final int BUTTON_REMOVE_HEIGHT = 20;\r
-    \r
+\r
     public static final int SCROLLBAR_WIDTH = 18;\r
+\r
     public static final int SCROLLBAR_HEIGHT = 18;\r
-    \r
+\r
     //\r
     // Common Help Text\r
     // First defined here\r
     // Will be replaced by resource file later\r
     //\r
     public static final String SUP_ARCH_LIST_HELP_TEXT = "Deselecting a checkbox will restrict this module for use with the selected architectures, based on the list of items that are checked. If all boxes are checked, then the module will support all current AND FUTURE architectures";\r
-    \r
+\r
     //\r
     // Project name and version\r
     //\r
     public static final String PROJECT_NAME = "Framework Wizard";\r
-    \r
+\r
     public static final String PROJECT_VERSION = "1.0";\r
-    \r
+\r
     //\r
     // Sort Type\r
     //\r
     public static final int SORT_TYPE_ASCENDING = 1;\r
-    \r
+\r
     public static final int SORT_TYPE_DESCENDING = 2;\r
-    \r
+\r
     //\r
     // Module Type\r
     //\r
     public static final String MODULE_TYPE_LIBRARY = "Library";\r
-    \r
+\r
     public static final String MODULE_TYPE_MODULE = "Module";\r
 }\r
index 2fc8b02..bb4212a 100644 (file)
@@ -20,6 +20,8 @@ public class EnumerationData {
     //\r
     // Static data\r
     //\r
+    public final static String EXTERNS_PCD_IS_DRIVER = "Pcd Is Driver";\r
+    \r
     public final static String EXTERNS_SPECIFICATION = "Specification";\r
     \r
     public final static String EXTERNS_MODULE_ENTRY_POINT = "ModuleEntryPoint";\r
@@ -647,6 +649,9 @@ public class EnumerationData {
     \r
     private void initExternTypes() {\r
         vExternTypes.removeAllElements();\r
+        \r
+        vExternTypes.addElement(EnumerationData.EXTERNS_PCD_IS_DRIVER);\r
+\r
         vExternTypes.addElement(EnumerationData.EXTERNS_SPECIFICATION);\r
         \r
         vExternTypes.addElement(EnumerationData.EXTERNS_MODULE_ENTRY_POINT);\r
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
new file mode 100644 (file)
index 0000000..e564ab5
--- /dev/null
@@ -0,0 +1,246 @@
+/** @file\r
\r
+ The file is used to provid 6 kinds of arch in one jpanel \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.common.ui;\r
+\r
+import java.util.Vector;\r
+\r
+import javax.swing.JPanel;\r
+import javax.swing.JCheckBox;\r
+\r
+public class ArchCheckBox extends JPanel {\r
+\r
+    ///\r
+    ///\r
+    ///\r
+    private static final long serialVersionUID = 4792669775676953990L;\r
+\r
+    private JCheckBox jCheckBoxIa32 = null;\r
+\r
+    private JCheckBox jCheckBoxX64 = null;\r
+\r
+    private JCheckBox jCheckBoxIpf = null;\r
+\r
+    private JCheckBox jCheckBoxEbc = null;\r
+\r
+    private JCheckBox jCheckBoxArm = null;\r
+\r
+    private JCheckBox jCheckBoxPpc = null;\r
+\r
+    /**\r
+     * This method initializes jCheckBoxIa32   \r
+     *         \r
+     * @return javax.swing.JCheckBox   \r
+     */\r
+    private JCheckBox getJCheckBoxIa32() {\r
+        if (jCheckBoxIa32 == null) {\r
+            jCheckBoxIa32 = new JCheckBox();\r
+            jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 50, 20));\r
+            jCheckBoxIa32.setText("IA32");\r
+        }\r
+        return jCheckBoxIa32;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jCheckBoxX64    \r
+     *         \r
+     * @return javax.swing.JCheckBox   \r
+     */\r
+    private JCheckBox getJCheckBoxX64() {\r
+        if (jCheckBoxX64 == null) {\r
+            jCheckBoxX64 = new JCheckBox();\r
+            jCheckBoxX64.setBounds(new java.awt.Rectangle(50, 0, 50, 20));\r
+            jCheckBoxX64.setText("X64");\r
+        }\r
+        return jCheckBoxX64;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jCheckBoxIpf    \r
+     *         \r
+     * @return javax.swing.JCheckBox   \r
+     */\r
+    private JCheckBox getJCheckBoxIpf() {\r
+        if (jCheckBoxIpf == null) {\r
+            jCheckBoxIpf = new JCheckBox();\r
+            jCheckBoxIpf.setBounds(new java.awt.Rectangle(100, 0, 50, 20));\r
+            jCheckBoxIpf.setText("IPF");\r
+        }\r
+        return jCheckBoxIpf;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jCheckBoxEbc    \r
+     *         \r
+     * @return javax.swing.JCheckBox   \r
+     */\r
+    private JCheckBox getJCheckBoxEbc() {\r
+        if (jCheckBoxEbc == null) {\r
+            jCheckBoxEbc = new JCheckBox();\r
+            jCheckBoxEbc.setBounds(new java.awt.Rectangle(150, 0, 50, 20));\r
+            jCheckBoxEbc.setText("EBC");\r
+        }\r
+        return jCheckBoxEbc;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jCheckBoxArm    \r
+     *         \r
+     * @return javax.swing.JCheckBox   \r
+     */\r
+    private JCheckBox getJCheckBoxArm() {\r
+        if (jCheckBoxArm == null) {\r
+            jCheckBoxArm = new JCheckBox();\r
+            jCheckBoxArm.setBounds(new java.awt.Rectangle(200, 0, 55, 20));\r
+            jCheckBoxArm.setText("ARM");\r
+        }\r
+        return jCheckBoxArm;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jCheckBoxPrc    \r
+     *         \r
+     * @return javax.swing.JCheckBox   \r
+     */\r
+    private JCheckBox getJCheckBoxPpc() {\r
+        if (jCheckBoxPpc == null) {\r
+            jCheckBoxPpc = new JCheckBox();\r
+            jCheckBoxPpc.setBounds(new java.awt.Rectangle(255, 0, 50, 20));\r
+            jCheckBoxPpc.setText("PPC");\r
+        }\r
+        return jCheckBoxPpc;\r
+    }\r
+\r
+    /**\r
+     \r
+     @param args\r
+     \r
+     **/\r
+    public static void main(String[] args) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    /**\r
+     * This is the default constructor\r
+     */\r
+    public ArchCheckBox() {\r
+        super();\r
+        initialize();\r
+    }\r
+\r
+    /**\r
+     * This method initializes this\r
+     * \r
+     * @return void\r
+     */\r
+    private void initialize() {\r
+        this.setSize(320, 20);\r
+        this.setLayout(null);\r
+        this.add(getJCheckBoxIa32(), null);\r
+        this.add(getJCheckBoxX64(), null);\r
+        this.add(getJCheckBoxIpf(), null);\r
+        this.add(getJCheckBoxEbc(), null);\r
+        this.add(getJCheckBoxArm(), null);\r
+        this.add(getJCheckBoxPpc(), null);\r
+    }\r
+    \r
+    public Vector<String> getSelectedItemsVector() {\r
+        Vector<String> v = new Vector<String>();\r
+        if (this.jCheckBoxIa32.isSelected()) {\r
+            v.addElement(jCheckBoxIa32.getText());\r
+        }\r
+        if (this.jCheckBoxX64.isSelected()) {\r
+            v.addElement(jCheckBoxX64.getText());\r
+        }\r
+        if (this.jCheckBoxIpf.isSelected()) {\r
+            v.addElement(jCheckBoxIpf.getText());\r
+        }\r
+        if (this.jCheckBoxEbc.isSelected()) {\r
+            v.addElement(jCheckBoxEbc.getText());\r
+        }\r
+        if (this.jCheckBoxArm.isSelected()) {\r
+            v.addElement(jCheckBoxArm.getText());\r
+        }\r
+        if (this.jCheckBoxPpc.isSelected()) {\r
+            v.addElement(jCheckBoxPpc.getText());\r
+        }\r
+        return v;\r
+    }\r
+    \r
+    public String getSelectedItemsString() {\r
+        String s = "";\r
+        if (this.jCheckBoxIa32.isSelected()) {\r
+            s = s + jCheckBoxIa32.getText() + " ";\r
+        }\r
+        if (this.jCheckBoxX64.isSelected()) {\r
+            s = s + jCheckBoxX64.getText() + " ";\r
+        }\r
+        if (this.jCheckBoxIpf.isSelected()) {\r
+            s = s + jCheckBoxIpf.getText() + " ";\r
+        }\r
+        if (this.jCheckBoxEbc.isSelected()) {\r
+            s = s + jCheckBoxEbc.getText() + " ";\r
+        }\r
+        if (this.jCheckBoxArm.isSelected()) {\r
+            s = s + jCheckBoxArm.getText() + " ";\r
+        }\r
+        if (this.jCheckBoxPpc.isSelected()) {\r
+            s = s + jCheckBoxPpc.getText() + " ";\r
+        }\r
+        return s.trim();\r
+    }\r
+    \r
+    public void setAllItmesSelected(boolean isSelected) {\r
+        this.jCheckBoxIa32.setSelected(isSelected);\r
+        this.jCheckBoxX64.setSelected(isSelected);\r
+        this.jCheckBoxIpf.setSelected(isSelected);\r
+        this.jCheckBoxEbc.setSelected(isSelected);\r
+        this.jCheckBoxArm.setSelected(isSelected);\r
+        this.jCheckBoxPpc.setSelected(isSelected);\r
+    }\r
+    \r
+    public void setSelectedItems(Vector<String> v) {\r
+        setAllItmesSelected(false);\r
+        if (v != null) {\r
+            for (int index = 0; index < v.size(); index++) {\r
+                if (v.get(index).equals(this.jCheckBoxIa32.getText())) {\r
+                    this.jCheckBoxIa32.setSelected(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxIpf.getText())) {\r
+                    this.jCheckBoxIpf.setSelected(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxX64.getText())) {\r
+                    this.jCheckBoxX64.setSelected(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxEbc.getText())) {\r
+                    this.jCheckBoxEbc.setSelected(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxArm.getText())) {\r
+                    this.jCheckBoxArm.setSelected(true);\r
+                    continue;\r
+                }\r
+                if (v.get(index).equals(this.jCheckBoxPpc.getText())) {\r
+                    this.jCheckBoxPpc.setSelected(true);\r
+                    continue;\r
+                }\r
+            }\r
+        }\r
+    }\r
+}\r
index 7125578..8292806 100644 (file)
@@ -50,7 +50,7 @@ public class BootModesVector {
         vBootModes.addElement(arg0);\r
     }\r
 \r
-    public void updateBootModes(BootModesIdentification arg0, int arg1) {\r
+    public void setBootModes(BootModesIdentification arg0, int arg1) {\r
         vBootModes.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,11 @@ public class BootModesVector {
     public int size() {\r
         return this.vBootModes.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getBootModes(index).getName());\r
+        v.addElement(getBootModes(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index b7899bd..7405342 100644 (file)
@@ -50,7 +50,7 @@ public class DataHubsVector {
         vDataHubs.addElement(arg0);\r
     }\r
 \r
-    public void updateDataHubs(DataHubsIdentification arg0, int arg1) {\r
+    public void setDataHubs(DataHubsIdentification arg0, int arg1) {\r
         vDataHubs.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,11 @@ public class DataHubsVector {
     public int size() {\r
         return this.vDataHubs.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getDataHubs(index).getName());\r
+        v.addElement(getDataHubs(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index bafd98a..f64e184 100644 (file)
@@ -50,7 +50,7 @@ public class EventsVector {
         vEvents.addElement(arg0);\r
     }\r
 \r
-    public void updateEvents(EventsIdentification arg0, int arg1) {\r
+    public void setEvents(EventsIdentification arg0, int arg1) {\r
         vEvents.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,12 @@ public class EventsVector {
     public int size() {\r
         return this.vEvents.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getEvents(index).getName());\r
+        v.addElement(getEvents(index).getType());\r
+        v.addElement(getEvents(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index ee5a031..93b2507 100644 (file)
@@ -16,6 +16,8 @@ package org.tianocore.frameworkwizard.module.Identifications.Externs;
 \r
 import java.util.Vector;\r
 \r
+import org.tianocore.frameworkwizard.common.EnumerationData;\r
+\r
 public class ExternsVector {\r
 \r
     private Vector<ExternsIdentification> vExterns = new Vector<ExternsIdentification>();\r
@@ -47,10 +49,24 @@ public class ExternsVector {
     }\r
 \r
     public void addExterns(ExternsIdentification arg0) {\r
-        vExterns.addElement(arg0);\r
+        boolean isExistPcd = false;\r
+        if (arg0.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {\r
+            for (int index = 0; index < size(); index++) {\r
+                if (getExterns(index).getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {\r
+                    setExterns(arg0, index);\r
+                    isExistPcd = true;\r
+                    break;\r
+                }\r
+            }\r
+            if (!isExistPcd) {\r
+                vExterns.addElement(arg0);    \r
+            }\r
+        } else {\r
+            vExterns.addElement(arg0);\r
+        }\r
     }\r
 \r
-    public void updateExterns(ExternsIdentification arg0, int arg1) {\r
+    public void setExterns(ExternsIdentification arg0, int arg1) {\r
         vExterns.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -87,4 +103,10 @@ public class ExternsVector {
         return this.vExterns.size();\r
     }\r
 \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getExterns(index).getName());\r
+        v.addElement(getExterns(index).getType());\r
+        return v;\r
+    }\r
 }\r
index 01694cc..6d415c3 100644 (file)
@@ -50,7 +50,7 @@ public class GuidsVector {
         vGuids.addElement(arg0);\r
     }\r
 \r
-    public void updateGuids(GuidsIdentification arg0, int arg1) {\r
+    public void setGuids(GuidsIdentification arg0, int arg1) {\r
         vGuids.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,12 @@ public class GuidsVector {
     public int size() {\r
         return this.vGuids.size();\r
     }\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getGuids(index).getName());\r
+        v.addElement(getGuids(index).getUsage());\r
+        return v;\r
+    }\r
 \r
 }\r
index 161f6a4..f946c0c 100644 (file)
@@ -50,7 +50,7 @@ public class HiiPackagesVector {
         vHiiPackages.addElement(arg0);\r
     }\r
 \r
-    public void updateHiiPackages(HiiPackagesIdentification arg0, int arg1) {\r
+    public void setHiiPackages(HiiPackagesIdentification arg0, int arg1) {\r
         vHiiPackages.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,11 @@ public class HiiPackagesVector {
     public int size() {\r
         return this.vHiiPackages.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getHiiPackages(index).getName());\r
+        v.addElement(getHiiPackages(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index fbbf529..550cb0a 100644 (file)
@@ -50,7 +50,7 @@ public class HobsVector {
         vHobs.addElement(arg0);\r
     }\r
 \r
-    public void updateHobs(HobsIdentification arg0, int arg1) {\r
+    public void setHobs(HobsIdentification arg0, int arg1) {\r
         vHobs.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,12 @@ public class HobsVector {
     public int size() {\r
         return this.vHobs.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getHobs(index).getName());\r
+        v.addElement(getHobs(index).getType());\r
+        v.addElement(getHobs(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index efb146e..d5e22f9 100644 (file)
@@ -50,7 +50,7 @@ public class LibraryClassVector {
         vLibraryClass.addElement(lib);\r
     }\r
     \r
-    public void updateLibraryClass(LibraryClassIdentification lib, int index) {\r
+    public void setLibraryClass(LibraryClassIdentification lib, int index) {\r
         vLibraryClass.setElementAt(lib, index);\r
     }\r
     \r
index 386a803..7661453 100644 (file)
@@ -50,7 +50,7 @@ public class PackageDependenciesVector {
         vPackageDependencies.addElement(arg0);\r
     }\r
 \r
-    public void updatePackageDependencies(PackageDependenciesIdentification arg0, int arg1) {\r
+    public void setPackageDependencies(PackageDependenciesIdentification arg0, int arg1) {\r
         vPackageDependencies.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,12 @@ public class PackageDependenciesVector {
     public int size() {\r
         return this.vPackageDependencies.size();\r
     }\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getPackageDependencies(index).getName());\r
+        v.addElement(getPackageDependencies(index).getVersion());\r
+        return v;\r
+    }\r
 \r
 }\r
index 023290d..7d8529f 100644 (file)
@@ -50,7 +50,7 @@ public class PcdCodedVector {
         vPcdCoded.addElement(arg0);\r
     }\r
 \r
-    public void updatePcdCoded(PcdCodedIdentification arg0, int arg1) {\r
+    public void setPcdCoded(PcdCodedIdentification arg0, int arg1) {\r
         vPcdCoded.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -87,4 +87,11 @@ public class PcdCodedVector {
         return this.vPcdCoded.size();\r
     }\r
 \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getPcdCoded(index).getName());\r
+        v.addElement(getPcdCoded(index).getType());\r
+        v.addElement(getPcdCoded(index).getValue());\r
+        return v;\r
+    }\r
 }\r
index b1d3457..5baa0a0 100644 (file)
@@ -50,7 +50,7 @@ public class PpisVector {
         vPpis.addElement(arg0);\r
     }\r
 \r
-    public void updatePpis(PpisIdentification arg0, int arg1) {\r
+    public void setPpis(PpisIdentification arg0, int arg1) {\r
         vPpis.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,13 @@ public class PpisVector {
     public int size() {\r
         return this.vPpis.size();\r
     }\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getPpis(index).getName());\r
+        v.addElement(getPpis(index).getType());\r
+        v.addElement(getPpis(index).getUsage());\r
+        return v;\r
+    }\r
 \r
 }\r
index b966704..7f09670 100644 (file)
@@ -50,7 +50,7 @@ public class ProtocolsVector {
         vProtocols.addElement(arg0);\r
     }\r
 \r
-    public void updateProtocols(ProtocolsIdentification arg0, int arg1) {\r
+    public void setProtocols(ProtocolsIdentification arg0, int arg1) {\r
         vProtocols.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,12 @@ public class ProtocolsVector {
     public int size() {\r
         return this.vProtocols.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getProtocols(index).getName());\r
+        v.addElement(getProtocols(index).getType());\r
+        v.addElement(getProtocols(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index 8dccb74..3e6e98d 100644 (file)
@@ -50,7 +50,7 @@ public class SourceFilesVector {
         vSourceFiles.addElement(sfi);\r
     }\r
 \r
-    public void updateSourceFiles(SourceFilesIdentification sfi, int index) {\r
+    public void setSourceFiles(SourceFilesIdentification sfi, int index) {\r
         vSourceFiles.setElementAt(sfi, index);\r
     }\r
 \r
@@ -86,4 +86,10 @@ public class SourceFilesVector {
     public int size() {\r
         return this.vSourceFiles.size();\r
     }\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getSourceFiles(index).getFilename());\r
+        return v;\r
+    }\r
 }\r
index 8babcd7..fb875ac 100644 (file)
@@ -50,7 +50,7 @@ public class SystemTablesVector {
         vSystemTables.addElement(arg0);\r
     }\r
 \r
-    public void updateSystemTables(SystemTablesIdentification arg0, int arg1) {\r
+    public void setSystemTables(SystemTablesIdentification arg0, int arg1) {\r
         vSystemTables.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,11 @@ public class SystemTablesVector {
     public int size() {\r
         return this.vSystemTables.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getSystemTables(index).getName());\r
+        v.addElement(getSystemTables(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index 9465457..6949eff 100644 (file)
@@ -50,7 +50,7 @@ public class VariablesVector {
         vVariables.addElement(arg0);\r
     }\r
 \r
-    public void updateVariables(VariablesIdentification arg0, int arg1) {\r
+    public void setVariables(VariablesIdentification arg0, int arg1) {\r
         vVariables.setElementAt(arg0, arg1);\r
     }\r
 \r
@@ -86,5 +86,12 @@ public class VariablesVector {
     public int size() {\r
         return this.vVariables.size();\r
     }\r
-\r
+    \r
+    public Vector<String> toStringVector(int index) {\r
+        Vector<String> v = new Vector<String>();\r
+        v.addElement(getVariables(index).getName());\r
+        v.addElement(getVariables(index).getGuid());\r
+        v.addElement(getVariables(index).getUsage());\r
+        return v;\r
+    }\r
 }\r
index 9782146..51fa6f8 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.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.BootModeNames;\r
 import org.tianocore.BootModeUsage;\r
@@ -35,16 +35,15 @@ import org.tianocore.BootModesDocument.BootModes;
 import org.tianocore.BootModesDocument.BootModes.BootMode;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\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.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.Identifications.BootModes.BootModesIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesVector;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.BootModesDlg;\r
 \r
 /**\r
  The class is used to create, update BootModes of MSA/MBD file\r
@@ -65,28 +64,6 @@ public class ModuleBootModes extends IInternalFrame {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabelBootModeName = null;\r
-\r
-    private JComboBox jComboBoxBootModeName = 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 jLabelFeatureFlag = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = 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
@@ -95,21 +72,13 @@ public class ModuleBootModes extends IInternalFrame {
 \r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JScrollPane jScrollPaneList = null;\r
-\r
-    private ICheckBoxList iCheckBoxListArch = null;\r
+    private JScrollPane jScrollPaneTable = null;\r
 \r
-    private JScrollPane jScrollPaneArch = null;\r
-    \r
-    private JLabel jLabelHelpText = null;\r
-\r
-    private JTextField jTextFieldHelpText = 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
@@ -120,68 +89,9 @@ public class ModuleBootModes extends IInternalFrame {
 \r
     private BootModesVector vid = new BootModesVector();\r
 \r
-    private EnumerationData ed = new EnumerationData();\r
-\r
-    /**\r
-     This method initializes jComboBoxBootModeName \r
-     \r
-     @return javax.swing.JComboBox jComboBoxBootModeName\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxBootModeName() {\r
-        if (jComboBoxBootModeName == null) {\r
-            jComboBoxBootModeName = new JComboBox();\r
-            jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
-            jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxBootModeName;\r
-    }\r
-\r
-    /**\r
-     This method initializes jComboBoxUsage \r
-     \r
-     @return javax.swing.JComboBox jComboBoxUsage\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxUsage() {\r
-        if (jComboBoxUsage == null) {\r
-            jComboBoxUsage = new JComboBox();\r
-            jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxUsage;\r
-    }\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
+    private IDefaultTableModel model = null;\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,27 +138,12 @@ public class ModuleBootModes extends IInternalFrame {
             jButtonUpdate = new JButton();\r
             jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 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
@@ -263,117 +158,91 @@ public class ModuleBootModes extends IInternalFrame {
     }\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
+     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
-\r
-     @return ICheckBoxList   \r
+     This method initializes jTable  \r
+     \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("Name");\r
+            model.addColumn("Usage");\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
-    /**\r
-     This method initializes jScrollPaneArch \r
-\r
-     @return javax.swing.JScrollPane \r
+    public static void main(String[] args) {\r
+    }\r
 \r
+    /**\r
+     This method initializes this\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
+    private void init() {\r
+        this.setSize(500, 515);\r
+        this.setContentPane(getJScrollPane());\r
+        this.setTitle("Boot Modes");\r
     }\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, 60, 320, 20));\r
-           jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));\r
-       }\r
-       return jTextFieldHelpText;\r
-   }\r
+     This method initializes this\r
+     Fill values to all fields if these values are not empty\r
+     \r
+     @param inBootModes\r
 \r
-    public static void main(String[] args) {\r
+     **/\r
+    private void init(BootModes inBootModes) {\r
+        init();\r
+        this.bootModes = inBootModes;\r
+\r
+        if (this.bootModes != null) {\r
+            if (this.bootModes.getBootModeList().size() > 0) {\r
+                for (int index = 0; index < this.bootModes.getBootModeList().size(); index++) {\r
+                    String arg0 = null;\r
+                    if (bootModes.getBootModeList().get(index).getBootModeName() != null) {\r
+                        arg0 = bootModes.getBootModeList().get(index).getBootModeName().toString();\r
+                    }\r
+                    String arg1 = null;\r
+                    if (bootModes.getBootModeList().get(index).getUsage() != null) {\r
+                        arg1 = bootModes.getBootModeList().get(index).getUsage().toString();\r
+                    }\r
+\r
+                    String arg2 = bootModes.getBootModeList().get(index).getFeatureFlag();\r
+                    Vector<String> arg3 = Tools.convertListToVector(bootModes.getBootModeList().get(index)\r
+                                                                             .getSupArchList());\r
+                    String arg4 = bootModes.getBootModeList().get(index).getHelpText();\r
+\r
+                    id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);\r
+                    vid.addBootModes(id);\r
+                }\r
+            }\r
+        }\r
+        showTable();\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("Boot Modes");\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(BootModes inBootModes) {\r
-       init();\r
-       this.bootModes = inBootModes;\r
-\r
-       if (this.bootModes != null) {\r
-           if (this.bootModes.getBootModeList().size() > 0) {\r
-               for (int index = 0; index < this.bootModes.getBootModeList().size(); index++) {\r
-                   String arg0 = null;\r
-                   if (bootModes.getBootModeList().get(index).getBootModeName() != null) {\r
-                       arg0 = bootModes.getBootModeList().get(index).getBootModeName().toString();\r
-                   }\r
-                   String arg1 = null;\r
-                   if (bootModes.getBootModeList().get(index).getUsage() != null) {\r
-                       arg1 = bootModes.getBootModeList().get(index).getUsage().toString();    \r
-                   }\r
-                   \r
-                   String arg2 = bootModes.getBootModeList().get(index).getFeatureFlag();\r
-                   Vector<String> arg3 = Tools.convertListToVector(bootModes.getBootModeList().get(index).getSupArchList());\r
-                   String arg4 = bootModes.getBootModeList().get(index).getHelpText();\r
-                   \r
-                   id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);\r
-                   vid.addBootModes(id);\r
-               }\r
-           }\r
-       }\r
-       //\r
-       // Update the list\r
-       //\r
-       Tools.generateComboBoxByVector(jComboBoxList, vid.getBootModesName());\r
-       reloadListArea();\r
-   }\r
 \r
     /**\r
      This is the default constructor\r
@@ -398,20 +267,6 @@ public class ModuleBootModes extends IInternalFrame {
         init(msa.getBootModes());\r
         this.setVisible(true);\r
     }\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.jComboBoxBootModeName.setEnabled(!isView);\r
-            this.jComboBoxUsage.setEnabled(!isView);\r
-        }\r
-    }\r
 \r
     /**\r
      This method initializes jContentPane\r
@@ -421,62 +276,62 @@ public class ModuleBootModes extends IInternalFrame {
      **/\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("Arch");\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-            jLabelUsage = new JLabel();\r
-            jLabelUsage.setText("Usage");\r
-            jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelBootModeName = new JLabel();\r
-            jLabelBootModeName.setText("Boot Mode Name");\r
-            jLabelBootModeName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelHelpText = new JLabel();\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));\r
-            jLabelHelpText.setText("Help Text");\r
-\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));\r
-\r
-            jContentPane.add(jLabelBootModeName, null);\r
-            jContentPane.add(getJComboBoxBootModeName(), null);\r
-            jContentPane.add(jLabelUsage, null);\r
-            jContentPane.add(getJComboBoxUsage(), null);\r
-            jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-            jStarLabel2 = new StarLabel();\r
-            jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
-\r
-            jContentPane.add(jStarLabel1, null);\r
-            jContentPane.add(jStarLabel2, null);\r
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
-            jContentPane.add(jLabelArch, 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(getJScrollPaneArch(), null);\r
-            jContentPane.add(jLabelHelpText, null);\r
-            jContentPane.add(getJTextFieldHelpText(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
         }\r
         return jContentPane;\r
     }\r
 \r
+    private void showEdit(int index) {\r
+        BootModesDlg dlg = new BootModesDlg(vid.getBootModes(index), new IFrame());\r
+        int result = dlg.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addBootModes(dlg.getId());\r
+            } else {\r
+                this.vid.setBootModes(dlg.getId(), index);\r
+            }\r
+            this.showTable();\r
+            this.save();\r
+            dlg.dispose();\r
+        }\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            dlg.dispose();\r
+        }\r
+    }\r
+\r
+    /**\r
+     Clear all table rows\r
+     \r
+     **/\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
+    }\r
+\r
     /**\r
-     This method initializes BootModeName groups and Usage type\r
+     Read content of vector and put then into table\r
      \r
      **/\r
-    private void initFrame() {\r
-        Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames());\r
-        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());\r
-        \r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\r
+    private void showTable() {\r
+        clearAll();\r
+\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
+            }\r
+        }\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -487,45 +342,27 @@ public class ModuleBootModes extends IInternalFrame {
      */\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
+            showEdit(-1);\r
         }\r
         if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\r
                 return;\r
             }\r
-            updateForList();\r
+            showEdit(selectedRow);\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 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
+        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.removeBootModes(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-\r
-        return true;\r
     }\r
 \r
     /**\r
@@ -551,7 +388,8 @@ public class ModuleBootModes extends IInternalFrame {
                     if (!isEmpty(vid.getBootModes(index).getFeatureFlag())) {\r
                         p.setFeatureFlag(vid.getBootModes(index).getFeatureFlag());\r
                     }\r
-                    if (vid.getBootModes(index).getSupArchList() != null && vid.getBootModes(index).getSupArchList().size() > 0) {\r
+                    if (vid.getBootModes(index).getSupArchList() != null\r
+                        && vid.getBootModes(index).getSupArchList().size() > 0) {\r
                         p.setSupArchList(vid.getBootModes(index).getSupArchList());\r
                     }\r
                     if (!isEmpty(vid.getBootModes(index).getHelp())) {\r
@@ -569,6 +407,36 @@ public class ModuleBootModes extends IInternalFrame {
         }\r
     }\r
 \r
+    /* (non-Javadoc)\r
+     * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)\r
+     *\r
+     */\r
+    public void valueChanged(ListSelectionEvent arg0) {\r
+        if (arg0.getValueIsAdjusting()) {\r
+            return;\r
+        }\r
+        ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();\r
+        if (lsm.isSelectionEmpty()) {\r
+            return;\r
+        } else {\r
+            selectedRow = lsm.getMinSelectionIndex();\r
+        }\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
+     *\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
@@ -580,180 +448,12 @@ public class ModuleBootModes extends IInternalFrame {
         int intPreferredWidth = this.getJContentPane().getPreferredSize().width;\r
         int intPreferredHeight = this.getJContentPane().getPreferredSize().height;\r
 \r
-        resizeComponentWidth(jComboBoxBootModeName, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
-\r
-        resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);\r
-        resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
-\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
-    }\r
-    \r
-    private BootModesIdentification getCurrentBootModes() {\r
-        String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString();\r
-        \r
-        String arg1 = this.jComboBoxUsage.getSelectedItem().toString();\r
-\r
-        String arg2 = this.jTextFieldFeatureFlag.getText();\r
-        Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();\r
-        String arg4 = this.jTextFieldHelpText.getText();\r
-        id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);\r
-        return id;\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
-    /**\r
-    Add current item to Vector\r
-    \r
-    **/\r
-   private void addToList() {\r
-       intSelectedItemId = vid.size();\r
-\r
-       vid.addBootModes(getCurrentBootModes());\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.removeBootModes(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.updateBootModes(getCurrentBootModes(), intTempIndex);\r
-\r
-       jComboBoxList.removeAllItems();\r
-       for (int index = 0; index < vid.size(); index++) {\r
-           jComboBoxList.addItem(vid.getBootModes(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.jComboBoxBootModeName.setSelectedItem(vid.getBootModes(intSelectedItemId).getName());\r
-           this.jComboBoxUsage.setSelectedItem(vid.getBootModes(intSelectedItemId).getUsage());\r
-           this.jTextFieldHelpText.setText(vid.getBootModes(intSelectedItemId).getHelp());\r
-\r
-           jTextFieldFeatureFlag.setText(vid.getBootModes(intSelectedItemId).getFeatureFlag());\r
-           iCheckBoxListArch.setAllItemsUnchecked();\r
-           iCheckBoxListArch.initCheckedItem(true, vid.getBootModes(intSelectedItemId).getSupArchList());\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.getBootModes(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
-   }\r
 }\r
index cf342d2..753b7e8 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.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.DataHubUsage;\r
 import org.tianocore.DataHubsDocument;\r
@@ -34,16 +34,15 @@ import org.tianocore.DataHubsDocument.DataHubs;
 import org.tianocore.DataHubsDocument.DataHubs.DataHubRecord;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\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.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.Identifications.DataHubs.DataHubsIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsVector;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.DataHubsDlg;\r
 \r
 /**\r
  The class is used to create, update DataHub of MSA/MBD file\r
@@ -64,28 +63,6 @@ public class ModuleDataHubs extends IInternalFrame {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabelUsage = null;\r
-\r
-    private JComboBox jComboBoxUsage = null;\r
-\r
-    private JLabel jLabelDataHubRecord = null;\r
-\r
-    private JTextField jTextFieldDataHubRecord = null;\r
-\r
-    private StarLabel jStarLabel1 = null;\r
-\r
-    private StarLabel jStarLabel2 = null;\r
-\r
-    private JLabel jLabelFeatureFlag = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = 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
@@ -94,21 +71,13 @@ public class ModuleDataHubs extends IInternalFrame {
 \r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JScrollPane jScrollPaneList = null;\r
-\r
-    private ICheckBoxList iCheckBoxListArch = null;\r
+    private JScrollPane jScrollPaneTable = null;\r
 \r
-    private JScrollPane jScrollPaneArch = null;\r
-\r
-    private JLabel jLabelHelpText = null;\r
-\r
-    private JTextField jTextFieldHelpText = 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
@@ -119,69 +88,9 @@ public class ModuleDataHubs extends IInternalFrame {
 \r
     private DataHubsVector vid = new DataHubsVector();\r
 \r
-    private EnumerationData ed = new EnumerationData();\r
+    private IDefaultTableModel model = null;\r
 \r
-    /**\r
-     This method initializes jComboBoxUsage \r
-     \r
-     @return javax.swing.JComboBox jComboBoxUsage\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxUsage() {\r
-        if (jComboBoxUsage == null) {\r
-            jComboBoxUsage = new JComboBox();\r
-            jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxUsage;\r
-    }\r
-\r
-    /**\r
-     This method initializes jTextFieldDataHubRecord \r
-     \r
-     @return javax.swing.JTextField jTextFieldDataHubRecord\r
-     \r
-     **/\r
-    private JTextField getJTextFieldDataHubRecord() {\r
-        if (jTextFieldDataHubRecord == null) {\r
-            jTextFieldDataHubRecord = new JTextField();\r
-            jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
-            jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jTextFieldDataHubRecord.setToolTipText("Enter the C Name of the Data Hub Record");\r
-        }\r
-        return jTextFieldDataHubRecord;\r
-    }\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,27 +137,12 @@ public class ModuleDataHubs extends IInternalFrame {
             jButtonUpdate = new JButton();\r
             jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 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
@@ -263,62 +157,41 @@ public class ModuleDataHubs extends IInternalFrame {
     }\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 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
+     This method initializes jScrollPaneTable    \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, 110, 320, 80));\r
-            jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));\r
-            jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());\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 jScrollPaneArch;\r
+        return jScrollPaneTable;\r
     }\r
 \r
     /**\r
-     This method initializes jTextFieldHelpText  \r
-     \r
-     @return javax.swing.JTextField  \r
+     This method initializes jTable  \r
      \r
+     @return javax.swing.JTable  \r
      **/\r
-    private JTextField getJTextFieldHelpText() {\r
-        if (jTextFieldHelpText == null) {\r
-            jTextFieldHelpText = new JTextField();\r
-            jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
-            jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));\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("Data Hub C_Name");\r
+            model.addColumn("Usage");\r
+\r
+            jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            jTable.getSelectionModel().addListSelectionListener(this);\r
+            jTable.getModel().addTableModelListener(this);\r
+            jTable.addMouseListener(this);\r
         }\r
-        return jTextFieldHelpText;\r
+        return jTable;\r
     }\r
 \r
     public static void main(String[] args) {\r
@@ -333,8 +206,6 @@ public class ModuleDataHubs extends IInternalFrame {
         this.setSize(500, 515);\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Data Hubs");\r
-        initFrame();\r
-        this.setViewMode(false);\r
     }\r
 \r
     /**\r
@@ -354,24 +225,20 @@ public class ModuleDataHubs extends IInternalFrame {
                     String arg0 = dataHubs.getDataHubRecordList().get(index).getDataHubCName();\r
                     String arg1 = null;\r
                     if (dataHubs.getDataHubRecordList().get(index).getUsage() != null) {\r
-                        arg1 = dataHubs.getDataHubRecordList().get(index).getUsage().toString();    \r
+                        arg1 = dataHubs.getDataHubRecordList().get(index).getUsage().toString();\r
                     }\r
-                    \r
+\r
                     String arg2 = dataHubs.getDataHubRecordList().get(index).getFeatureFlag();\r
                     Vector<String> arg3 = Tools.convertListToVector(dataHubs.getDataHubRecordList().get(index)\r
                                                                             .getSupArchList());\r
                     String arg4 = dataHubs.getDataHubRecordList().get(index).getHelpText();\r
-                    \r
+\r
                     id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);\r
                     vid.addDataHubs(id);\r
                 }\r
             }\r
         }\r
-        //\r
-        // Update the list\r
-        //\r
-        Tools.generateComboBoxByVector(jComboBoxList, vid.getDataHubsName());\r
-        reloadListArea();\r
+        showTable();\r
     }\r
 \r
     /**\r
@@ -398,19 +265,6 @@ public class ModuleDataHubs extends IInternalFrame {
         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.jTextFieldDataHubRecord.setEnabled(!isView);\r
-            this.jComboBoxUsage.setEnabled(!isView);\r
-        }\r
-    }\r
-\r
     /**\r
      This method initializes jContentPane\r
      \r
@@ -419,62 +273,62 @@ public class ModuleDataHubs extends IInternalFrame {
      **/\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
-            jLabelDataHubRecord = new JLabel();\r
-            jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelDataHubRecord.setText("Data Hub Record");\r
-            jLabelUsage = new JLabel();\r
-            jLabelUsage.setText("Usage");\r
-            jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
-            jLabelArch.setText("Arch");\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-            jLabelHelpText = new JLabel();\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));\r
-            jLabelHelpText.setText("Help Text");\r
-\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));\r
-\r
-            jContentPane.add(jLabelDataHubRecord, null);\r
-            jContentPane.add(jLabelUsage, null);\r
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(jLabelArch, null);\r
-\r
-            jContentPane.add(getJTextFieldDataHubRecord(), null);\r
-            jContentPane.add(getJComboBoxUsage(), null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
-\r
-            jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-            jStarLabel2 = new StarLabel();\r
-            jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));\r
 \r
-            jContentPane.add(jStarLabel1, null);\r
-            jContentPane.add(jStarLabel2, null);\r
-\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
-            jContentPane.add(getJScrollPaneArch(), null);\r
-            jContentPane.add(jLabelHelpText, null);\r
-            jContentPane.add(getJTextFieldHelpText(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
         }\r
         return jContentPane;\r
     }\r
 \r
+    private void showEdit(int index) {\r
+        DataHubsDlg dlg = new DataHubsDlg(vid.getDataHubs(index), new IFrame());\r
+        int result = dlg.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addDataHubs(dlg.getId());\r
+            } else {\r
+                this.vid.setDataHubs(dlg.getId(), index);\r
+            }\r
+            this.showTable();\r
+            this.save();\r
+            dlg.dispose();\r
+        }\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            dlg.dispose();\r
+        }\r
+    }\r
+\r
     /**\r
-     This method initializes Usage type\r
+     Clear all table rows\r
      \r
      **/\r
-    private void initFrame() {\r
-        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage());\r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\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
+    }\r
+\r
+    /**\r
+     Read content of vector and put then into table\r
+     \r
+     **/\r
+    private void showTable() {\r
+        clearAll();\r
+\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
+            }\r
+        }\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -485,60 +339,27 @@ public class ModuleDataHubs extends IInternalFrame {
      */\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
+            showEdit(-1);\r
         }\r
         if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\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 DataHubRecord \r
-        //\r
-        if (isEmpty(this.jTextFieldDataHubRecord.getText())) {\r
-            Log.err("Data Hub Record couldn't be empty");\r
-            return false;\r
+            showEdit(selectedRow);\r
         }\r
 \r
-        if (!isEmpty(this.jTextFieldDataHubRecord.getText())) {\r
-            if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) {\r
-                Log.err("Incorrect data type for Data Hub Record");\r
-                return false;\r
+        if (arg0.getSource() == jButtonRemove) {\r
+            if (jTable.isEditing()) {\r
+                jTable.getCellEditor().stopCellEditing();\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
+            if (selectedRow > -1) {\r
+                this.model.removeRow(selectedRow);\r
+                this.vid.removeDataHubs(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-\r
-        return true;\r
     }\r
 \r
     /**\r
@@ -584,190 +405,52 @@ public class ModuleDataHubs extends IInternalFrame {
     }\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(jTextFieldDataHubRecord, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
-\r
-        resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);\r
-        resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
-\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
-    }\r
-\r
-    private DataHubsIdentification getCurrentDataHubs() {\r
-        String arg0 = this.jTextFieldDataHubRecord.getText();\r
-        String arg1 = this.jComboBoxUsage.getSelectedItem().toString();\r
-\r
-        String arg2 = this.jTextFieldFeatureFlag.getText();\r
-        Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();\r
-        String arg4 = this.jTextFieldHelpText.getText();\r
-        \r
-        id = new DataHubsIdentification(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.addDataHubs(getCurrentDataHubs());\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.removeDataHubs(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.updateDataHubs(getCurrentDataHubs(), intTempIndex);\r
-\r
-        jComboBoxList.removeAllItems();\r
-        for (int index = 0; index < vid.size(); index++) {\r
-            jComboBoxList.addItem(vid.getDataHubs(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.jTextFieldDataHubRecord.setText(vid.getDataHubs(intSelectedItemId).getName());\r
-            this.jComboBoxUsage.setSelectedItem(vid.getDataHubs(intSelectedItemId).getUsage());\r
-            this.jTextFieldHelpText.setText(vid.getDataHubs(intSelectedItemId).getHelp());\r
-\r
-            jTextFieldFeatureFlag.setText(vid.getDataHubs(intSelectedItemId).getFeatureFlag());\r
-            iCheckBoxListArch.setAllItemsUnchecked();\r
-            iCheckBoxListArch.initCheckedItem(true, vid.getDataHubs(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.getDataHubs(index).getName() + DataType.UNIX_LINE_SEPARATOR;\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
+     *\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
-        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
+     * @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 itemStateChanged(ItemEvent arg0) {\r
-        if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {\r
-            reloadFromList();\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
index 26c8a62..676b7ac 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.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.EventsDocument;\r
 import org.tianocore.ProtocolNotifyUsage;\r
@@ -35,17 +35,16 @@ import org.tianocore.EventsDocument.Events.CreateEvents;
 import org.tianocore.EventsDocument.Events.SignalEvents;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\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.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.Identifications.Events.EventsIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.Events.EventsVector;\r
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.EventsDlg;\r
 \r
 /**\r
  The class is used to create, update Event of MSA/MBD file\r
@@ -66,26 +65,6 @@ public class ModuleEvents extends IInternalFrame {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabelEventType = null;\r
-\r
-    private JLabel jLabelC_Name = null;\r
-\r
-    private JComboBox jComboBoxGuidC_Name = 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 JComboBox jComboBoxEventsType = 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
@@ -94,27 +73,13 @@ public class ModuleEvents extends IInternalFrame {
 \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
-    \r
-    private JLabel jLabelHelpText = null;\r
-\r
-    private JTextField jTextFieldHelpText = null;\r
-    \r
-    private JLabel jLabelFeatureFlag = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = 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
@@ -126,71 +91,10 @@ public class ModuleEvents extends IInternalFrame {
     private EventsVector vid = new EventsVector();\r
 \r
     private EnumerationData ed = new EnumerationData();\r
-    \r
-    private WorkspaceTools wt = new WorkspaceTools();\r
 \r
-    /**\r
-     This method initializes jTextFieldC_Name \r
-     \r
-     @return javax.swing.JTextField jTextFieldC_Name\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxGuidC_Name() {\r
-        if (jComboBoxGuidC_Name == null) {\r
-            jComboBoxGuidC_Name = new JComboBox();\r
-            jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Event");\r
-        }\r
-        return jComboBoxGuidC_Name;\r
-    }\r
+    private IDefaultTableModel model = null;\r
 \r
-    /**\r
-     This method initializes jComboBoxUsage \r
-     \r
-     @return javax.swing.JComboBox jComboBoxUsage\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxUsage() {\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 jComboBoxEventsType     \r
-     *         \r
-     * @return javax.swing.JComboBox   \r
-     */\r
-    private JComboBox getJComboBoxEventsType() {\r
-        if (jComboBoxEventsType == null) {\r
-            jComboBoxEventsType = new JComboBox();\r
-            jComboBoxEventsType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
-            jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jComboBoxEventsType.setToolTipText("Select Create event if the Module has an event that is waiting to be signaled.  Select Signal if the Module will signal all events in an event group.  Signal Event The events are named by GUID.");\r
-        }\r
-        return jComboBoxEventsType;\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
+    private int selectedRow = -1;\r
 \r
     /**\r
      This method initializes jButtonAdd \r
@@ -237,27 +141,12 @@ public class ModuleEvents extends IInternalFrame {
             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.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, 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
@@ -272,151 +161,111 @@ public class ModuleEvents extends IInternalFrame {
     }\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
+     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("Guid C_Name");\r
+            model.addColumn("Type");\r
+            model.addColumn("Usage");\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 method initializes this\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
+    private void init() {\r
+        this.setSize(500, 515);\r
+        this.setContentPane(getJScrollPane());\r
+        this.setTitle("Events");\r
     }\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,110,320,20));\r
-            jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320,20));\r
-        }\r
-        return jTextFieldFeatureFlag;\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
+     This method initializes this\r
+     Fill values to all fields if these values are not empty\r
+     \r
+     @param inPackageDependencies\r
 \r
-    public static void main(String[] args) {\r
+     **/\r
+    private void init(Events inEvents) {\r
+        init();\r
+        this.events = inEvents;\r
+\r
+        if (this.events != null) {\r
+            if (this.events.getCreateEvents() != null) {\r
+                if (this.events.getCreateEvents().getEventTypesList().size() > 0) {\r
+                    for (int index = 0; index < this.events.getCreateEvents().getEventTypesList().size(); index++) {\r
+                        String arg0 = events.getCreateEvents().getEventTypesList().get(index).getEventGuidCName();\r
+                        String arg1 = ed.getVEventType().get(0);\r
+                        String arg2 = null;\r
+                        if (events.getCreateEvents().getEventTypesList().get(index).getUsage() != null) {\r
+                            arg2 = events.getCreateEvents().getEventTypesList().get(index).getUsage().toString();\r
+                        }\r
+\r
+                        String arg3 = events.getCreateEvents().getEventTypesList().get(index).getFeatureFlag();\r
+                        Vector<String> arg4 = Tools.convertListToVector(events.getCreateEvents().getEventTypesList()\r
+                                                                              .get(index).getSupArchList());\r
+                        String arg5 = events.getCreateEvents().getEventTypesList().get(index).getHelpText();\r
+                        id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
+                        vid.addEvents(id);\r
+                    }\r
+                }\r
+            }\r
+            if (this.events.getSignalEvents() != null) {\r
+                if (this.events.getSignalEvents().getEventTypesList().size() > 0) {\r
+                    for (int index = 0; index < this.events.getSignalEvents().getEventTypesList().size(); index++) {\r
+                        String arg0 = events.getSignalEvents().getEventTypesList().get(index).getEventGuidCName();\r
+                        String arg1 = ed.getVEventType().get(1);\r
+                        String arg2 = null;\r
+                        if (events.getSignalEvents().getEventTypesList().get(index).getUsage() != null) {\r
+                            arg2 = events.getSignalEvents().getEventTypesList().get(index).getUsage().toString();\r
+                        }\r
 \r
+                        String arg3 = events.getSignalEvents().getEventTypesList().get(index).getFeatureFlag();\r
+                        Vector<String> arg4 = Tools.convertListToVector(events.getSignalEvents().getEventTypesList()\r
+                                                                              .get(index).getSupArchList());\r
+                        String arg5 = events.getSignalEvents().getEventTypesList().get(index).getHelpText();\r
+                        id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
+                        vid.addEvents(id);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        showTable();\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("Events");\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(Events inEvents) {\r
-       init();\r
-       this.events = inEvents;\r
-\r
-       if (this.events != null) {\r
-           if (this.events.getCreateEvents() != null) {\r
-               if (this.events.getCreateEvents().getEventTypesList().size() > 0) {\r
-                   for (int index = 0; index < this.events.getCreateEvents().getEventTypesList().size(); index++) {\r
-                       String arg0 = events.getCreateEvents().getEventTypesList().get(index).getEventGuidCName();\r
-                       String arg1 = ed.getVEventType().get(0);\r
-                       String arg2 = null;\r
-                       if (events.getCreateEvents().getEventTypesList().get(index).getUsage() != null) {\r
-                           arg2 = events.getCreateEvents().getEventTypesList().get(index).getUsage().toString();    \r
-                       }\r
-                       \r
-                       String arg3 = events.getCreateEvents().getEventTypesList().get(index).getFeatureFlag();\r
-                       Vector<String> arg4 = Tools.convertListToVector(events.getCreateEvents().getEventTypesList().get(index)\r
-                                                                                .getSupArchList());\r
-                       String arg5 = events.getCreateEvents().getEventTypesList().get(index).getHelpText();\r
-                       id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
-                       vid.addEvents(id);\r
-                   }\r
-               }\r
-           }\r
-           if (this.events.getSignalEvents() != null) {\r
-               if (this.events.getSignalEvents().getEventTypesList().size() > 0) {\r
-                   for (int index = 0; index < this.events.getSignalEvents().getEventTypesList().size(); index++) {\r
-                       String arg0 = events.getSignalEvents().getEventTypesList().get(index).getEventGuidCName();\r
-                       String arg1 = ed.getVEventType().get(1);\r
-                       String arg2 = null;\r
-                       if (events.getSignalEvents().getEventTypesList().get(index).getUsage() != null) {\r
-                           arg2 = events.getSignalEvents().getEventTypesList().get(index).getUsage().toString();    \r
-                       }\r
-\r
-                       String arg3 = events.getSignalEvents().getEventTypesList().get(index).getFeatureFlag();\r
-                       Vector<String> arg4 = Tools.convertListToVector(events.getSignalEvents().getEventTypesList().get(index)\r
-                                                                                .getSupArchList());\r
-                       String arg5 = events.getSignalEvents().getEventTypesList().get(index).getHelpText();\r
-                       id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
-                       vid.addEvents(id);\r
-                   }\r
-               }\r
-           }\r
-       }\r
-       //\r
-       // Update the list\r
-       //\r
-       Tools.generateComboBoxByVector(jComboBoxList, vid.getEventsName());\r
-       reloadListArea();\r
-   }\r
 \r
     /**\r
      This is the default constructor\r
@@ -442,19 +291,6 @@ public class ModuleEvents extends IInternalFrame {
         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.jComboBoxGuidC_Name.setEnabled(!isView);\r
-            this.jComboBoxUsage.setEnabled(!isView);\r
-        }\r
-    }\r
-\r
     /**\r
      This method initializes jContentPane\r
      \r
@@ -463,68 +299,62 @@ public class ModuleEvents extends IInternalFrame {
      **/\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15,110,140,20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-            jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
-            jLabelArch.setText("Arch");\r
-            jLabelUsage = new JLabel();\r
-            jLabelUsage.setText("Usage");\r
-            jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
-            jLabelC_Name = new JLabel();\r
-            jLabelC_Name.setText("Guid C_Name");\r
-            jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelEventType = new JLabel();\r
-            jLabelEventType.setText("Event Type");\r
-            jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelHelpText = new JLabel();\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));\r
-            jLabelHelpText.setText("Help Text");\r
-\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
             jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));\r
 \r
-            jContentPane.add(jLabelEventType, null);\r
-            jContentPane.add(jLabelC_Name, null);\r
-            jContentPane.add(getJComboBoxGuidC_Name(), null);\r
-            jContentPane.add(jLabelUsage, null);\r
-            jContentPane.add(getJComboBoxUsage(), null);\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(getJComboBoxEventsType(), null);\r
-\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
-            jContentPane.add(jLabelArch, null);\r
-            jContentPane.add(getJScrollPaneArch(), null);\r
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
-            jContentPane.add(jLabelHelpText, null);\r
-            jContentPane.add(getJTextFieldHelpText(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
         }\r
         return jContentPane;\r
     }\r
+    \r
+    private void showEdit(int index) {\r
+        EventsDlg dlg = new EventsDlg(vid.getEvents(index), new IFrame());\r
+        int result = dlg.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addEvents(dlg.getId());\r
+            } else {\r
+                this.vid.setEvents(dlg.getId(), index);\r
+            }\r
+            this.showTable();\r
+            this.save();\r
+            dlg.dispose();\r
+        }\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            dlg.dispose();\r
+        }\r
+    }\r
 \r
     /**\r
-     This method initializes events groups and usage type\r
+     Clear all table rows\r
      \r
      **/\r
-    private void initFrame() {\r
-        Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType());\r
-        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage());\r
-        Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace());\r
-        \r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\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
+    }\r
+\r
+    /**\r
+     Read content of vector and put then into table\r
+     \r
+     **/\r
+    private void showTable() {\r
+        clearAll();\r
+\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
+            }\r
+        }\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -535,60 +365,27 @@ public class ModuleEvents extends IInternalFrame {
      */\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
+            showEdit(-1);\r
         }\r
         if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\r
                 return;\r
             }\r
-            updateForList();\r
+            showEdit(selectedRow);\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.jComboBoxGuidC_Name.getSelectedItem().toString())) {\r
-            Log.err("Event Name couldn't be empty");\r
-            return false;\r
-        }\r
-        \r
-        if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {\r
-            if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {\r
-                Log.err("Incorrect data type for Event Name");\r
-                return false;\r
+        if (arg0.getSource() == jButtonRemove) {\r
+            if (jTable.isEditing()) {\r
+                jTable.getCellEditor().stopCellEditing();\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
+            if (selectedRow > -1) {\r
+                this.model.removeRow(selectedRow);\r
+                this.vid.removeEvents(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-\r
-        return true;\r
     }\r
 \r
     /**\r
@@ -604,7 +401,7 @@ public class ModuleEvents extends IInternalFrame {
             this.events = Events.Factory.newInstance();\r
             CreateEvents ce = CreateEvents.Factory.newInstance();\r
             SignalEvents se = SignalEvents.Factory.newInstance();\r
-            \r
+\r
             if (count > 0) {\r
                 for (int index = 0; index < count; index++) {\r
                     if (vid.getEvents(index).getType().equals(ed.getVEventType().get(0))) {\r
@@ -628,7 +425,7 @@ public class ModuleEvents extends IInternalFrame {
                         ce.addNewEventTypes();\r
                         ce.setEventTypesArray(ce.getEventTypesList().size() - 1, e);\r
                     }\r
-                    if (vid.getEvents(index).getType().equals("Protocol Notify")) {\r
+                    if (vid.getEvents(index).getType().equals(ed.getVEventType().get(1))) {\r
                         SignalEvents.EventTypes e = SignalEvents.EventTypes.Factory.newInstance();\r
                         if (!isEmpty(vid.getEvents(index).getName())) {\r
                             e.setEventGuidCName(vid.getEvents(index).getName());\r
@@ -668,191 +465,52 @@ public class ModuleEvents extends IInternalFrame {
     }\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(jComboBoxEventsType, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxGuidC_Name, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(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
-    }\r
-    \r
-    private EventsIdentification getCurrentEvents() {\r
-        String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString();\r
-        String arg1 = this.jComboBoxEventsType.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 EventsIdentification(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.addEvents(getCurrentEvents());\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.removeEvents(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.updateEvents(getCurrentEvents(), intTempIndex);\r
-\r
-        jComboBoxList.removeAllItems();\r
-        for (int index = 0; index < vid.size(); index++) {\r
-            jComboBoxList.addItem(vid.getEvents(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.jComboBoxGuidC_Name.setSelectedItem(vid.getEvents(intSelectedItemId).getName());\r
-            this.jComboBoxEventsType.setSelectedItem(vid.getEvents(intSelectedItemId).getType());\r
-            this.jComboBoxUsage.setSelectedItem(vid.getEvents(intSelectedItemId).getUsage());\r
-            this.jTextFieldHelpText.setText(vid.getEvents(intSelectedItemId).getHelp());\r
-\r
-            jTextFieldFeatureFlag.setText(vid.getEvents(intSelectedItemId).getFeatureFlag());\r
-            iCheckBoxListArch.setAllItemsUnchecked();\r
-            iCheckBoxListArch.initCheckedItem(true, vid.getEvents(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.getEvents(index).getName() + DataType.UNIX_LINE_SEPARATOR;\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
+     *\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
-        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
+     * @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 itemStateChanged(ItemEvent arg0) {\r
-        if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {\r
-            reloadFromList();\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
index cfabd0a..99a2430 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.ExternsDocument;\r
 import org.tianocore.PcdDriverTypes;\r
@@ -34,15 +34,16 @@ import org.tianocore.ExternsDocument.Externs;
 import org.tianocore.ExternsDocument.Externs.Extern;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\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.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.iCheckBoxList.ICheckBoxList;\r
 import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsVector;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.ExternsDlg;\r
 \r
 /**\r
  The class is used to create, update DataHub of MSA/MBD file \r
@@ -63,14 +64,6 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabelName = null;\r
-\r
-    private JComboBox jComboBoxType = 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
@@ -79,31 +72,13 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
 \r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JScrollPane jScrollPaneList = null;\r
-\r
-    private JLabel jLabelPcdIsDriver = null;\r
-\r
-    private JComboBox jComboBoxPcdIsDriver = null;\r
-\r
-    private JLabel jLabelC_Name = null;\r
-\r
-    private JTextField jTextFieldC_Name = null;\r
-\r
-    private JLabel jLabelFeatureFlag = null;\r
-\r
-    private JLabel jLabelArch = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = null;\r
-\r
-    private ICheckBoxList iCheckBoxListArch = null;\r
+    private JScrollPane jScrollPaneTable = 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
@@ -114,39 +89,9 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
 \r
     private ExternsVector vid = new ExternsVector();\r
 \r
-    private EnumerationData ed = new EnumerationData();\r
+    private IDefaultTableModel model = null;\r
 \r
-    /**\r
-     This method initializes jComboBoxType \r
-     \r
-     @return javax.swing.JComboBox jComboBoxType\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxType() {\r
-        if (jComboBoxType == null) {\r
-            jComboBoxType = new JComboBox();\r
-            jComboBoxType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jComboBoxType.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxType;\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
@@ -193,27 +138,12 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
             jButtonUpdate = new JButton();\r
             jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 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
@@ -228,92 +158,41 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
     }\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
-        return jTextAreaList;\r
-    }\r
-\r
-    /**\r
-     * This method initializes jComboBoxPcdIsDriver    \r
-     *         \r
-     * @return javax.swing.JComboBox   \r
-     */\r
-    private JComboBox getJComboBoxPcdIsDriver() {\r
-        if (jComboBoxPcdIsDriver == null) {\r
-            jComboBoxPcdIsDriver = new JComboBox();\r
-            jComboBoxPcdIsDriver.setLocation(new java.awt.Point(160, 10));\r
-            jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jComboBoxPcdIsDriver.setSize(new java.awt.Dimension(320, 20));\r
-            jComboBoxPcdIsDriver.addItemListener(this);\r
-        }\r
-        return jComboBoxPcdIsDriver;\r
-    }\r
-\r
-    /**\r
-     This method initializes jTextFieldC_Name  \r
-     \r
-     @return javax.swing.JTextField    \r
+     This method initializes jScrollPaneTable    \r
      \r
+     @return javax.swing.JScrollPane \r
      **/\r
-    private JTextField getJTextFieldC_Name() {\r
-        if (jTextFieldC_Name == null) {\r
-            jTextFieldC_Name = new JTextField();\r
-            jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
-            jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(320,20));\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 jTextFieldC_Name;\r
+        return jScrollPaneTable;\r
     }\r
 \r
     /**\r
-     This method initializes jTextFieldFeatureFlag    \r
-     \r
-     @return javax.swing.JTextField   \r
+     This method initializes jTable  \r
      \r
+     @return javax.swing.JTable  \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
+    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("Name");\r
+            model.addColumn("Type");\r
+\r
+            jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            jTable.getSelectionModel().addListSelectionListener(this);\r
+            jTable.getModel().addTableModelListener(this);\r
+            jTable.addMouseListener(this);\r
         }\r
-        return jTextFieldFeatureFlag;\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, 110, 320, 80));\r
-            jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));\r
-            jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());\r
-        }\r
-        return jScrollPaneArch;\r
+        return jTable;\r
     }\r
 \r
     public static void main(String[] args) {\r
@@ -328,7 +207,6 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
         this.setSize(500, 515);\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Externs");\r
-        initFrame();\r
     }\r
 \r
     /**\r
@@ -347,9 +225,13 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
             // Get PcdIsDriver\r
             //\r
             if (this.externs.getPcdIsDriver() != null) {\r
-                this.jComboBoxPcdIsDriver.setSelectedItem(this.externs.getPcdIsDriver().toString());\r
+                String arg0 = this.externs.getPcdIsDriver().toString();\r
+                String arg1 = EnumerationData.EXTERNS_PCD_IS_DRIVER;\r
+\r
+                id = new ExternsIdentification(arg0, arg1, null, null);\r
+                vid.addExterns(id);\r
             }\r
-            \r
+\r
             //\r
             // Get specification\r
             //\r
@@ -423,11 +305,7 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
                 }\r
             }\r
         }\r
-        //\r
-        // Update the list\r
-        //\r
-        Tools.generateComboBoxByVector(jComboBoxList, vid.getExternsName());\r
-        reloadListArea();\r
+        showTable();\r
     }\r
 \r
     /**\r
@@ -462,54 +340,62 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
      **/\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
-            jLabelC_Name = new JLabel();\r
-            jLabelC_Name.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
-            jLabelC_Name.setText("Value");\r
-            jLabelPcdIsDriver = new JLabel();\r
-            jLabelPcdIsDriver.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelPcdIsDriver.setText("Pcd Is Driver");\r
-            jLabelName = new JLabel();\r
-            jLabelName.setText("Choose Type");\r
-            jLabelName.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
-            jLabelArch.setText("Arch");\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));\r
-\r
-            jContentPane.add(jLabelName, null);\r
-            jContentPane.add(getJComboBoxType(), null);\r
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(jLabelArch, null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
-            jContentPane.add(getJScrollPaneArch(), 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(jLabelPcdIsDriver, null);\r
-            jContentPane.add(getJComboBoxPcdIsDriver(), null);\r
-            jContentPane.add(jLabelC_Name, null);\r
-            jContentPane.add(getJTextFieldC_Name(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
         }\r
         return jContentPane;\r
     }\r
 \r
+    private void showEdit(int index) {\r
+        ExternsDlg dlg = new ExternsDlg(vid.getExterns(index), new IFrame());\r
+        int result = dlg.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addExterns(dlg.getId());\r
+            } else {\r
+                this.vid.setExterns(dlg.getId(), index);\r
+            }\r
+            this.showTable();\r
+            this.save();\r
+            dlg.dispose();\r
+        }\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            dlg.dispose();\r
+        }\r
+    }\r
+\r
+    /**\r
+     Clear all table rows\r
+     \r
+     **/\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
+    }\r
+\r
     /**\r
-     This method initializes Usage type and Externs type\r
+     Read content of vector and put then into table\r
      \r
      **/\r
-    private void initFrame() {\r
-        Tools.generateComboBoxByVector(this.jComboBoxType, ed.getVExternTypes());\r
-        Tools.generateComboBoxByVector(this.jComboBoxPcdIsDriver, ed.getVPcdDriverTypes());\r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\r
+    private void showTable() {\r
+        clearAll();\r
+\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
+            }\r
+        }\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -520,67 +406,27 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
      */\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
+            showEdit(-1);\r
         }\r
         if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\r
                 return;\r
             }\r
-            updateForList();\r
+            showEdit(selectedRow);\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 CName \r
-        //\r
-        if (isEmpty(this.jTextFieldC_Name.getText())) {\r
-            Log.err("Value couldn't be empty");\r
-            return false;\r
-        }\r
-\r
-        if (!isEmpty(this.jTextFieldC_Name.getText())) {\r
-            if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {\r
-                if (!DataValidation.isSentence(this.jTextFieldC_Name.getText())) {\r
-                    Log.err("Incorrect data type for Specification");\r
-                    return false;\r
-                }    \r
-            } else {\r
-                if (!DataValidation.isC_NameType(this.jTextFieldC_Name.getText())) {\r
-                    Log.err("Incorrect data type for C_Name");\r
-                    return false;\r
-                }    \r
+        if (arg0.getSource() == jButtonRemove) {\r
+            if (jTable.isEditing()) {\r
+                jTable.getCellEditor().stopCellEditing();\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
+            if (selectedRow > -1) {\r
+                this.model.removeRow(selectedRow);\r
+                this.vid.removeExterns(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-\r
-        return true;\r
     }\r
 \r
     /**\r
@@ -594,16 +440,24 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
             int count = this.vid.size();\r
 \r
             this.externs = Externs.Factory.newInstance();\r
-            //\r
-            // Save PcdIsDriver first\r
-            //\r
-            if (!this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals(DataType.EMPTY_SELECT_ITEM)) {\r
-                externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()\r
-                                                                                              .toString()));\r
-            }\r
+            //            //\r
+            //            // Save PcdIsDriver first\r
+            //            //\r
+            //            if (!this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals(DataType.EMPTY_SELECT_ITEM)) {\r
+            //                externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem()\r
+            //                                                                                              .toString()));\r
+            //            }\r
 \r
             if (count > 0) {\r
                 for (int index = 0; index < count; index++) {\r
+                    //\r
+                    // Save Pcd Is Driver\r
+                    //\r
+                    if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {\r
+                        externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(vid.getExterns(index).getName()));\r
+                        continue;\r
+                    }\r
+\r
                     //\r
                     // Save specfication\r
                     //\r
@@ -697,198 +551,52 @@ public class ModuleExterns extends IInternalFrame implements ItemListener {
     }\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.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(this.jComboBoxType, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(this.jTextFieldC_Name, 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
-\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
-    }\r
-\r
-    private ExternsIdentification getCurrentExterns() {\r
-        String arg0 = this.jTextFieldC_Name.getText();\r
-        String arg1 = this.jComboBoxType.getSelectedItem().toString();\r
-\r
-        String arg2 = this.jTextFieldFeatureFlag.getText();\r
-        Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();\r
-\r
-        id = new ExternsIdentification(arg0, arg1, arg2, arg3);\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.addExterns(getCurrentExterns());\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.removeExterns(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.updateExterns(getCurrentExterns(), intTempIndex);\r
-\r
-        jComboBoxList.removeAllItems();\r
-        for (int index = 0; index < vid.size(); index++) {\r
-            jComboBoxList.addItem(vid.getExterns(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.jTextFieldC_Name.setText(vid.getExterns(intSelectedItemId).getName());\r
-            this.jComboBoxType.setSelectedItem(vid.getExterns(intSelectedItemId).getType());\r
-\r
-            jTextFieldFeatureFlag.setText(vid.getExterns(intSelectedItemId).getFeatureFlag());\r
-            iCheckBoxListArch.setAllItemsUnchecked();\r
-            iCheckBoxListArch.initCheckedItem(true, vid.getExterns(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.getExterns(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.jComboBoxPcdIsDriver && arg0.getStateChange() == ItemEvent.SELECTED && externs != null) {\r
-            String s = this.jComboBoxPcdIsDriver.getSelectedItem().toString();\r
-            if (s.equals(DataType.EMPTY_SELECT_ITEM)) {\r
-                this.externs.setPcdIsDriver(null);\r
+    public void mouseClicked(MouseEvent arg0) {\r
+        if (arg0.getClickCount() == 2) {\r
+            if (this.selectedRow < 0) {\r
+                return;\r
             } else {\r
-                this.externs.setPcdIsDriver(PcdDriverTypes.Enum.forString(s));\r
+                showEdit(selectedRow);\r
             }\r
-            this.msa.setExterns(externs);\r
-            this.omt.setSaved(false);\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
index 35ac3f5..6c0c411 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.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.GuidUsage;\r
 import org.tianocore.GuidsDocument;\r
@@ -33,24 +33,20 @@ import org.tianocore.GuidsDocument.Guids;
 import org.tianocore.GuidsDocument.Guids.GuidCNames;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\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.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.Identifications.Guids.GuidsIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;\r
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.GuidsDlg;\r
 \r
 /**\r
  The class is used to create, update Guids of MSA/MBD file\r
  It extends IInternalFrame\r
  \r
-\r
-\r
  **/\r
 public class ModuleGuids extends IInternalFrame {\r
 \r
@@ -64,28 +60,6 @@ public class ModuleGuids extends IInternalFrame {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabelC_Name = null;\r
-\r
-    private JComboBox jComboBoxCName = 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 jLabelFeatureFlag = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = 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
@@ -94,21 +68,13 @@ public class ModuleGuids extends IInternalFrame {
 \r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JScrollPane jScrollPaneList = null;\r
-\r
-    private ICheckBoxList iCheckBoxListArch = null;\r
-\r
-    private JScrollPane jScrollPaneArch = null;\r
+    private JScrollPane jScrollPaneTable = null;\r
 \r
-    private JLabel jLabelHelpText = null;\r
-\r
-    private JTextField jTextFieldHelpText = 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
@@ -119,71 +85,9 @@ public class ModuleGuids extends IInternalFrame {
 \r
     private GuidsVector vid = new GuidsVector();\r
 \r
-    private EnumerationData ed = new EnumerationData();\r
-\r
-    private WorkspaceTools wt = new WorkspaceTools();\r
-\r
-    /**\r
-     This method initializes jTextFieldC_Name \r
-     \r
-     @return javax.swing.JTextField jTextFieldC_Name\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxCName() {\r
-        if (jComboBoxCName == null) {\r
-            jComboBoxCName = new JComboBox();\r
-            jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
-            jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxCName;\r
-    }\r
-\r
-    /**\r
-     This method initializes jComboBoxUsage \r
-     \r
-     @return javax.swing.JComboBox jComboBoxUsage\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxUsage() {\r
-        if (jComboBoxUsage == null) {\r
-            jComboBoxUsage = new JComboBox();\r
-            jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxUsage;\r
-    }\r
+    private IDefaultTableModel model = null;\r
 \r
-    /**\r
-     This method initializes jTextFieldFeatureFlag    \r
-     \r
-     @return javax.swing.JTextField   \r
-     \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
@@ -230,27 +134,12 @@ public class ModuleGuids extends IInternalFrame {
             jButtonUpdate = new JButton();\r
             jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 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
@@ -265,62 +154,41 @@ public class ModuleGuids extends IInternalFrame {
     }\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 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
+     This method initializes jScrollPaneTable    \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, 110, 320, 80));\r
-            jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));\r
-            jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());\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 jScrollPaneArch;\r
+        return jScrollPaneTable;\r
     }\r
 \r
     /**\r
-     This method initializes jTextFieldHelpText  \r
-     \r
-     @return javax.swing.JTextField  \r
+     This method initializes jTable  \r
      \r
+     @return javax.swing.JTable  \r
      **/\r
-    private JTextField getJTextFieldHelpText() {\r
-        if (jTextFieldHelpText == null) {\r
-            jTextFieldHelpText = new JTextField();\r
-            jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
-            jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));\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("Guid C_Name");\r
+            model.addColumn("Usage");\r
+\r
+            jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            jTable.getSelectionModel().addListSelectionListener(this);\r
+            jTable.getModel().addTableModelListener(this);\r
+            jTable.addMouseListener(this);\r
         }\r
-        return jTextFieldHelpText;\r
+        return jTable;\r
     }\r
 \r
     public static void main(String[] args) {\r
@@ -335,8 +203,6 @@ public class ModuleGuids extends IInternalFrame {
         this.setSize(500, 515);\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Guids");\r
-        initFrame();\r
-        this.setViewMode(false);\r
     }\r
 \r
     /**\r
@@ -356,7 +222,7 @@ public class ModuleGuids extends IInternalFrame {
                     String arg0 = guids.getGuidCNamesList().get(index).getGuidCName();\r
                     String arg1 = null;\r
                     if (guids.getGuidCNamesList().get(index).getUsage() != null) {\r
-                        arg1 = guids.getGuidCNamesList().get(index).getUsage().toString();    \r
+                        arg1 = guids.getGuidCNamesList().get(index).getUsage().toString();\r
                     }\r
 \r
                     String arg2 = guids.getGuidCNamesList().get(index).getFeatureFlag();\r
@@ -369,11 +235,7 @@ public class ModuleGuids extends IInternalFrame {
                 }\r
             }\r
         }\r
-        //\r
-        // Update the list\r
-        //\r
-        Tools.generateComboBoxByVector(jComboBoxList, vid.getGuidsName());\r
-        reloadListArea();\r
+        showTable();\r
     }\r
 \r
     /**\r
@@ -400,18 +262,6 @@ public class ModuleGuids extends IInternalFrame {
         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
-        }\r
-    }\r
-\r
     /**\r
      This method initializes jContentPane\r
      \r
@@ -420,65 +270,62 @@ public class ModuleGuids extends IInternalFrame {
      **/\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
-            jLabelUsage = new JLabel();\r
-            jLabelUsage.setText("Usage");\r
-            jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelC_Name = new JLabel();\r
-            jLabelC_Name.setText("C_Name");\r
-            jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
-            jLabelArch.setText("Arch");\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-            jLabelHelpText = new JLabel();\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));\r
-            jLabelHelpText.setText("Help Text");\r
-\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));\r
-\r
-            jContentPane.add(jLabelC_Name, null);\r
-            jContentPane.add(getJComboBoxCName(), null);\r
-            jContentPane.add(jLabelUsage, null);\r
-            jContentPane.add(getJComboBoxUsage(), null);\r
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(jLabelArch, null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));\r
 \r
-            jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-            jStarLabel2 = new StarLabel();\r
-            jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
-\r
-            jContentPane.add(jStarLabel1, null);\r
-            jContentPane.add(jStarLabel2, null);\r
-\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
-            jContentPane.add(getJScrollPaneArch(), null);\r
-            jContentPane.add(jLabelHelpText, null);\r
-            jContentPane.add(getJTextFieldHelpText(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
+        }\r
+        return jContentPane;\r
+    }\r
 \r
-            initFrame();\r
+    private void showEdit(int index) {\r
+        GuidsDlg dlg = new GuidsDlg(vid.getGuids(index), new IFrame());\r
+        int result = dlg.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addGuids(dlg.getId());\r
+            } else {\r
+                this.vid.setGuids(dlg.getId(), index);\r
+            }\r
+            this.showTable();\r
+            this.save();\r
+            dlg.dispose();\r
+        }\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            dlg.dispose();\r
+        }\r
+    }\r
 \r
+    /**\r
+     Clear all table rows\r
+     \r
+     **/\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
-        return jContentPane;\r
     }\r
 \r
     /**\r
-     This method initializes Usage type\r
+     Read content of vector and put then into table\r
      \r
      **/\r
-    private void initFrame() {\r
-        Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllGuidDeclarationsFromWorkspace());\r
-        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage());\r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\r
+    private void showTable() {\r
+        clearAll();\r
+\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
+            }\r
+        }\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -489,55 +336,27 @@ public class ModuleGuids extends IInternalFrame {
      */\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
+            showEdit(-1);\r
         }\r
         if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\r
                 return;\r
             }\r
-            updateForList();\r
+            showEdit(selectedRow);\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 Guid Name");\r
-                return false;\r
+        if (arg0.getSource() == jButtonRemove) {\r
+            if (jTable.isEditing()) {\r
+                jTable.getCellEditor().stopCellEditing();\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
+            if (selectedRow > -1) {\r
+                this.model.removeRow(selectedRow);\r
+                this.vid.removeGuids(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-\r
-        return true;\r
     }\r
 \r
     /**\r
@@ -582,190 +401,52 @@ public class ModuleGuids extends IInternalFrame {
     }\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(jComboBoxCName, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
-\r
-        resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);\r
-        resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
-\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
-    }\r
-\r
-    private GuidsIdentification getCurrentGuids() {\r
-        String arg0 = this.jComboBoxCName.getSelectedItem().toString();\r
-        String arg1 = this.jComboBoxUsage.getSelectedItem().toString();\r
-\r
-        String arg2 = this.jTextFieldFeatureFlag.getText();\r
-        Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();\r
-        String arg4 = this.jTextFieldHelpText.getText();\r
-\r
-        id = new GuidsIdentification(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.addGuids(getCurrentGuids());\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.removeGuids(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.updateGuids(getCurrentGuids(), intTempIndex);\r
-\r
-        jComboBoxList.removeAllItems();\r
-        for (int index = 0; index < vid.size(); index++) {\r
-            jComboBoxList.addItem(vid.getGuids(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.getGuids(intSelectedItemId).getName());\r
-            this.jComboBoxUsage.setSelectedItem(vid.getGuids(intSelectedItemId).getUsage());\r
-            this.jTextFieldHelpText.setText(vid.getGuids(intSelectedItemId).getHelp());\r
-\r
-            jTextFieldFeatureFlag.setText(vid.getGuids(intSelectedItemId).getFeatureFlag());\r
-            iCheckBoxListArch.setAllItemsUnchecked();\r
-            iCheckBoxListArch.initCheckedItem(true, vid.getGuids(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.getGuids(index).getName() + DataType.UNIX_LINE_SEPARATOR;\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
+     *\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
-        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
+     * @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 itemStateChanged(ItemEvent arg0) {\r
-        if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {\r
-            reloadFromList();\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
index aefeba5..884879e 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.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.HiiPackageUsage;\r
 import org.tianocore.HiiPackagesDocument;\r
@@ -33,22 +33,19 @@ import org.tianocore.HiiPackagesDocument.HiiPackages;
 import org.tianocore.HiiPackagesDocument.HiiPackages.HiiPackage;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\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.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.Identifications.HiiPackages.HiiPackagesIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesVector;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.HiiPackagesDlg;\r
 \r
 /**\r
  The class is used to create, update Formset of MSA/MBD file\r
  It extends IInternalFrame\r
\r
-\r
 \r
  **/\r
 public class ModuleHiiPackages extends IInternalFrame {\r
@@ -63,28 +60,6 @@ public class ModuleHiiPackages extends IInternalFrame {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabelName = null;\r
-\r
-    private JTextField jTextFieldName = 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 jLabelFeatureFlag = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = 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
@@ -93,21 +68,13 @@ public class ModuleHiiPackages extends IInternalFrame {
 \r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JScrollPane jScrollPaneList = null;\r
-\r
-    private ICheckBoxList iCheckBoxListArch = null;\r
-\r
-    private JScrollPane jScrollPaneArch = null;\r
+    private JScrollPane jScrollPaneTable = null;\r
 \r
-    private JLabel jLabelHelpText = null;\r
-\r
-    private JTextField jTextFieldHelpText = 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
@@ -118,69 +85,9 @@ public class ModuleHiiPackages extends IInternalFrame {
 \r
     private HiiPackagesVector vid = new HiiPackagesVector();\r
 \r
-    private EnumerationData ed = new EnumerationData();\r
-\r
-    /**\r
-     This method initializes jTextFieldName \r
-     \r
-     @return javax.swing.JTextField jTextFieldName\r
-     \r
-     **/\r
-    private JTextField getJTextFieldName() {\r
-        if (jTextFieldName == null) {\r
-            jTextFieldName = new JTextField();\r
-            jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
-            jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jTextFieldName.setToolTipText("Enter the C Name of the HII Package");\r
-        }\r
-        return jTextFieldName;\r
-    }\r
-\r
-    /**\r
-     This method initializes jComboBoxUsage \r
-     \r
-     @return javax.swing.JComboBox jComboBoxUsage\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxUsage() {\r
-        if (jComboBoxUsage == null) {\r
-            jComboBoxUsage = new JComboBox();\r
-            jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxUsage;\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
@@ -227,27 +134,12 @@ public class ModuleHiiPackages extends IInternalFrame {
             jButtonUpdate = new JButton();\r
             jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 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
@@ -262,62 +154,41 @@ public class ModuleHiiPackages extends IInternalFrame {
     }\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 jTextFieldHelpText  \r
-     \r
-     @return javax.swing.JTextField  \r
+     This method initializes jScrollPaneTable    \r
      \r
+     @return javax.swing.JScrollPane \r
      **/\r
-    private JTextField getJTextFieldHelpText() {\r
-        if (jTextFieldHelpText == null) {\r
-            jTextFieldHelpText = new JTextField();\r
-            jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
-            jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jTextFieldHelpText;\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
+    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 iCheckBoxListArch;\r
+        return jScrollPaneTable;\r
     }\r
 \r
     /**\r
-     This method initializes jScrollPaneArch \r
-\r
-     @return javax.swing.JScrollPane \r
-\r
+     This method initializes jTable  \r
+     \r
+     @return javax.swing.JTable  \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
+    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("Hii Package C_Name");\r
+            model.addColumn("Usage");\r
+\r
+            jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            jTable.getSelectionModel().addListSelectionListener(this);\r
+            jTable.getModel().addTableModelListener(this);\r
+            jTable.addMouseListener(this);\r
         }\r
-        return jScrollPaneArch;\r
+        return jTable;\r
     }\r
 \r
     public static void main(String[] args) {\r
@@ -332,8 +203,6 @@ public class ModuleHiiPackages extends IInternalFrame {
         this.setSize(500, 515);\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Hii Packages");\r
-        initFrame();\r
-        this.setViewMode(false);\r
     }\r
 \r
     /**\r
@@ -353,24 +222,20 @@ public class ModuleHiiPackages extends IInternalFrame {
                     String arg0 = hiiPackages.getHiiPackageList().get(index).getHiiCName();\r
                     String arg1 = null;\r
                     if (hiiPackages.getHiiPackageList().get(index).getUsage() != null) {\r
-                        arg1 = hiiPackages.getHiiPackageList().get(index).getUsage().toString();    \r
+                        arg1 = hiiPackages.getHiiPackageList().get(index).getUsage().toString();\r
                     }\r
 \r
                     String arg2 = hiiPackages.getHiiPackageList().get(index).getFeatureFlag();\r
                     Vector<String> arg3 = Tools.convertListToVector(hiiPackages.getHiiPackageList().get(index)\r
                                                                                .getSupArchList());\r
                     String arg4 = hiiPackages.getHiiPackageList().get(index).getHelpText();\r
-                    \r
+\r
                     id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);\r
                     vid.addHiiPackages(id);\r
                 }\r
             }\r
         }\r
-        //\r
-        // Update the list\r
-        //\r
-        Tools.generateComboBoxByVector(jComboBoxList, vid.getHiiPackagesName());\r
-        reloadListArea();\r
+        showTable();\r
     }\r
 \r
     /**\r
@@ -400,19 +265,6 @@ public class ModuleHiiPackages extends IInternalFrame {
         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.jTextFieldName.setEnabled(!isView);\r
-            this.jComboBoxUsage.setEnabled(!isView);\r
-        }\r
-    }\r
-\r
     /**\r
      This method initializes jContentPane\r
      \r
@@ -421,62 +273,62 @@ public class ModuleHiiPackages extends IInternalFrame {
      **/\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
-            jLabelUsage = new JLabel();\r
-            jLabelUsage.setText("Usage");\r
-            jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelName = new JLabel();\r
-            jLabelName.setText("Name");\r
-            jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
-            jLabelArch.setText("Arch");\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-            jLabelHelpText = new JLabel();\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));\r
-            jLabelHelpText.setText("Help Text");\r
-\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 475));\r
-\r
-            jContentPane.add(jLabelName, null);\r
-            jContentPane.add(jLabelUsage, null);\r
-            jContentPane.add(getJTextFieldName(), null);\r
-            jContentPane.add(getJComboBoxUsage(), null);\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));\r
 \r
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(jLabelArch, null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
-\r
-            jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-            jStarLabel2 = new StarLabel();\r
-            jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
-\r
-            jContentPane.add(jStarLabel1, null);\r
-            jContentPane.add(jStarLabel2, null);\r
-\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
-            jContentPane.add(getJScrollPaneArch(), null);\r
-            jContentPane.add(jLabelHelpText, null);\r
-            jContentPane.add(getJTextFieldHelpText(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
         }\r
         return jContentPane;\r
     }\r
 \r
+    private void showEdit(int index) {\r
+        HiiPackagesDlg dlg = new HiiPackagesDlg(vid.getHiiPackages(index), new IFrame());\r
+        int result = dlg.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addHiiPackages(dlg.getId());\r
+            } else {\r
+                this.vid.setHiiPackages(dlg.getId(), index);\r
+            }\r
+            this.showTable();\r
+            this.save();\r
+            dlg.dispose();\r
+        }\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            dlg.dispose();\r
+        }\r
+    }\r
+\r
     /**\r
-     This method initializes Usage type\r
+     Clear all table rows\r
      \r
      **/\r
-    private void initFrame() {\r
-        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage());\r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\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
+    }\r
+\r
+    /**\r
+     Read content of vector and put then into table\r
+     \r
+     **/\r
+    private void showTable() {\r
+        clearAll();\r
+\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
+            }\r
+        }\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -487,60 +339,27 @@ public class ModuleHiiPackages extends IInternalFrame {
      */\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
+            showEdit(-1);\r
         }\r
         if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\r
                 return;\r
             }\r
-            updateForList();\r
+            showEdit(selectedRow);\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 Hii Package Name \r
-        //\r
-        if (isEmpty(this.jTextFieldName.getText())) {\r
-            Log.err("Hii Package Name Record couldn't be empty");\r
-            return false;\r
-        }\r
-\r
-        if (!isEmpty(this.jTextFieldName.getText())) {\r
-            if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) {\r
-                Log.err("Incorrect data type for Hii Package Name");\r
-                return false;\r
+        if (arg0.getSource() == jButtonRemove) {\r
+            if (jTable.isEditing()) {\r
+                jTable.getCellEditor().stopCellEditing();\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
+            if (selectedRow > -1) {\r
+                this.model.removeRow(selectedRow);\r
+                this.vid.removeHiiPackages(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-\r
-        return true;\r
     }\r
 \r
     /**\r
@@ -586,190 +405,52 @@ public class ModuleHiiPackages extends IInternalFrame {
     }\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(jTextFieldName, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
-\r
-        resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);\r
-        resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
-\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
-    }\r
-\r
-    private HiiPackagesIdentification getCurrentHiiPackages() {\r
-        String arg0 = this.jTextFieldName.getText();\r
-        String arg1 = this.jComboBoxUsage.getSelectedItem().toString();\r
-\r
-        String arg2 = this.jTextFieldFeatureFlag.getText();\r
-        Vector<String> arg3 = this.iCheckBoxListArch.getAllCheckedItemsString();\r
-        String arg4 = this.jTextFieldHelpText.getText();\r
-        \r
-        id = new HiiPackagesIdentification(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.addHiiPackages(getCurrentHiiPackages());\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.removeHiiPackages(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.updateHiiPackages(getCurrentHiiPackages(), intTempIndex);\r
-\r
-        jComboBoxList.removeAllItems();\r
-        for (int index = 0; index < vid.size(); index++) {\r
-            jComboBoxList.addItem(vid.getHiiPackages(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.jTextFieldName.setText(vid.getHiiPackages(intSelectedItemId).getName());\r
-            this.jComboBoxUsage.setSelectedItem(vid.getHiiPackages(intSelectedItemId).getUsage());\r
-            this.jTextFieldHelpText.setText(vid.getHiiPackages(intSelectedItemId).getHelp());\r
-\r
-            jTextFieldFeatureFlag.setText(vid.getHiiPackages(intSelectedItemId).getFeatureFlag());\r
-            iCheckBoxListArch.setAllItemsUnchecked();\r
-            iCheckBoxListArch.initCheckedItem(true, vid.getHiiPackages(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.getHiiPackages(index).getName() + DataType.UNIX_LINE_SEPARATOR;\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
+     *\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
-        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
+     * @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 itemStateChanged(ItemEvent arg0) {\r
-        if (arg0.getSource() == this.jComboBoxList && arg0.getStateChange() == ItemEvent.SELECTED) {\r
-            reloadFromList();\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
index 7bbf119..8b11f08 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.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.HobTypes;\r
 import org.tianocore.HobUsage;\r
@@ -33,17 +33,15 @@ import org.tianocore.HobsDocument;
 import org.tianocore.HobsDocument.Hobs;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\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.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.Identifications.Hobs.HobsIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsVector;\r
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.HobsDlg;\r
 \r
 /**\r
  The class is used to create, update Hob of MSA/MBD file\r
@@ -64,26 +62,6 @@ public class ModuleHobs extends IInternalFrame {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JLabel jLabel = null;\r
-\r
-    private JComboBox jComboBoxGuidC_Name = null;\r
-\r
-    private JLabel jLabelUsage = null;\r
-\r
-    private JLabel jLabelHobType = null;\r
-\r
-    private JComboBox jComboBoxUsage = null;\r
-\r
-    private JComboBox jComboBoxHobType = null;\r
-\r
-    private StarLabel jStarLabel1 = 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
@@ -92,25 +70,13 @@ public class ModuleHobs extends IInternalFrame {
 \r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JScrollPane jScrollPaneList = null;\r
-\r
-    private JLabel jLabelFeatureFlag = null;\r
-\r
-    private JTextField jTextFieldFeatureFlag = null;\r
+    private JScrollPane jScrollPaneTable = 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
+    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
@@ -121,72 +87,9 @@ public class ModuleHobs extends IInternalFrame {
 \r
     private HobsVector vid = new HobsVector();\r
 \r
-    private EnumerationData ed = new EnumerationData();\r
-    \r
-    private WorkspaceTools wt = new WorkspaceTools();\r
-\r
-    /**\r
-     This method initializes jTextField \r
-     \r
-     @return javax.swing.JTextField jTextFieldC_Name\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxGuidC_Name() {\r
-        if (jComboBoxGuidC_Name == null) {\r
-            jComboBoxGuidC_Name = new JComboBox();\r
-            jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
-            jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));\r
-            jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob");\r
-        }\r
-        return jComboBoxGuidC_Name;\r
-    }\r
-\r
-    /**\r
-     This method initializes jComboBoxUsage \r
-     \r
-     @return javax.swing.JComboBox jComboBoxUsage\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxUsage() {\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 jComboBoxHobType \r
-     \r
-     @return javax.swing.JComboBox jComboBoxHobType\r
-     \r
-     **/\r
-    private JComboBox getJComboBoxHobType() {\r
-        if (jComboBoxHobType == null) {\r
-            jComboBoxHobType = new JComboBox();\r
-            jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
-            jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jComboBoxHobType;\r
-    }\r
+    private IDefaultTableModel model = null;\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
+    private int selectedRow = -1;\r
 \r
     /**\r
      This method initializes jButtonAdd \r
@@ -233,27 +136,12 @@ public class ModuleHobs extends IInternalFrame {
             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.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, 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
@@ -268,77 +156,43 @@ public class ModuleHobs extends IInternalFrame {
     }\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 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, 110, 320, 20));\r
-            jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
-        }\r
-        return jTextFieldFeatureFlag;\r
-    }\r
-\r
-    /**\r
-     This method initializes iCheckBoxListArch   \r
-\r
-     @return ICheckBoxList   \r
+     This method initializes jScrollPaneTable    \r
+     \r
+     @return javax.swing.JScrollPane \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 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 iCheckBoxListArch;\r
+        return jScrollPaneTable;\r
     }\r
 \r
     /**\r
-     This method initializes jScrollPaneArch \r
-\r
-     @return javax.swing.JScrollPane \r
-\r
+     This method initializes jTable  \r
+     \r
+     @return javax.swing.JTable  \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
+    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("Guid C_Name");\r
+            model.addColumn("Type");\r
+            model.addColumn("Usage");\r
+\r
+            jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            jTable.getSelectionModel().addListSelectionListener(this);\r
+            jTable.getModel().addTableModelListener(this);\r
+            jTable.addMouseListener(this);\r
         }\r
-        return jScrollPaneArch;\r
+        return jTable;\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
@@ -352,8 +206,6 @@ public class ModuleHobs extends IInternalFrame {
         this.setSize(500, 515);\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Hobs");\r
-        initFrame();\r
-        this.setViewMode(false);\r
     }\r
 \r
     /**\r
@@ -373,13 +225,13 @@ public class ModuleHobs extends IInternalFrame {
                     String arg0 = hobs.getHobTypesList().get(index).getHobGuidCName();\r
                     String arg1 = null;\r
                     if (hobs.getHobTypesList().get(index).getHobType() != null) {\r
-                        arg1 = hobs.getHobTypesList().get(index).getHobType().toString();    \r
+                        arg1 = hobs.getHobTypesList().get(index).getHobType().toString();\r
                     }\r
                     String arg2 = null;\r
                     if (hobs.getHobTypesList().get(index).getUsage() != null) {\r
-                        arg2 = hobs.getHobTypesList().get(index).getUsage().toString();    \r
+                        arg2 = hobs.getHobTypesList().get(index).getUsage().toString();\r
                     }\r
-                    \r
+\r
                     String arg3 = hobs.getHobTypesList().get(index).getFeatureFlag();\r
                     Vector<String> arg4 = Tools.convertListToVector(hobs.getHobTypesList().get(index).getSupArchList());\r
                     String arg5 = hobs.getHobTypesList().get(index).getHelpText();\r
@@ -388,11 +240,7 @@ public class ModuleHobs extends IInternalFrame {
                 }\r
             }\r
         }\r
-        //\r
-        // Update the list\r
-        //\r
-        Tools.generateComboBoxByVector(jComboBoxList, vid.getHobsName());\r
-        reloadListArea();\r
+        showTable();\r
     }\r
 \r
     /**\r
@@ -419,20 +267,6 @@ public class ModuleHobs extends IInternalFrame {
         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.jComboBoxGuidC_Name.setEnabled(!isView);\r
-            this.jComboBoxUsage.setEnabled(!isView);\r
-            this.jComboBoxHobType.setEnabled(!isView);\r
-        }\r
-    }\r
-\r
     /**\r
      This method initializes jContentPane\r
      \r
@@ -441,65 +275,63 @@ public class ModuleHobs extends IInternalFrame {
      **/\r
     public JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
-            jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
-            jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
-            jLabelArch.setText("Arch");\r
-            jLabelHobType = new JLabel();\r
-            jLabelHobType.setText("Hob Type");\r
-            jLabelHobType.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
-            jLabelUsage = new JLabel();\r
-            jLabelUsage.setText("Usage");\r
-            jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
-            jLabel = new JLabel();\r
-            jLabel.setText("C_Name");\r
-            jLabel.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
-            jLabelHelpText = new JLabel();\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));\r
-            jLabelHelpText.setText("Help Text");\r
-            \r
+\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 495));\r
-\r
-            jContentPane.add(jLabel, null);\r
-            jContentPane.add(getJComboBoxGuidC_Name(), null);\r
-            jContentPane.add(jLabelUsage, null);\r
-            jContentPane.add(jLabelHobType, null);\r
-            jContentPane.add(getJComboBoxUsage(), null);\r
-            jContentPane.add(getJComboBoxHobType(), null);\r
-            jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
-            jContentPane.add(jStarLabel1, null);\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));\r
 \r
-            jContentPane.add(jLabelArch, null);\r
-\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
-            jContentPane.add(jLabelFeatureFlag, null);\r
-            jContentPane.add(getJTextFieldFeatureFlag(), null);\r
-            jContentPane.add(getJScrollPaneArch(), null);\r
-            jContentPane.add(jLabelHelpText, null);\r
-            jContentPane.add(getJTextFieldHelpText(), null);\r
+            jContentPane.add(getJScrollPaneTable(), null);\r
         }\r
         return jContentPane;\r
     }\r
 \r
+    private void showEdit(int index) {\r
+        HobsDlg dlg = new HobsDlg(vid.getHobs(index), new IFrame());\r
+        int result = dlg.showDialog();\r
+        if (result == DataType.RETURN_TYPE_OK) {\r
+            if (index == -1) {\r
+                this.vid.addHobs(dlg.getId());\r
+            } else {\r
+                this.vid.setHobs(dlg.getId(), index);\r
+            }\r
+            this.showTable();\r
+            this.save();\r
+            dlg.dispose();\r
+        }\r
+        if (result == DataType.RETURN_TYPE_CANCEL) {\r
+            dlg.dispose();\r
+        }\r
+    }\r
+\r
     /**\r
-     This method initializes Usage type and Hob type\r
+     Clear all table rows\r
      \r
      **/\r
-    private void initFrame() {\r
-        Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());\r
-        Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());\r
-        Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace());\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
+    }\r
 \r
-        this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\r
+    /**\r
+     Read content of vector and put then into table\r
+     \r
+     **/\r
+    private void showTable() {\r
+        clearAll();\r
+\r
+        if (vid.size() > 0) {\r
+            for (int index = 0; index < vid.size(); index++) {\r
+                model.addRow(vid.toStringVector(index));\r
+            }\r
+        }\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -510,60 +342,27 @@ public class ModuleHobs extends IInternalFrame {
      */\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
+            showEdit(-1);\r
         }\r
         if (arg0.getSource() == jButtonUpdate) {\r
-            if (!checkAdd()) {\r
+            if (this.selectedRow < 0) {\r
+                Log.err("Please select one record first.");\r
                 return;\r
             }\r
-            updateForList();\r
+            showEdit(selectedRow);\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.jComboBoxGuidC_Name.getSelectedItem().toString())) {\r
-            Log.err("Hob Name couldn't be empty");\r
-            return false;\r
-        }\r
-        \r
-        if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {\r
-            if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {\r
-                Log.err("Incorrect data type for Hob Name");\r
-                return false;\r
+        if (arg0.getSource() == jButtonRemove) {\r
+            if (jTable.isEditing()) {\r
+                jTable.getCellEditor().stopCellEditing();\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
+            if (selectedRow > -1) {\r
+                this.model.removeRow(selectedRow);\r
+                this.vid.removeHobs(selectedRow);\r
+                selectedRow = -1;\r
+                this.save();\r
             }\r
         }\r
-\r
-        return true;\r
     }\r
 \r
     /**\r
@@ -608,6 +407,36 @@ public class ModuleHobs extends IInternalFrame {
         }\r
     }\r
 \r
+    /* (non-Javadoc)\r
+     * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)\r
+     *\r
+     */\r
+    public void valueChanged(ListSelectionEvent arg0) {\r
+        if (arg0.getValueIsAdjusting()) {\r
+            return;\r
+        }\r
+        ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();\r
+        if (lsm.isSelectionEmpty()) {\r
+            return;\r
+        } else {\r
+            selectedRow = lsm.getMinSelectionIndex();\r
+        }\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
+     *\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
@@ -619,182 +448,12 @@ public class ModuleHobs extends IInternalFrame {
         int intPreferredWidth = this.getJContentPane().getPreferredSize().width;\r
         int intPreferredHeight = this.getJContentPane().getPreferredSize().height;\r
 \r
-        resizeComponentWidth(jComboBoxGuidC_Name, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxHobType, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jComboBoxUsage, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldHelpText, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jTextFieldFeatureFlag, intCurrentWidth, intPreferredWidth);\r
-        resizeComponentWidth(jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
-\r
-        resizeComponentWidth(jComboBoxList, intCurrentWidth, intPreferredWidth);\r
-        resizeComponent(jScrollPaneList, intCurrentWidth, intCurrentHeight, intPreferredWidth, intPreferredHeight);\r
-\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
-    }\r
-    \r
-    private HobsIdentification getCurrentHobs() {\r
-        String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString();\r
-        String arg1 = this.jComboBoxHobType.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 HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
-        return id;\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
-    /**\r
-    Add current item to Vector\r
-    \r
-    **/\r
-   private void addToList() {\r
-       intSelectedItemId = vid.size();\r
-\r
-       vid.addHobs(getCurrentHobs());\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.removeHobs(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.updateHobs(getCurrentHobs(), intTempIndex);\r
-\r
-       jComboBoxList.removeAllItems();\r
-       for (int index = 0; index < vid.size(); index++) {\r
-           jComboBoxList.addItem(vid.getHobs(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.jComboBoxGuidC_Name.setSelectedItem(vid.getHobs(intSelectedItemId).getName());\r
-           this.jComboBoxHobType.setSelectedItem(vid.getHobs(intSelectedItemId).getType());\r
-           this.jComboBoxUsage.setSelectedItem(vid.getHobs(intSelectedItemId).getUsage());\r
-           this.jTextFieldHelpText.setText(vid.getHobs(intSelectedItemId).getHelp());\r
-\r
-           jTextFieldFeatureFlag.setText(vid.getHobs(intSelectedItemId).getFeatureFlag());\r
-           iCheckBoxListArch.setAllItemsUnchecked();\r
-           iCheckBoxListArch.initCheckedItem(true, vid.getHobs(intSelectedItemId).getSupArchList());\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.getHobs(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
-   }\r
 }\r
index a815c85..5104651 100644 (file)
@@ -17,16 +17,15 @@ package org.tianocore.frameworkwizard.module.ui;
 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.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.LibraryClassDefinitionsDocument;\r
 import org.tianocore.LibraryUsage;\r
@@ -34,17 +33,15 @@ import org.tianocore.ModuleSurfaceAreaDocument;
 import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r
 import org.tianocore.LibraryClassDocument.LibraryClass;\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.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.Identifications.LibraryClass.LibraryClassIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;\r
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+import org.tianocore.frameworkwizard.module.ui.dialog.LibraryClassDefsDlg;\r
 \r
 /**\r
  The class is used to create, update Library Class Definition of MSA/MBD file\r
@@ -63,61 +60,17 @@ public class ModuleLibraryClassDefinitions extends IInternalFrame {
     //\r
     private JPanel jContentPane = null;\r
 \r
-    private JComboBox jComboBoxLibraryClassName = null;\r
-\r
-    private JLabel jLabelUsage = null;\r
-\r
-    private JComboBox jComboBoxUsage = 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 JLabel jLabelLibraryClassName = null;\r
-\r
-    private JScrollPane jScrollPaneList = null;\r
-\r
     private JScrollPane jScrollPane = null;\r
 \r
-    private JTextArea jTextAreaList = null;\r
-\r
-    private StarLabel jStarLabel1 = null;\r
-\r
-    private StarLabel jStarLabel2 = null;\r
-\r
-    private ICheckBoxList iCheckBoxListArch = null;\r
-\r
-    private JScrollPane jScrollPaneArch = null;\r
-\r
-    private JLabel jLabelRecommendedInstanceVersion = null;\r
-\r
-    private JTextField jTextFieldRecommendedInstanceVersion = null;\r
-