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@1131 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lhauch 2006-07-28 02:02:09 +00:00
parent 9cf435c223
commit 5101eff919
3 changed files with 1302 additions and 1187 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,23 +38,22 @@ import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsIdentificat
import org.tianocore.frameworkwizard.workspace.WorkspaceTools; import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/** /**
The class is used to create, update Hob of MSA/MBD file * The class is used to create, update Hob of the MSA file It extends JDialog
It extends IInternalFrame *
*/
**/
public class HobsDlg extends IDialog { public class HobsDlg extends IDialog {
/// // /
/// Define class Serial Version UID // / Define class Serial Version UID
/// // /
private static final long serialVersionUID = -553473437579358325L; private static final long serialVersionUID = -553473437579358325L;
// //
//Define class members // Define class members
// //
private JPanel jContentPane = null; private JPanel jContentPane = null;
private JLabel jLabel = null; private JLabel jLabelC_Name = null;
private JComboBox jComboBoxGuidC_Name = null; private JComboBox jComboBoxGuidC_Name = null;
@ -67,6 +67,10 @@ public class HobsDlg extends IDialog {
private StarLabel jStarLabel1 = null; private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JLabel jLabelArch = null; private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null; private JScrollPane jScrollPane = null;
@ -77,7 +81,9 @@ public class HobsDlg extends IDialog {
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;
@ -95,11 +101,11 @@ public class HobsDlg extends IDialog {
private WorkspaceTools wt = new WorkspaceTools(); private WorkspaceTools wt = new WorkspaceTools();
/** /**
This method initializes jTextField * This method initializes jTextField
*
@return javax.swing.JTextField jTextFieldC_Name * @return javax.swing.JTextField jTextFieldC_Name
*
**/ */
private JComboBox getJComboBoxGuidC_Name() { private JComboBox getJComboBoxGuidC_Name() {
if (jComboBoxGuidC_Name == null) { if (jComboBoxGuidC_Name == null) {
jComboBoxGuidC_Name = new JComboBox(); jComboBoxGuidC_Name = new JComboBox();
@ -111,39 +117,41 @@ public class HobsDlg extends IDialog {
} }
/** /**
This method initializes jComboBoxUsage * This method initializes jComboBoxHobType
*
@return javax.swing.JComboBox jComboBoxUsage * @return javax.swing.JComboBox jComboBoxHobType
*
**/ */
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;
}
/**
This method initializes jComboBoxHobType
@return javax.swing.JComboBox jComboBoxHobType
**/
private JComboBox getJComboBoxHobType() { private JComboBox getJComboBoxHobType() {
if (jComboBoxHobType == null) { if (jComboBoxHobType == null) {
jComboBoxHobType = new JComboBox(); jComboBoxHobType = new JComboBox();
jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxHobType.setToolTipText("<html><table><tr><td>PHIT</td><td>EFI_HOB_TYPE_HANDOFF</td></tr><tr><td>MEMORY_ALLOCATION</td><td>EFI_HOB_TYPE_MEMORY_ALLOCATION and $BaseName</td></tr><tr><td>RESOURCE_DESCRIPTOR</td><td>EFI_HOB_TYPE_RESOURCE_DESCRIPTOR</td></tr><tr><td>GUID_EXTENTION</td><td>EFI_HOB_TYPE_GUID_EXTENSION and BaseName of GUID</td></tr><tr><td>FIRMWARE_VOLUME</td><td>EFI_HOB_TYPE_FV</td></tr><tr><td>CPU</td><td>EFI_HOB_TYPE_CPU</td></tr><tr><td>POOL</td><td>EFI_HOB_TYPE_PEI_MEMORY_POOL</td></tr><tr><td>CAPSULE_VOLUME</td><td>EFI_HOB_TYPE_CV</td></tr></table></html>");
} }
return jComboBoxHobType; return jComboBoxHobType;
} }
/** /**
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, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>HOB must be present in the system</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>HOB will be used if it's present</td></tr><tr><td>ALWAYS_PRODUCED</td><td>HOB is always produced</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>HOB will sometimes be produced by the module</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) {
@ -161,37 +169,57 @@ public class HobsDlg 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, 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 jTextFieldHelpText * This method initializes jTextFieldHelpText
*
@return javax.swing.JTextField * @return javax.swing.JTextField
*
**/ */
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);
} }
@ -199,15 +227,15 @@ public class HobsDlg 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, 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);
} }
@ -219,11 +247,11 @@ public class HobsDlg extends IDialog {
} }
/** /**
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("Hobs"); this.setTitle("Hobs");
initFrame(); initFrame();
@ -232,12 +260,12 @@ public class HobsDlg 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 inHobsId * @param inHobsId
*
**/ */
private void init(HobsIdentification inHobsId) { private void init(HobsIdentification inHobsId) {
init(); init();
this.id = inHobsId; this.id = inHobsId;
@ -246,30 +274,31 @@ public class HobsDlg extends IDialog {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxHobType.setSelectedItem(id.getType()); this.jComboBoxHobType.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()); this.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 inHobsIdentification * @param inHobsIdentification
@param iFrame * @param iFrame
*
**/ */
public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame) { public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame) {
super(iFrame, true); super(iFrame, true);
init(inHobsIdentification); init(inHobsIdentification);
} }
/** /**
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);
@ -279,55 +308,64 @@ public class HobsDlg extends IDialog {
} }
/** /**
This method initializes jContentPane * This method initializes jContentPane
*
@return javax.swing.JPanel jContentPane * @return javax.swing.JPanel jContentPane
*
**/ */
public JPanel getJContentPane() { public 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)); jLabelC_Name = new JLabel();
jLabelFeatureFlag = new JLabel(); jLabelC_Name.setText("Hob's Guid C Name");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 140, 20)); jLabelC_Name.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, 135, 140, 20)); jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelArch.setText("Arch");
jLabelHobType = new JLabel(); jLabelHobType = new JLabel();
jLabelHobType.setText("Hob Type"); jLabelHobType.setText("Hob Type");
jLabelHobType.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); jLabelHobType.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));
jLabel = new JLabel();
jLabel.setText("Guid C Name");
jLabel.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
jLabelHelpText = new JLabel(); jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20)); jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20));
jLabelHelpText.setText("Help Text"); jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
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 = 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(jLabel, null);
jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(jLabelHobType, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(getJComboBoxHobType(), null);
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(0, 10));
jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(jLabelArch, null); jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelHobType, null);
jContentPane.add(getJComboBoxHobType(), 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(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);
@ -336,16 +374,19 @@ public class HobsDlg extends IDialog {
} }
/** /**
This method initializes Usage type and Hob type * This method initializes Usage type and Hob type
*
**/ */
private void initFrame() { private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage()); Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());
Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType()); Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());
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
@ -367,12 +408,12 @@ public class HobsDlg 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
@ -382,12 +423,13 @@ public class HobsDlg extends IDialog {
// Check Name // Check Name
// //
if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
Log.wrn("Update Hobs", "Hob Name couldn't be empty"); Log.wrn("Update Hobs", "Hob Guid C Name must not be empty");
return false; return false;
} }
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 Hobs", "Incorrect data type for Hob Name"); Log.wrn("Update Hobs", "Incorrect data type for Hob Name");
return false; return false;
} }
@ -413,7 +455,7 @@ public class HobsDlg 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();
id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id; return id;
} }

