]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
Re-implement sorting algorithm of table and modified FpdFrameworkModules.java to...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFrameworkModules.java
index e0c1167925bb07095607dfa49e7527fc0e78d989..767fd525642dfaf1deecd2a8018c31bba811466b 100644 (file)
@@ -1,3 +1,17 @@
+/** @file\r
\r
+ The file is used to create, update FrameworkModules of Fpd file\r
\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
+ **/\r
 package org.tianocore.frameworkwizard.platform.ui;\r
 \r
 import java.awt.BorderLayout;\r
@@ -35,6 +49,8 @@ public class FpdFrameworkModules extends IInternalFrame {
      * Initialize Globals\r
      */\r
     private static final long serialVersionUID = 1L;\r
+    \r
+    public static final int forceDbgColForFpdModTable = 7;\r
 \r
     static JFrame frame;\r
 \r
@@ -68,7 +84,7 @@ public class FpdFrameworkModules extends IInternalFrame {
 \r
     private NonEditableTableModel modelAllModules = null;\r
 \r
-    private NonEditableTableModel modelFpdModules = null;\r
+    private FpdModulesTableModel modelFpdModules = null;\r
 \r
     private FpdModuleSA settingDlg = null;\r
 \r
@@ -321,7 +337,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     }\r
 \r
                     TableSorter sorter = (TableSorter) jTableAllModules.getModel();\r
-                    selectedRow = sorter.modelIndex(selectedRow);\r
+                    selectedRow = sorter.getModelRowIndex(selectedRow);\r
                     String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + "";\r
                     ModuleIdentification mi = miList.get(selectedRow);\r
                     Vector<String> vArchs = null;\r
@@ -419,7 +435,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     }\r
                     JOptionPane.showMessageDialog(frame, s);\r
                     TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel();\r
-                    int viewIndex = sorterFpdModules.getModelToView()[modelFpdModules.getRowCount() - 1];\r
+                    int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1];\r
                     jTableFpdModules.changeSelection(viewIndex, 0, false, false);\r
                 }\r
             });\r
@@ -467,7 +483,7 @@ public class FpdFrameworkModules extends IInternalFrame {
      */\r
     private JTable getJTableFpdModules() {\r
         if (jTableFpdModules == null) {\r
-            modelFpdModules = new NonEditableTableModel();\r
+            modelFpdModules = new FpdModulesTableModel();\r
             TableSorter sorter = new TableSorter(modelFpdModules);\r
             jTableFpdModules = new JTable(sorter);\r
             sorter.setTableHeader(jTableFpdModules.getTableHeader());\r
@@ -479,7 +495,7 @@ public class FpdFrameworkModules extends IInternalFrame {
             modelFpdModules.addColumn("<html>Module<br>Type</html>");\r
             modelFpdModules.addColumn("<html>Module<br>Version</html>");\r
             modelFpdModules.addColumn("<html>Package<br>Version</html>");\r
-\r
+            modelFpdModules.addColumn("<html>Force<br>Debug</html>");\r
             \r
             javax.swing.table.TableColumn column = null;\r
             column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable);\r
@@ -535,7 +551,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     }\r
 \r
                     TableSorter sorter = (TableSorter) jTableFpdModules.getModel();\r
-                    selectedRow = sorter.modelIndex(selectedRow);\r
+                    selectedRow = sorter.getModelRowIndex(selectedRow);\r
                     try {\r
                         if (ffc.adjustPcd(selectedRow)) {\r
                             docConsole.setSaved(false);\r
@@ -584,7 +600,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     docConsole.setSaved(false);\r
 \r
                     TableSorter sorter = (TableSorter) jTableFpdModules.getModel();\r
-                    selectedRow = sorter.modelIndex(selectedRow);\r
+                    selectedRow = sorter.getModelRowIndex(selectedRow);\r
 \r
                     String[] sa = new String[5];\r
                     ffc.getFrameworkModuleInfo(selectedRow, sa);\r
@@ -667,7 +683,7 @@ public class FpdFrameworkModules extends IInternalFrame {
             for (int i = 0; i < saa.length; ++i) {\r
                 ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "\r
                                                                  + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);\r
-                String[] row = { "", "", "", "", "", "", "" };\r
+                Object[] row = { "", "", "", "", "", "", "", "" };\r
                 if (mi != null) {\r
                     row[modNameColForFpdModTable] = mi.getName();\r
                     row[modVerColForFpdModTable] = mi.getVersion();\r
@@ -692,11 +708,12 @@ public class FpdFrameworkModules extends IInternalFrame {
                     }\r
                     al.add(saa[i][ffcModArch]);\r
                 }\r
+                row[forceDbgColForFpdModTable] = ffc.getModuleSAForceDebug(i);\r
                 modelFpdModules.addRow(row);\r
 \r
             }\r
             TableSorter sorter = (TableSorter)jTableFpdModules.getModel();\r
-            sorter.setSortingStatus(modNameColForFpdModTable, TableSorter.ASCENDING);\r
+            sorter.setSortState(modNameColForFpdModTable, TableSorter.ASCENDING);\r
         }\r
 \r
         showAllModules();\r
@@ -736,7 +753,7 @@ public class FpdFrameworkModules extends IInternalFrame {
         }\r
         \r
         TableSorter sorter = (TableSorter)jTableAllModules.getModel();\r
-        sorter.setSortingStatus(modNameColForAllModTable, TableSorter.ASCENDING);\r
+        sorter.setSortState(modNameColForAllModTable, TableSorter.ASCENDING);\r
     }\r
 \r
     /**\r
@@ -764,3 +781,25 @@ class NonEditableTableModel extends DefaultTableModel {
         return false;\r
     }\r
 }\r
+\r
+class FpdModulesTableModel extends DefaultTableModel {\r
+\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
+    \r
+    public Class<?> getColumnClass (int c) {\r
+        if (getValueAt(0, c) != null){\r
+            return getValueAt(0, c).getClass();\r
+        }\r
+        return String.class;\r
+    }\r
+    \r
+    public boolean isCellEditable (int row, int col) {\r
+        if (col == FpdFrameworkModules.forceDbgColForFpdModTable) {\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+}\r