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