Fixed Absolute position of fields, Added ToolTipText and made HelpText a Scrolling Text Area

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1132 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lhauch 2006-07-28 03:20:46 +00:00
parent 5101eff919
commit ccb063b1f2
8 changed files with 601 additions and 549 deletions

View File

@ -348,7 +348,7 @@ public class EventsDlg extends IDialog {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelEventType = new JLabel();
jLabelEventType.setText("Type");
jLabelEventType.setText("Select Event Type");
jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
@ -360,7 +360,7 @@ public class EventsDlg extends IDialog {
jStarLabel3 = new StarLabel();
jStarLabel3.setLocation(new java.awt.Point(2, 60));
jLabelGroup = new JLabel();
jLabelGroup.setText("Event Type");
jLabelGroup.setText("Event Group Type");
jLabelGroup.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jStarLabel4 = new StarLabel();
@ -375,11 +375,11 @@ public class EventsDlg extends IDialog {
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelFeatureFlag.setText("Feature Flag");
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20));
jLabelArch.setText("Arch");
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));

View File

@ -257,16 +257,16 @@ public class ExternsDlg extends IDialog implements ItemListener {
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jLabelC_Name = new JLabel();
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
jLabelC_Name.setText("Value");
jLabelC_Name.setText("Enter Value");
jLabelName = new JLabel();
jLabelName.setText("Choose Type");
jLabelName.setText("Choose Extern Type");
jLabelName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelArch.setText("Arch");
jLabelArch.setText("Supported Architectures");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
jLabelFeatureFlag.setText("Feature Flag");
jLabelFeatureFlag.setText("Feature Flag Expression");
jContentPane = new JPanel();
jContentPane.setLayout(null);

View File

@ -362,14 +362,14 @@ public class LibraryClassDefsDlg extends IDialog {
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
jLabelHelpText.setText("Help Text");
jLabelModuleList = new JLabel();
jLabelModuleList.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
jLabelModuleList.setText("Sup Module List");
jLabelModuleList.setText("Supported Module Types");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
jLabelArch.setText("Sup Arch List");
jLabelArch.setText("Supported Architectures");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelFeatureFlag.setText("Feature Flag");
@ -404,9 +404,9 @@ public class LibraryClassDefsDlg extends IDialog {
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(0, 10));
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(0, 35));
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);

View File

