X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2Fdialog%2FProtocolsDlg.java;h=0bd5b5fcd1d6ce0395d00fcdb7387722262bdd32;hp=0f4970cc88d3b2eb536a5ec3bb509603d143866b;hb=3f62225f1e49da815a9cc4c6ed6f56d3753ca37b;hpb=06a19ceec7b8b78f4698073ce4054b26dc4a74bd
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
index 0f4970cc88..0bd5b5fcd1 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java
@@ -1,6 +1,6 @@
/** @file
- The file is used to create, update Protocol of MSA/MBD file
+ The file is used to create, update Protocol of section of the MSA file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
@@ -26,6 +26,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;
@@ -40,21 +41,20 @@ 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 IInternalFrame
-
-
-
- **/
+ * The class is used to create, update Protocol of MSA file
+ *
+ * It extends IDialog
+ *
+ */
public class ProtocolsDlg extends IDialog implements ItemListener {
- ///
- /// Define class Serial Version UID
- ///
+ // /
+ // / Define class Serial Version UID
+ // /
private static final long serialVersionUID = -9084913640747858848L;
//
- //Define class members
+ // Define class members
//
private JPanel jContentPane = null;
@@ -72,6 +72,8 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
private StarLabel jStarLabel2 = null;
+ private StarLabel jStarLabel3 = null;
+
private JLabel jLabelProtocolType = null;
private JLabel jLabelArch = null;
@@ -84,10 +86,12 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
private JLabel jLabelHelpText = null;
- private JTextField jTextFieldHelpText = null;
+ private JTextArea jTextAreaHelpText = null;
+
+ private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
-
+
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
@@ -102,39 +106,50 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
private EnumerationData ed = new EnumerationData();
/**
- This method initializes jTextFieldFeatureFlag
-
- @return javax.swing.JTextField jTextFieldFeatureFlag
-
- **/
+ * 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.setBounds(new java.awt.Rectangle(168, 132, 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 jComboBoxUsage
-
- @return javax.swing.JComboBox jComboBoxUsage
-
- **/
+ * This method initializes jComboBoxUsage
+ *
+ * @return javax.swing.JComboBox jComboBoxUsage
+ *
+ */
private JComboBox getJComboBoxProtocolUsage() {
if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
+ jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxUsage
+ .setToolTipText("
Protocol |
"
+ + "ALWAYS_CONSUMED | Module always consumes the protocol |
"
+ + "SOMETIMES_CONSUMES | Module sometimes consumes the protocol |
"
+ + "ALWAYS_PRODUCED | Module always produces the protocol |
"
+ + "SOMETIMES_PRODUCED | Module sometimes produces the protocol |
"
+ + "TO_START | The protocol is consumed by a Driver Binding protocol Start function. The protocol is used in EFI 1.10 driver model |
"
+ + "BY_START | Protocol is produced by a Driver Binding protocol Start function. The protocol is used in EFI 1.10 driver model |
"
+ + "Protocol Notify |
"
+ + "SOMETIMES_CONSUMED | Module will consume the protocol if it is produced. Consumption is defined by executing the protocol notify function. |
");
}
return jComboBoxUsage;
}
/**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
+ * This method initializes jScrollPane
+ *
+ * @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
@@ -145,61 +160,81 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
}
/**
- * This method initializes jComboBoxProtocolType
- *
- * @return javax.swing.JComboBox
+ * This method initializes jComboBoxProtocolType
+ *
+ * @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxProtocolType() {
if (jComboBoxProtocolType == null) {
jComboBoxProtocolType = new JComboBox();
- jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
+ jComboBoxProtocolType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxProtocolType.addItemListener(this);
- jComboBoxProtocolType.setToolTipText("Select Protocol Type");
+ jComboBoxProtocolType
+ .setToolTipText("Select Protocol Type
Protocol Notify is a register protocol notify mechanism.");
}
return jComboBoxProtocolType;
}
/**
- * This method initializes jComboBoxCName
- *
- * @return javax.swing.JComboBox
+ * This method initializes jComboBoxCName
+ *
+ * @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxCName() {
if (jComboBoxCName == null) {
jComboBoxCName = new JComboBox();
- jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
+ jComboBoxCName.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
+ jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol");
}
return jComboBoxCName;
}
/**
- 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));
+ * This method initializes jTextAreaHelpText
+ *
+ * @return javax.swing.JTextArea
+ *
+ */
+ private JTextArea getJTextAreaHelpText() {
+ if (jTextAreaHelpText == null) {
+ jTextAreaHelpText = new JTextArea();
+ jTextAreaHelpText.setLineWrap(true);
+ jTextAreaHelpText.setWrapStyleWord(true);
}
- return jTextFieldHelpText;
+ return jTextAreaHelpText;
}
/**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
+ * This method initializes jScrollPaneHelpText
+ *
+ * @return javax.swing.JScrollPane
+ *
+ */
+ 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(168, 87));
+ jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
+ }
+ return jScrollPaneHelpText;
+ }
+
+ /**
+ * 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.setBounds(new java.awt.Rectangle(290, 187, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
@@ -207,15 +242,15 @@ public class ProtocolsDlg 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();
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 165, 90, 20));
+ jButtonCancel.setBounds(new java.awt.Rectangle(390, 187, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
@@ -227,11 +262,13 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
}
/**
- This method initializes this
-
- **/
+ * This method initializes this
+ *
+ */
private void init() {
- this.setSize(500, 225);
+ // Width must be 20 larger than Content Pane PreferredSize width for MSFT
+ // Height must be 45 larger than ContentPane PreferredSize height for MSFT
+ this.setSize(505, 260);
this.setContentPane(getJScrollPane());
this.setTitle("Protocols");
initFrame();
@@ -240,12 +277,12 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
}
/**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inProtocolsId
-
- **/
+ * This method initializes this Fill values to all fields if these values are
+ * not empty
+ *
+ * @param inProtocolsId
+ *
+ */
private void init(ProtocolsIdentification inProtocolsId) {
init();
this.id = inProtocolsId;
@@ -254,31 +291,31 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxProtocolType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextFieldHelpText.setText(id.getHelp());
-
- jTextFieldFeatureFlag.setText(id.getFeatureFlag());
+ this.jTextAreaHelpText.setText(id.getHelp());
+ this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
- This is the override edit constructor
-
- @param inProtocolsIdentification
- @param iFrame
-
- **/
+ * This is the override edit constructor
+ *
+ * @param inProtocolsIdentification
+ * @param iFrame
+ *
+ */
public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inProtocolsIdentification);
}
/**
- 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.jComboBoxUsage.setEnabled(!isView);
@@ -287,58 +324,64 @@ public class ProtocolsDlg 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, 135, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20));
- jLabelHelpText.setText("Help Text");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
- jLabelArch.setText("Arch Type");
+ jStarLabel1 = new StarLabel();
+ jStarLabel1.setLocation(new java.awt.Point(2, 12));
jLabelProtocolType = new JLabel();
- jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
- jLabelProtocolType.setText("Protocol Type");
+ jLabelProtocolType.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
+ jLabelProtocolType.setText("Select Protocol Type");
+
+ jStarLabel2 = new StarLabel();
+ jStarLabel2.setLocation(new java.awt.Point(2, 37));
+ jLabelC_Name = new JLabel();
+ jLabelC_Name.setText("Protocol Guid C Name");
+ jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
+
+ jStarLabel3 = new StarLabel();
+ jStarLabel3.setLocation(new java.awt.Point(2, 62));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
+ jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
+
+ jLabelHelpText = new JLabel();
+ jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
+ jLabelHelpText.setText("Help Text");
+
jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("C_Name Type");
- jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
+ jLabelFeatureFlag.setText("Feature Flag Expression");
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
+
+ jLabelArch = new JLabel();
+ jLabelArch.setBounds(new java.awt.Rectangle(12, 157, 155, 20));
+ jLabelArch.setText("Supported Architectures");
+ jArchCheckBox = new ArchCheckBox();
+ jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
+ jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 190));
-
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxProtocolUsage(), null);
- jContentPane.add(jLabelProtocolType, null);
-
- jStarLabel1 = new StarLabel();
- jStarLabel1.setBounds(new java.awt.Rectangle(0, 10, 10, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20));
+ jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelArch, null);
+ jContentPane.add(jLabelProtocolType, null);
jContentPane.add(getJComboBoxProtocolType(), null);
+ jContentPane.add(jStarLabel2, null);
+ jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null);
+ jContentPane.add(jStarLabel3, null);
+ jContentPane.add(jLabelUsage, null);
+ jContentPane.add(getJComboBoxProtocolUsage(), null);
jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJTextFieldHelpText(), 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);
@@ -347,18 +390,20 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
}
/**
- This method initializes Usage type
-
- **/
+ * This method initializes Usage type
+ *
+ */
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
+ *
* Override actionPerformed to listen all actions
*
*/
@@ -378,23 +423,23 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
}
/**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
+ * 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 if all fields have correct data types
//
//
- // Check Name
+ // Check Name
//
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
- Log.err("Incorrect data type for Protocol/ProtocolNotify Name");
+ Log.wrn("Update Protocols", "Incorrect data type for Protocol/ProtocolNotify Name");
return false;
}
}
@@ -404,7 +449,7 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.err("Incorrect data type for Feature Flag");
+ Log.wrn("Update Protocols", "Incorrect data type for Feature Flag");
return false;
}
}
@@ -419,17 +464,20 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
String arg3 = this.jTextFieldFeatureFlag.getText();
Vector arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextFieldHelpText.getText();
+ String arg5 = this.jTextAreaHelpText.getText();
id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- *
+ *
* Reflesh the frame when selected item changed
*
*/
+
public void itemStateChanged(ItemEvent arg0) {
if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) {
if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) {