Fix the bug of leaving empty GuidTypeList, SupArchList attributes in xml file.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1038 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-07-18 09:53:52 +00:00
parent 562d28495d
commit 2c85fbc88a
4 changed files with 87 additions and 35 deletions

View File

@ -1216,18 +1216,31 @@ public class SpdFileContents {
e.setCName(cName);
e.setGuidValue(guid);
e.setHelpText(help);
e.setGuidTypeList(guidTypeList);
e.setSupArchList(archList);
e.setSupModuleList(modTypeList);
// if (guidTypeList != null && guidTypeList.size() > 0) {
// e.setGuidTypeList(new ArrayList<String>(guidTypeList));
// }
// if (archList != null && archList.size() > 0){
// e.setSupArchList(new ArrayList<String>(archList));
// }
// if (modTypeList != null && modTypeList.size() > 0) {
// e.setSupModuleList(new ArrayList<String>(modTypeList));
// }
if (guidTypeList != null) {
e.setGuidTypeList(guidTypeList);
}
else{
if (e.isSetGuidTypeList()) {
e.unsetGuidTypeList();
}
}
if (archList != null) {
e.setSupArchList(archList);
}
else {
if (e.isSetSupArchList()) {
e.unsetSupArchList();
}
}
if (modTypeList != null){
e.setSupModuleList(modTypeList);
}
else {
if (e.isSetSupModuleList()) {
e.unsetSupModuleList();
}
}
return;
}
if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
@ -1237,14 +1250,23 @@ public class SpdFileContents {
pe.setCName(cName);
pe.setGuidValue(guid);
pe.setHelpText(help);
pe.setSupArchList(archList);
pe.setSupModuleList(modTypeList);
// if (archList != null && archList.size() > 0){
// pe.setSupArchList(new ArrayList<String>(archList));
// }
// if (modTypeList != null && modTypeList.size() > 0) {
// pe.setSupModuleList(new ArrayList<String>(modTypeList));
// }
if (archList != null) {
pe.setSupArchList(archList);
}
else {
if (pe.isSetSupArchList()) {
pe.unsetSupArchList();
}
}
if (modTypeList != null){
pe.setSupModuleList(modTypeList);
}
else {
if (pe.isSetSupModuleList()) {
pe.unsetSupModuleList();
}
}
return;
}
if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
@ -1254,14 +1276,23 @@ public class SpdFileContents {
ppe.setCName(cName);
ppe.setGuidValue(guid);
ppe.setHelpText(help);
ppe.setSupArchList(archList);
ppe.setSupModuleList(modTypeList);
// if (archList != null && archList.size() > 0){
// ppe.setSupArchList(new ArrayList<String>(archList));
// }
// if (archList != null && modTypeList.size() > 0) {
// ppe.setSupModuleList(new ArrayList<String>(modTypeList));
// }
if (archList != null) {
ppe.setSupArchList(archList);
}
else {
if (ppe.isSetSupArchList()) {
ppe.unsetSupArchList();
}
}
if (modTypeList != null){
ppe.setSupModuleList(modTypeList);
}
else {
if (ppe.isSetSupModuleList()) {
ppe.unsetSupModuleList();
}
}
return;
}

View File

@ -252,9 +252,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
int row = arg0.getFirstRow();
TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
if (docConsole != null) {
docConsole.setSaved(false);
}
updateRow(row, m);
}
}
@ -280,7 +278,9 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
if (!dataValidation(rowData)){
return;
}
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
}
/**
@ -549,9 +549,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
if (!dataValidation(row)) {
return;
}
if (docConsole != null) {
docConsole.setSaved(false);
}
model.addRow(row);
jTable.changeSelection(model.getRowCount()-1, 0, false, false);
addRow(row);
@ -610,17 +608,35 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
protected void addRow(String[] row) {
Vector<String> vArch = iCheckBoxList.getAllCheckedItemsString();
if (vArch.size() == 0) {
vArch = null;
}
Vector<String> vModType = iCheckBoxList2.getAllCheckedItemsString();
if (vModType.size() == 0) {
vModType = null;
}
Vector<String> vguidType = iCheckBoxList1.getAllCheckedItemsString();
if (vguidType.size() == 0) {
vguidType = null;
}
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType);
}
protected void removeRow(int i){
sfc.removeSpdGuidDeclaration(i);
if (docConsole != null) {
docConsole.setSaved(false);
}
}
protected void clearAllRow(){
sfc.removeSpdGuidDeclaration();
if (docConsole != null) {
docConsole.setSaved(false);
}
}
/**

View File

@ -108,9 +108,11 @@ public class SpdPpiDecls extends SpdGuidDecls {
protected void removeRow(int i){
sfc.removeSpdPpiDeclaration(i);
docConsole.setSaved(false);
}
protected void clearAllRow(){
sfc.removeSpdPpiDeclaration();
docConsole.setSaved(false);
}
}

View File

@ -102,14 +102,17 @@ public class SpdProtocolDecls extends SpdGuidDecls {
if (!dataValidation(row)){
return;
}
docConsole.setSaved(false);
sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));
}
protected void removeRow(int i){
sfc.removeSpdProtocolDeclaration(i);
docConsole.setSaved(false);
}
protected void clearAllRow(){
sfc.removeSpdProtocolDeclaration();
docConsole.setSaved(false);
}
}