Fix tracker "Package Library Class Recommended Instance should not default to null":

When adding a library class to a Package, the recommended instance name is a drop down with no entries, and the table gets filled in with a recommended instance of "null"

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1030 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-07-17 07:35:43 +00:00
parent 9653129917
commit d129bd96fa
2 changed files with 42 additions and 27 deletions

View File

@ -348,6 +348,9 @@ public class SpdFileContents {
if (lc.isSetRecommendedInstanceGuid()) { if (lc.isSetRecommendedInstanceGuid()) {
lc.unsetRecommendedInstanceGuid(); lc.unsetRecommendedInstanceGuid();
} }
if (lc.isSetRecommendedInstanceVersion()) {
lc.unsetRecommendedInstanceVersion();
}
} }
if (stringToList(hdrAttribArch) != null){ if (stringToList(hdrAttribArch) != null){
@ -1011,14 +1014,22 @@ public class SpdFileContents {
lc.setIncludeHeader(clsIncludeFile); lc.setIncludeHeader(clsIncludeFile);
lc.setHelpText(help); lc.setHelpText(help);
// LAH added logic so you cannot set the version unless the GUID is defined. // LAH added logic so you cannot set the version unless the GUID is defined.
/* LAH
if (clsUsage != null) { if (clsUsage != null) {
lc.setRecommendedInstanceGuid(clsUsage); lc.setRecommendedInstanceGuid(clsUsage);
if (instanceVer != null) { if (instanceVer != null) {
lc.setRecommendedInstanceVersion(instanceVer); lc.setRecommendedInstanceVersion(instanceVer);
} }
} }
*/ else {
if (lc.isSetRecommendedInstanceGuid()) {
lc.unsetRecommendedInstanceGuid();
}
if (lc.isSetRecommendedInstanceVersion()) {
lc.unsetRecommendedInstanceVersion();
}
}
if (hdrAttribArch != null) { if (hdrAttribArch != null) {
lc.setSupArchList(stringToList(hdrAttribArch)); lc.setSupArchList(stringToList(hdrAttribArch));
} else { } else {

View File

@ -217,15 +217,13 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
model = new DefaultTableModel(); model = new DefaultTableModel();
jTable = new JTable(model); jTable = new JTable(model);
jTable.setRowHeight(20); jTable.setRowHeight(20);
// jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jTable.setColumnSelectionAllowed(false); jTable.setColumnSelectionAllowed(false);
model.addColumn("Class Name"); model.addColumn("Class Name");
model.addColumn("Header"); model.addColumn("Header");
model.addColumn("Help Text"); model.addColumn("Help Text");
model.addColumn("Reserved"); model.addColumn("Recommended Instance");
model.addColumn("Reserved"); model.addColumn("Version");
// model.addColumn("Recommended Instance");
// model.addColumn("Version");
model.addColumn("Sup. Arch"); model.addColumn("Sup. Arch");
model.addColumn("Mod. Types"); model.addColumn("Mod. Types");
@ -236,7 +234,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
vArch.add("EBC"); vArch.add("EBC");
vArch.add("ARM"); vArch.add("ARM");
vArch.add("PPC"); vArch.add("PPC");
// jTable.getColumnModel().getColumn(cnSupArch).setCellEditor(new ListEditor(vArch)); jTable.getColumnModel().getColumn(cnSupArch).setCellEditor(new ListEditor(vArch));
Vector<String> vModule = new Vector<String>(); Vector<String> vModule = new Vector<String>();
vModule.add("BASE"); vModule.add("BASE");
@ -295,20 +293,16 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
if (m.getValueAt(row, cnSupMod) != null) { if (m.getValueAt(row, cnSupMod) != null) {
module = m.getValueAt(row, cnSupMod).toString(); module = m.getValueAt(row, cnSupMod).toString();
} }
String[] rowData = {lib, hdr, hlp}; String[] rowData = {lib, hdr, hlp, name, ver};
if (!dataValidation(rowData)) { if (!dataValidation(rowData)) {
return; return;
} }
docConsole.setSaved(false); docConsole.setSaved(false);
// LAH getLibInstances(lib); getLibInstances(lib);
String guid = nameToGuid(name);
if (name != null) { sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);
String guid = nameToGuid(name);
}
// LAH WAS sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);
sfc.updateSpdLibClass(row, lib, hdr, hlp, null, null, arch, module);
} }
} }
@ -494,17 +488,17 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
jContentPane.add(starLabel, null); jContentPane.add(starLabel, null);
jContentPane.add(jLabel2HelpText, null); jContentPane.add(jLabel2HelpText, null);
jContentPane.add(getJTextFieldHelp(), null); jContentPane.add(getJTextFieldHelp(), null);
// LAH Removed until we can fix permanently
// jContentPane.add(jLabel3RecInstName, null); jContentPane.add(jLabel3RecInstName, null);
// jContentPane.add(getJTextField1RecInstName(), null); jContentPane.add(getJTextField1RecInstName(), null);
// jContentPane.add(jLabel4RecInstVer, null); jContentPane.add(jLabel4RecInstVer, null);
// jContentPane.add(getJTextField2RecInstVer(), null); jContentPane.add(getJTextField2RecInstVer(), null);
jContentPane.add(jLabel5SupArchList, null); jContentPane.add(jLabel5SupArchList, null);
jContentPane.add(jLabel6SupModList, null); jContentPane.add(jLabel6SupModList, null);
jContentPane.add(getJScrollPaneModules(), null); jContentPane.add(getJScrollPaneModules(), null);
jContentPane.add(getJScrollPane1Arch(), null); jContentPane.add(getJScrollPane1Arch(), null);
// LAH jContentPane.add(getJComboBox(), null); jContentPane.add(getJComboBox(), null);
} }
@ -569,6 +563,8 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
row[cnClassName] = jTextFieldAdd.getText(); row[cnClassName] = jTextFieldAdd.getText();
row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/'); row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/');
row[cnHelpText] = jTextFieldHelp.getText(); row[cnHelpText] = jTextFieldHelp.getText();
row[cnRecInstName] = jComboBox.getSelectedItem()+"";
row[cnRecInstVer] = jTextField2RecInstVer.getText();
row[cnSupArch] = vectorToString(iCheckBoxList.getAllCheckedItemsString()); row[cnSupArch] = vectorToString(iCheckBoxList.getAllCheckedItemsString());
if (row[cnSupArch].length() == 0) { if (row[cnSupArch].length() == 0) {
row[cnSupArch] = null; row[cnSupArch] = null;
@ -587,10 +583,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
//convert to GUID before storing recommended lib instance. //convert to GUID before storing recommended lib instance.
// //
getLibInstances(row[cnClassName]); getLibInstances(row[cnClassName]);
// LAH recommendGuid = nameToGuid(row[3]); String recommendGuid = nameToGuid(row[cnRecInstName]);
// LAH WAS sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]); sfc.genSpdLibClassDeclarations(row[cnClassName], recommendGuid, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, row[cnRecInstVer], null, row[cnSupMod]);
sfc.genSpdLibClassDeclarations(row[cnClassName], null, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, row[cnRecInstVer], null, row[cnSupMod]);
} }
// //
@ -603,6 +598,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
int rowSelected = selectedRow; int rowSelected = selectedRow;
if (rowSelected >= 0) { if (rowSelected >= 0) {
model.removeRow(rowSelected); model.removeRow(rowSelected);
docConsole.setSaved(false);
sfc.removeSpdLibClass(rowSelected); sfc.removeSpdLibClass(rowSelected);
} }
} }
@ -611,7 +607,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
if (model.getRowCount() == 0) { if (model.getRowCount() == 0) {
return; return;
} }
docConsole.setSaved(false);
model.setRowCount(0); model.setRowCount(0);
sfc.removeSpdLibClass(); sfc.removeSpdLibClass();
} }
@ -624,9 +620,17 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
} }
if (!DataValidation.isPathAndFilename(row[cnHdrFile])) { if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {
JOptionPane.showMessageDialog(frame, "Include Header is NOT PathAndFilename Type."); JOptionPane.showMessageDialog(frame, "Include Header is NOT PathAndFilename Type.");
return false;
} }
if (row[cnHelpText].length() == 0) { if (row[cnHelpText].length() == 0) {
JOptionPane.showMessageDialog(frame, "Help Text Must NOT be empty."); JOptionPane.showMessageDialog(frame, "Help Text Must NOT be empty.");
return false;
}
if (row[cnRecInstVer].length() > 0) {
if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {
JOptionPane.showMessageDialog(frame, "Recommended Instance Version is NOT VersionDataType.");
return false;
}
} }
return true; return true;
} }
@ -892,7 +896,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
} }
private String nameToGuid(String name) { private String nameToGuid(String name) {
String s = ""; String s = null;
if (!libNameGuidMap.containsKey(name)) { if (!libNameGuidMap.containsKey(name)) {
return s; return s;
} }