@ -38,83 +38,82 @@ import org.tianocore.frameworkwizard.packaging.PackageIdentification;
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
The class is used to create, update Include of MSA/MBD file
It extends IInternalFrame
**/
* The class is used to create, update Include of MSA/MBD file It extends
* IInternalFrame
*
*
*
*/
public class PackageDepDlg extends IDialog implements ItemListener {
// /
// / Define class Serial Version UID
// /
private static final long serialVersionUID = 3465193035145152131L;
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = 3465193035145152131L;
//
// Define class members
//
private JPanel jContentPane = null;
//
//Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelPackageName = null;
private JLabel jLabelPackageName = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel1 = null;
private JComboBox jComboBoxPackageName = null;
private JComboBox jComboBoxPackageName = null;
private JLabel jLabelPackageGuid = null;
private JLabel jLabelPackageGuid = null;
private JTextField jTextFieldPackageGuid = null;
private JTextField jTextFieldPackageGuid = null;
private JButton jButtonGenerateGuid = null;
private JButton jButtonGenerateGuid = null;
private JLabel jLabelPackageVersion = null;
private JLabel jLabelPackageVersion = null;
private JTextField jTextFieldPackageVersion = null;
private JTextField jTextFieldPackageVersion = null;
private JLabel jLabelFeatureFlag = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JScrollPane jScrollPane = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelArch = null;
private JLabel jLabelArch = null;
private ArchCheckBox jArchCheckBox = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private PackageDependenciesIdentification pdid = null;
//
// Not used by UI
//
private PackageDependenciesIdentification pdid = null;
private WorkspaceTools wt = new WorkspaceTools();
private WorkspaceTools wt = new WorkspaceTools();
private Vector<PackageIdentification> vPackage = wt.getAllPackages();
private Vector<PackageIdentification> vPackage = wt.getAllPackages();
/**
* This method initializes jComboBoxPackageName
*
* @return javax.swing.JComboBox
*/
/**
* This method initializes jComboBoxPackageName
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxPackageName() {
if (jComboBoxPackageName == null) {
jComboBoxPackageName = new JComboBox();
jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPackageName.setToolTipText("If your Module requires a package list that here.");
jComboBoxPackageName.addItemListener(this);
}
return jComboBoxPackageName;
if (jComboBoxPackageName == null) {
jComboBoxPackageName = new JComboBox();
jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPackageName.setToolTipText("If your Module requires a package list that here.");
jComboBoxPackageName.addItemListener(this);
}
return jComboBoxPackageName;
}
/**
* This method initializes jTextFieldPackageGuid
*
* @return javax.swing.JTextField
* This method initializes jTextFieldPackageGuid
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldPackageGuid() {
if (jTextFieldPackageGuid == null) {
@ -128,9 +127,9 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
* This method initializes jButtonGenerateGuid
*
* @return javax.swing.JButton
* This method initializes jButtonGenerateGuid
*
* @return javax.swing.JButton
*/
private JButton getJButtonGenerateGuid() {
if (jButtonGenerateGuid == null) {
@ -145,9 +144,9 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
* This method initializes jTextFieldPackageVersion
*
* @return javax.swing.JTextField
* This method initializes jTextFieldPackageVersion
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldPackageVersion() {
if (jTextFieldPackageVersion == null) {
@ -161,9 +160,9 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
@ -175,9 +174,9 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This method initializes jScrollPane
@return javax.swing.JScrollPane
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
@ -188,11 +187,11 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This method initializes jButtonOk
@return javax.swing.JButton
**/
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
@ -204,11 +203,11 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This method initializes jButtonCancel
@return javax.swing.JButton
**/
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
@ -224,9 +223,9 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This method initializes this
**/
* This method initializes this
*
*/
private void init() {
this.setSize(508, 188);
this.setContentPane(getJScrollPane());
@ -237,9 +236,9 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This method initializes this
**/
* This method initializes this
*
*/
private void init(PackageDependenciesIdentification inPackageDependenciesIdentification) {
init();
this.pdid = inPackageDependenciesIdentification;
@ -253,20 +252,21 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This is the default constructor
**/
* This is the default constructor
*
*/
public PackageDepDlg(PackageDependenciesIdentification inPackageDependenciesIdentification, IFrame iFrame) {
super(iFrame, true);
init(inPackageDependenciesIdentification);
}
/**
Disable all components when the mode is view
@param isView true - The view mode; false - The non-view mode
**/
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxPackageName.setEnabled(!isView);
@ -274,52 +274,54 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This method initializes jContentPane
@return javax.swing.JPanel jContentPane
**/
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelArch.setText("Sup Arch List");
jLabelPackageVersion = new JLabel();
jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
jLabelPackageVersion.setText("Package Version");
jLabelPackageGuid = new JLabel();
jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
jLabelPackageGuid.setText("Package Guid");
jLabelPackageGuid.setVisible(false);
jLabelPackageName = new JLabel();
jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
jLabelPackageName.setText("Package Name");
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelPackageName = new JLabel();
jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelPackageName.setText("Package Name");
jLabelPackageVersion = new JLabel();
jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelPackageVersion.setText("Package Version");
jLabelPackageGuid = new JLabel();
jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelPackageGuid.setText("Package Guid");
jLabelPackageGuid.setVisible(false);
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(490, 140));
jContentPane.add(jLabelPackageName, null);
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(0, 10));
jContentPane.setPreferredSize(new java.awt.Dimension(485, 145));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelPackageName, null);
jContentPane.add(getJComboBoxPackageName(), null);
jContentPane.add(jLabelPackageGuid, null);
jContentPane.add(getJTextFieldPackageGuid(), null);
jContentPane.add(getJButtonGenerateGuid(), null);
jContentPane.add(jLabelPackageVersion, null);
jContentPane.add(getJTextFieldPackageVersion(), null);
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
jLabelFeatureFlag.setText("Feature Flag");
// LAH Not Used here
// jContentPane.add(getJButtonGenerateGuid(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
@ -328,9 +330,11 @@ public class PackageDepDlg extends IDialog implements ItemListener {
return jContentPane;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
*
* Override actionPerformed to listen all actions
*
*/
@ -350,9 +354,9 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
This method initializes Usage type, Package type and Arch type
**/
* This method initializes Usage type, Package type and Arch type
*
*/
private void initFrame() {
for (int index = 0; index < vPackage.size(); index++) {
jComboBoxPackageName.addItem(vPackage.elementAt(index).getName());
@ -360,29 +364,29 @@ public class PackageDepDlg extends IDialog implements ItemListener {
}
/**
Data validation for all fields before add current item to Vector
@retval true - All datas are valid
@retval false - At least one data is invalid
**/
* Data validation for all fields before add current item to Vector
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
// Check if all fields have correct data types
//
//
// Check PackageGuid
// Check PackageGuid
//
// if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
// if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
// Log.err("Incorrect data type for Package Guid");
// return false;
// }
// }
// if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
// if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
// Log.err("Incorrect data type for Package Guid");
// return false;
// }
// }
//
// Check PackageVersion
// Check PackageVersion
//
if (!isEmpty(this.jTextFieldPackageVersion.getText())) {
if (!DataValidation.isVersion(this.jTextFieldPackageVersion.getText())) {
@ -416,9 +420,11 @@ public class PackageDepDlg extends IDialog implements ItemListener {
return pdid;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
*
*
* Reflesh the frame when selected item changed
*
*/

View File

@ -309,7 +309,7 @@ public class PpisDlg extends IDialog implements ItemListener {
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelPpiType = new JLabel();
jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelPpiType.setText("Ppi Type");
jLabelPpiType.setText("Select Ppi Type");
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
@ -328,12 +328,12 @@ public class PpisDlg extends IDialog implements ItemListener {
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag");
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelArch.setText("Arch");
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));

View File

@ -41,8 +41,9 @@ import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsI
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
* The class is used to create, update Protocol of MSA/MBD file
* It extends JDialog
* The class is used to create, update Protocol of MSA file
*
* It extends IDialog
*
*/
public class ProtocolsDlg extends IDialog implements ItemListener {
@ -134,7 +135,15 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td colspan=2>Protocol</td></tr><tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the protocol</td></tr><tr><td>SOMETIMES_CONSUMES</td><td>Module sometimes consumes the protocol</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces the protocol</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the protocol</td></tr><tr><td>TO_START</td><td>The protocol is consumed by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr><tr><td>BY_START</td><td>Protocol is produced by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr><tr><td colspan=2>Protocol Notify</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the protocol if it is produced.<br>Consumption is defined by executing the protocol notify<br>function.</td></tr></table></html>");
.setToolTipText("<html><table><tr><td colspan=2 align=center><b>Protocol</b></td></tr>"
+ "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the protocol</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMES</td><td>Module sometimes consumes the protocol</td></tr>"
+ "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the protocol</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the protocol</td></tr>"
+ "<tr><td>TO_START</td><td>The protocol is consumed by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
+ "<tr><td>BY_START</td><td>Protocol is produced by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
+ "<tr><td colspan=2 align=center><b>Protocol Notify</b></td></tr>"
+ "<tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the protocol if it is produced.<br>Consumption is defined by executing the protocol notify<br>function.</td></tr></table></html>");
}
return jComboBoxUsage;
}
@ -464,8 +473,8 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
String arg5 = this.jTextAreaHelpText.getText();
id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id;
}
}
/*
* (non-Javadoc)
*

View File

@ -307,7 +307,7 @@ public class SourceFilesDlg extends IDialog {
jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20));
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
jLabelFeatureFlag.setText("Feature Flag");
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelToolCode = new JLabel();
jLabelToolCode.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
jLabelToolCode.setText("Tool Code");
@ -316,7 +316,7 @@ public class SourceFilesDlg extends IDialog {
jLabelTagName.setText("Tag Name");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 120, 20));
jLabelArch.setText("Sup Arch List");
jLabelArch.setText("Supported Architectures");
jLabelToolChainFamily = new JLabel();
jLabelToolChainFamily.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
jLabelToolChainFamily.setText("Tool Chain Family");

View File

@ -24,6 +24,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation;
@ -38,402 +39,438 @@ import org.tianocore.frameworkwizard.module.Identifications.Variables.VariablesI
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
The class is used to create, update Variable of MSA/MBD file
It extends IInternalFrame
**/
* The class is used to create, update Variable of MSA/MBD file It extends
* IDialog
*
*/
public class VariablesDlg extends IDialog {
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = -6998982978030439446L;
// /
// / Define class Serial Version UID
// /
private static final long serialVersionUID = -6998982978030439446L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelVariableName = null;
private JTextField jTextFieldVariableName = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelGuidCName = null;
private JComboBox jComboBoxGuidC_Name = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelFeatureFlag = null;
private JLabel jLabelArch = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private VariablesIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
* This method initializes jTextFieldString
*
* @return javax.swing.JTextField jTextFieldString
*
*/
private JTextField getJTextFieldString() {
if (jTextFieldVariableName == null) {
jTextFieldVariableName = new JTextField();
jTextFieldVariableName.setSize(new java.awt.Dimension(320, 20));
jTextFieldVariableName.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldVariableName.setLocation(new java.awt.Point(160, 10));
jTextFieldVariableName
.setToolTipText("Enter a Hex Word Array, you must provide leading Zeros. 0x000a, 0x0010, 0x00FF");
}
return jTextFieldVariableName;
}
/**
* This method initializes jComboBoxUsage
*
* @return javax.swing.JComboBox jComboBoxUsage
*
*/
private JComboBox getJComboBoxUsage() {
if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>The module requires the variable entry to be set</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMED</td><td>The module will use the variable entry if its set.</td></tr>"
+ "<tr><td>ALWAYS_PRODUCED</td><td>The module will always write the variable.</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>The module will sometimes write the variable.</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField jTextFieldFeatureFlag
*
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag
.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
/**
* This method initializes jTextFieldHelpText
*
* @return javax.swing.JTextField
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
jTextAreaHelpText
.setToolTipText("Enter information on how to use this Variable.");
}
return jTextAreaHelpText;
}
private JScrollPane getJScrollPaneHelpText() {
if (jScrollPaneHelpText == null) {
jScrollPaneHelpText = new JScrollPane();
jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPaneHelpText.setSize(new java.awt.Dimension(320,40));
jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320,40));
jScrollPaneHelpText.setLocation(new java.awt.Point(160,85));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jComboBoxGuidC_Name
*
* @return javax.swing.JComboBox jComboBoxGuidC_Name
*
*/
private JComboBox getJComboBoxGuidC_Name() {
if (jComboBoxGuidC_Name == null) {
jComboBoxGuidC_Name = new JComboBox();
jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxGuidC_Name
.setToolTipText("Select the GUID C Name of the Variable.");
}
return jComboBoxGuidC_Name;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 255);
this.setContentPane(getJScrollPane());
this.setTitle("Variables");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inVariablesId
*
*/
private void init(VariablesIdentification inVariablesId) {
init();
this.id = inVariablesId;
if (this.id != null) {
this.jTextFieldVariableName.setText(id.getName());
this.jComboBoxGuidC_Name.setSelectedItem(id.getGuid());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inVariablesIdentification
* @param iFrame
*
*/
public VariablesDlg(VariablesIdentification inVariablesIdentification,
IFrame iFrame) {
super(iFrame, true);
init(inVariablesIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jTextFieldVariableName.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelVariableName = new JLabel();
jLabelVariableName.setText("Variable Name");
jLabelVariableName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelGuidCName = new JLabel();
jLabelGuidCName.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelGuidCName.setText("Variable Guid C Name");
jStarLabel3 = new StarLabel();
jStarLabel3.setLocation(new java.awt.Point(2, 60));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelVariableName, null);
jContentPane.add(getJTextFieldString(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelGuidCName, null);
jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentVariables();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt
.getAllGuidDeclarationsFromWorkspace());
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
//Define class members
// Check VariableName
//
private JPanel jContentPane = null;
if (isEmpty(this.jTextFieldVariableName.getText())) {
Log.wrn("Update Variables", "Variable Name must not be empty");
return false;
}
private JLabel jLabelVariableName = null;
private JTextField jTextFieldVariableName = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelGuidCName = null;
private JComboBox jComboBoxGuidC_Name = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelFeatureFlag = null;
private JLabel jLabelArch = null;
private JLabel jLabelHelpText = null;
private JTextField jTextFieldHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
if (!isEmpty(this.jTextFieldVariableName.getText())) {
if (!DataValidation.isHexWordArrayType(this.jTextFieldVariableName
.getText())) {
Log.wrn("Update Variables", "Incorrect data type for Variable Name");
return false;
}
}
//
// Not used by UI
// Check FeatureFlag
//
private VariablesIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
This method initializes jTextFieldString
@return javax.swing.JTextField jTextFieldString
**/
private JTextField getJTextFieldString() {
if (jTextFieldVariableName == null) {
jTextFieldVariableName = new JTextField();
jTextFieldVariableName.setSize(new java.awt.Dimension(320, 20));
jTextFieldVariableName.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldVariableName.setLocation(new java.awt.Point(160, 10));
jTextFieldVariableName
.setToolTipText("Enter a Hex Word Array, you must provide leading Zeros. 0x000a, 0x0010, 0x00FF");
}
return jTextFieldVariableName;
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Variables", "Incorrect data type for Feature Flag");
return false;
}
}
/**
This method initializes jComboBoxUsage
@return javax.swing.JComboBox jComboBoxUsage
**/
private JComboBox getJComboBoxUsage() {
if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
}
return jComboBoxUsage;
}
return true;
}
/**
This method initializes jScrollPane
@return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
private VariablesIdentification getCurrentVariables() {
String arg0 = this.jTextFieldVariableName.getText();
String arg1 = this.jComboBoxGuidC_Name.getSelectedItem().toString();
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
/**
This method initializes jTextFieldFeatureFlag
@return javax.swing.JTextField jTextFieldFeatureFlag
**/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
}
return jTextFieldFeatureFlag;
}
String arg3 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
String arg5 = this.jTextAreaHelpText.getText();
/**
This method initializes jTextFieldHelpText
@return javax.swing.JTextField
**/
private JTextField getJTextFieldHelpText() {
if (jTextFieldHelpText == null) {
jTextFieldHelpText = new JTextField();
jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldHelpText.setToolTipText("Enter information on how to use this Variable.");
}
return jTextFieldHelpText;
}
id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id;
}
public VariablesIdentification getId() {
return id;
}
/**
This method initializes jTextField
@return javax.swing.JTextField jTextFieldC_Name
**/
private JComboBox getJComboBoxGuidC_Name() {
if (jComboBoxGuidC_Name == null) {
jComboBoxGuidC_Name = new JComboBox();
jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Variable.");
}
return jComboBoxGuidC_Name;
}
/**
This method initializes jButtonOk
@return javax.swing.JButton
**/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 165, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
This method initializes jButtonCancel
@return javax.swing.JButton
**/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 165, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
This method initializes this
**/
private void init() {
this.setSize(510, 240);
this.setContentPane(getJScrollPane());
this.setTitle("Variables");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
This method initializes this
Fill values to all fields if these values are not empty
@param inVariablesId
**/
private void init(VariablesIdentification inVariablesId) {
init();
this.id = inVariablesId;
if (this.id != null) {
this.jTextFieldVariableName.setText(id.getName());
this.jComboBoxGuidC_Name.setSelectedItem(id.getGuid());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextFieldHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
This is the override edit constructor
@param inVariablesIdentification
@param iFrame
**/
public VariablesDlg(VariablesIdentification inVariablesIdentification, IFrame iFrame) {
super(iFrame, true);
init(inVariablesIdentification);
}
/**
Disable all components when the mode is view
@param isView true - The view mode; false - The non-view mode
**/
public void setViewMode(boolean isView) {
if (isView) {
this.jTextFieldVariableName.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
This method initializes jContentPane
@return javax.swing.JPanel jContentPane
**/
private JPanel getJContentPane() {
if (jContentPane == null) {
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 135, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jLabelGuidCName = new JLabel();
jLabelGuidCName.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
jLabelGuidCName.setText("Guid C Name");
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
jLabelVariableName = new JLabel();
jLabelVariableName.setText("Variable Name");
jLabelVariableName.setLocation(new java.awt.Point(15, 10));
jLabelVariableName.setSize(new java.awt.Dimension(140, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
jLabelArch.setText("Arch");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(490, 190));
jContentPane.add(jLabelVariableName, null);
jContentPane.add(jLabelGuidCName, null);
jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(getJTextFieldString(), null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(0, 10));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(0, 35));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
jLabelHelpText.setText("Help Text");
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJTextFieldHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentVariables();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
This method initializes Usage type
**/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace());
}
/**
Data validation for all fields
@retval true - All datas are valid
@retval false - At least one data is invalid
**/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check VariableName
//
if (isEmpty(this.jTextFieldVariableName.getText())) {
Log.wrn("Update Variables", "Variable Name couldn't be empty");
return false;
}
if (!isEmpty(this.jTextFieldVariableName.getText())) {
if (!DataValidation.isHexWordArrayType(this.jTextFieldVariableName.getText())) {
Log.wrn("Update Variables", "Incorrect data type for Variable Name");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Variables", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private VariablesIdentification getCurrentVariables() {
String arg0 = this.jTextFieldVariableName.getText();
String arg1 = this.jComboBoxGuidC_Name.getSelectedItem().toString();
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
String arg3 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
String arg5 = this.jTextFieldHelpText.getText();
id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id;
}
public VariablesIdentification getId() {
return id;
}
public void setId(VariablesIdentification id) {
this.id = id;
}
public void setId(VariablesIdentification id) {
this.id = id;
}
}