git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@718 6f19259b...
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 3 Jul 2006 03:51:10 +0000 (03:51 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 3 Jul 2006 03:51:10 +0000 (03:51 +0000)
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java

index 9b4fa0943db5dd85a7e4a5c7d6710c084175ec24..e48ff495c24fd8aff708c0e08743070955b3cde9 100644 (file)
@@ -551,6 +551,15 @@ public class FpdBuildOptions extends IInternalFrame {
         if (jTextField6 == null) {\r
             jTextField6 = new JTextField();\r
             jTextField6.setPreferredSize(new java.awt.Dimension(100,20));\r
+            jTextField6.setEditable(false);\r
+            jTextField6.addFocusListener(new java.awt.event.FocusAdapter() {\r
+                public void focusLost(java.awt.event.FocusEvent e) {\r
+                    if (jTable.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+//                    ffc.updateBuildOptionsFfsKey(jTable.getSelectedRow(), jTextField6.getText());\r
+                }\r
+            });\r
         }\r
         return jTextField6;\r
     }\r
@@ -1212,8 +1221,7 @@ public class FpdBuildOptions extends IInternalFrame {
                             return;\r
                         }\r
                        \r
-//                        ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder);\r
-                        \r
+                        ffc.updateBuildOptionsFfsKey(row, id);\r
                     }\r
                 }\r
             });\r
@@ -1245,7 +1253,41 @@ public class FpdBuildOptions extends IInternalFrame {
             sectionTableModel = new DefaultTableModel();\r
             sectionTableModel.addColumn("SectionType");\r
             \r
-            jTable1 = new JTable(sectionsTableModel);\r
+            jTable1 = new JTable(sectionTableModel);\r
+            JComboBox cb = new JComboBox();\r
+            cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");\r
+            cb.addItem("EFI_SECTION_VERSION");\r
+            cb.addItem("EFI_SECTION_USER_INTERFACE");\r
+            cb.addItem("EFI_SECTION_DXE_DEPEX");\r
+            cb.addItem("EFI_SECTION_PEI_DEPEX");\r
+            cb.addItem("EFI_SECTION_PE32");\r
+            cb.addItem("EFI_SECTION_PIC");\r
+            cb.addItem("EFI_SECTION_TE");\r
+            cb.addItem("EFI_SECTION_RAW");\r
+            cb.addItem("EFI_SECTION_COMPRESSION");\r
+            cb.addItem("EFI_SECTION_GUID_DEFINED");\r
+            cb.addItem("EFI_SECTION_COMPATIBILITY16");\r
+            cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");\r
+            jTable1.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));\r
+            \r
+            jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            \r
+            jTable1.getModel().addTableModelListener(new TableModelListener() {\r
+                public void tableChanged(TableModelEvent arg0) {\r
+                    // TODO Auto-generated method stub\r
+                    if (jTable.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    int row = arg0.getFirstRow();\r
+                    TableModel m = (TableModel)arg0.getSource();\r
+                    if (arg0.getType() == TableModelEvent.UPDATE){\r
+                        //ToDo Data Validition check.\r
+                        String type = m.getValueAt(row, 0) + "";\r
+                        \r
+                       ffc.updateBuildOptionsFfsSectionsSection(jTable.getSelectedRow(), row, type);\r
+                    }\r
+                }\r
+            });\r
         }\r
         return jTable1;\r
     }\r
@@ -1274,6 +1316,38 @@ public class FpdBuildOptions extends IInternalFrame {
             subsectionsTableModel = new DefaultTableModel();\r
             subsectionsTableModel.addColumn("SectionType");\r
             jTable3 = new JTable(subsectionsTableModel);\r
+            JComboBox cb = new JComboBox();\r
+            cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");\r
+            cb.addItem("EFI_SECTION_VERSION");\r
+            cb.addItem("EFI_SECTION_USER_INTERFACE");\r
+            cb.addItem("EFI_SECTION_DXE_DEPEX");\r
+            cb.addItem("EFI_SECTION_PEI_DEPEX");\r
+            cb.addItem("EFI_SECTION_PE32");\r
+            cb.addItem("EFI_SECTION_PIC");\r
+            cb.addItem("EFI_SECTION_TE");\r
+            cb.addItem("EFI_SECTION_RAW");\r
+            cb.addItem("EFI_SECTION_COMPRESSION");\r
+            cb.addItem("EFI_SECTION_GUID_DEFINED");\r
+            cb.addItem("EFI_SECTION_COMPATIBILITY16");\r
+            cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");\r
+            jTable3.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));\r
+            jTable3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            \r
+            jTable3.getModel().addTableModelListener(new TableModelListener() {\r
+                public void tableChanged(TableModelEvent arg0) {\r
+                    // TODO Auto-generated method stub\r
+                    if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    int row = arg0.getFirstRow();\r
+                    TableModel m = (TableModel)arg0.getSource();\r
+                    if (arg0.getType() == TableModelEvent.UPDATE){\r
+                        //ToDo Data Validition check.\r
+                        String type = m.getValueAt(row, 0) + "";\r
+                        ffc.updateBuildOptionsFfsSectionsSectionsSection(jTable.getSelectedRow(), jTable6.getSelectedRow(), row, type);\r
+                    }\r
+                }\r
+            });\r
         }\r
         return jTable3;\r
     }\r
