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@1129 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lhauch 2006-07-28 00:17:23 +00:00
parent 5b38b75ba6
commit 7ab6baa9de
2 changed files with 901 additions and 812 deletions

View File

@ -23,6 +23,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.JTextArea;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
@ -37,21 +38,21 @@ import org.tianocore.frameworkwizard.module.Identifications.Events.EventsIdentif
import org.tianocore.frameworkwizard.workspace.WorkspaceTools; import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/** /**
The class is used to create, update Event of MSA/MBD file * The class is used to create, update Event of MSA/MBD file It extends
It extends IInternalFrame * IInternalFrame
*
@since ModuleEditor 1.0 * @since ModuleEditor 1.0
*
**/ */
public class EventsDlg extends IDialog { public class EventsDlg extends IDialog {
/// // /
/// Define class Serial Version UID // / Define class Serial Version UID
/// // /
private static final long serialVersionUID = -4396143706422842331L; private static final long serialVersionUID = -4396143706422842331L;
// //
//Define class members // Define class members
// //
private JPanel jContentPane = null; private JPanel jContentPane = null;
@ -75,6 +76,8 @@ public class EventsDlg extends IDialog {
private StarLabel jStarLabel3 = null; private StarLabel jStarLabel3 = null;
private StarLabel jStarLabel4 = null;
private JComboBox jComboBoxEventsType = null; private JComboBox jComboBoxEventsType = null;
private JScrollPane jScrollPane = null; private JScrollPane jScrollPane = null;
@ -83,7 +86,9 @@ public class EventsDlg extends IDialog {
private JLabel jLabelHelpText = null; private JLabel jLabelHelpText = null;
private JTextField jTextFieldHelpText = null; private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private JLabel jLabelFeatureFlag = null; private JLabel jLabelFeatureFlag = null;
@ -105,42 +110,11 @@ public class EventsDlg extends IDialog {
private WorkspaceTools wt = new WorkspaceTools(); private WorkspaceTools wt = new WorkspaceTools();
/** /**
This method initializes jTextFieldC_Name * This method initializes jComboBoxType
*
@return javax.swing.JTextField jTextFieldC_Name * @return javax.swing.JComboBox jComboBoxType
*
**/ */
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 Event");
}
return jComboBoxGuidC_Name;
}
/**
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, 85, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
}
return jComboBoxUsage;
}
/**
This method initializes jComboBoxType
@return javax.swing.JComboBox jComboBoxType
**/
private JComboBox getJComboBoxEventsType() { private JComboBox getJComboBoxEventsType() {
if (jComboBoxEventsType == null) { if (jComboBoxEventsType == null) {
jComboBoxEventsType = new JComboBox(); jComboBoxEventsType = new JComboBox();
@ -152,6 +126,22 @@ public class EventsDlg extends IDialog {
return jComboBoxEventsType; return jComboBoxEventsType;
} }
/**
* This method initializes jTextFieldC_Name
*
* @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 Event");
}
return jComboBoxGuidC_Name;
}
/** /**
* This method initializes jComboBoxEventsType * This method initializes jComboBoxEventsType
* *
@ -162,16 +152,34 @@ public class EventsDlg extends IDialog {
jComboBoxEventGroup = new JComboBox(); jComboBoxEventGroup = new JComboBox();
jComboBoxEventGroup.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); jComboBoxEventGroup.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxEventGroup.setToolTipText("Select Type of Event, Guid or Timer."); jComboBoxEventGroup
.setToolTipText("Select Type of Event: Guid or Timer.");
} }
return jComboBoxEventGroup; return jComboBoxEventGroup;
} }
/** /**
This method initializes jScrollPane * 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, 85, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td colspan=2 align=center><b>Create Events</b></td></tr><tr><td>ALWAYS_CONSUMED</td><td>Module registers a notification function and REQUIRES that it be<br>executed for the module to fully function.</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module registers a notification function and calls the function<br>when it is signaled</td></tr><tr><td colspan=2 align=center><b>Signal Events</b></td></tr><tr><td>ALWAYS_PRODUCED</td><td>Module will Always signal the event</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes signal the event</td></tr></table></html>");
}
return jComboBoxUsage;
}
@return javax.swing.JScrollPane /**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/ */
private JScrollPane getJScrollPane() { private JScrollPane getJScrollPane() {
if (jScrollPane == null) { if (jScrollPane == null) {
@ -189,37 +197,58 @@ public class EventsDlg extends IDialog {
private JTextField getJTextFieldFeatureFlag() { private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) { if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField(); jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 135, 320, 20)); jTextFieldFeatureFlag
.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag
.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
} }
return jTextFieldFeatureFlag; return jTextFieldFeatureFlag;
} }
/** /**
This method initializes jTextFieldHelpText * This method initializes jTextAreaHelpText
*
@return javax.swing.JTextField * @return javax.swing.JTextArea
*
**/ */
private JTextField getJTextFieldHelpText() { private JTextArea getJTextAreaHelpText() {
if (jTextFieldHelpText == null) { if (jTextAreaHelpText == null) {
jTextFieldHelpText = new JTextField(); jTextAreaHelpText = new JTextArea();
jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 110, 320, 20)); jTextAreaHelpText.setLineWrap(true);
jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20)); jTextAreaHelpText.setWrapStyleWord(true);
} }
return jTextFieldHelpText; return jTextAreaHelpText;
} }
/** /**
This method initializes jButtonOk * 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(160,110));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
@return javax.swing.JButton /**
* This method initializes jButtonOk
**/ *
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() { private JButton getJButtonOk() {
if (jButtonOk == null) { if (jButtonOk == null) {
jButtonOk = new JButton(); jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 190, 90, 20)); jButtonOk.setBounds(new java.awt.Rectangle(290, 202, 90, 20));
jButtonOk.setText("Ok"); jButtonOk.setText("Ok");
jButtonOk.addActionListener(this); jButtonOk.addActionListener(this);
} }
@ -227,15 +256,15 @@ public class EventsDlg extends IDialog {
} }
/** /**
This method initializes jButtonCancel * This method initializes jButtonCancel
*
@return javax.swing.JButton * @return javax.swing.JButton
*
**/ */
private JButton getJButtonCancel() { private JButton getJButtonCancel() {
if (jButtonCancel == null) { if (jButtonCancel == null) {
jButtonCancel = new JButton(); jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 190, 90, 20)); jButtonCancel.setBounds(new java.awt.Rectangle(390, 202, 90, 20));
jButtonCancel.setText("Cancel"); jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this); jButtonCancel.addActionListener(this);
} }
@ -247,11 +276,11 @@ public class EventsDlg extends IDialog {
} }
/** /**
This method initializes this * This method initializes this
*
**/ */
private void init() { private void init() {
this.setSize(508, 265); this.setSize(500, 275);
this.setContentPane(getJScrollPane()); this.setContentPane(getJScrollPane());
this.setTitle("Events"); this.setTitle("Events");
initFrame(); initFrame();
@ -260,12 +289,12 @@ public class EventsDlg extends IDialog {
} }
/** /**
This method initializes this * This method initializes this Fill values to all fields if these values are
Fill values to all fields if these values are not empty * not empty
*
@param inEventsId * @param inEventsId
*
**/ */
private void init(EventsIdentification inEventsId) { private void init(EventsIdentification inEventsId) {
init(); init();
this.id = inEventsId; this.id = inEventsId;
@ -274,7 +303,7 @@ public class EventsDlg extends IDialog {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxEventsType.setSelectedItem(id.getType()); this.jComboBoxEventsType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage()); this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextFieldHelpText.setText(id.getHelp()); this.jTextAreaHelpText.setText(id.getHelp());
jTextFieldFeatureFlag.setText(id.getFeatureFlag()); jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList()); this.jArchCheckBox.setSelectedItems(id.getSupArchList());
@ -283,23 +312,24 @@ public class EventsDlg extends IDialog {
} }
/** /**
This is the override edit constructor * This is the override edit constructor
*
@param inEventsIdentification * @param inEventsIdentification
@param iFrame * @param iFrame
*
**/ */
public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame) { public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame) {
super(iFrame, true); super(iFrame, true);
init(inEventsIdentification); init(inEventsIdentification);
} }
/** /**
Disable all components when the mode is view * Disable all components when the mode is view
*
@param isView true - The view mode; false - The non-view mode * @param isView
* true - The view mode; false - The non-view mode
**/ *
*/
public void setViewMode(boolean isView) { public void setViewMode(boolean isView) {
if (isView) { if (isView) {
this.jComboBoxGuidC_Name.setEnabled(!isView); this.jComboBoxGuidC_Name.setEnabled(!isView);
@ -308,85 +338,96 @@ public class EventsDlg extends IDialog {
} }
/** /**
This method initializes jContentPane * This method initializes jContentPane
*
@return javax.swing.JPanel jContentPane * @return javax.swing.JPanel jContentPane
*
**/ */
private JPanel getJContentPane() { private JPanel getJContentPane() {
if (jContentPane == null) { if (jContentPane == null) {
jArchCheckBox = new ArchCheckBox(); jStarLabel1 = new StarLabel();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 160, 320, 20)); jStarLabel1.setLocation(new java.awt.Point(2, 10));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); jLabelEventType = new JLabel();
jLabelFeatureFlag = new JLabel(); jLabelEventType.setText("Type");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 135, 140, 20)); jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelFeatureFlag.setText("Feature Flag");
jLabelArch = new JLabel(); jStarLabel2 = new StarLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 160, 140, 20)); jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelArch.setText("Arch"); jLabelC_Name = new JLabel();
jLabelC_Name.setText("Guid C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jStarLabel3 = new StarLabel();
jStarLabel3.setLocation(new java.awt.Point(2, 60));
jLabelGroup = new JLabel();
jLabelGroup.setText("Event Type");
jLabelGroup.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jStarLabel4 = new StarLabel();
jStarLabel4.setLocation(new java.awt.Point(2, 85));
jLabelUsage = new JLabel(); jLabelUsage = new JLabel();
jLabelUsage.setText("Usage"); jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("Guid C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
jLabelGroup = new JLabel();
jLabelGroup.setText("Event Type");
jLabelGroup.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
jLabelEventType = new JLabel();
jLabelEventType.setText("Type");
jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
jLabelHelpText = new JLabel(); jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 110, 140, 20)); jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 145, 20));
jLabelHelpText.setText("Help Text"); jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelFeatureFlag.setText("Feature Flag");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20));
jLabelArch.setText("Arch");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel(); jContentPane = new JPanel();
jContentPane.setLayout(null); jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(490, 220)); jContentPane.setPreferredSize(new java.awt.Dimension(485, 230));
jContentPane.add(jLabelEventType, null);
jContentPane.add(jLabelGroup, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), 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));
jStarLabel3 = new StarLabel();
jStarLabel3.setBounds(new java.awt.Rectangle(0, 60, 10, 20));
jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null); jContentPane.add(jLabelEventType, null);
jContentPane.add(jStarLabel3, null);
jContentPane.add(getJComboBoxEventsType(), null); jContentPane.add(getJComboBoxEventsType(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelArch, null); jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelGroup, null);
jContentPane.add(getJComboBoxEventGroup(), null);
jContentPane.add(jStarLabel4, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null); jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null); jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelHelpText, null); jContentPane.add(jLabelArch, null);
jContentPane.add(getJTextFieldHelpText(), null);
jContentPane.add(jArchCheckBox, null); jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null); jContentPane.add(getJButtonCancel(), null);
jContentPane.add(getJComboBoxEventGroup(), null);
} }
return jContentPane; return jContentPane;
} }
/** /**
This method initializes events groups and usage type * This method initializes events groups and usage type
*
**/ */
private void initFrame() { private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType()); Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType());
Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup()); Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage()); Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace()); Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt
.getAllGuidDeclarationsFromWorkspace());
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
* *
* Override actionPerformed to listen all actions * Override actionPerformed to listen all actions
@ -408,12 +449,12 @@ public class EventsDlg extends IDialog {
} }
/** /**
Data validation for all fields * Data validation for all fields
*
@retval true - All datas are valid * @retval true - All datas are valid
@retval false - At least one data is invalid * @retval false - At least one data is invalid
*
**/ */
public boolean checkAdd() { public boolean checkAdd() {
// //
// Check if all fields have correct data types // Check if all fields have correct data types
@ -428,7 +469,8 @@ public class EventsDlg extends IDialog {
} }
if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name
.getSelectedItem().toString())) {
Log.wrn("Update Events", "Incorrect data type for Event Name"); Log.wrn("Update Events", "Incorrect data type for Event Name");
return false; return false;
} }
@ -454,7 +496,7 @@ public class EventsDlg extends IDialog {
String arg3 = this.jTextFieldFeatureFlag.getText(); String arg3 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector(); Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
String arg5 = this.jTextFieldHelpText.getText(); String arg5 = this.jTextAreaHelpText.getText();
String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString(); String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString();
id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
return id; return id;

View File

@ -26,6 +26,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.JTextArea;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
@ -40,21 +41,19 @@ import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsI
import org.tianocore.frameworkwizard.workspace.WorkspaceTools; import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/** /**
The class is used to create, update Protocol of MSA/MBD file * The class is used to create, update Protocol of MSA/MBD file
It extends IInternalFrame * It extends JDialog
*
*/
**/
public class ProtocolsDlg extends IDialog implements ItemListener { public class ProtocolsDlg extends IDialog implements ItemListener {
/// // /
/// Define class Serial Version UID // / Define class Serial Version UID
/// // /
private static final long serialVersionUID = -9084913640747858848L; private static final long serialVersionUID = -9084913640747858848L;
// //
//Define class members // Define class members
// //
private JPanel jContentPane = null; private JPanel jContentPane = null;
@ -72,6 +71,8 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
private StarLabel jStarLabel2 = null; private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JLabel jLabelProtocolType = null; private JLabel jLabelProtocolType = null;
private JLabel jLabelArch = null; private JLabel jLabelArch = null;
@ -84,7 +85,9 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
private JLabel jLabelHelpText = null; private JLabel jLabelHelpText = null;
private JTextField jTextFieldHelpText = null; private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null; private ArchCheckBox jArchCheckBox = null;
@ -102,40 +105,44 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
private EnumerationData ed = new EnumerationData(); private EnumerationData ed = new EnumerationData();
/** /**
This method initializes jTextFieldFeatureFlag * This method initializes jTextFieldFeatureFlag
*
@return javax.swing.JTextField jTextFieldFeatureFlag * @return javax.swing.JTextField jTextFieldFeatureFlag
*
**/ */
private JTextField getJTextFieldFeatureFlag() { private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) { if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField(); jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 110, 320, 20)); jTextFieldFeatureFlag
.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag
.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
} }
return jTextFieldFeatureFlag; return jTextFieldFeatureFlag;
} }
/** /**
This method initializes jComboBoxUsage * This method initializes jComboBoxUsage
*
@return javax.swing.JComboBox jComboBoxUsage * @return javax.swing.JComboBox jComboBoxUsage
*
**/ */
private JComboBox getJComboBoxProtocolUsage() { private JComboBox getJComboBoxProtocolUsage() {
if (jComboBoxUsage == null) { if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox(); jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage.setToolTipText("ALWAYS_CONSUMED is the only valid usage for type ProtocolNotify."); 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>");
} }
return jComboBoxUsage; return jComboBoxUsage;
} }
/** /**
This method initializes jScrollPane * This method initializes jScrollPane
*
@return javax.swing.JScrollPane * @return javax.swing.JScrollPane
*/ */
private JScrollPane getJScrollPane() { private JScrollPane getJScrollPane() {
if (jScrollPane == null) { if (jScrollPane == null) {
@ -156,7 +163,8 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxProtocolType.addItemListener(this); jComboBoxProtocolType.addItemListener(this);
jComboBoxProtocolType.setToolTipText("<html>Select Protocol Type<br>Protocol Notify is a register protocol notify mechanism."); jComboBoxProtocolType
.setToolTipText("<html>Select Protocol Type<br>Protocol Notify is a register protocol notify mechanism.");
} }
return jComboBoxProtocolType; return jComboBoxProtocolType;
} }
@ -178,30 +186,49 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes jTextFieldHelpText * This method initializes jTextAreaHelpText
*
@return javax.swing.JTextField * @return javax.swing.JTextArea
*
**/ */
private JTextField getJTextFieldHelpText() { private JTextArea getJTextAreaHelpText() {
if (jTextFieldHelpText == null) { if (jTextAreaHelpText == null) {
jTextFieldHelpText = new JTextField(); jTextAreaHelpText = new JTextArea();
jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); jTextAreaHelpText.setLineWrap(true);
jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20)); jTextAreaHelpText.setWrapStyleWord(true);
} }
return jTextFieldHelpText; return jTextAreaHelpText;
} }
/** /**
This method initializes jButtonOk * 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(160, 85));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
@return javax.swing.JButton /**
* This method initializes jButtonOk
**/ *
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() { private JButton getJButtonOk() {
if (jButtonOk == null) { if (jButtonOk == null) {
jButtonOk = new JButton(); jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 165, 90, 20)); jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok"); jButtonOk.setText("Ok");
jButtonOk.addActionListener(this); jButtonOk.addActionListener(this);
} }
@ -209,15 +236,15 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes jButtonCancel * This method initializes jButtonCancel
*
@return javax.swing.JButton * @return javax.swing.JButton
*
**/ */
private JButton getJButtonCancel() { private JButton getJButtonCancel() {
if (jButtonCancel == null) { if (jButtonCancel == null) {
jButtonCancel = new JButton(); jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 165, 90, 20)); jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel"); jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this); jButtonCancel.addActionListener(this);
} }
@ -229,11 +256,11 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes this * This method initializes this
*
**/ */
private void init() { private void init() {
this.setSize(510, 240); this.setSize(500, 255);
this.setContentPane(getJScrollPane()); this.setContentPane(getJScrollPane());
this.setTitle("Protocols"); this.setTitle("Protocols");
initFrame(); initFrame();
@ -242,12 +269,12 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes this * This method initializes this Fill values to all fields if these values are
Fill values to all fields if these values are not empty * not empty
*
@param inProtocolsId * @param inProtocolsId
*
**/ */
private void init(ProtocolsIdentification inProtocolsId) { private void init(ProtocolsIdentification inProtocolsId) {
init(); init();
this.id = inProtocolsId; this.id = inProtocolsId;
@ -256,31 +283,32 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
this.jComboBoxCName.setSelectedItem(id.getName()); this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxProtocolType.setSelectedItem(id.getType()); this.jComboBoxProtocolType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage()); this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextFieldHelpText.setText(id.getHelp()); this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList()); this.jArchCheckBox.setSelectedItems(id.getSupArchList());
} }
} }
/** /**
This is the override edit constructor * This is the override edit constructor
*
@param inProtocolsIdentification * @param inProtocolsIdentification
@param iFrame * @param iFrame
*
**/ */
public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame) { public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification,
IFrame iFrame) {
super(iFrame, true); super(iFrame, true);
init(inProtocolsIdentification); init(inProtocolsIdentification);
} }
/** /**
Disable all components when the mode is view * Disable all components when the mode is view
*
@param isView true - The view mode; false - The non-view mode * @param isView
* true - The view mode; false - The non-view mode
**/ *
*/
public void setViewMode(boolean isView) { public void setViewMode(boolean isView) {
if (isView) { if (isView) {
this.jComboBoxUsage.setEnabled(!isView); this.jComboBoxUsage.setEnabled(!isView);
@ -289,58 +317,64 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes jContentPane * This method initializes jContentPane
*
@return javax.swing.JPanel jContentPane * @return javax.swing.JPanel jContentPane
*
**/ */
private JPanel getJContentPane() { private JPanel getJContentPane() {
if (jContentPane == null) { if (jContentPane == null) {
jArchCheckBox = new ArchCheckBox(); jStarLabel1 = new StarLabel();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 135, 320, 20)); jStarLabel1.setLocation(new java.awt.Point(2, 10));
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");
jLabelProtocolType = new JLabel(); jLabelProtocolType = new JLabel();
jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelProtocolType.setText("Protocol Type"); jLabelProtocolType.setText("Select Protocol Type");
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("Protocol Guid C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jStarLabel3 = new StarLabel();
jStarLabel3.setLocation(new java.awt.Point(2, 60));
jLabelUsage = new JLabel(); jLabelUsage = new JLabel();
jLabelUsage.setText("Usage"); jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag"); jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20)); jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("C Name Type"); jLabelArch = new JLabel();
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); 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 = new JPanel();
jContentPane.setLayout(null); jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(490, 190)); jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
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.add(jStarLabel1, null); jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null); jContentPane.add(jLabelProtocolType, null);
jContentPane.add(jLabelArch, null);
jContentPane.add(getJComboBoxProtocolType(), null); jContentPane.add(getJComboBoxProtocolType(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null); jContentPane.add(getJComboBoxCName(), null);
jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxProtocolUsage(), null);
jContentPane.add(jLabelHelpText, 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(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null); jContentPane.add(getJButtonCancel(), null);
@ -349,16 +383,20 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes Usage type * This method initializes Usage type
*
**/ */
private void initFrame() { private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType()); Tools
Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace()); .generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
Tools.generateComboBoxByVector(jComboBoxCName, wt
.getAllProtocolDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage()); Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
* *
* Override actionPerformed to listen all actions * Override actionPerformed to listen all actions
@ -380,12 +418,12 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
} }
/** /**
Data validation for all fields * Data validation for all fields
*
@retval true - All datas are valid * @retval true - All datas are valid
@retval false - At least one data is invalid * @retval false - At least one data is invalid
*
**/ */
public boolean checkAdd() { public boolean checkAdd() {
// //
// Check if all fields have correct data types // Check if all fields have correct data types
@ -395,8 +433,10 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
// Check Name // Check Name
// //
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) { if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem()
Log.wrn("Update Protocols", "Incorrect data type for Protocol/ProtocolNotify Name"); .toString())) {
Log.wrn("Update Protocols",
"Incorrect data type for Protocol/ProtocolNotify Name");
return false; return false;
} }
} }
@ -421,23 +461,30 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
String arg3 = this.jTextFieldFeatureFlag.getText(); String arg3 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector(); Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
String arg5 = this.jTextFieldHelpText.getText(); String arg5 = this.jTextAreaHelpText.getText();
id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id; return id;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
* *
* Reflesh the frame when selected item changed * Reflesh the frame when selected item changed
* *
*/ */
public void itemStateChanged(ItemEvent arg0) { public void itemStateChanged(ItemEvent arg0) {
if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) { if (arg0.getSource() == this.jComboBoxProtocolType
if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) { && arg0.getStateChange() == ItemEvent.SELECTED) {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolUsage()); if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(
ed.getVProtocolType().get(0))) {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed
.getVProtocolUsage());
} else { } else {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolNotifyUsage()); Tools.generateComboBoxByVector(this.jComboBoxUsage, ed
.getVProtocolNotifyUsage());
} }
} }
} }