fix the problem that if no data updated in wizard editors, the Save indicator will not pop-up.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1100 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-07-26 09:42:04 +00:00
parent 6c96db7120
commit a490bca85d
11 changed files with 414 additions and 200 deletions

View File

@ -641,14 +641,14 @@ public class SpdFileContents {
libClass[i][1] = lc.getIncludeHeader();
libClass[i][2] = lc.getHelpText();
// LAH added logic so you cannot set the version unless the GUID is defined.
/* LAH do not set now
if (lc.getRecommendedInstanceGuid() != null) {
// if (lc.getRecommendedInstanceGuid() != null) {
libClass[i][3] = lc.getRecommendedInstanceGuid();
if (lc.getRecommendedInstanceVersion() != null) {
// if (lc.getRecommendedInstanceVersion() != null) {
libClass[i][4] = lc.getRecommendedInstanceVersion();
}
}
*/
// }
// }
if (lc.getSupArchList() != null) {
libClass[i][5] = listToString(lc.getSupArchList());
}
@ -994,6 +994,27 @@ public class SpdFileContents {
incHdrAttribModuleType, spdLibClassDeclarations);
}
public void getSpdLibClassDeclaration(String[] sa, int i) {
if (getSpdLibClassDeclarations() == null) {
return;
}
XmlCursor cursor = getSpdLibClassDeclarations().newCursor();
if (cursor.toFirstChild()) {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();
sa[0] = lc.getName();
sa[1] = lc.getIncludeHeader();
sa[2] = lc.getHelpText();
sa[3] = lc.getRecommendedInstanceGuid();
sa[4] = lc.getRecommendedInstanceVersion();
sa[5] = listToString(lc.getSupArchList());
sa[6] = listToString(lc.getSupModuleList());
}
cursor.dispose();
}
/**
Set library class declaration contents under parent tag
@ -1119,6 +1140,20 @@ public class SpdFileContents {
}
public void getSpdMsaFile (String[] sa, int i) {
if (getSpdMsaFiles() == null) {
return;
}
XmlCursor cursor = getSpdMsaFiles().newCursor();
if (cursor.toFirstChild()) {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
sa[0] = cursor.getTextValue();
}
cursor.dispose();
}
/**
Set MsaFile contents under parent element.
@ -1160,6 +1195,22 @@ public class SpdFileContents {
hdrAttribVer, hdrAttribOverID, spdModHdrs);
}
public void getSpdModuleHeader(String[] sa, int i) {
if (getSpdModHdrs() == null) {
return;
}
XmlCursor cursor = getSpdModHdrs().newCursor();
if (cursor.toFirstChild()) {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();
sa[0] = ih.getModuleType()+"";
sa[1] = ih.getStringValue();
}
cursor.dispose();
}
/**
Generate GUID declaration element using parameters passed in.
@ -1214,6 +1265,69 @@ public class SpdFileContents {
setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, archList, modTypeList, guidTypeList, spdPpiDeclarations);
}
public void getSpdGuidDeclaration(String[] sa, int i) {
if (getSpdGuidDeclarations() == null) {
return;
}
getSpdEntry(sa, i, getSpdGuidDeclarations());
}
public void getSpdProtocolDeclaration(String[] sa, int i) {
if (getSpdProtocolDeclarations() == null) {
return;
}
getSpdEntry(sa, i, getSpdProtocolDeclarations());
}
public void getSpdPpiDeclaration(String[] sa, int i) {
if (getSpdPpiDeclarations() == null) {
return;
}
getSpdEntry(sa, i, getSpdPpiDeclarations());
}
public void getSpdEntry(String[] sa, int i, XmlObject parent) {
XmlCursor cursor = parent.newCursor();
if (cursor.toFirstChild()) {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {
GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();
sa[0] = e.getName();
sa[1] = e.getCName();
sa[2] = e.getGuidValue();
sa[3] = e.getHelpText();
sa[4] = listToString(e.getSupArchList());
sa[5] = listToString(e.getSupModuleList());
sa[6] = listToString(e.getGuidTypeList());
}
if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();
sa[0] = e.getName();
sa[1] = e.getCName();
sa[2] = e.getGuidValue();
sa[3] = e.getHelpText();
sa[4] = listToString(e.getSupArchList());
sa[5] = listToString(e.getSupModuleList());
sa[6] = listToString(e.getGuidTypeList());
}
if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();
sa[0] = e.getName();
sa[1] = e.getCName();
sa[2] = e.getGuidValue();
sa[3] = e.getHelpText();
sa[4] = listToString(e.getSupArchList());
sa[5] = listToString(e.getSupModuleList());
sa[6] = listToString(e.getGuidTypeList());
}
}
cursor.dispose();
}
/**
Set Entry contents using parameters passed in
@ -1359,6 +1473,30 @@ public class SpdFileContents {
defaultString, archList, modTypeList, spdPcdDefinitions);
}
public void getSpdPcdDeclaration(String[] sa, int i) {
if (getSpdPcdDefinitions() == null) {
return;
}
XmlCursor cursor = getSpdPcdDefinitions().newCursor();
if (cursor.toFirstChild()) {
for (int j = 0; j < i; ++j) {
cursor.toNextSibling();
}
PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();
sa[0] = pe.getCName();
sa[1] = pe.getToken()+"";
sa[2] = pe.getTokenSpaceGuidCName();
sa[3] = pe.getDatumType()+"";
sa[4] = pe.getDefaultValue();
sa[5] = pe.getHelpText();
sa[6] = listToString(pe.getValidUsage());
sa[7] = listToString(pe.getSupArchList());
sa[8] = listToString(pe.getSupModuleList());
}
cursor.dispose();
}
/**
Set Pcd entry contents under parent tag

View File

@ -129,7 +129,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
private JLabel jLabel3 = null;
protected String[][] saa = null;
/**
This method initializes this
@ -237,6 +237,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
}
else{
selectedRow = lsm.getMinSelectionIndex();
}
}
});
@ -250,14 +251,28 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
public void tableChanged(TableModelEvent arg0) {
// TODO Auto-generated method stub
int row = arg0.getFirstRow();
int column = arg0.getColumn();
TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
updateRow(row, m);
updateRow(row, column, m);
}
}
protected void updateRow(int row, TableModel m){
protected void updateRow(int row, int column, TableModel m){
String[] sa = new String[7];
sfc.getSpdGuidDeclaration(sa, row);
Object cellData = m.getValueAt(row, column);
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[column])) {
return;
}
if (cellData.toString().length() == 0 && sa[column] == null) {
return;
}
String name = m.getValueAt(row, 0) + "";
String cName = m.getValueAt(row, 1) + "";
String guid = m.getValueAt(row, 2) + "";
@ -409,7 +424,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
//
// initialize table using SpdFileContents object
//
String[][] saa = new String[sfc.getSpdGuidDeclarationCount()][7];
saa = new String[sfc.getSpdGuidDeclarationCount()][7];
sfc.getSpdGuidDeclarations(saa);
int i = 0;
while (i < saa.length) {

View File

@ -32,7 +32,6 @@ import javax.swing.JTextField;
import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Log;
import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
@ -144,6 +143,9 @@ public class SpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Package Name is NOT UiNameType.");
return;
}
if (jTextFieldBaseName.getText().equals(sfc.getSpdHdrPkgName())) {
return;
}
docConsole.setSaved(false);
sfc.setSpdHdrPkgName(jTextFieldBaseName.getText());
}
@ -169,6 +171,9 @@ public class SpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Guid is NOT GuidType.");
return;
}
if (jTextFieldGuid.getText().equals(sfc.getSpdHdrGuidValue())) {
return;
}
docConsole.setSaved(false);
sfc.setSpdHdrGuidValue(jTextFieldGuid.getText());
}
@ -194,6 +199,9 @@ public class SpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Version is NOT version type.");
return;
}
if (jTextFieldVersion.getText().equals(sfc.getSpdHdrVer())){
return;
}
docConsole.setSaved(false);
sfc.setSpdHdrVer(jTextFieldVersion.getText());
}
@ -228,7 +236,6 @@ public class SpdHeader extends IInternalFrame {
if (jTextAreaLicense == null) {
jTextAreaLicense = new JTextArea();
jTextAreaLicense.setText("");
// jTextAreaLicense.setPreferredSize(new java.awt.Dimension(317,77));
jTextAreaLicense.setLineWrap(true);
jTextAreaLicense.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
@ -236,6 +243,9 @@ public class SpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "License contents could NOT be empty.");
return;
}
if (jTextAreaLicense.getText().equals(sfc.getSpdHdrLicense())) {
return;
}
docConsole.setSaved(false);
sfc.setSpdHdrLicense(jTextAreaLicense.getText());
}
@ -254,13 +264,15 @@ public class SpdHeader extends IInternalFrame {
if (jTextAreaDescription == null) {
jTextAreaDescription = new JTextArea();
jTextAreaDescription.setLineWrap(true);
// jTextAreaDescription.setPreferredSize(new java.awt.Dimension(317,77));
jTextAreaDescription.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
if (jTextAreaDescription.getText().length() == 0) {
JOptionPane.showMessageDialog(frame, "Description contents could NOT be empty.");
return;
}
if (jTextAreaDescription.getText().equals(sfc.getSpdHdrDescription())) {
return;
}
docConsole.setSaved(false);
sfc.setSpdHdrDescription(jTextAreaDescription.getText());
}
@ -374,6 +386,9 @@ public class SpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Abstract could NOT be empty.");
return;
}
if (jTextFieldAbstract.getText().equals(sfc.getSpdHdrAbs())) {
return;
}
docConsole.setSaved(false);
sfc.setSpdHdrAbs(jTextFieldAbstract.getText());
}
@ -399,6 +414,9 @@ public class SpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Copyright contents could not be empty.");
return;
}
if (jTextFieldCopyright.getText().equals(sfc.getSpdHdrCopyright())) {
return;
}
docConsole.setSaved(false);
sfc.setSpdHdrCopyright(jTextFieldCopyright.getText());
}
@ -419,6 +437,12 @@ public class SpdHeader extends IInternalFrame {
jTextField.setPreferredSize(new java.awt.Dimension(320, 20));
jTextField.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
if (jTextField.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {
return;
}
if (jTextField.getText().equals(sfc.getSpdHdrUrl())) {
return;
}
sfc.setSpdHdrLicense(jTextAreaLicense.getText());
sfc.setSpdHdrUrl(jTextField.getText());
docConsole.setSaved(false);
@ -612,98 +636,15 @@ public class SpdHeader extends IInternalFrame {
*
*/
public void actionPerformed(ActionEvent arg0) {
docConsole.setSaved(false);
if (arg0.getSource() == jButtonOk) {
this.save();
this.setEdited(true);
}
if (arg0.getSource() == jButtonCancel) {
this.setEdited(false);
}
if (arg0.getSource() == jButtonGenerateGuid) {
//ToDo: invoke GuidValueEditor
jTextFieldGuid.setText(Tools.generateUuidString());
docConsole.setSaved(false);
sfc.setSpdHdrGuidValue(jTextFieldGuid.getText());
}
}
/**
Data validation for all fields
@retval true - All datas are valid
@retval false - At least one data is invalid
**/
public boolean check() {
//
// Check if all required fields are not empty
//
if (isEmpty(this.jTextFieldBaseName.getText())) {
Log.wrn("Update Spd Header", "Base Name couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldGuid.getText())) {
Log.wrn("Update Spd Header", "Guid couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldVersion.getText())) {
Log.wrn("Update Spd Header", "Version couldn't be empty");
return false;
}
if (isEmpty(this.jTextAreaLicense.getText())) {
Log.wrn("Update Spd Header", "License couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldCopyright.getText())) {
Log.wrn("Update Spd Header", "Copyright couldn't be empty");
return false;
}
if (isEmpty(this.jTextAreaDescription.getText())) {
Log.wrn("Update Spd Header", "Description couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldAbstract.getText())) {
Log.wrn("Update Spd Header", "Abstract couldn't be empty");
return false;
}
//
// Check if all fields have correct data types
//
if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
Log.wrn("Update Spd Header", "Incorrect data type for Base Name");
return false;
}
if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
Log.wrn("Update Spd Header", "Incorrect data type for Guid");
return false;
}
if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
Log.wrn("Update Spd Header", "Incorrect data type for Abstract");
return false;
}
if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {
Log.wrn("Update Spd Header", "Incorrect data type for Copyright");
return false;
}
return true;
}
/**
Save all components of Spd Header
if exists spdHeader, set the value directly
if not exists spdHeader, new an instance first
**/
public void save() {
try {
} catch (Exception e) {
Log.wrn("Save Package", e.getMessage());
Log.err("Save Package", e.getMessage());
}
}
/**
This method initializes Package type and Compontent type

View File

@ -278,13 +278,21 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
public void tableChanged(TableModelEvent arg0) {
// TODO Auto-generated method stub
int row = arg0.getFirstRow();
int column = arg0.getColumn();
TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
String lib = m.getValueAt(row, cnClassName) + "";
String hdr = m.getValueAt(row, cnHdrFile) + "";
String hlp = m.getValueAt(row, cnHelpText) + "";
String name = m.getValueAt(row, cnRecInstName) + "";
String ver = m.getValueAt(row, cnRecInstVer) + "";
String name = null;
if (m.getValueAt(row, cnRecInstName) != null) {
name = m.getValueAt(row, cnRecInstName).toString();
}
String ver = null;
if (m.getValueAt(row, cnRecInstVer) != null){
ver = m.getValueAt(row, cnRecInstVer).toString();
}
String arch = null;
if (m.getValueAt(row, cnSupArch) != null) {
arch = m.getValueAt(row, cnSupArch).toString();
@ -297,11 +305,40 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
if (!dataValidation(rowData)) {
return;
}
docConsole.setSaved(false);
String guid = null;
if (name != null && name.length() > 0) {
getLibInstances(lib);
String guid = nameToGuid(name);
guid = nameToGuid(name);
}
String[] sa = new String[7];
sfc.getSpdLibClassDeclaration(sa, row);
Object cellData = m.getValueAt(row, column);
if (cellData == null) {
cellData = "";
}
if (column == cnRecInstName) {
if (guid == null) {
if (sa[cnRecInstName] == null) {
return;
}
}
else {
if (guid.equals(sa[cnRecInstName])) {
return;
}
}
}
else {
if (cellData.equals(sa[column])) {
return;
}
if (cellData.toString().length() == 0 && sa[column] == null) {
return;
}
}
docConsole.setSaved(false);
sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);
}
}
@ -576,9 +613,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
if (!dataValidation(row)) {
return;
}
model.addRow(row);
jTable.changeSelection(model.getRowCount()-1, 0, false, false);
docConsole.setSaved(false);
//
//convert to GUID before storing recommended lib instance.
//
@ -586,7 +620,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
String recommendGuid = nameToGuid(row[cnRecInstName]);
sfc.genSpdLibClassDeclarations(row[cnClassName], recommendGuid, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, row[cnRecInstVer], null, row[cnSupMod]);
model.addRow(row);
jTable.changeSelection(model.getRowCount()-1, 0, false, false);
docConsole.setSaved(false);
}
//
// remove selected line
@ -626,7 +662,12 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
JOptionPane.showMessageDialog(frame, "Help Text Must NOT be empty.");
return false;
}
if (row[cnRecInstVer].length() > 0) {
if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) {
if (row[cnRecInstName] == null || row[cnRecInstName].length() == 0) {
JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with Instance Name.");
return false;
}
if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {
JOptionPane.showMessageDialog(frame, "Recommended Instance Version is NOT VersionDataType.");
return false;
@ -898,6 +939,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
private String nameToGuid(String name) {
String s = null;
if (!libNameGuidMap.containsKey(name)) {
JOptionPane.showMessageDialog(frame, "Recommended Instance NOT exists.");
return s;
}

View File

@ -381,8 +381,21 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
public void tableChanged(TableModelEvent arg0) {
// TODO Auto-generated method stub
int row = arg0.getFirstRow();
int column = arg0.getColumn();
TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
String[] sa = new String[1];
sfc.getSpdMsaFile(sa, row);
Object cellData = m.getValueAt(row, column);
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[column])) {
return;
}
if (cellData.toString().length() == 0 && sa[column] == null) {
return;
}
String file = m.getValueAt(row, 0) + "";
if (file.length() == 0) {
JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");

View File

@ -128,6 +128,9 @@ public class SpdPackageDefinitions extends IInternalFrame {
jComboBoxReadOnly.setSelectedIndex(1);
jComboBoxReadOnly.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
if (jComboBoxReadOnly.getSelectedItem().equals(sfc.getSpdPkgDefsRdOnly())) {
return;
}
if (docConsole != null) {
docConsole.setSaved(false);
}
@ -153,6 +156,9 @@ public class SpdPackageDefinitions extends IInternalFrame {
jComboBoxRePackage.setSelectedIndex(0);
jComboBoxRePackage.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
if (jComboBoxRePackage.getSelectedItem().equals(sfc.getSpdPkgDefsRePkg())) {
return;
}
if (docConsole != null) {
docConsole.setSaved(false);
}

View File

@ -564,8 +564,21 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
public void tableChanged(TableModelEvent arg0) {
// TODO Auto-generated method stub
int row = arg0.getFirstRow();
int column = arg0.getColumn();
TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
String[] sa = new String[2];
sfc.getSpdModuleHeader(sa, row);
Object cellData = m.getValueAt(row, column);
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[column])) {
return;
}
if (cellData.toString().length() == 0 && sa[column] == null) {
return;
}
String pkg = m.getValueAt(row, 0) + "";
String hdr = m.getValueAt(row, 1) + "";
String[] rowData = {pkg, hdr};

View File

@ -721,16 +721,66 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
public void tableChanged(TableModelEvent arg0) {
// TODO Auto-generated method stub
int row = arg0.getFirstRow();
int column = arg0.getColumn();
TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
String[] sa = new String[9];
sfc.getSpdPcdDeclaration(sa, row);
Object cellData = m.getValueAt(row, column);
if (column < 6) {
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[column])) {
return;
}
if (cellData.toString().length() == 0 && sa[column] == null) {
return;
}
}
String usage = getValidUsage(new Boolean(m.getValueAt(row, 6)+""), new Boolean(m.getValueAt(row, 7)+""), new Boolean(m.getValueAt(row, 8)+""), new Boolean(m.getValueAt(row, 9)+""), new Boolean(m.getValueAt(row, 10)+""));
if (usage.length() == 0) {
JOptionPane.showMessageDialog(frame, "You must choose at least one usage for PCD entry.");
return;
}
if (column <= 10 && column >= 6) {
if (compareTwoVectors(stringToVector(usage), stringToVector(sa[6]))) {
return;
}
}
if (column == 11) {
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[7])) {
return;
}
if (cellData.toString().length() == 0 && sa[7] == null) {
return;
}
}
if (column == 12) {
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[8])) {
return;
}
if (cellData.toString().length() == 0 && sa[8] == null) {
return;
}
}
String cName = m.getValueAt(row, 0) + "";
String token = m.getValueAt(row, 1) + "";
String ts = m.getValueAt(row, 2) + "";
String dataType = m.getValueAt(row, 3) + "";
String defaultVal = m.getValueAt(row, 4) + "";
String help = m.getValueAt(row, 5) + "";
String usage = getValidUsage(new Boolean(m.getValueAt(row, 6)+""), new Boolean(m.getValueAt(row, 7)+""), new Boolean(m.getValueAt(row, 8)+""), new Boolean(m.getValueAt(row, 9)+""), new Boolean(m.getValueAt(row, 10)+""));
String archList = null;
if (m.getValueAt(row, 11) != null){
@ -740,10 +790,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
if (m.getValueAt(row, 12) != null) {
modTypeList = m.getValueAt(row, 12).toString();
}
if (usage.length() == 0) {
JOptionPane.showMessageDialog(frame, "You must choose at least one usage for PCD entry.");
return;
}
Object[] o = {cName, token, ts, dataType, defaultVal, help};
if (!dataValidation(o)){
return;
@ -967,6 +1014,30 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
}
return s.trim();
}
protected Vector<String> stringToVector(String s){
if (s == null) {
return null;
}
String[] sArray = s.split(" ");
Vector<String> v = new Vector<String>();
for (int i = 0; i < sArray.length; ++i) {
v.add(sArray[i]);
}
return v;
}
private boolean compareTwoVectors(Vector v1, Vector v2) {
if (v1.size() != v2.size()) {
return false;
}
for (int i = 0; i < v1.size(); ++i) {
if (!v2.contains(v1.get(i))) {
return false;
}
}
return true;
}
} // @jve:decl-index=0:visual-constraint="22,11"
class CheckboxTableModel extends DefaultTableModel {

View File

@ -62,7 +62,7 @@ public class SpdPpiDecls extends SpdGuidDecls {
if (sfc.getSpdPpiDeclarationCount() == 0) {
return ;
}
String[][] saa = new String[sfc.getSpdPpiDeclarationCount()][7];
saa = new String[sfc.getSpdPpiDeclarationCount()][7];
sfc.getSpdPpiDeclarations(saa);
int i = 0;
while (i < saa.length) {
@ -71,7 +71,20 @@ public class SpdPpiDecls extends SpdGuidDecls {
}
}
protected void updateRow(int row, TableModel m){
protected void updateRow(int row, int column, TableModel m){
String[] sa = new String[7];
sfc.getSpdPpiDeclaration(sa, row);
Object cellData = m.getValueAt(row, column);
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[column])) {
return;
}
if (cellData.toString().length() == 0 && sa[column] == null) {
return;
}
String name = m.getValueAt(row, 0) + "";
String cName = m.getValueAt(row, 1) + "";
String guid = m.getValueAt(row, 2) + "";

View File

@ -62,7 +62,7 @@ public class SpdProtocolDecls extends SpdGuidDecls {
if (sfc.getSpdProtocolDeclarationCount() == 0) {
return ;
}
String[][] saa = new String[sfc.getSpdProtocolDeclarationCount()][7];
saa = new String[sfc.getSpdProtocolDeclarationCount()][7];
sfc.getSpdProtocolDeclarations(saa);
int i = 0;
while (i < saa.length) {
@ -72,7 +72,20 @@ public class SpdProtocolDecls extends SpdGuidDecls {
}
protected void updateRow(int row, TableModel m){
protected void updateRow(int row, int column, TableModel m){
String[] sa = new String[7];
sfc.getSpdProtocolDeclaration(sa, row);
Object cellData = m.getValueAt(row, column);
if (cellData == null) {
cellData = "";
}
if (cellData.equals(sa[column])) {
return;
}
if (cellData.toString().length() == 0 && sa[column] == null) {
return;
}
String name = m.getValueAt(row, 0) + "";
String cName = m.getValueAt(row, 1) + "";
String guid = m.getValueAt(row, 2) + "";

View File

@ -35,7 +35,6 @@ import javax.swing.JTextField;
import org.tianocore.PlatformSurfaceAreaDocument;
import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Log;
import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
@ -146,6 +145,9 @@ public class FpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Package Name is NOT UiNameType.");
return;
}
if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) {
return;
}
docConsole.setSaved(false);
ffc.setFpdHdrPlatformName(jTextFieldBaseName.getText());
}
@ -171,6 +173,9 @@ public class FpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Guid is NOT GuidType.");
return;
}
if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) {
return;
}
docConsole.setSaved(false);
ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());
}
@ -196,6 +201,9 @@ public class FpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Version is NOT version type.");
return;
}
if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) {
return;
}
docConsole.setSaved(false);
ffc.setFpdHdrVer(jTextFieldVersion.getText());
}
@ -237,6 +245,9 @@ public class FpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "License contents could NOT be empty.");
return;
}
if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) {
return;
}
docConsole.setSaved(false);
ffc.setFpdHdrLicense(jTextAreaLicense.getText());
}
@ -261,6 +272,9 @@ public class FpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Description contents could NOT be empty.");
return;
}
if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) {
return;
}
docConsole.setSaved(false);
ffc.setFpdHdrDescription(jTextAreaDescription.getText());
}
@ -374,6 +388,9 @@ public class FpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Abstract could NOT be empty.");
return;
}
if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) {
return;
}
docConsole.setSaved(false);
ffc.setFpdHdrAbs(jTextFieldAbstract.getText());
}
@ -399,6 +416,9 @@ public class FpdHeader extends IInternalFrame {
JOptionPane.showMessageDialog(frame, "Copyright contents could not be empty.");
return;
}
if (jTextFieldCopyright.getText().equals(ffc.getFpdHdrCopyright())) {
return;
}
docConsole.setSaved(false);
ffc.setFpdHdrCopyright(jTextFieldCopyright.getText());
}
@ -419,6 +439,12 @@ public class FpdHeader extends IInternalFrame {
jTextField.setPreferredSize(new Dimension(320, 20));
jTextField.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
if (jTextField.getText().length() == 0 && ffc.getFpdHdrUrl() == null) {
return;
}
if (jTextField.getText().equals(ffc.getFpdHdrUrl())) {
return;
}
ffc.setFpdHdrLicense(jTextAreaLicense.getText());
ffc.setFpdHdrUrl(jTextField.getText());
docConsole.setSaved(false);
@ -613,13 +639,7 @@ public class FpdHeader extends IInternalFrame {
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
this.save();
this.setEdited(true);
}
if (arg0.getSource() == jButtonCancel) {
this.setEdited(false);
}
if (arg0.getSource() == jButtonGenerateGuid) {
docConsole.setSaved(false);
jTextFieldGuid.setText(Tools.generateUuidString());
@ -627,77 +647,6 @@ public class FpdHeader extends IInternalFrame {
}
}
/**
Data validation for all fields
@retval true - All datas are valid
@retval false - At least one data is invalid
**/
public boolean check() {
//
// Check if all required fields are not empty
//
if (isEmpty(this.jTextFieldBaseName.getText())) {
Log.wrn("Update Fpd Header", "Base Name couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldGuid.getText())) {
Log.wrn("Update Fpd Header", "Guid couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldVersion.getText())) {
Log.wrn("Update Fpd Header", "Version couldn't be empty");
return false;
}
if (isEmpty(this.jTextAreaLicense.getText())) {
Log.wrn("Update Fpd Header", "License couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldCopyright.getText())) {
Log.wrn("Update Fpd Header", "Copyright couldn't be empty");
return false;
}
if (isEmpty(this.jTextAreaDescription.getText())) {
Log.wrn("Update Fpd Header", "Description couldn't be empty");
return false;
}
if (isEmpty(this.jTextFieldAbstract.getText())) {
Log.wrn("Update Fpd Header", "Abstract couldn't be empty");
return false;
}
//
// Check if all fields have correct data types
//
if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
Log.wrn("Update Fpd Header", "Incorrect data type for Base Name");
return false;
}
if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
Log.wrn("Update Fpd Header", "Incorrect data type for Guid");
return false;
}
if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
Log.wrn("Update Fpd Header", "Incorrect data type for Abstract");
return false;
}
if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) {
Log.wrn("Update Fpd Header", "Incorrect data type for Copyright");
return false;
}
return true;
}
/**
Save all components of Fpd Header
if exists FpdHeader, set the value directly
if not exists FpdHeader, new an instance first
**/
public void save() {
}
/**
This method initializes Package type and Compontent type