@@ -1287,6 +1361,14 @@ public class FpdBuildOptions extends IInternalFrame {
         if (jTextField == null) {\r
             jTextField = new JTextField();\r
             jTextField.setPreferredSize(new java.awt.Dimension(100,20));\r
+            jTextField.addFocusListener(new java.awt.event.FocusAdapter() {\r
+                public void focusLost(java.awt.event.FocusEvent e) {\r
+                    if (jTable.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    ffc.updateBuildOptionsFfsSectionsType(jTable.getSelectedRow(), jTextField.getText());\r
+                }\r
+            });\r
         }\r
         return jTextField;\r
     }\r
@@ -1316,6 +1398,16 @@ public class FpdBuildOptions extends IInternalFrame {
             jButton = new JButton();\r
             jButton.setPreferredSize(new java.awt.Dimension(80,20));\r
             jButton.setText("New");\r
+            jButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(java.awt.event.ActionEvent e) {\r
+                    if (jTable.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    String[] row = {"EFI_SECTION_RAW"};\r
+                    sectionTableModel.addRow(row);\r
+                    ffc.genBuildOptionsFfsSectionsSection(jTable.getSelectedRow(), row[0]);\r
+                }\r
+            });\r
         }\r
         return jButton;\r
     }\r
@@ -1330,6 +1422,16 @@ public class FpdBuildOptions extends IInternalFrame {
             jButton1 = new JButton();\r
             jButton1.setPreferredSize(new java.awt.Dimension(80,20));\r
             jButton1.setText("Remove");\r
+          \r
+            jButton1.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(java.awt.event.ActionEvent e) {\r
+                    if (jTable.getSelectedRow() < 0 || jTable1.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    sectionTableModel.removeRow(jTable1.getSelectedRow());\r
+                    ffc.removeBuildOptionsFfsSectionsSection(jTable.getSelectedRow(), jTable1.getSelectedRow());\r
+                }\r
+            });\r
         }\r
         return jButton1;\r
     }\r
@@ -1344,6 +1446,17 @@ public class FpdBuildOptions extends IInternalFrame {
             jButton2 = new JButton();\r
             jButton2.setPreferredSize(new java.awt.Dimension(80,20));\r
             jButton2.setText("New");\r
+            jButton2.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(java.awt.event.ActionEvent e) {\r
+                    if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    String[] row = {"EFI_SECTION_RAW"};\r
+                    subsectionsTableModel.addRow(row);\r
+                    ffc.genBuildOptionsFfsSectionsSectionsSection(jTable.getSelectedRow(), jTable6.getSelectedRow(), row[0]);\r
+                    \r
+                }\r
+            });\r
         }\r
         return jButton2;\r
     }\r
@@ -1358,6 +1471,15 @@ public class FpdBuildOptions extends IInternalFrame {
             jButton3 = new JButton();\r
             jButton3.setPreferredSize(new java.awt.Dimension(80,20));\r
             jButton3.setText("Remove");\r
+            jButton3.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(java.awt.event.ActionEvent e) {\r
+                    if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0 || jTable3.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    subsectionsTableModel.removeRow(jTable3.getSelectedRow());\r
+                    ffc.removeBuildOptionsFfsSectionsSectionsSection(jTable.getSelectedRow(), jTable6.getSelectedRow(), jTable3.getSelectedRow());\r
+                }\r
+            });\r
         }\r
         return jButton3;\r
     }\r
