Mark Guid Type as required in Guid declaration editor. Set cell editor to long text editor for Help text fields in tables.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1728 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-10-12 08:54:06 +00:00
parent f436f72804
commit fbf730ff01
6 changed files with 50 additions and 8 deletions

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
package org.tianocore.frameworkwizard.packaging.ui; package org.tianocore.frameworkwizard.packaging.ui;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.util.Vector; import java.util.Vector;
@ -43,6 +44,7 @@ import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel; import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList; import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
import org.tianocore.frameworkwizard.platform.ui.ListEditor; import org.tianocore.frameworkwizard.platform.ui.ListEditor;
import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
/** /**
GUI for create library definition elements of spd file. GUI for create library definition elements of spd file.
@ -131,6 +133,8 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
protected String[][] saa = null; protected String[][] saa = null;
protected StarLabel starLabel = null;
/** /**
This method initializes this This method initializes this
@ -189,6 +193,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
model.addColumn("Supported Module Types"); model.addColumn("Supported Module Types");
model.addColumn("GuidTypes"); model.addColumn("GuidTypes");
jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor()); jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());
jTable.getColumnModel().getColumn(3).setCellEditor(new LongTextEditor());
Vector<String> vArch = new Vector<String>(); Vector<String> vArch = new Vector<String>();
vArch.add("IA32"); vArch.add("IA32");
@ -223,7 +228,9 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
vGuid.add("HII_PACKAGE_LIST"); vGuid.add("HII_PACKAGE_LIST");
vGuid.add("HOB"); vGuid.add("HOB");
vGuid.add("TOKEN_SPACE_GUID"); vGuid.add("TOKEN_SPACE_GUID");
jTable.getColumnModel().getColumn(6).setCellEditor(new ListEditor(vGuid)); ListEditor le = new ListEditor(vGuid);
le.setCanNotBeEmpty(true);
jTable.getColumnModel().getColumn(6).setCellEditor(le);
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
@ -269,6 +276,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
if (cellData.equals(sa[column])) { if (cellData.equals(sa[column])) {
return; return;
} }
if (cellData.toString().length() == 0 && sa[column] == null) { if (cellData.toString().length() == 0 && sa[column] == null) {
return; return;
} }
@ -450,10 +458,14 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
**/ **/
protected JPanel getJContentPane1() { protected JPanel getJContentPane1() {
if (jContentPane == null) { if (jContentPane == null) {
jLabelGuidType = new JLabel(); jLabelGuidType = new JLabel();
jLabelGuidType.setBounds(new java.awt.Rectangle(400,122,103,16)); jLabelGuidType.setBounds(new java.awt.Rectangle(420,122,103,16));
jLabelGuidType.setText("GUID Type List"); jLabelGuidType.setText("GUID Type List");
jLabelGuidType.setEnabled(true); jLabelGuidType.setEnabled(true);
starLabel = new StarLabel();
starLabel.setLocation(new Point(jLabelGuidType.getX() - 20, jLabelGuidType.getY()));
starLabel.setVisible(true);
jLabelSupArch = new JLabel(); jLabelSupArch = new JLabel();
jLabelSupArch.setBounds(new java.awt.Rectangle(197,122,108,16)); jLabelSupArch.setBounds(new java.awt.Rectangle(197,122,108,16));
jLabelSupArch.setText("Supported Arch"); jLabelSupArch.setText("Supported Arch");
@ -513,6 +525,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
jContentPane.add(getJScrollPaneGuid(), null); jContentPane.add(getJScrollPaneGuid(), null);
jContentPane.add(getJScrollPaneModule(), null); jContentPane.add(getJScrollPaneModule(), null);
jContentPane.add(jLabelGuidType, null); jContentPane.add(jLabelGuidType, null);
jContentPane.add(starLabel, null);
} }
return jContentPane; return jContentPane;
} }
@ -638,7 +651,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
vguidType = null; vguidType = null;
} }
if (vguidType == null) { if (vguidType == null) {
JOptionPane.showMessageDialog(this, "You must select one GUID type."); JOptionPane.showMessageDialog(this, "You must select at least one GUID type.");
return -1; return -1;
} }
if (docConsole != null) { if (docConsole != null) {

View File

@ -50,6 +50,7 @@ import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel; import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList; import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
import org.tianocore.frameworkwizard.platform.ui.ListEditor; import org.tianocore.frameworkwizard.platform.ui.ListEditor;
import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery; import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
@ -222,6 +223,8 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
model.addColumn("Supported Architectures"); model.addColumn("Supported Architectures");
model.addColumn("Supported Module Types"); model.addColumn("Supported Module Types");
jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor());
Vector<String> vArch = new Vector<String>(); Vector<String> vArch = new Vector<String>();
vArch.add("IA32"); vArch.add("IA32");
vArch.add("X64"); vArch.add("X64");

View File

@ -48,6 +48,7 @@ import javax.swing.JTable;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList; import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
import org.tianocore.frameworkwizard.platform.ui.ListEditor; import org.tianocore.frameworkwizard.platform.ui.ListEditor;
import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.Vector; import java.util.Vector;
@ -689,6 +690,8 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3); TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3);
dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType)); dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType));
jTable.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
Vector<String> vArch = new Vector<String>(); Vector<String> vArch = new Vector<String>();
vArch.add("IA32"); vArch.add("IA32");
vArch.add("X64"); vArch.add("X64");
@ -762,7 +765,12 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
return; return;
} }
if (column <= 10 && column >= 6) { if (column <= 10 && column >= 6) {
if (compareTwoVectors(stringToVector(usage), stringToVector(sa[6]))) { Vector<String> v = stringToVector(usage);
if (compareTwoVectors(v, stringToVector(sa[6]))) {
return;
}
if (v.contains("FEATURE_FLAG") && v.size() > 1) {
JOptionPane.showMessageDialog(frame, "Usage Feature Flag can NOT co-exist with others.");
return; return;
} }
} }
@ -1092,11 +1100,12 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
} }
protected Vector<String> stringToVector(String s){ protected Vector<String> stringToVector(String s){
Vector<String> v = new Vector<String>();
if (s == null) { if (s == null) {
return null; return v;
} }
String[] sArray = s.split(" "); String[] sArray = s.split(" ");
Vector<String> v = new Vector<String>();
for (int i = 0; i < sArray.length; ++i) { for (int i = 0; i < sArray.length; ++i) {
v.add(sArray[i]); v.add(sArray[i]);
} }

View File

@ -17,6 +17,7 @@ import javax.swing.table.TableModel;
import org.tianocore.PackageSurfaceAreaDocument; import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType; import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
import org.tianocore.frameworkwizard.platform.ui.ListEditor;
/** /**
GUI for create library definition elements of spd file. GUI for create library definition elements of spd file.
@ -51,7 +52,8 @@ public class SpdPpiDecls extends SpdGuidDecls {
protected void initFrame() { protected void initFrame() {
this.setTitle("PPI Declarations"); this.setTitle("PPI Declarations");
starLabel.setVisible(false);
((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
} }
protected void init(SpdFileContents sfc){ protected void init(SpdFileContents sfc){

View File

@ -17,6 +17,7 @@ import javax.swing.table.TableModel;
import org.tianocore.PackageSurfaceAreaDocument; import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType; import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
import org.tianocore.frameworkwizard.platform.ui.ListEditor;
/** /**
GUI for create library definition elements of spd file. GUI for create library definition elements of spd file.
@ -51,7 +52,8 @@ public class SpdProtocolDecls extends SpdGuidDecls {
protected void initFrame() { protected void initFrame() {
this.setTitle("Protocol Declarations"); this.setTitle("Protocol Declarations");
starLabel.setVisible(false);
((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
} }
protected void init(SpdFileContents sfc){ protected void init(SpdFileContents sfc){

View File

@ -21,6 +21,7 @@ import java.util.Vector;
import javax.swing.AbstractCellEditor; import javax.swing.AbstractCellEditor;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
@ -35,6 +36,7 @@ public class ListEditor extends AbstractCellEditor implements TableCellEditor, A
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private boolean canNotBeEmpty = false;
String archs; String archs;
JButton button; JButton button;
static JFrame frame; static JFrame frame;
@ -92,6 +94,10 @@ public class ListEditor extends AbstractCellEditor implements TableCellEditor, A
} }
else { //User pressed dialog's "OK" button. else { //User pressed dialog's "OK" button.
Vector<String> v = dialog.getList(); Vector<String> v = dialog.getList();
if (canNotBeEmpty && v.size() == 0) {
JOptionPane.showMessageDialog(frame, "You must select at least one item.");
return;
}
String s = " "; String s = " ";
for (int i = 0; i < v.size(); ++i) { for (int i = 0; i < v.size(); ++i) {
s += v.get(i); s += v.get(i);
@ -103,4 +109,11 @@ public class ListEditor extends AbstractCellEditor implements TableCellEditor, A
} }
/**
* @param canNotBeEmpty The canNotBeEmpty to set.
*/
public void setCanNotBeEmpty(boolean canNotBeEmpty) {
this.canNotBeEmpty = canNotBeEmpty;
}
} }