]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
1. Make SPD editor tables bigger.and table now focus the entry added.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFrameworkModules.java
index f9abe9d01794a36e00af9aab61a2ba8a081038a4..cb2a5aa4206911a218c98be99153f0235e39e4d9 100644 (file)
@@ -5,7 +5,6 @@ import java.awt.BorderLayout;
 import javax.swing.JFrame;\r
 import javax.swing.JOptionPane;\r
 import javax.swing.JPanel;\r
-import javax.swing.JDialog;\r
 import javax.swing.JSplitPane;\r
 import javax.swing.JLabel;\r
 import javax.swing.JScrollPane;\r
@@ -15,6 +14,7 @@ import javax.swing.ListSelectionModel;
 import javax.swing.table.DefaultTableModel;\r
 \r
 import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
 import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
@@ -30,6 +30,10 @@ import java.util.Set;
 \r
 public class FpdFrameworkModules extends IInternalFrame {\r
 \r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
     static JFrame frame;\r
     private JSplitPane jSplitPane = null;\r
     private JPanel jPanel = null;\r
@@ -51,7 +55,7 @@ public class FpdFrameworkModules extends IInternalFrame {
     private FpdModuleSA settingDlg = null;\r
     \r
     private FpdFileContents ffc = null;\r
-    \r
+    private OpeningPlatformType docConsole = null;\r
     private Map<String, String> fpdMsa = null;\r
     \r
     private ArrayList<ModuleIdentification> miList = null;\r
@@ -131,6 +135,7 @@ public class FpdFrameworkModules extends IInternalFrame {
         if (jTable == null) {\r
             model = new NonEditableTableModel();\r
             jTable = new JTable(model);\r
+            jTable.setRowHeight(20);\r
             model.addColumn("ModuleName");\r
             model.addColumn("ModuleGUID");\r
             model.addColumn("ModuleVersion");\r
@@ -187,11 +192,23 @@ public class FpdFrameworkModules extends IInternalFrame {
                     fpdMsa.put(mg + mv + pg + pv, null);\r
                     \r
                     String[] row = {" ", mg, mv, pg, pv};\r
-                    if (getModuleId(mg + " " + mv + " " + pg + " " + pv) != null) {\r
-                        row[0] = getModuleId(mg + " " + mv + " " + pg + " " + pv).getName();\r
+                    ModuleIdentification mi = getModuleId(mg + " " + mv + " " + pg + " " + pv);\r
+                    if (mi != null) {\r
+                        row[0] = mi.getName();\r
+                        row[2] = mi.getVersion();\r
+                        row[4] = mi.getPackage().getVersion();\r
                     }\r
                     model1.addRow(row);\r
-                    ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null);\r
+                    \r
+                    docConsole.setSaved(false);\r
+                    try{\r
+                        ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null);\r
+                    }\r
+                    catch (Exception exception) {\r
+                        JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage());\r
+                    }\r
+                    JOptionPane.showMessageDialog(frame, "This Module Added Successfully.");\r
+                    jTable1.changeSelection(model1.getRowCount()-1, 0, false, false);\r
                 }\r
             });\r
         }\r
@@ -238,6 +255,7 @@ public class FpdFrameworkModules extends IInternalFrame {
         if (jTable1 == null) {\r
             model1 = new NonEditableTableModel();\r
             jTable1 = new JTable(model1);\r
+            jTable1.setRowHeight(20);\r
             model1.addColumn("ModuleName");\r
             model1.addColumn("ModuleGUID");\r
             model1.addColumn("ModuleVersion");            \r
@@ -269,11 +287,11 @@ public class FpdFrameworkModules extends IInternalFrame {
                     if (settingDlg == null) {\r
                         settingDlg = new FpdModuleSA(ffc);\r
                     }\r
-                    \r
-                    String mg = model1.getValueAt(selectedRow, 1).toString();\r
-                    String mv = model1.getValueAt(selectedRow, 2).toString();\r
-                    String pg = model1.getValueAt(selectedRow, 3).toString();\r
-                    String pv = model1.getValueAt(selectedRow, 4).toString();\r
+                    docConsole.setSaved(false);\r
+                    String mg = model1.getValueAt(selectedRow, 1)+"";\r
+                    String mv = model1.getValueAt(selectedRow, 2)+"";\r
+                    String pg = model1.getValueAt(selectedRow, 3)+"";\r
+                    String pv = model1.getValueAt(selectedRow, 4)+"";\r
                     settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv);\r
                     settingDlg.setVisible(true);\r
                 }\r
@@ -304,6 +322,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     String pv = model1.getValueAt(selectedRow, 4).toString();\r
                     model1.removeRow(selectedRow);\r
                     fpdMsa.remove(mg+mv+pg+pv);\r
+                    docConsole.setSaved(false);\r
                     ffc.removeModuleSA(selectedRow);\r
                 }\r
             });\r
@@ -333,6 +352,11 @@ public class FpdFrameworkModules extends IInternalFrame {
         \r
     }\r
     \r
+    public FpdFrameworkModules(OpeningPlatformType opt) {\r
+        this(opt.getXmlFpd());\r
+        docConsole = opt;\r
+    }\r
+    \r
     private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
         try {\r
             GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
@@ -354,8 +378,11 @@ public class FpdFrameworkModules extends IInternalFrame {
             String[][] saa = new String[ffc.getFrameworkModulesCount()][5];\r
             ffc.getFrameworkModulesInfo(saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
-                if (getModuleId(saa[i][1]+ " "+saa[i][2]+" "+saa[i][3]+" "+saa[i][4]) != null) {\r
-                    saa[i][0] = getModuleId(saa[i][1]+ " "+saa[i][2]+" "+saa[i][3]+" "+saa[i][4]).getName();\r
+                ModuleIdentification mi = getModuleId(saa[i][1]+ " "+saa[i][2]+" "+saa[i][3]+" "+saa[i][4]);\r
+                if (mi != null) {\r
+                    saa[i][0] = mi.getName();\r
+                    saa[i][2] = mi.getVersion();\r
+                    saa[i][4] = mi.getPackage().getVersion();\r
                 }\r
                 model1.addRow(saa[i]);\r
                 fpdMsa.put(saa[i][1]+saa[i][2]+saa[i][3]+saa[i][4], saa[i][0]);\r
@@ -414,14 +441,17 @@ public class FpdFrameworkModules extends IInternalFrame {
         \r
         while(ispi.hasNext()) {\r
             PackageIdentification pi = (PackageIdentification)ispi.next();\r
-            if ( !pi.getGuid().equals(keyPart[2]) || !pi.getVersion().equals(keyPart[3])){\r
+            if ( !pi.getGuid().equals(keyPart[2])){ \r
+//                            || !pi.getVersion().equals(keyPart[3])){\r
                 continue;\r
             }\r
             Set<ModuleIdentification> smi = GlobalData.getModules(pi);\r
             Iterator ismi = smi.iterator();\r
             while(ismi.hasNext()) {\r
                 ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
-                if (mi.getGuid().equals(keyPart[0]) && mi.getVersion().equals(keyPart[1])){\r
+                if (mi.getGuid().equals(keyPart[0])){\r
+//                                && mi.getVersion().equals(keyPart[1])){\r
+\r
                     return mi;\r
                 }\r
             }\r
@@ -432,6 +462,11 @@ public class FpdFrameworkModules extends IInternalFrame {
 }  //  @jve:decl-index=0:visual-constraint="10,10"\r
 \r
 class NonEditableTableModel extends DefaultTableModel {\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1L;\r
+\r
     public boolean isCellEditable(int row, int col) {\r
         return false;\r
     }\r