@@ -1372,6 +1494,16 @@ public class FpdBuildOptions extends IInternalFrame {
             jButton6 = new JButton();\r
             jButton6.setPreferredSize(new java.awt.Dimension(80,20));\r
             jButton6.setText("New");\r
+            jButton6.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(java.awt.event.ActionEvent e) {\r
+                    if (jTable.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    String[] row = {""};\r
+                    sectionsTableModel.addRow(row);\r
+                    ffc.genBuildOptionsFfsSectionsSections(jTable.getSelectedRow(), "");\r
+                }\r
+            });\r
         }\r
         return jButton6;\r
     }\r
@@ -1386,6 +1518,15 @@ public class FpdBuildOptions extends IInternalFrame {
             jButton7 = new JButton();\r
             jButton7.setPreferredSize(new java.awt.Dimension(80,20));\r
             jButton7.setText("Remove");\r
+            jButton7.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(java.awt.event.ActionEvent e) {\r
+                    if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0) {\r
+                        return;\r
+                    }\r
+                    sectionsTableModel.removeRow(jTable6.getSelectedRow());\r
+                    ffc.removeBuildOptionsFfsSectionsSections(jTable.getSelectedRow(), jTable6.getSelectedRow());\r
+                }\r
+            });\r
         }\r
         return jButton7;\r
     }\r
@@ -1448,13 +1589,8 @@ public class FpdBuildOptions extends IInternalFrame {
                     TableModel m = (TableModel)arg0.getSource();\r
                     if (arg0.getType() == TableModelEvent.UPDATE){\r
                         //ToDo Data Validition check.\r
-//                        String targetName = m.getValueAt(row, 0) + "";\r
-//                        String toolChain = m.getValueAt(row, 1) + "";\r
-//                        String supArch = m.getValueAt(row, 2) + "";\r
-//                        String toolCmd = m.getValueAt(row, 3) + "";\r
-//                        String tagName = m.getValueAt(row, 4) + "";\r
-//                        String contents = m.getValueAt(row, 5) + "";\r
-//                        ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents);\r
+                        String encapType = m.getValueAt(row, 0) + "";\r
+                        ffc.updateBuildOptionsFfsSectionsSections(jTable.getSelectedRow(), row, encapType);\r
                     }\r
                 }\r
             });\r
index 3d34eb5b63d44cd39dd1f03bea19a6d162fc4c12..2f2dbc6b757b7efc9b20af386e324ddbfeccc509 100644 (file)
@@ -1169,6 +1169,13 @@ public class FpdFileContents {
         }\r
     }\r
     \r