View File

@ -40,19 +40,19 @@ import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
import org.tianocore.frameworkwizard.workspace.WorkspaceTools; import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/** /**
The class is used to create, update PCD of MSA/MBD file * The class is used to create, update PCD of MSA/MBD file It extends
It extends IInternalFrame * IInternalFrame
*
**/ */
public class PCDsDlg extends IDialog implements ItemListener { public class PCDsDlg extends IDialog implements ItemListener {
/// // /
/// Define class Serial Version UID // / Define class Serial Version UID
/// // /
private static final long serialVersionUID = 2227717658188438696L; private static final long serialVersionUID = 2227717658188438696L;
// //
//Define class members // Define class members
// //
private JPanel jContentPane = null; private JPanel jContentPane = null;
@ -97,6 +97,7 @@ public class PCDsDlg extends IDialog implements ItemListener {
private JButton jButtonCancel = null; private JButton jButtonCancel = null;
private JScrollPane jScrollPaneHelpText = null; private JScrollPane jScrollPaneHelpText = null;
// //
// Not used by UI // Not used by UI
// //
@ -107,11 +108,11 @@ public class PCDsDlg extends IDialog implements ItemListener {
private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace(); private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace();
/** /**
This method initializes jComboBoxItemType * This method initializes jComboBoxItemType
*
@return javax.swing.JComboBox jComboBoxItemType * @return javax.swing.JComboBox jComboBoxItemType
*
**/ */
private JComboBox getJComboBoxItemType() { private JComboBox getJComboBoxItemType() {
if (jComboBoxItemType == null) { if (jComboBoxItemType == null) {
jComboBoxItemType = new JComboBox(); jComboBoxItemType = new JComboBox();
@ -122,32 +123,32 @@ public class PCDsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes jTextFieldC_Name * This method initializes jTextFieldC_Name
*
@return javax.swing.JTextField jTextFieldC_Name * @return javax.swing.JTextField jTextFieldC_Name
*
**/ */
private JComboBox getJComboBoxCName() { private JComboBox getJComboBoxCName() {
if (jComboBoxCName == null) { if (jComboBoxCName == null) {
jComboBoxCName = new JComboBox(); jComboBoxCName = new JComboBox();
jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxCName.addItemListener(this); jComboBoxCName.addItemListener(this);
//jComboBoxCName.addActionListener(this);
} }
return jComboBoxCName; return jComboBoxCName;
} }
/** /**
This method initializes jTextFieldDefaultValue * This method initializes jTextFieldDefaultValue
*
@return javax.swing.JTextField jTextFieldDefaultValue * @return javax.swing.JTextField jTextFieldDefaultValue
*
**/ */
private JTextField getJTextFieldDefaultValue() { private JTextField getJTextFieldDefaultValue() {
if (jTextFieldDefaultValue == null) { if (jTextFieldDefaultValue == null) {
jTextFieldDefaultValue = new JTextField(); jTextFieldDefaultValue = new JTextField();
jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); jTextFieldDefaultValue
.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20));
} }
return jTextFieldDefaultValue; return jTextFieldDefaultValue;
@ -163,29 +164,33 @@ public class PCDsDlg extends IDialog implements ItemListener {
jTextAreaHelpText = new JTextArea(); jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true); jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true); jTextAreaHelpText.setWrapStyleWord(true);
// jTextAreaHelpText.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
// jTextAreaHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
} }
return jTextAreaHelpText; return jTextAreaHelpText;
} }
/**
* This method initializes jScrollPaneHelpText
*
* @return javax.swing.JScrollPane
*
*/
private JScrollPane getJScrollPaneHelpText() { private JScrollPane getJScrollPaneHelpText() {
if (jScrollPaneHelpText == null ) { if (jScrollPaneHelpText == null) {
jScrollPaneHelpText = new JScrollPane(); jScrollPaneHelpText = new JScrollPane();
jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jScrollPaneHelpText
.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40));
jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
} }
return jScrollPaneHelpText; return jScrollPaneHelpText;
} }
/** /**
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) {
@ -203,8 +208,10 @@ public class PCDsDlg extends IDialog implements ItemListener {
private JTextField getJTextFieldTokenSpaceGuid() { private JTextField getJTextFieldTokenSpaceGuid() {
if (jTextFieldTokenSpaceGuid == null) { if (jTextFieldTokenSpaceGuid == null) {
jTextFieldTokenSpaceGuid = new JTextField(); jTextFieldTokenSpaceGuid = new JTextField();
jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(160, 60, 320,
jTextFieldTokenSpaceGuid.setPreferredSize(new java.awt.Dimension(320, 20)); 20));
jTextFieldTokenSpaceGuid
.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldTokenSpaceGuid.setVisible(false); jTextFieldTokenSpaceGuid.setVisible(false);
} }
return jTextFieldTokenSpaceGuid; return jTextFieldTokenSpaceGuid;
@ -218,23 +225,24 @@ public class PCDsDlg extends IDialog implements ItemListener {
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, 130, 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));
//jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 140, 20)); jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
} }
return jTextFieldFeatureFlag; return jTextFieldFeatureFlag;
} }
/** /**
This method initializes jButtonOk * This method initializes jButtonOk
*
@return javax.swing.JButton * @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, 185, 90, 20)); jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok"); jButtonOk.setText("Ok");
jButtonOk.addActionListener(this); jButtonOk.addActionListener(this);
} }
@ -242,15 +250,15 @@ public class PCDsDlg 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, 185, 90, 20)); jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel"); jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this); jButtonCancel.addActionListener(this);
} }
@ -262,11 +270,11 @@ public class PCDsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes this * This method initializes this
*
**/ */
private void init() { private void init() {
this.setSize(508, 260); this.setSize(500, 255);
this.setContentPane(getJScrollPane()); this.setContentPane(getJScrollPane());
this.setTitle("Pcd Coded"); this.setTitle("Pcd Coded");
initFrame(); initFrame();
@ -275,12 +283,12 @@ public class PCDsDlg 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 inPcdCodedId * @param inPcdCodedId
*
**/ */
private void init(PcdCodedIdentification inPcdCodedId) { private void init(PcdCodedIdentification inPcdCodedId) {
init(); init();
this.id = inPcdCodedId; this.id = inPcdCodedId;
@ -297,23 +305,24 @@ public class PCDsDlg extends IDialog implements ItemListener {
} }
/** /**
This is the override edit constructor * This is the override edit constructor
*
@param inPcdCodedId * @param inPcdCodedId
@param iFrame * @param iFrame
*
**/ */
public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame) { public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame) {
super(iFrame, true); super(iFrame, true);
init(inPcdCodedId); init(inPcdCodedId);
} }
/** /**
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.jTextFieldDefaultValue.setEnabled(!isView); this.jTextFieldDefaultValue.setEnabled(!isView);
@ -322,70 +331,75 @@ public class PCDsDlg 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.setPreferredSize(new java.awt.Dimension(320, 20)); jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelArch = new JLabel(); jLabelC_Name = new JLabel();
jLabelArch.setText("Sup Arch List"); jLabelC_Name.setText("PCD C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelItemType = new JLabel();
jLabelItemType.setText("PCD Item Type");
jLabelItemType.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelDefaultValue = new JLabel();
jLabelDefaultValue.setText("Default Value");
jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jStarLabel3 = new StarLabel();
jStarLabel3.setLocation(new java.awt.Point(2, 85));
jLabelHelpText = new JLabel();
jLabelHelpText.setText("Help Text");
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20));
jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag"); jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 140, 20));
jLabelTokenSpaceGuid = new JLabel(); jLabelTokenSpaceGuid = new JLabel();
jLabelTokenSpaceGuid.setText("Token Space C Name"); jLabelTokenSpaceGuid.setText("Token Space C Name");
jLabelTokenSpaceGuid.setVisible(false); jLabelTokenSpaceGuid.setVisible(false);
jLabelHelpText = new JLabel();
jLabelHelpText.setText("Help Text");
jLabelC_Name = new JLabel();
jLabelC_Name.setText("C Name");
jLabelDefaultValue = new JLabel();
jLabelDefaultValue.setText("Default Value");
jLabelItemType = new JLabel();
jLabelItemType.setText("Item Type");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
jLabelItemType.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 60, 140, 20));
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 140, 20));
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 140, 20));
jLabelArch = new JLabel();
jLabelArch.setText("Supported Architectures");
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
// Hidden field
jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 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(jLabelItemType, null); jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelC_Name, null); jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null); jContentPane.add(getJComboBoxCName(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelItemType, null);
jContentPane.add(getJComboBoxItemType(), null);
jContentPane.add(jLabelDefaultValue, null); jContentPane.add(jLabelDefaultValue, null);
jContentPane.add(getJTextFieldDefaultValue(), null); jContentPane.add(getJTextFieldDefaultValue(), null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(getJComboBoxItemType(), null);
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(0, 10));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(0, 35));
jStarLabel3 = new StarLabel();
jStarLabel3.setLocation(new java.awt.Point(0, 85));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jStarLabel3, null); jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelHelpText, null); jContentPane.add(jLabelHelpText, null);
// jContentPane.add(getJTextFieldHelpText(), null); jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelTokenSpaceGuid, null);
jContentPane.add(getJTextFieldTokenSpaceGuid(), null);
jContentPane.add(jLabelFeatureFlag, null); jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null); jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null); jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null); jContentPane.add(jArchCheckBox, null);
// Hidden
jContentPane.add(getJTextFieldTokenSpaceGuid(), null);
jContentPane.add(jLabelTokenSpaceGuid, null);
jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null); jContentPane.add(getJButtonCancel(), null);
} }
@ -393,18 +407,21 @@ public class PCDsDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes Usage type, Item type and Datum type * This method initializes Usage type, Item type and Datum type
*
**/ */
private void initFrame() { private void initFrame() {
for (int index = 0; index < pcd.size(); index++) { for (int index = 0; index < pcd.size(); index++) {
jComboBoxCName.addItem(pcd.getPcd(index)); jComboBoxCName.addItem(pcd.getPcd(index));
} }
//Tools.generateComboBoxByVector(jComboBoxItemType, ed.getVPcdItemTypes()); // Tools.generateComboBoxByVector(jComboBoxItemType, ed.getVPcdItemTypes());
} }
/* (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
@ -426,12 +443,12 @@ public class PCDsDlg 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
@ -441,7 +458,8 @@ public class PCDsDlg extends IDialog implements ItemListener {
// Check C_Name // Check C_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()
.toString())) {
Log.wrn("Update PcdCoded", "Incorrect data type for C Name"); Log.wrn("Update PcdCoded", "Incorrect data type for C Name");
return false; return false;
} }
@ -452,7 +470,9 @@ public class PCDsDlg extends IDialog implements ItemListener {
// //
if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) { if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldTokenSpaceGuid.getText())) { if (!DataValidation.isC_NameType(this.jTextFieldTokenSpaceGuid.getText())) {
Log.wrn("Update PcdCoded", "Incorrect data type for the selected pcd entry, please check in in spd file"); Log
.wrn("Update PcdCoded",
"Incorrect data type for the selected pcd entry, please check in in spd file");
return false; return false;
} }
} }
@ -461,7 +481,8 @@ public class PCDsDlg extends IDialog implements ItemListener {
// Check DefaultValue // Check DefaultValue
// //
if (!isEmpty(this.jTextFieldDefaultValue.getText())) { if (!isEmpty(this.jTextFieldDefaultValue.getText())) {
if (!DataValidation.isDefaultValueType(this.jTextFieldDefaultValue.getText())) { if (!DataValidation.isDefaultValueType(this.jTextFieldDefaultValue
.getText())) {
Log.wrn("Update PcdCoded", "Incorrect data type for Default Value"); Log.wrn("Update PcdCoded", "Incorrect data type for Default Value");
return false; return false;
} }
@ -510,7 +531,9 @@ public class PCDsDlg extends IDialog implements ItemListener {
this.id = id; this.id = 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
@ -518,13 +541,20 @@ public class PCDsDlg extends IDialog implements ItemListener {
*/ */
public void itemStateChanged(ItemEvent arg0) { public void itemStateChanged(ItemEvent arg0) {
int index = this.jComboBoxCName.getSelectedIndex(); int index = this.jComboBoxCName.getSelectedIndex();
if (arg0.getSource() == this.jComboBoxCName && arg0.getStateChange() == ItemEvent.SELECTED ) { if (arg0.getSource() == this.jComboBoxCName
if (pcd.getPcd(index).getGuidCName() == null || isEmpty(pcd.getPcd(index).getGuidCName()) && arg0.getStateChange() == ItemEvent.SELECTED) {
|| pcd.getPcd(index).getType() == null || pcd.getPcd(index).getHelp() == null || isEmpty(pcd.getPcd(index).getHelp())) { if (pcd.getPcd(index).getGuidCName() == null
Log.wrn("select pcd entry when editing msa", "The selected is defined incorrectly.\r\nPlease check it in spd file"); || isEmpty(pcd.getPcd(index).getGuidCName())
|| pcd.getPcd(index).getType() == null
|| pcd.getPcd(index).getHelp() == null
|| isEmpty(pcd.getPcd(index).getHelp())) {
Log
.wrn("select pcd entry when editing msa",
"The selected is defined incorrectly.\r\nPlease check it in spd file");
} else { } else {
this.jTextFieldTokenSpaceGuid.setText(pcd.getPcd(index).getGuidCName()); this.jTextFieldTokenSpaceGuid.setText(pcd.getPcd(index).getGuidCName());
Tools.generateComboBoxByVector(this.jComboBoxItemType, pcd.getPcd(index).getType()); Tools.generateComboBoxByVector(this.jComboBoxItemType, pcd
.getPcd(index).getType());
this.jTextAreaHelpText.setText(pcd.getPcd(index).getHelp()); this.jTextAreaHelpText.setText(pcd.getPcd(index).getHelp());
this.jTextAreaHelpText.setSelectionStart(0); this.jTextAreaHelpText.setSelectionStart(0);
this.jTextAreaHelpText.setSelectionEnd(0); this.jTextAreaHelpText.setSelectionEnd(0);

View File

@ -25,6 +25,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;
@ -39,19 +40,19 @@ import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentificat
import org.tianocore.frameworkwizard.workspace.WorkspaceTools; import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/** /**
The class is used to create, update Ppi of MSA/MBD file * The class is used to create, update Ppi of MSA/MBD file It extends
It extends IInternalFrame * IInternalFrame
*
**/ */
public class PpisDlg extends IDialog implements ItemListener { public class PpisDlg extends IDialog implements ItemListener {
/// // /
/// Define class Serial Version UID // / Define class Serial Version UID
/// // /
private static final long serialVersionUID = -4284901202357037724L; private static final long serialVersionUID = -4284901202357037724L;
// //
//Define class members // Define class members
// //
private JPanel jContentPane = null; private JPanel jContentPane = null;
@ -73,6 +74,8 @@ public class PpisDlg extends IDialog implements ItemListener {
private StarLabel jStarLabel2 = null; private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JComboBox jComboBoxPpiType = null; private JComboBox jComboBoxPpiType = null;
private JLabel jLabelArch = null; private JLabel jLabelArch = null;
@ -81,7 +84,9 @@ public class PpisDlg 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;
@ -98,51 +103,6 @@ public class PpisDlg extends IDialog implements ItemListener {
private EnumerationData ed = new EnumerationData(); private EnumerationData ed = new EnumerationData();
/**
This method initializes jTextFieldC_Name
@return javax.swing.JTextField jTextFieldC_Name
**/
private JComboBox getJComboBoxCName() {
if (jComboBoxCName == null) {
jComboBoxCName = new JComboBox();
jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
}
return jComboBoxCName;
}
/**
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;
}
/**
This method initializes jComboBox
@return javax.swing.JComboBox jComboBoxUsage
**/
private JComboBox getJComboBox() {
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;
}
/** /**
* This method initializes jComboBoxPpiType * This method initializes jComboBoxPpiType
* *
@ -154,14 +114,65 @@ public class PpisDlg extends IDialog implements ItemListener {
jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPpiType.addItemListener(this); jComboBoxPpiType.addItemListener(this);
jComboBoxPpiType.setToolTipText("<html>PPIs are named by GUID.<br>PPI Notify is consumed via a register PPI Notify mechanism");
} }
return jComboBoxPpiType; return jComboBoxPpiType;
} }
/** /**
This method initializes jScrollPane * This method initializes jTextFieldC_Name
*
* @return javax.swing.JTextField jTextFieldC_Name
*
*/
private JComboBox getJComboBoxCName() {
if (jComboBoxCName == null) {
jComboBoxCName = new JComboBox();
jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxCName.setToolTipText("Select Guid C Name of PPI");
}
return jComboBoxCName;
}
@return javax.swing.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, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage.setToolTipText("<html><table><tr><td colspan=2 align=center><b>PPI</b></td></tr><tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the PPI</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module sometimes consumes the PPI</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces the PPI</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the PPI</td></tr><tr><td colspan=2 align=center><b>PPI Notify</b></td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the PPI if it is produced. Consumption<br>is defined by executing the PPI notify function</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* 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 jScrollPane
*
* @return javax.swing.JScrollPane
*/ */
private JScrollPane getJScrollPane() { private JScrollPane getJScrollPane() {
if (jScrollPane == null) { if (jScrollPane == null) {
@ -172,30 +183,49 @@ public class PpisDlg 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);
} }
@ -203,15 +233,15 @@ public class PpisDlg 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);
} }
@ -223,24 +253,24 @@ public class PpisDlg 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("Ppis"); this.setTitle("PPI Definitions");
initFrame(); initFrame();
this.centerWindow(); this.centerWindow();
} }
/** /**
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(PpisIdentification inPpisId) { private void init(PpisIdentification inPpisId) {
init(); init();
this.id = inPpisId; this.id = inPpisId;
@ -249,77 +279,83 @@ public class PpisDlg extends IDialog implements ItemListener {
this.jComboBoxCName.setSelectedItem(id.getName()); this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxPpiType.setSelectedItem(id.getType()); this.jComboBoxPpiType.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()); this.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 PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) { public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) {
super(iFrame, true); super(iFrame, true);
init(inPpisIdentification); init(inPpisIdentification);
} }
/** /**
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));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 140, 20));
jLabelArch.setText("Arch");
jLabelPpiType = new JLabel(); jLabelPpiType = new JLabel();
jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelPpiType.setText("Ppi Type"); jLabelPpiType.setText("Ppi Type");
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("PPI 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(14, 85, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag"); jLabelFeatureFlag.setText("Feature Flag");
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));
jLabelHelpText = new JLabel(); jLabelArch.setText("Arch");
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 140, 20)); jArchCheckBox = new ArchCheckBox();
jLabelHelpText.setText("Help Text"); 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(getJComboBoxCName(), null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBox(), null);
jContentPane.add(getJComboBoxPpiType(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jLabelPpiType, 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(jLabelPpiType, null);
jContentPane.add(getJComboBoxPpiType(), null);
jContentPane.add(jStarLabel2, null); jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null);
jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), 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);
@ -328,16 +364,19 @@ public class PpisDlg extends IDialog implements ItemListener {
} }
/** /**
This method initializes Usage type * This method initializes Usage type
*
**/ */
private void initFrame() { private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPpiDeclarationsFromWorkspace()); Tools.generateComboBoxByVector(jComboBoxCName, wt
.getAllPpiDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType()); Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
} }
/* (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
@ -359,12 +398,12 @@ public class PpisDlg 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
@ -374,7 +413,8 @@ public class PpisDlg 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()
.toString())) {
Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name"); Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name");
return false; return false;
} }
@ -393,31 +433,34 @@ public class PpisDlg extends IDialog implements ItemListener {
return true; return true;
} }
private PpisIdentification getCurrentPpis() { private PpisIdentification getCurrentPpis() {
String arg0 = this.jComboBoxCName.getSelectedItem().toString(); String arg0 = this.jComboBoxCName.getSelectedItem().toString();
String arg1 = this.jComboBoxPpiType.getSelectedItem().toString(); String arg1 = this.jComboBoxPpiType.getSelectedItem().toString();
String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
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 PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5); id = new PpisIdentification(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.jComboBoxPpiType && arg0.getStateChange() == ItemEvent.SELECTED) { if (arg0.getSource() == this.jComboBoxPpiType
if (this.jComboBoxPpiType.getSelectedItem().toString().equals(ed.getVPpiType().get(0))) { && arg0.getStateChange() == ItemEvent.SELECTED) {
if (this.jComboBoxPpiType.getSelectedItem().toString().equals(
ed.getVPpiType().get(0))) {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage()); Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage());
} else { } else {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiNotifyUsage()); Tools.generateComboBoxByVector(this.jComboBoxUsage, ed
.getVPpiNotifyUsage());
} }
} }
} }