diff options
author | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-05 08:16:05 +0000 |
---|---|---|
committer | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-05 08:16:05 +0000 |
commit | ce73a791eb81b088783de77a5c72565154b215f6 (patch) | |
tree | b61f856b36cb0e2dc927fb31d853fb7820e58e3f | |
parent | 78d0508ad9e44e8e7975ee852b9fefb0843a5c6f (diff) | |
download | edk2-platforms-ce73a791eb81b088783de77a5c72565154b215f6.tar.xz |
Add Data Validations for SPD editor.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@765 6f19259b-4bc3-4df7-8a09-765794883524
10 files changed, 431 insertions, 236 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 24fab96634..5bac8be0cd 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 @@ -19,7 +19,6 @@ import java.util.List; import java.util.ListIterator;
import java.util.Vector;
-import javax.xml.namespace.QName;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
@@ -360,15 +359,24 @@ public class SpdFileContents { e.setCName(cName);
e.setGuidValue(guid);
e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null && !guidTypeList.equals("")) {
+ if (stringToList(guidTypeList) != null) {
e.setGuidTypeList(stringToList(guidTypeList));
}
+ else{
+ e.setGuidTypeList(null);
+ }
if (stringToList(archList) != null){
e.setSupArchList(stringToList(archList));
}
+ else{
+ e.setSupArchList(null);
+ }
if (stringToList(modTypeList) != null) {
e.setSupModuleList(stringToList(modTypeList));
}
+ else{
+ e.setSupModuleList(null);
+ }
}
cursor.dispose();
@@ -394,9 +402,15 @@ public class SpdFileContents { if (stringToList(archList) != null){
e.setSupArchList(stringToList(archList));
}
+ else{
+ e.setSupArchList(null);
+ }
if (stringToList(modTypeList) != null) {
e.setSupModuleList(stringToList(modTypeList));
}
+ else{
+ e.setSupModuleList(null);
+ }
}
cursor.dispose();
}
@@ -421,9 +435,15 @@ public class SpdFileContents { if (stringToList(archList) != null){
e.setSupArchList(stringToList(archList));
}
+ else{
+ e.setSupArchList(null);
+ }
if (stringToList(modTypeList) != null) {
e.setSupModuleList(stringToList(modTypeList));
}
+ else{
+ e.setSupModuleList(null);
+ }
}
cursor.dispose();
}
@@ -1093,15 +1113,18 @@ public class SpdFileContents { e.setCName(cName);
e.setGuidValue(guid);
e.setHelpText(help);
- 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));
- }
+ 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));
+// }
return;
}
if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
@@ -1111,12 +1134,14 @@ public class SpdFileContents { pe.setCName(cName);
pe.setGuidValue(guid);
pe.setHelpText(help);
- if (archList != null && archList.size() > 0){
- pe.setSupArchList(new ArrayList<String>(archList));
- }
- if (modTypeList != null && modTypeList.size() > 0) {
- pe.setSupModuleList(new ArrayList<String>(modTypeList));
- }
+ 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));
+// }
return;
}
if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
@@ -1126,12 +1151,14 @@ public class SpdFileContents { ppe.setCName(cName);
ppe.setGuidValue(guid);
ppe.setHelpText(help);
- if (archList != null && archList.size() > 0){
- ppe.setSupArchList(new ArrayList<String>(archList));
- }
- if (archList != null && modTypeList.size() > 0) {
- ppe.setSupModuleList(new ArrayList<String>(modTypeList));
- }
+ 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));
+// }
return;
}
@@ -1507,10 +1534,10 @@ public class SpdFileContents { }
private List<String> stringToList(String s){
- if (s == null) {
+ if (s == null || s.length() == 0) {
return null;
}
- ArrayList<String> al = new ArrayList<String>();
+ Vector<String> al = new Vector<String>();
String[] sArray = s.split(" ");
for(int i = 0; i < sArray.length; ++i){
al.add(sArray[i]);
@@ -1518,7 +1545,7 @@ public class SpdFileContents { return al;
}
- private String listToString(List<String> l) {
+ private String listToString(List l) {
if (l == null) {
return null;
}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java index 2eaf87054c..6fe9d43bb2 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java @@ -12,25 +12,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.frameworkwizard.packaging.ui;
-import java.awt.BorderLayout;
import java.awt.Dimension;
-import java.awt.Toolkit;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
-import java.io.File;
import java.util.Vector;
-import javax.swing.DefaultListModel;
-import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JRadioButton;
import javax.swing.JTable;
import javax.swing.JTextField;
-import javax.swing.JComboBox;
import javax.swing.JLabel;
-import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -45,11 +36,12 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel;
import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
+import org.tianocore.frameworkwizard.platform.ui.ListEditor;
/**
GUI for create library definition elements of spd file.
@@ -57,6 +49,11 @@ import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList; @since PackageEditor 1.0
**/
public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
static JFrame frame;
private SpdFileContents sfc = null;
@@ -190,6 +187,41 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ model.addColumn("GuidTypes");
jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());
+ Vector<String> vArch = new Vector<String>();
+ vArch.add("IA32");
+ vArch.add("X64");
+ vArch.add("IPF");
+ vArch.add("EBC");
+ vArch.add("ARM");
+ vArch.add("PPC");
+ jTable.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch));
+
+ Vector<String> vModule = new Vector<String>();
+ vModule.add("BASE");
+ vModule.add("SEC");
+ vModule.add("PEI_CORE");
+ vModule.add("PEIM");
+ vModule.add("DXE_CORE");
+ vModule.add("DXE_DRIVER");
+ vModule.add("DXE_RUNTIME_DRIVER");
+ vModule.add("DXE_SAL_DRIVER");
+ vModule.add("DXE_SMM_DRIVER");
+ vModule.add("UEFI_DRIVER");
+ vModule.add("UEFI_APPLICATION");
+ vModule.add("USER_DEFINED");
+ jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vModule));
+
+ Vector<String> vGuid = new Vector<String>();
+ vGuid.add("DATA_HUB_RECORD");
+ vGuid.add("EFI_EVENT");
+ vGuid.add("EFI_SYSTEM_CONFIGURATION_TABLE");
+ vGuid.add("EFI_VARIABLE");
+ vGuid.add("GUID");
+ vGuid.add("HII_PACKAGE_LIST");
+ vGuid.add("HOB");
+ vGuid.add("TOKEN_SPACE_GUID");
+ jTable.getColumnModel().getColumn(6).setCellEditor(new ListEditor(vGuid));
+
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e) {
@@ -238,7 +270,10 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ if (m.getValueAt(row, 6) != null){
guidTypeList = m.getValueAt(row, 6).toString();
}
-
+ String[] rowData = {name, cName, guid, help};
+ if (!dataValidation(rowData)){
+ return;
+ }
sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
}
@@ -481,7 +516,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ if (arg0.getSource() == jButtonAdd) {
//ToDo: check before add
- String[] row = {"", "", "", "", "", "", null};
+ String[] row = {"", "", "", "", "", "", ""};
row[3] = jTextField.getText();
row[2] = jTextFieldAdd.getText();
row[1] = jTextFieldVersion.getText();
@@ -494,8 +529,13 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ if (row[5].length() == 0) {
row[5] = null;
}
- if (iCheckBoxList1.getAllCheckedItemsString() != null) {
- row[6] = vectorToString(iCheckBoxList1.getAllCheckedItemsString());
+ row[6] = vectorToString(iCheckBoxList1.getAllCheckedItemsString());
+ if (row[6].length() == 0) {
+ row[6] = null;
+ }
+
+ if (!dataValidation(row)) {
+ return;
}
model.addRow(row);
addRow(row);
@@ -523,9 +563,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ }
if (arg0.getSource() == jButtonGen) {
- guidDialog = new GenGuidDialog(this);
- guidDialog.setGuid(jTextFieldAdd.getText());
- guidDialog.setVisible(true);
+ jTextFieldAdd.setText(Tools.generateUuidString());
}
if (arg0.getActionCommand().equals("GenGuidValue")) {
@@ -534,6 +572,26 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ }
+ protected boolean dataValidation(String[] row){
+ if (!DataValidation.isUiNameType(row[0])) {
+ JOptionPane.showMessageDialog(this, "Name is NOT UiNameType.");
+ return false;
+ }
+ if (!DataValidation.isGuid(row[2])) {
+ JOptionPane.showMessageDialog(this, "Guid Value is NOT GuidType.");
+ return false;
+ }
+ if (!DataValidation.isC_NameType(row[1])) {
+ JOptionPane.showMessageDialog(this, "C_Name is NOT C_NameType.");
+ return false;
+ }
+ if (row[3].length() == 0) {
+ JOptionPane.showMessageDialog(this, "HelpText could NOT be empty.");
+ return false;
+ }
+ return true;
+ }
+
protected void addRow(String[] row) {
Vector<String> vArch = iCheckBoxList.getAllCheckedItemsString();
Vector<String> vModType = iCheckBoxList2.getAllCheckedItemsString();
@@ -649,7 +707,8 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ v.add("X64");
v.add("IPF");
v.add("EBC");
-
+ v.add("ARM");
+ v.add("PPC");
iCheckBoxList.setAllItems(v);
}
return iCheckBoxList;
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java index 0d482e83e3..433c2d3d4c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java @@ -15,14 +15,15 @@ package org.tianocore.frameworkwizard.packaging.ui;
-import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import javax.swing.JButton;
+import javax.swing.JFrame;
import javax.swing.JLabel;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
@@ -52,6 +53,8 @@ public class SpdHeader extends IInternalFrame { //
//Define class members
//
+ static JFrame frame;
+
private JPanel jContentPane = null;
private JLabel jLabelBaseName = null;
@@ -133,6 +136,10 @@ public class SpdHeader extends IInternalFrame { jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320,20));
jTextFieldBaseName.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
+ if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) {
+ JOptionPane.showMessageDialog(frame, "Package Name is NOT UiNameType.");
+ return;
+ }
sfc.setSpdHdrPkgName(jTextFieldBaseName.getText());
}
});
@@ -153,6 +160,10 @@ public class SpdHeader extends IInternalFrame { jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250,20));
jTextFieldGuid.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
+ if (!DataValidation.isGuid(jTextFieldGuid.getText())) {
+ JOptionPane.showMessageDialog(frame, "Guid is NOT GuidType.");
+ return;
+ }
sfc.setSpdHdrGuidValue(jTextFieldGuid.getText());
}
});
@@ -173,6 +184,10 @@ public class SpdHeader extends IInternalFrame { jTextFieldVersion.setPreferredSize(new java.awt.Dimension(320,20));
jTextFieldVersion.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
+ if (!DataValidation.isVersion(jTextFieldVersion.getText())) {
+ JOptionPane.showMessageDialog(frame, "Version is NOT version type.");
+ return;
+ }
sfc.setSpdHdrVer(jTextFieldVersion.getText());
}
});
@@ -210,6 +225,10 @@ public class SpdHeader extends IInternalFrame { jTextAreaLicense.setLineWrap(true);
jTextAreaLicense.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
+ if (jTextAreaLicense.getText().length() == 0) {
+ JOptionPane.showMessageDialog(frame, "License contents could NOT be empty.");
+ return;
+ }
sfc.setSpdHdrLicense(jTextAreaLicense.getText());
}
});
@@ -230,6 +249,10 @@ public class SpdHeader extends IInternalFrame { 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;
+ }
sfc.setSpdHdrDescription(jTextAreaDescription.getText());
}
});
@@ -338,6 +361,10 @@ public class SpdHeader extends IInternalFrame { jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldAbstract.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
+ if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) {
+ JOptionPane.showMessageDialog(frame, "Abstract could NOT be empty.");
+ return;
+ }
sfc.setSpdHdrAbs(jTextFieldAbstract.getText());
}
});
@@ -358,6 +385,10 @@ public class SpdHeader extends IInternalFrame { jTextFieldCopyright.setPreferredSize(new java.awt.Dimension(320,20));
jTextFieldCopyright.addFocusListener(new FocusAdapter(){
public void focusLost(FocusEvent e){
+ if (!DataValidation.isCopyright(jTextFieldCopyright.getText())) {
+ JOptionPane.showMessageDialog(frame, "Copyright contents could not be empty.");
+ return;
+ }
sfc.setSpdHdrCopyright(jTextFieldCopyright.getText());
}
});
@@ -666,6 +697,7 @@ public class SpdHeader extends IInternalFrame { resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth,intPreferredWidth);
resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth,intPreferredWidth);
resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth,intPreferredWidth);
+ resizeComponentWidth(this.jTextField, intCurrentWidth,intPreferredWidth);
resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth,intPreferredWidth);
resizeComponentWidth(this.jTextFieldCopyright, intCurrentWidth,intPreferredWidth);
resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth,intPreferredWidth);
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 fd5c552720..32596fe639 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 @@ -12,20 +12,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.frameworkwizard.packaging.ui;
-import java.awt.BorderLayout;
import java.awt.Dimension;
-import java.awt.Toolkit;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
import java.io.File;
import java.util.Vector;
import javax.swing.AbstractAction;
-import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@@ -34,7 +27,6 @@ import javax.swing.JTable; import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JLabel;
-import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -49,11 +41,12 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel;
import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
+import org.tianocore.frameworkwizard.platform.ui.ListEditor;
import javax.swing.JCheckBox;
@@ -63,6 +56,11 @@ import javax.swing.JCheckBox; @since PackageEditor 1.0
**/
public class SpdLibClassDecls extends IInternalFrame implements TableModelListener{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
static JFrame frame;
private JTable jTable = null;
@@ -87,8 +85,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JButton jButtonClearAll = null;
- private JButton jButtonCancel = null;
-
private JButton jButtonOk = null;
private JLabel jLabel = null;
@@ -139,6 +135,10 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private ICheckBoxList iCheckBoxListArch = null;
+ private JCheckBox jCheckBox4 = null;
+
+ private JCheckBox jCheckBox5 = null;
+
/**
This method initializes this
@@ -191,7 +191,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JTextField getJTextFieldAdd() {
if (jTextFieldAdd == null) {
jTextFieldAdd = new JTextField();
- jTextFieldAdd.setBounds(new java.awt.Rectangle(122,6,343,20));
+ jTextFieldAdd.setBounds(new java.awt.Rectangle(122,6,390,20));
jTextFieldAdd.setPreferredSize(new java.awt.Dimension(260,20));
jTextFieldAdd.setEnabled(true);
}
@@ -222,7 +222,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(12,302,351,164));
+ jScrollPane.setBounds(new java.awt.Rectangle(12,351,608,139));
jScrollPane.setPreferredSize(new java.awt.Dimension(330,150));
jScrollPane.setViewportView(getJTable());
}
@@ -247,6 +247,30 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen model.addColumn("InstanceVersion");
model.addColumn("SupportedArch");
model.addColumn("SupportedModule");
+
+ Vector<String> vArch = new Vector<String>();
+ vArch.add("IA32");
+ vArch.add("X64");
+ vArch.add("IPF");
+ vArch.add("EBC");
+ vArch.add("ARM");
+ vArch.add("PPC");
+ jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vArch));
+
+ Vector<String> vModule = new Vector<String>();
+ vModule.add("BASE");
+ vModule.add("SEC");
+ vModule.add("PEI_CORE");
+ vModule.add("PEIM");
+ vModule.add("DXE_CORE");
+ vModule.add("DXE_DRIVER");
+ vModule.add("DXE_RUNTIME_DRIVER");
+ vModule.add("DXE_SAL_DRIVER");
+ vModule.add("DXE_SMM_DRIVER");
+ vModule.add("UEFI_DRIVER");
+ vModule.add("UEFI_APPLICATION");
+ vModule.add("USER_DEFINED");
+ jTable.getColumnModel().getColumn(6).setCellEditor(new ListEditor(vModule));
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
@@ -289,6 +313,10 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen if (m.getValueAt(row, 6) != null) {
module = m.getValueAt(row, 6).toString();
}
+ String[] rowData = {lib, hdr, hlp};
+ if (!dataValidation(rowData)) {
+ return;
+ }
sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);
}
}
@@ -301,8 +329,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JButton getJButtonAdd() {
if (jButtonAdd == null) {
jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(374,303,90,20));
jButtonAdd.setText("Add");
+ jButtonAdd.setSize(new java.awt.Dimension(80,20));
+ jButtonAdd.setLocation(new java.awt.Point(365,315));
jButtonAdd.addActionListener(this);
}
return jButtonAdd;
@@ -316,8 +345,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JButton getJButtonRemove() {
if (jButtonRemove == null) {
jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(374,381,90,20));
jButtonRemove.setText("Remove");
+ jButtonRemove.setSize(new java.awt.Dimension(80,20));
+ jButtonRemove.setLocation(new java.awt.Point(449,315));
jButtonRemove.addActionListener(this);
}
return jButtonRemove;
@@ -331,32 +361,15 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JButton getJButtonClearAll() {
if (jButtonClearAll == null) {
jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(374,411,90,20));
jButtonClearAll.setText("Clear All");
+ jButtonClearAll.setSize(new java.awt.Dimension(86,20));
+ jButtonClearAll.setLocation(new java.awt.Point(536,315));
jButtonClearAll.addActionListener(this);
}
return jButtonClearAll;
}
/**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setLocation(new java.awt.Point(390, 305));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
This method initializes jButton
@return javax.swing.JButton
@@ -427,7 +440,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JScrollPane getJContentPane(){
if (topScrollPane == null){
topScrollPane = new JScrollPane();
- topScrollPane.setSize(new java.awt.Dimension(483,500));
+ topScrollPane.setSize(new java.awt.Dimension(634,500));
topScrollPane.setViewportView(getJContentPane1());
}
return topScrollPane;
@@ -448,11 +461,11 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jLabel5.setText("Supported Arch");
jLabel5.setEnabled(true);
jLabel4 = new JLabel();
- jLabel4.setBounds(new java.awt.Rectangle(16,160,196,16));
+ jLabel4.setBounds(new java.awt.Rectangle(16,138,196,16));
jLabel4.setEnabled(true);
jLabel4.setText("Recommended Instance Version");
jLabel3 = new JLabel();
- jLabel3.setBounds(new java.awt.Rectangle(17,112,175,16));
+ jLabel3.setBounds(new java.awt.Rectangle(17,112,195,16));
jLabel3.setEnabled(true);
jLabel3.setText("Recommended Instance GUID");
jLabel2 = new JLabel();
@@ -466,9 +479,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(1,7));
jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(1,56));
+ jStarLabel2.setLocation(new java.awt.Point(-1,74));
jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(16,56,199,22));
+ jLabel.setBounds(new java.awt.Rectangle(14,74,199,22));
jLabel.setText("Include Header for Specified Class");
jContentPane = new JPanel();
@@ -485,7 +498,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jContentPane.add(getJButtonAdd(), null);
jContentPane.add(getJButtonRemove(), null);
jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonCancel(), null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJTextField(), null);
@@ -506,6 +518,8 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jContentPane.add(jLabel6, null);
jContentPane.add(getJScrollPaneArch(), null);
+ jContentPane.add(getJCheckBox4(), null);
+ jContentPane.add(getJCheckBox5(), null);
}
return jContentPane;
@@ -565,9 +579,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen this.dispose();
}
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
if (arg0.getSource() == jButtonAdd) {
@@ -576,7 +587,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen row[0] = jTextFieldAdd.getText();
row[1] = jTextField.getText().replace('\\', '/');
row[2] = jTextFieldHelp.getText();
- row[5] = booleanToString(jCheckBox.isSelected(), jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected());
+ row[5] = booleanToString(jCheckBox.isSelected(), jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected(), jCheckBox5.isSelected());
if (row[5].length() == 0){
row[5] = null;
}
@@ -584,6 +595,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen if (row[6].length() == 0){
row[6] = null;
}
+ if (!dataValidation(row)) {
+ return;
+ }
model.addRow(row);
sfc.genSpdLibClassDeclarations(row[0], row[3], row[1], row[2], row[5], null, null, row[4], null, row[6]);
@@ -638,7 +652,19 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen }
}
-
+ private boolean dataValidation(String[] row) {
+ if (!DataValidation.isKeywordType(row[0])) {
+ JOptionPane.showMessageDialog(frame, "Library Class is NOT KeyWord Type.");
+ return false;
+ }
+ if (!DataValidation.isPathAndFilename(row[1])) {
+ JOptionPane.showMessageDialog(frame, "Include Header is NOT PathAndFilename Type.");
+ }
+ if (row[2].length() == 0) {
+ JOptionPane.showMessageDialog(frame, "HelpText could NOT be empty.");
+ }
+ return true;
+ }
/**
Add contents in list to sfc
**/
@@ -654,7 +680,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(16,83,346,21));
+ jTextField.setBounds(new java.awt.Rectangle(221,75,290,21));
jTextField.setPreferredSize(new java.awt.Dimension(260,20));
}
return jTextField;
@@ -668,11 +694,16 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JButton getJButtonBrowse() {
if (jButtonBrowse == null) {
jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(376,82,90,20));
+ jButtonBrowse.setBounds(new java.awt.Rectangle(528,75,90,20));
jButtonBrowse.setText("Browse");
jButtonBrowse.setPreferredSize(new java.awt.Dimension(80,20));
jButtonBrowse.addActionListener(new AbstractAction() {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
public void actionPerformed(ActionEvent arg0) {
//
// Select files from current pkg
@@ -718,10 +749,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen resizeComponentWidth(this.jTextFieldAdd, this.getWidth(), intPreferredWidth);
resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
- relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width,25);
- relocateComponentX(this.jButtonClearAll, this.getWidth(), this.getPreferredSize().width,25);
- relocateComponentX(this.jButtonRemove, this.getWidth(), this.getPreferredSize().width,25);
- relocateComponentX(this.jButtonAdd, this.getWidth(), this.getPreferredSize().width,50);
}
/**
@@ -732,7 +759,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JTextField getJTextFieldHelp() {
if (jTextFieldHelp == null) {
jTextFieldHelp = new JTextField();
- jTextFieldHelp.setBounds(new java.awt.Rectangle(122,33,343,20));
+ jTextFieldHelp.setBounds(new java.awt.Rectangle(122,33,390,20));
jTextFieldHelp.setPreferredSize(new java.awt.Dimension(260,20));
}
return jTextFieldHelp;
@@ -746,7 +773,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JTextField getJTextField1() {
if (jTextField1 == null) {
jTextField1 = new JTextField();
- jTextField1.setBounds(new java.awt.Rectangle(16,135,344,20));
+ jTextField1.setBounds(new java.awt.Rectangle(220,110,291,20));
jTextField1.setEnabled(true);
}
return jTextField1;
@@ -760,7 +787,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JTextField getJTextField2() {
if (jTextField2 == null) {
jTextField2 = new JTextField();
- jTextField2.setBounds(new java.awt.Rectangle(16,184,344,20));
+ jTextField2.setBounds(new java.awt.Rectangle(218,135,292,20));
jTextField2.setEnabled(true);
}
return jTextField2;
@@ -789,7 +816,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JCheckBox getJCheckBox1() {
if (jCheckBox1 == null) {
jCheckBox1 = new JCheckBox();
- jCheckBox1.setBounds(new java.awt.Rectangle(197,213,49,20));
+ jCheckBox1.setBounds(new java.awt.Rectangle(182,213,49,20));
jCheckBox1.setText("X64");
jCheckBox1.setPreferredSize(new java.awt.Dimension(21,20));
}
@@ -806,7 +833,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jCheckBox2 = new JCheckBox();
jCheckBox2.setText("IPF");
jCheckBox2.setSize(new java.awt.Dimension(50,20));
- jCheckBox2.setLocation(new java.awt.Point(258,213));
+ jCheckBox2.setLocation(new java.awt.Point(237,213));
jCheckBox2.setPreferredSize(new java.awt.Dimension(21,20));
}
return jCheckBox2;
@@ -820,7 +847,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JCheckBox getJCheckBox3() {
if (jCheckBox3 == null) {
jCheckBox3 = new JCheckBox();
- jCheckBox3.setBounds(new java.awt.Rectangle(319,213,59,20));
+ jCheckBox3.setBounds(new java.awt.Rectangle(286,213,50,20));
jCheckBox3.setText("EBC");
jCheckBox3.setPreferredSize(new java.awt.Dimension(21,20));
}
@@ -830,7 +857,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JScrollPane getJScrollPaneArch() {
if (jScrollPaneArch == null) {
jScrollPaneArch = new JScrollPane();
- jScrollPaneArch.setBounds(new java.awt.Rectangle(130,252,230,45));
+ jScrollPaneArch.setBounds(new java.awt.Rectangle(130,252,230,88));
jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80));
jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());
}
@@ -858,7 +885,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen return iCheckBoxListArch;
}
- private String booleanToString(boolean b1, boolean b2, boolean b3, boolean b4){
+ private String booleanToString(boolean b1, boolean b2, boolean b3, boolean b4, boolean b5, boolean b6){
String s = " ";
if (b1){
s += "IA32 ";
@@ -872,6 +899,12 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen if (b4){
s += "EBC ";
}
+ if (b5){
+ s += "ARM ";
+ }
+ if (b6){
+ s += "PPC ";
+ }
return s.trim();
}
@@ -883,6 +916,36 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen }
return s.trim();
}
+ /**
+ * This method initializes jCheckBox4
+ *
+ * @return javax.swing.JCheckBox
+ */
+ private JCheckBox getJCheckBox4() {
+ if (jCheckBox4 == null) {
+ jCheckBox4 = new JCheckBox();
+ jCheckBox4.setBounds(new java.awt.Rectangle(343,213,60,20));
+ jCheckBox4.setText("ARM");
+ jCheckBox4.setPreferredSize(new Dimension(60, 20));
+ }
+ return jCheckBox4;
+ }
+
+ /**
+ * This method initializes jCheckBox5
+ *
+ * @return javax.swing.JCheckBox
+ */
+ private JCheckBox getJCheckBox5() {
+ if (jCheckBox5 == null) {
+ jCheckBox5 = new JCheckBox();
+ jCheckBox5.setBounds(new java.awt.Rectangle(400,213,60,20));
+ jCheckBox5.setText("PPC");
+ jCheckBox5.setPreferredSize(new Dimension(60, 20));
+ }
+ return jCheckBox5;
+ }
+
public static void main(String[] args){
new SpdLibClassDecls().setVisible(true);
}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java index f21ddd716c..09cb0f704f 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java @@ -12,26 +12,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.frameworkwizard.packaging.ui;
-import java.awt.BorderLayout;
import java.awt.Dimension;
-import java.awt.Toolkit;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.io.File;
-import java.util.Vector;
import javax.swing.AbstractAction;
-import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JRadioButton;
import javax.swing.JTable;
import javax.swing.JTextField;
-import javax.swing.JComboBox;
import javax.swing.JLabel;
-import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -46,7 +38,6 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel;
import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
@@ -57,6 +48,11 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel; @since PackageEditor 1.0
**/
public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
static JFrame frame;
private JScrollPane jScrollPane = null; // @jve:decl-index=0:visual-constraint="10,95"
@@ -340,7 +336,10 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ if (arg0.getSource() == jButtonAdd) {
//ToDo: check before add
String[] row = {jTextField.getText().replace('\\', '/')};
-
+ if (jTextField.getText().length() == 0) {
+ JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
+ return;
+ }
model.addRow(row);
sfc.genSpdMsaFiles(row[0], null, null, null);
}
@@ -374,7 +373,10 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ TableModel m = (TableModel)arg0.getSource();
if (arg0.getType() == TableModelEvent.UPDATE){
String file = m.getValueAt(row, 0) + "";
-
+ if (file.length() == 0) {
+ JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
+ return;
+ }
sfc.updateSpdMsaFile(row, file, null, null, null);
}
}
@@ -412,6 +414,11 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ jButtonBrowse.setText("Browse");
jButtonBrowse.setPreferredSize(new java.awt.Dimension(90,20));
jButtonBrowse.addActionListener(new AbstractAction() {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
public void actionPerformed(ActionEvent e) {
//
// Select files from current workspace
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java index 7df0d35e5f..e4188930fe 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java @@ -15,7 +15,6 @@ package org.tianocore.frameworkwizard.packaging.ui;
import javax.swing.JPanel;
-import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import java.awt.Dimension;
@@ -26,6 +25,10 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel; public class SpdPackageDefinitions extends IInternalFrame {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JComboBox jComboBoxReadOnly = null;
@@ -113,8 +116,8 @@ public class SpdPackageDefinitions extends IInternalFrame { jComboBoxReadOnly = new JComboBox();
jComboBoxReadOnly.setBounds(new java.awt.Rectangle(95,22,117,20));
jComboBoxReadOnly.setPreferredSize(new Dimension(80, 20));
- jComboBoxReadOnly.addItem("TRUE");
- jComboBoxReadOnly.addItem("FALSE");
+ jComboBoxReadOnly.addItem("true");
+ jComboBoxReadOnly.addItem("false");
jComboBoxReadOnly.setSelectedIndex(1);
jComboBoxReadOnly.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
@@ -135,8 +138,8 @@ public class SpdPackageDefinitions extends IInternalFrame { jComboBoxRePackage = new JComboBox();
jComboBoxRePackage.setBounds(new java.awt.Rectangle(95,62,116,20));
jComboBoxRePackage.setPreferredSize(new Dimension(80, 20));
- jComboBoxRePackage.addItem("FALSE");
- jComboBoxRePackage.addItem("TRUE");
+ jComboBoxRePackage.addItem("false");
+ jComboBoxRePackage.addItem("true");
jComboBoxRePackage.setSelectedIndex(0);
jComboBoxRePackage.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java index 9deba4c4dd..de91069872 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java @@ -12,17 +12,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.frameworkwizard.packaging.ui;
-import java.awt.BorderLayout;
import java.awt.Dimension;
-import java.awt.Toolkit;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.io.File;
-import java.util.Vector;
import javax.swing.DefaultCellEditor;
-import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@@ -31,7 +26,6 @@ import javax.swing.JTable; import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.JLabel;
-import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -47,7 +41,7 @@ import javax.swing.table.TableColumn; import javax.swing.table.TableModel;
import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
@@ -58,6 +52,11 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel; @since PackageEditor 1.0
**/
public class SpdPackageHeaders extends IInternalFrame implements TableModelListener{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
static JFrame frame;
private SpdFileContents sfc = null;
@@ -66,12 +65,8 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe private JPanel jContentPane = null;
- private JRadioButton jRadioButtonAdd = null;
-
private JRadioButton jRadioButtonSelect = null;
- private JTextField jTextFieldAdd = null;
-
private JComboBox jComboBoxSelect = null;
private JButton jButtonAdd = null;
@@ -115,23 +110,6 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe }
/**
- This method initializes jRadioButtonAdd
-
- @return javax.swing.JRadioButton
- **/
- private JRadioButton getJRadioButtonAdd() {
- if (jRadioButtonAdd == null) {
- jRadioButtonAdd = new JRadioButton();
- jRadioButtonAdd.setBounds(new java.awt.Rectangle(9,35,197,20));
- jRadioButtonAdd.setText("Add a new ModuleType");
- jRadioButtonAdd.setEnabled(false);
- jRadioButtonAdd.addActionListener(this);
- jRadioButtonAdd.setSelected(false);
- }
- return jRadioButtonAdd;
- }
-
- /**
This method initializes jRadioButtonSelect
@return javax.swing.JRadioButton
@@ -148,21 +126,6 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe }
/**
- This method initializes jTextFieldAdd
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldAdd() {
- if (jTextFieldAdd == null) {
- jTextFieldAdd = new JTextField();
- jTextFieldAdd.setBounds(new java.awt.Rectangle(220, 35, 260, 20));
- jTextFieldAdd.setPreferredSize(new java.awt.Dimension(260,20));
- jTextFieldAdd.setEnabled(false);
- }
- return jTextFieldAdd;
- }
-
- /**
This method initializes jComboBoxSelect
@return javax.swing.JComboBox
@@ -350,9 +313,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe jContentPane.add(jLabel, null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
- jContentPane.add(getJRadioButtonAdd(), null);
jContentPane.add(getJRadioButtonSelect(), null);
- jContentPane.add(getJTextFieldAdd(), null);
jContentPane.add(getJComboBoxSelect(), null);
jContentPane.add(getJButtonAdd(), null);
jContentPane.add(getJButtonRemove(), null);
@@ -402,9 +363,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe if (arg0.getSource() == jButtonAdd) {
String strLibClass = "";
- if (jRadioButtonAdd.isSelected()) {
- strLibClass = jTextFieldAdd.getText();
- }
+
if (jRadioButtonSelect.isSelected()) {
strLibClass = jComboBoxSelect.getSelectedItem().toString();
}
@@ -412,6 +371,9 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe String[] row = {"", ""};
row[0] = strLibClass;
row[1] = jTextField.getText().replace('\\', '/');
+ if (!dataValidation(row)) {
+ return;
+ }
model.addRow(row);
sfc.genSpdModuleHeaders(row[0], row[1], null, null, null, null, null, null);
}
@@ -437,31 +399,15 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe sfc.removeSpdPkgHeader();
}
- if (arg0.getSource() == jRadioButtonAdd) {
- if (jRadioButtonAdd.isSelected()) {
- jRadioButtonSelect.setSelected(false);
- jTextFieldAdd.setEnabled(true);
- jComboBoxSelect.setEnabled(false);
- }
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {
- jRadioButtonAdd.setSelected(true);
- jTextFieldAdd.setEnabled(true);
- jComboBoxSelect.setEnabled(false);
- }
- }
-
- if (arg0.getSource() == jRadioButtonSelect) {
- if (jRadioButtonSelect.isSelected()) {
- jRadioButtonAdd.setSelected(false);
- jTextFieldAdd.setEnabled(false);
- jComboBoxSelect.setEnabled(true);
- }
- if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) {
- jRadioButtonSelect.setSelected(true);
- jTextFieldAdd.setEnabled(false);
- jComboBoxSelect.setEnabled(true);
- }
+ }
+
+ private boolean dataValidation(String[] row) {
+ if (!DataValidation.isPathAndFilename(row[1])) {
+ JOptionPane.showMessageDialog(this, "Include header path is NOT PathAndFilename type.");
+ return false;
}
+
+ return true;
}
/**
@@ -497,6 +443,11 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe jButtonBrowse.setText("Browse");
jButtonBrowse.setPreferredSize(new java.awt.Dimension(92,20));
jButtonBrowse.addActionListener(new javax.swing.AbstractAction() {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
public void actionPerformed(ActionEvent e) {
//
// Select files from current workspace
@@ -558,6 +509,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe if (jTable == null) {
model = new DefaultTableModel();
jTable = new JTable(model);
+ jTable.setRowHeight(20);
model.addColumn("ModuleType");
model.addColumn("IncludeHeader");
TableColumn typeColumn = jTable.getColumnModel().getColumn(0);
@@ -605,6 +557,10 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe if (arg0.getType() == TableModelEvent.UPDATE){
String pkg = m.getValueAt(row, 0) + "";
String hdr = m.getValueAt(row, 1) + "";
+ String[] rowData = {pkg, hdr};
+ if (!dataValidation(rowData)) {
+ return;
+ }
sfc.updateSpdPkgHdr(row, pkg, hdr);
}
}
@@ -613,7 +569,6 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe int intPreferredWidth = 500;
resizeComponentWidth(this.jComboBoxSelect, this.getWidth(), intPreferredWidth);
- resizeComponentWidth(this.jTextFieldAdd, this.getWidth(), intPreferredWidth);
resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 30);
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java index 019ced3879..f85e40b988 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java @@ -38,12 +38,15 @@ import javax.swing.table.TableModel; import org.tianocore.PackageSurfaceAreaDocument;
+import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JCheckBox;
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
+import org.tianocore.frameworkwizard.platform.ui.ListEditor;
+
import java.awt.Rectangle;
import java.util.Vector;
@@ -113,10 +116,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JButton jButtonClearAll = null;
- private JButton jButtonGen = null;
-
- private GenGuidDialog guidDialog = null;
-
private JScrollPane jScrollPane = null;
private JTable jTable = null;
@@ -403,7 +402,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ jContentPane.add(getJButtonAdd(), null);
jContentPane.add(getJButtonRemove(), null);
jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonGen(), null);
jContentPane.add(getJScrollPane(), null);
jContentPane.add(starLabel, null);
jContentPane.add(getJCheckBox(), null);
@@ -440,7 +438,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ if (arg0.getSource() == jButtonOk) {
this.save();
this.dispose();
-
}
if (arg0.getSource() == jButtonCancel) {
this.dispose();
@@ -448,10 +445,10 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ if (arg0.getSource() == jButtonAdd) {
//ToDo: check before add
- if (!checkValid()) {
+ boolean[] b = {jCheckBox.isSelected(), jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected()};
+ if (!checkValidUsage(b)) {
return;
}
-
String archList = vectorToString(iCheckBoxList.getAllCheckedItemsString());
if (archList.length() == 0) {
archList = null;
@@ -466,7 +463,9 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ jCheckBox.isSelected(), jCheckBox1.isSelected(),
jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected(),
archList, modTypeList};
-
+ if (!dataValidation(row)) {
+ return;
+ }
model.addRow(row);
String usage = getValidUsage(jCheckBox.isSelected(), jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected());
@@ -497,16 +496,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ sfc.removeSpdPcdDefinition();
}
- if (arg0.getSource() == jButtonGen) {
- guidDialog = new GenGuidDialog(this);
- guidDialog.setGuid(jTextFieldTsGuid.getText());
- guidDialog.setVisible(true);
- }
-
- if (arg0.getActionCommand().equals("GenGuidValue")) {
- jTextFieldTsGuid.setText(guidDialog.getGuid());
- }
-
}
protected void save() {
@@ -521,8 +510,9 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JTextField getJTextFieldTsGuid() {
if (jTextFieldTsGuid == null) {
jTextFieldTsGuid = new JTextField();
- jTextFieldTsGuid.setBounds(new java.awt.Rectangle(156,58,249,20));
- jTextFieldTsGuid.setPreferredSize(new java.awt.Dimension(250,20));
+ jTextFieldTsGuid.setPreferredSize(new java.awt.Dimension(315,20));
+ jTextFieldTsGuid.setSize(new java.awt.Dimension(317,20));
+ jTextFieldTsGuid.setLocation(new java.awt.Point(156,58));
}
return jTextFieldTsGuid;
}
@@ -604,22 +594,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ return jButtonClearAll;
}
- /**
- * This method initializes jButtonGen
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonGen() {
- if (jButtonGen == null) {
- jButtonGen = new JButton();
- jButtonGen.setBounds(new java.awt.Rectangle(414,57,58,20));
- jButtonGen.setPreferredSize(new java.awt.Dimension(56,20));
- jButtonGen.setText("Gen");
- jButtonGen.addActionListener(this);
- }
- return jButtonGen;
- }
-
public void componentResized(ComponentEvent arg0) {
int intPreferredWidth = 500;
@@ -630,12 +604,10 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
- resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
resizeComponentWidth(this.jTextFieldDefaultValue, this.getWidth(), intPreferredWidth);
// relocateComponentX(this.jButtonClearAll, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
// relocateComponentX(this.jButtonRemove, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
// relocateComponentX(this.jButtonAdd, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- relocateComponentX(this.jButtonGen, this.getWidth(), this.getPreferredSize().width, 30);
}
/**
@@ -661,6 +633,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ if (jTable == null) {
model = new CheckboxTableModel();
jTable = new JTable(model);
+ jTable.setRowHeight(20);
jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jTable.setSize(new Dimension(1000, 300));
@@ -678,7 +651,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ model.addColumn("DynamicEx");
model.addColumn("SupportedArch");
model.addColumn("SupportedModule");
- jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());
//ToDo: add a valid usage editor
@@ -692,6 +664,30 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3);
dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType));
+ Vector<String> vArch = new Vector<String>();
+ vArch.add("IA32");
+ vArch.add("X64");
+ vArch.add("IPF");
+ vArch.add("EBC");
+ vArch.add("ARM");
+ vArch.add("PPC");
+ jTable.getColumnModel().getColumn(11).setCellEditor(new ListEditor(vArch));
+
+ Vector<String> vModule = new Vector<String>();
+ vModule.add("BASE");
+ vModule.add("SEC");
+ vModule.add("PEI_CORE");
+ vModule.add("PEIM");
+ vModule.add("DXE_CORE");
+ vModule.add("DXE_DRIVER");
+ vModule.add("DXE_RUNTIME_DRIVER");
+ vModule.add("DXE_SAL_DRIVER");
+ vModule.add("DXE_SMM_DRIVER");
+ vModule.add("UEFI_DRIVER");
+ vModule.add("UEFI_APPLICATION");
+ vModule.add("USER_DEFINED");
+ jTable.getColumnModel().getColumn(12).setCellEditor(new ListEditor(vModule));
+
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e) {
@@ -728,6 +724,14 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ 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 = vectorToString(iCheckBoxList.getAllCheckedItemsString());
String modTypeList = vectorToString(iCheckBoxList1.getAllCheckedItemsString());
+ 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;
+ }
sfc.updateSpdPcdDefinition(row, cName, token, dataType, usage, ts, defaultVal, help, archList, modTypeList);
}
}
@@ -828,13 +832,34 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ return usage.trim();
}
- private boolean checkValid() {
- if (!(jCheckBox.isSelected() || jCheckBox1.isSelected() || jCheckBox2.isSelected() || jCheckBox3.isSelected() || jCheckBox4.isSelected())){
+ private boolean checkValidUsage(boolean[] b) {
+ if (!(b[0] || b[1] || b[2] || b[3] || b[4])){
JOptionPane.showMessageDialog(frame, "You must specify at least one usage.");
return false;
}
return true;
}
+ private boolean dataValidation(Object[] row) {
+
+ if (!DataValidation.isC_NameType(row[0].toString())) {
+ JOptionPane.showMessageDialog(frame, "C_Name is NOT C_NameType.");
+ return false;
+ }
+ if (!(DataValidation.isHexDoubleWordDataType(row[1].toString()) ||
+ DataValidation.isInt(row[1].toString(), 0, 0xffffffff))) {
+ JOptionPane.showMessageDialog(frame, "Token is NOT correct.");
+ return false;
+ }
+ if (!DataValidation.isC_NameType(row[2].toString())) {
+ JOptionPane.showMessageDialog(frame, "Token Space is NOT C_NameType");
+ return false;
+ }
+ if (row[5].toString().length() == 0) {
+ JOptionPane.showMessageDialog(frame, "HelpText could NOT be empty.");
+ return false;
+ }
+ return true;
+ }
/**
* This method initializes jScrollPane1
@@ -865,6 +890,8 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ v.add("X64");
v.add("IPF");
v.add("EBC");
+ v.add("ARM");
+ v.add("PPC");
iCheckBoxList.setAllItems(v);
}
return iCheckBoxList;
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java index b16dd37fb9..5730aba2e6 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java @@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.frameworkwizard.packaging.ui;
-import javax.swing.event.TableModelEvent;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
@@ -25,6 +24,10 @@ GUI for create library definition elements of spd file. **/
public class SpdPpiDecls extends SpdGuidDecls {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private SpdFileContents sfc = null;
public SpdPpiDecls() {
@@ -79,10 +82,18 @@ public class SpdPpiDecls extends SpdGuidDecls { if (m.getValueAt(row, 5) != null) {
modTypeList = m.getValueAt(row, 5).toString();
}
+ String[] rowData = {name, cName, guid, help};
+ if (!dataValidation(rowData)){
+ return;
+ }
sfc.updateSpdPpiDecl(row, name, cName, guid, help, archList, modTypeList);
}
protected void addRow(String[] row) {
+
+ if (!dataValidation(row)){
+ return;
+ }
sfc.genSpdPpiDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));
}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java index 5c70c1769c..cc0584e340 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java @@ -24,6 +24,10 @@ GUI for create library definition elements of spd file. **/
public class SpdProtocolDecls extends SpdGuidDecls {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private SpdFileContents sfc = null;
public SpdProtocolDecls() {
@@ -79,11 +83,18 @@ public class SpdProtocolDecls extends SpdGuidDecls { if (m.getValueAt(row, 5) != null) {
modTypeList = m.getValueAt(row, 5).toString();
}
+ String[] rowData = {name, cName, guid, help};
+ if (!dataValidation(rowData)){
+ return;
+ }
sfc.updateSpdProtocolDecl(row, name, cName, guid, help, archList, modTypeList);
}
protected void addRow(String[] row) {
+ if (!dataValidation(row)){
+ return;
+ }
sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));
}
|