+    public void updateBuildOptionsFfsSectionsType(int i, String type) {\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs();\r
+        if (type != null) {\r
+            ffs.addNewSections().setEncapsulationType(type);\r
+        }\r
+    }\r
+    \r
     public void genBuildOptionsFfsAttribute(int i, String name, String value) {\r
         BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
         BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = ffs.addNewAttribute();\r
@@ -1221,6 +1228,41 @@ public class FpdFileContents {
         sections.addNewSection().setSectionType(EfiSectionType.Enum.forString(sectionType));\r
     }\r
     \r
+    public void removeBuildOptionsFfsSectionsSection(int i, int j) {\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
+        BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r
+        if (sections == null) {\r
+            return;\r
+        }\r
+        XmlCursor cursor = sections.newCursor();\r
+        QName qSection = new QName(xmlNs, "Section");\r
+        if (cursor.toChild(qSection)) {\r
+            for (int k = 0; k < j; ++k) {\r
+                cursor.toNextSibling(qSection);\r
+            }\r
+            cursor.removeXml();\r
+        }\r
+        cursor.dispose();\r
+    }\r
+    \r
+    public void updateBuildOptionsFfsSectionsSection(int i, int j, String type){\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
+        BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r
+        if (sections == null) {\r
+            return;\r
+        }\r
+        XmlCursor cursor = sections.newCursor();\r
+        QName qSection = new QName(xmlNs, "Section");\r
+        if (cursor.toChild(qSection)) {\r
+            for (int k = 0; k < j; ++k) {\r
+                cursor.toNextSibling(qSection);\r
+            }\r
+            BuildOptionsDocument.BuildOptions.Ffs.Sections.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Section)cursor.getObject();\r
+            section.setSectionType(EfiSectionType.Enum.forString(type));\r
+        }\r
+        cursor.dispose();\r
+    } \r
+    \r
     public void genBuildOptionsFfsSectionsSections(int i, String encapType) {\r
         BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
         if (ffs == null) {\r
@@ -1234,6 +1276,41 @@ public class FpdFileContents {
         sections.addNewSections().setEncapsulationType(encapType);\r
     }\r
     \r
+    public void removeBuildOptionsFfsSectionsSections(int i, int j) {\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
+        BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r
+        if (sections == null) {\r
+            return;\r
+        }\r
+        XmlCursor cursor = sections.newCursor();\r
+        QName qSections = new QName(xmlNs, "Sections");\r
+        if (cursor.toChild(qSections)) {\r
+            for (int k = 0; k < j; ++k) {\r
+                cursor.toNextSibling(qSections);\r
+            }\r
+            cursor.removeXml();\r
+        }\r
+        cursor.dispose();\r
+    }\r
+    \r
+    public void updateBuildOptionsFfsSectionsSections(int i, int j, String type) {\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
+        BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r
+        if (sections == null) {\r
+            return;\r
+        }\r
+        XmlCursor cursor = sections.newCursor();\r
+        QName qSections = new QName(xmlNs, "Sections");\r
+        if (cursor.toChild(qSections)) {\r
+            for (int k = 0; k < j; ++k) {\r
+                cursor.toNextSibling(qSections);\r
+            }\r
+            BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();\r
+            sections2.setEncapsulationType(type);\r
+        }\r
+        cursor.dispose();\r
+    }\r
+    \r
     public void genBuildOptionsFfsSectionsSectionsSection(int i, int j, String type) {\r
         BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
         if (ffs == null) {\r
@@ -1252,6 +1329,51 @@ public class FpdFileContents {
         cursor.dispose();\r
     }\r
     \r
+    public void removeBuildOptionsFfsSectionsSectionsSection(int i, int j, int k) {\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
+        BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r
+        if (sections == null) {\r
+            return;\r
+        }\r
+        XmlCursor cursor = sections.newCursor();\r
+        QName qSections = new QName(xmlNs, "Sections");\r
+        if (cursor.toChild(qSections)) {\r
+            for (int l = 0; l < j; ++l) {\r
+                cursor.toNextSibling(qSections);\r
+            }\r
+            if (cursor.toFirstChild()) {\r
+                for (int m = 0; m < k; ++m) {\r
+                    cursor.toNextSibling();\r
+                }\r
+                cursor.removeXml();\r
+            }\r
+        }\r
+        cursor.dispose();\r
+    }\r
+    \r
+    public void updateBuildOptionsFfsSectionsSectionsSection(int i, int j, int k, String type) {\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
+        BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();\r
+        if (sections == null) {\r
+            return;\r
+        }\r
+        XmlCursor cursor = sections.newCursor();\r
+        QName qSections = new QName(xmlNs, "Sections");\r
+        if (cursor.toChild(qSections)) {\r
+            for (int l = 0; l < j; ++l) {\r
+                cursor.toNextSibling(qSections);\r
+            }\r
+            if (cursor.toFirstChild()) {\r
+                for (int m = 0; m < k; ++m) {\r
+                    cursor.toNextSibling();\r
+                }\r
+                BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section)cursor.getObject();\r
+                section.setSectionType(EfiSectionType.Enum.forString(type));\r
+            }\r
+        }\r
+        cursor.dispose();\r
+    }\r
+    \r
     public void getBuildOptionsFfsSectionsSectionsSection(int i, int j, ArrayList<String> al) {\r
         BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
         if (ffs == null) {\r
@@ -1272,8 +1394,11 @@ public class FpdFileContents {
             ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section> li = sections2.getSectionList().listIterator();\r
             while(li.hasNext()) {\r
                 BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next();\r
+                if (section.isSetSectionType()) {\r
                 al.add(section.getSectionType().toString());\r
             }\r
+                \r
+            }\r
         }\r
         cursor.dispose();\r
         \r
@@ -1299,6 +1424,11 @@ public class FpdFileContents {
         }\r
     }\r
     \r
+    public void updateBuildOptionsFfsKey(int i, String key) {\r
+        BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);\r
+        ffs.setFfsKey(key);\r
+    }\r
+    \r
     /**Get ith FFS key and contents.\r
      * @param saa\r
      */\r
@@ -1365,6 +1495,8 @@ public class FpdFileContents {
         cursor.dispose();\r
     }\r
     \r
+    \r
+    \r
     public PlatformDefinitionsDocument.PlatformDefinitions getfpdPlatformDefs(){\r
         if (fpdPlatformDefs == null){\r
             fpdPlatformDefs = fpdRoot.addNewPlatformDefinitions();\r