Fix bug of missing Pcd information in FPD ModuleSA.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1010 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-07-14 09:19:24 +00:00
parent a71a82e576
commit 055e7ae674
3 changed files with 49 additions and 22 deletions

View File

@ -287,29 +287,56 @@ public class FpdFileContents {
//
// key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer"
//
public int getPcdDataCount(String key){
ModuleSADocument.ModuleSA msa = getModuleSA(key);
public int getPcdDataCount(int i){
if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {
return 0;
}
XmlCursor cursor = getfpdFrameworkModules().newCursor();
ModuleSADocument.ModuleSA msa = null;
if (cursor.toFirstChild()) {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
msa = (ModuleSADocument.ModuleSA)cursor.getObject();
}
cursor.dispose();
if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
return 0;
}
return msa.getPcdBuildDefinition().getPcdDataList().size();
}
public void getPcdData(String key, String[][] saa) {
ModuleSADocument.ModuleSA msa = getModuleSA(key);
public void getPcdData(int i, String[][] saa) {
if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {
return;
}
XmlCursor cursor = getfpdFrameworkModules().newCursor();
ModuleSADocument.ModuleSA msa = null;
if (cursor.toFirstChild()) {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
msa = (ModuleSADocument.ModuleSA)cursor.getObject();
}
cursor.dispose();
if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
return;
}
ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData>li = msa.getPcdBuildDefinition().getPcdDataList().listIterator();
for (int i = 0; i < saa.length; ++i) {
for (int k = 0; k < saa.length; ++k) {
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();
saa[i][0] = pcdData.getCName();
saa[i][1] = pcdData.getTokenSpaceGuidCName();
saa[i][2] = pcdData.getItemType()+"";
saa[i][3] = pcdData.getToken().toString();
saa[i][4] = pcdData.getMaxDatumSize()+"";
saa[i][5] = pcdData.getDatumType()+"";
saa[i][6] = pcdData.getValue();
saa[k][0] = pcdData.getCName();
saa[k][1] = pcdData.getTokenSpaceGuidCName();
saa[k][2] = pcdData.getItemType()+"";
saa[k][3] = pcdData.getToken().toString();
saa[k][4] = pcdData.getMaxDatumSize()+"";
saa[k][5] = pcdData.getDatumType()+"";
saa[k][6] = pcdData.getValue();
}
}

View File

@ -202,7 +202,7 @@ public class FpdFrameworkModules extends IInternalFrame {
docConsole.setSaved(false);
try{
ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null);
ffc.addFrameworkModulesPcdBuildDefs(mi, null);
}
catch (Exception exception) {
JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage());
@ -292,7 +292,7 @@ public class FpdFrameworkModules extends IInternalFrame {
String mv = model1.getValueAt(selectedRow, 2)+"";
String pg = model1.getValueAt(selectedRow, 3)+"";
String pv = model1.getValueAt(selectedRow, 4)+"";
settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv);
settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv, selectedRow);
settingDlg.setVisible(true);
}
});

View File

@ -129,27 +129,27 @@ public class FpdModuleSA extends JDialog implements ActionListener {
this.ffc = ffc;
}
public void setKey(String k){
public void setKey(String k, int i){
this.moduleKey = k;
jTabbedPane.setSelectedIndex(0);
initPcdBuildDefinition(k);
initPcdBuildDefinition(i);
}
/**
init will be called each time FpdModuleSA object is to be shown.
@param key Module information.
**/
public void initPcdBuildDefinition(String key) {
public void initPcdBuildDefinition(int i) {
//
// display pcd for key.
//
model.setRowCount(0);
int pcdCount = ffc.getPcdDataCount(key);
int pcdCount = ffc.getPcdDataCount(i);
if (pcdCount != 0) {
String[][] saa = new String[pcdCount][7];
ffc.getPcdData(key, saa);
for (int i = 0; i < saa.length; ++i) {
model.addRow(saa[i]);
ffc.getPcdData(i, saa);
for (int j = 0; j < saa.length; ++j) {
model.addRow(saa[j]);
}
}
}
@ -483,7 +483,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
jPanel.add(getJPanel2(), java.awt.BorderLayout.SOUTH);
jPanel.addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent e) {
initPcdBuildDefinition(moduleKey);
// initPcdBuildDefinition(moduleKey);
}
});