From d129bd96faae876cbdab473d54a42fb340eaba33 Mon Sep 17 00:00:00 2001 From: jlin16 Date: Mon, 17 Jul 2006 07:35:43 +0000 Subject: [PATCH] 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 --- .../packaging/ui/SpdFileContents.java | 15 +++++- .../packaging/ui/SpdLibClassDecls.java | 54 ++++++++++--------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java index 6bd63d43b4..e856cfce4c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java @@ -348,6 +348,9 @@ public class SpdFileContents { if (lc.isSetRecommendedInstanceGuid()) { lc.unsetRecommendedInstanceGuid(); } + if (lc.isSetRecommendedInstanceVersion()) { + lc.unsetRecommendedInstanceVersion(); + } } if (stringToList(hdrAttribArch) != null){ @@ -1011,14 +1014,22 @@ public class SpdFileContents { lc.setIncludeHeader(clsIncludeFile); lc.setHelpText(help); // LAH added logic so you cannot set the version unless the GUID is defined. -/* LAH + if (clsUsage != null) { lc.setRecommendedInstanceGuid(clsUsage); if (instanceVer != null) { lc.setRecommendedInstanceVersion(instanceVer); } } -*/ + else { + if (lc.isSetRecommendedInstanceGuid()) { + lc.unsetRecommendedInstanceGuid(); + } + if (lc.isSetRecommendedInstanceVersion()) { + lc.unsetRecommendedInstanceVersion(); + } + } + if (hdrAttribArch != null) { lc.setSupArchList(stringToList(hdrAttribArch)); } else { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java index dade30d282..51c8ee9a75 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java @@ -217,15 +217,13 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen model = new DefaultTableModel(); jTable = new JTable(model); jTable.setRowHeight(20); -// jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); + jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); jTable.setColumnSelectionAllowed(false); model.addColumn("Class Name"); model.addColumn("Header"); model.addColumn("Help Text"); - model.addColumn("Reserved"); - model.addColumn("Reserved"); -// model.addColumn("Recommended Instance"); -// model.addColumn("Version"); + model.addColumn("Recommended Instance"); + model.addColumn("Version"); model.addColumn("Sup. Arch"); model.addColumn("Mod. Types"); @@ -236,7 +234,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen vArch.add("EBC"); vArch.add("ARM"); vArch.add("PPC"); -// jTable.getColumnModel().getColumn(cnSupArch).setCellEditor(new ListEditor(vArch)); + jTable.getColumnModel().getColumn(cnSupArch).setCellEditor(new ListEditor(vArch)); Vector vModule = new Vector(); vModule.add("BASE"); @@ -295,20 +293,16 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen if (m.getValueAt(row, cnSupMod) != null) { module = m.getValueAt(row, cnSupMod).toString(); } - String[] rowData = {lib, hdr, hlp}; + String[] rowData = {lib, hdr, hlp, name, ver}; if (!dataValidation(rowData)) { return; } docConsole.setSaved(false); -// LAH getLibInstances(lib); - - if (name != null) { - String guid = nameToGuid(name); - } + getLibInstances(lib); + 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); + sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module); } } @@ -494,17 +488,17 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jContentPane.add(starLabel, null); jContentPane.add(jLabel2HelpText, null); jContentPane.add(getJTextFieldHelp(), null); -// LAH Removed until we can fix permanently -// jContentPane.add(jLabel3RecInstName, null); -// jContentPane.add(getJTextField1RecInstName(), null); -// jContentPane.add(jLabel4RecInstVer, null); -// jContentPane.add(getJTextField2RecInstVer(), null); + + jContentPane.add(jLabel3RecInstName, null); + jContentPane.add(getJTextField1RecInstName(), null); + jContentPane.add(jLabel4RecInstVer, null); + jContentPane.add(getJTextField2RecInstVer(), null); jContentPane.add(jLabel5SupArchList, null); jContentPane.add(jLabel6SupModList, null); jContentPane.add(getJScrollPaneModules(), 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[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/'); row[cnHelpText] = jTextFieldHelp.getText(); + row[cnRecInstName] = jComboBox.getSelectedItem()+""; + row[cnRecInstVer] = jTextField2RecInstVer.getText(); row[cnSupArch] = vectorToString(iCheckBoxList.getAllCheckedItemsString()); if (row[cnSupArch].length() == 0) { row[cnSupArch] = null; @@ -587,10 +583,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen //convert to GUID before storing recommended lib instance. // 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], null, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, row[cnRecInstVer], null, row[cnSupMod]); + sfc.genSpdLibClassDeclarations(row[cnClassName], recommendGuid, 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; if (rowSelected >= 0) { model.removeRow(rowSelected); + docConsole.setSaved(false); sfc.removeSpdLibClass(rowSelected); } } @@ -611,7 +607,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen if (model.getRowCount() == 0) { return; } - + docConsole.setSaved(false); model.setRowCount(0); sfc.removeSpdLibClass(); } @@ -624,9 +620,17 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen } if (!DataValidation.isPathAndFilename(row[cnHdrFile])) { JOptionPane.showMessageDialog(frame, "Include Header is NOT PathAndFilename Type."); + return false; } if (row[cnHelpText].length() == 0) { 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; } @@ -892,7 +896,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen } private String nameToGuid(String name) { - String s = ""; + String s = null; if (!libNameGuidMap.containsKey(name)) { return s; }