1. Change ToolCode from text field to drop down list, and user can enter their customizing tool command.

2. Fix some coding style issue


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1133 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-07-28 05:03:19 +00:00
parent ccb063b1f2
commit a929458e66
25 changed files with 4683 additions and 4636 deletions

View File

@ -2599,10 +2599,12 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
**/ **/
private void doubleClickModuleTreeNode() { private void doubleClickModuleTreeNode() {
Identification id = iTree.getSelectNode().getId(); Identification id = null;
int intCategory = iTree.getSelectCategory(); int intCategory = -1;
String path = null; String path = null;
try { try {
id = iTree.getSelectNode().getId();
intCategory = iTree.getSelectCategory();
// //
// If the node is not opened yet // If the node is not opened yet
// Insert top level elements first // Insert top level elements first
@ -2894,8 +2896,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
try { try {
wt.addPackageToDatabase(smb.getPid()); wt.addPackageToDatabase(smb.getPid());
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block Log.err("addPackageToDatabase", e.getMessage());
e.printStackTrace();
} }
vPackageList.addElement(smb.getPid()); vPackageList.addElement(smb.getPid());
@ -2932,8 +2933,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
try { try {
wt.addPlatformToDatabase(smb.getFid()); wt.addPlatformToDatabase(smb.getFid());
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block Log.err("addPlatformToDatabase", e.getMessage());
e.printStackTrace();
} }
vPlatformList.addElement(smb.getFid()); vPlatformList.addElement(smb.getFid());
// //

View File

@ -84,6 +84,8 @@ public class EnumerationData {
public Vector<String> vSourceFilesFileType = new Vector<String>(); public Vector<String> vSourceFilesFileType = new Vector<String>();
public Vector<String> vToolCode = new Vector<String>();
// //
// Used by Package Dependencies // Used by Package Dependencies
// //
@ -203,6 +205,7 @@ public class EnumerationData {
// //
initSourceFilesToolChainFamily(); initSourceFilesToolChainFamily();
initSourceFilesFileType(); initSourceFilesFileType();
initToolCode();
// //
// Used by Package Dependencies // Used by Package Dependencies
@ -491,6 +494,18 @@ public class EnumerationData {
vSourceFilesFileType.addElement("EFI"); vSourceFilesFileType.addElement("EFI");
} }
private void initToolCode() {
vToolCode.removeAllElements();
vToolCode.addElement(DataType.EMPTY_SELECT_ITEM);
vToolCode.addElement("CC");
vToolCode.addElement("DLINK");
vToolCode.addElement("SLINK");
vToolCode.addElement("PP");
vToolCode.addElement("ASM");
vToolCode.addElement("ASMLINK");
vToolCode.addElement("ASL");
}
private void initPackageUsage() { private void initPackageUsage() {
vPackageUsage.removeAllElements(); vPackageUsage.removeAllElements();
vPackageUsage.addElement("ALWAYS_CONSUMED"); vPackageUsage.addElement("ALWAYS_CONSUMED");
@ -1010,4 +1025,12 @@ public class EnumerationData {
public void setVPackageUsage(Vector<String> packageUsage) { public void setVPackageUsage(Vector<String> packageUsage) {
vPackageUsage = packageUsage; vPackageUsage = packageUsage;
} }
public Vector<String> getVToolCode() {
return vToolCode;
}
public void setVToolCode(Vector<String> toolCode) {
vToolCode = toolCode;
}
} }

View File

@ -40,26 +40,8 @@ public class FileOperation {
**/ **/
public static void newFolder(String folderPath) throws Exception { public static void newFolder(String folderPath) throws Exception {
folderPath = Tools.convertPathToCurrentOsType(folderPath); folderPath = Tools.convertPathToCurrentOsType(folderPath);
String temp = ""; File f = new File(folderPath);
while (folderPath.length() > 0) { f.mkdirs();
if (folderPath.indexOf(DataType.FILE_SEPARATOR) > -1) {
temp = temp + folderPath.substring(0, folderPath.indexOf(DataType.FILE_SEPARATOR));
if (temp.endsWith(":")) {
temp = Tools.addFileSeparator(temp);
folderPath = folderPath.substring(folderPath.indexOf(DataType.FILE_SEPARATOR) + DataType.FILE_SEPARATOR.length());
continue;
}
temp = Tools.addFileSeparator(temp);
folderPath = folderPath.substring(folderPath.indexOf(DataType.FILE_SEPARATOR) + DataType.FILE_SEPARATOR.length());
} else {
temp = Tools.addFileSeparator(temp) + folderPath;
folderPath = "";
}
File f = new File(temp);
if (!f.exists()) {
f.mkdir();
}
}
} }
/** /**

View File

@ -320,7 +320,7 @@ public class Tools {
**/ **/
public static void showInformationMessage(String arg0) { public static void showInformationMessage(String arg0) {
JOptionPane.showConfirmDialog(null, arg0, "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); JOptionPane.showConfirmDialog(null, arg0, "Info", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
} }
/** /**

View File

@ -92,7 +92,8 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
this.addKeyListener(this); this.addKeyListener(this);
this.getEditor().getEditorComponent().addKeyListener(this); this.getEditor().getEditorComponent().addKeyListener(this);
this.getEditor().getEditorComponent().addFocusListener(this); this.getEditor().getEditorComponent().addFocusListener(this);
this.setToolTipText("Double Click to add an entry and finished by press ENTER. Press DELETE can remove selected entry."); this.setToolTipText("<html>Double Click to add an entry and finished by press ENTER. <br>"
+ "Press DELETE can remove selected entry.</html>");
} }
public void keyPressed(KeyEvent arg0) { public void keyPressed(KeyEvent arg0) {
@ -122,6 +123,7 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
} }
this.setEditable(false); this.setEditable(false);
} }
if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) { if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {
closeEdit(); closeEdit();
} }
@ -160,7 +162,6 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
this.setEditable(true); this.setEditable(true);
this.getEditor().setItem(""); this.getEditor().setItem("");
} }
} }
public void mouseEntered(MouseEvent arg0) { public void mouseEntered(MouseEvent arg0) {
@ -190,8 +191,5 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
private void closeEdit() { private void closeEdit() {
this.setEditable(false); this.setEditable(false);
this.getEditor().setItem(""); this.getEditor().setItem("");
if (this.getItemCount() > 0) {
this.setSelectedIndex(0);
}
} }
} }

View File

@ -65,9 +65,9 @@ public class ModuleDefinitions extends IInternalFrame {
private StarLabel jStarLabel2 = null; private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null; private StarLabel jStarLabel3 = null;
private OpeningModuleType omt = null; private OpeningModuleType omt = null;
private ClonedFrom cf = null; private ClonedFrom cf = null;
private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
@ -136,12 +136,12 @@ public class ModuleDefinitions extends IInternalFrame {
if (iCheckBoxListArch == null) { if (iCheckBoxListArch == null) {
iCheckBoxListArch = new ICheckBoxList(); iCheckBoxListArch = new ICheckBoxList();
iCheckBoxListArch.addFocusListener(this); iCheckBoxListArch.addFocusListener(this);
iCheckBoxListArch.setToolTipText("<html>Deselecting a checkbox will restrict this module<br>" + iCheckBoxListArch.setToolTipText("<html>Deselecting a checkbox will restrict this module<br>"
"for use with the selected architectures, <br>" + + "for use with the selected architectures, <br>"
"based on the list of items that are checked. <br>" + + "based on the list of items that are checked. <br>"
"If all boxes are checked, <br>" + + "If all boxes are checked, <br>"
"then the module will support all <br>" + + "then the module will support all <br>"
"current AND FUTURE architectures</html>"); + "current AND FUTURE architectures</html>");
} }
return iCheckBoxListArch; return iCheckBoxListArch;
} }
@ -157,14 +157,14 @@ public class ModuleDefinitions extends IInternalFrame {
jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxBinaryModule.addFocusListener(this); jComboBoxBinaryModule.addFocusListener(this);
jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>" + jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>"
"which can be compiled or binary <br>" + + "which can be compiled or binary <br>"
"modules which are linked. <br>" + + "modules which are linked. <br>"
"A module cannot contain both. <br>" + + "A module cannot contain both. <br>"
"The GUID numbers should be identical <br>" + + "The GUID numbers should be identical <br>"
"for a binary and source MSA, <br>" + + "for a binary and source MSA, <br>"
"but the BINARY MSA should have <br>" + + "but the BINARY MSA should have <br>"
"a higher version number.</html>"); + "a higher version number.</html>");
} }
return jComboBoxBinaryModule; return jComboBoxBinaryModule;
} }
@ -231,7 +231,7 @@ public class ModuleDefinitions extends IInternalFrame {
this.omt = inOmt; this.omt = inOmt;
this.msa = omt.getXmlMsa(); this.msa = omt.getXmlMsa();
if (msa.getModuleDefinitions() != null) { if (msa.getModuleDefinitions() != null) {
this.cf = msa.getModuleDefinitions().getClonedFrom(); this.cf = msa.getModuleDefinitions().getClonedFrom();
} }
init(msa.getModuleDefinitions()); init(msa.getModuleDefinitions());
this.setVisible(true); this.setVisible(true);
@ -283,7 +283,7 @@ public class ModuleDefinitions extends IInternalFrame {
this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures()); this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean()); Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());
} }
private boolean check() { private boolean check() {
if (isEmpty(this.jTextFieldOutputFileBasename.getText())) { if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {
Log.wrn("Update Definitions", "Output File Basename couldn't be empty!"); Log.wrn("Update Definitions", "Output File Basename couldn't be empty!");
@ -332,7 +332,7 @@ public class ModuleDefinitions extends IInternalFrame {
} else { } else {
md.setBinaryModule(true); md.setBinaryModule(true);
} }
// //
// Set ClonedFrom field // Set ClonedFrom field
// //
@ -344,9 +344,9 @@ public class ModuleDefinitions extends IInternalFrame {
// Save Arch list // Save Arch list
// //
md.setSupportedArchitectures(this.iCheckBoxListArch.getAllCheckedItemsString()); md.setSupportedArchitectures(this.iCheckBoxListArch.getAllCheckedItemsString());
msa.setModuleDefinitions(md); msa.setModuleDefinitions(md);
this.omt.setSaved(false); this.omt.setSaved(false);
} catch (Exception e) { } catch (Exception e) {

View File

@ -313,7 +313,7 @@ public class ModuleEvents extends IInternalFrame {
} }
return jContentPane; return jContentPane;
} }
private void showEdit(int index) { private void showEdit(int index) {
EventsDlg dlg = new EventsDlg(vid.getEvents(index), new IFrame()); EventsDlg dlg = new EventsDlg(vid.getEvents(index), new IFrame());
int result = dlg.showDialog(); int result = dlg.showDialog();

View File

@ -307,7 +307,7 @@ public class ModuleProtocols extends IInternalFrame {
} }
return jContentPane; return jContentPane;
} }
private void showEdit(int index) { private void showEdit(int index) {
ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), new IFrame()); ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), new IFrame());
int result = dlg.showDialog(); int result = dlg.showDialog();
@ -450,7 +450,7 @@ public class ModuleProtocols extends IInternalFrame {
Log.err("Update Protocols", e.getMessage()); Log.err("Update Protocols", e.getMessage());
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
* *

View File

@ -348,7 +348,8 @@ public class ModuleSourceFiles extends IInternalFrame {
} }
private void showEdit(int index) { private void showEdit(int index) {
SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame(), omt.getId().getPath()); SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame(), omt.getId()
.getPath());
int result = sfd.showDialog(); int result = sfd.showDialog();
if (result == DataType.RETURN_TYPE_OK) { if (result == DataType.RETURN_TYPE_OK) {
if (index == -1) { if (index == -1) {

View File

@ -1052,7 +1052,7 @@ public class MsaHeader extends IInternalFrame {
} }
} }
} }
this.save(); this.save();
} }
} }

View File

@ -50,371 +50,386 @@ import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesI
*/ */
public class BootModesDlg extends IDialog { public class BootModesDlg extends IDialog {
// / // /
// / Define class Serial Version UID // / Define class Serial Version UID
// / // /
private static final long serialVersionUID = -3888558623432442561L; private static final long serialVersionUID = -3888558623432442561L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelBootModeName = null;
private JComboBox jComboBoxBootModeName = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private BootModesIdentification id = null;
private EnumerationData ed = new EnumerationData();
/**
* This method initializes jComboBoxBootModeName
*
* @return javax.swing.JComboBox jComboBoxBootModeName
*
*/
private JComboBox getJComboBoxBootModeName() {
if (jComboBoxBootModeName == null) {
jComboBoxBootModeName = new JComboBox();
jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxBootModeName.setToolTipText("<html><table><tr><td>FULL</td><td>Boot with full configuration</td></tr><tr><td>MINIMAL</td><td>Boot with minimal configuration</td></tr><tr><td>NO_CHANGE</td><td>Boot assuming no configuration changes</td></tr><tr><td>DIAGNOSTICS</td><td>Boot with full configuration plus diagnostics</td></tr><tr><td>DEFAULT</td><td>Boot with default settings</td></tr><tr><td>BOOT_ON_S#_RESUME</td><td>where # is 2, 3, 4 or 5</td></tr><tr><td>FLASH_UPDATE</td><td>Boot on flash update</td></tr><tr><td>RECOVERY</td><td>Boot in recovery mode</td></tr></table></html>");
}
return jComboBoxBootModeName;
}
/**
* 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>Indicates Supports the specified boot mode</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Indicates Supports the specified boot mode on some execution paths</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Always changes the boot mode</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Change the boot mode sometimes</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag
.setBounds(new java.awt.Rectangle(160, 105, 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() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Boot Modes");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inBootModesId
*
*/
private void init(BootModesIdentification inBootModesId) {
init();
this.id = inBootModesId;
if (this.id != null) {
this.jComboBoxBootModeName.setSelectedItem(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inBootModesIdentification
* @param iFrame
*
*/
public BootModesDlg(BootModesIdentification inBootModesIdentification, IFrame iFrame) {
super(iFrame, true);
init(inBootModesIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxBootModeName.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelBootModeName = new JLabel();
jLabelBootModeName.setText("Boot Mode Name");
jLabelBootModeName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Archectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelBootModeName, null);
jContentPane.add(getJComboBoxBootModeName(), null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes BootModeName groups and Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentBootModes();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check FeatureFlag // Define class members
// //
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { private JPanel jContentPane = null;
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag"); private JLabel jLabelBootModeName = null;
return false;
} private JComboBox jComboBoxBootModeName = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private BootModesIdentification id = null;
private EnumerationData ed = new EnumerationData();
/**
* This method initializes jComboBoxBootModeName
*
* @return javax.swing.JComboBox jComboBoxBootModeName
*
*/
private JComboBox getJComboBoxBootModeName() {
if (jComboBoxBootModeName == null) {
jComboBoxBootModeName = new JComboBox();
jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxBootModeName
.setToolTipText("<html><table>"
+ "<tr><td>FULL</td><td>Boot with full configuration</td></tr>"
+ "<tr><td>MINIMAL</td><td>Boot with minimal configuration</td></tr>"
+ "<tr><td>NO_CHANGE</td><td>Boot assuming no configuration changes</td></tr>"
+ "<tr><td>DIAGNOSTICS</td><td>Boot with full configuration plus diagnostics</td></tr>"
+ "<tr><td>DEFAULT</td><td>Boot with default settings</td></tr>"
+ "<tr><td>BOOT_ON_S#_RESUME</td><td>where # is 2, 3, 4 or 5</td></tr>"
+ "<tr><td>FLASH_UPDATE</td><td>Boot on flash update</td></tr>"
+ "<tr><td>RECOVERY</td><td>Boot in recovery mode</td></tr>"
+ "</table></html>");
}
return jComboBoxBootModeName;
} }
return true; /**
} * 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table>"
+ "<tr><td>ALWAYS_CONSUMED</td><td>Indicates Supports the specified boot mode</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMED</td><td>Indicates Supports the specified boot mode on some execution paths</td></tr>"
+ "<tr><td>ALWAYS_PRODUCED</td><td>Always changes the boot mode</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>Change the boot mode sometimes</td></tr>"
+ "</table></html>");
}
return jComboBoxUsage;
}
private BootModesIdentification getCurrentBootModes() { /**
String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString(); * This method initializes jTextFieldFeatureFlag
String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); *
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
String arg2 = this.jTextFieldFeatureFlag.getText(); /**
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector(); * This method initializes jScrollPane
String arg4 = this.jTextAreaHelpText.getText(); *
id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4); * @return javax.swing.JScrollPane
return id; */
} private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
public BootModesIdentification getId() { jScrollPane = new JScrollPane();
return id; jScrollPane.setViewportView(getJContentPane());
} }
return jScrollPane;
}
public void setId(BootModesIdentification id) { /**
this.id = id; * This method initializes jTextAreaHelpText
} *
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Boot Modes");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inBootModesId
*
*/
private void init(BootModesIdentification inBootModesId) {
init();
this.id = inBootModesId;
if (this.id != null) {
this.jComboBoxBootModeName.setSelectedItem(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inBootModesIdentification
* @param iFrame
*
*/
public BootModesDlg(BootModesIdentification inBootModesIdentification, IFrame iFrame) {
super(iFrame, true);
init(inBootModesIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxBootModeName.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelBootModeName = new JLabel();
jLabelBootModeName.setText("Boot Mode Name");
jLabelBootModeName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Archectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelBootModeName, null);
jContentPane.add(getJComboBoxBootModeName(), null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes BootModeName groups and Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentBootModes();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private BootModesIdentification getCurrentBootModes() {
String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
String arg2 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
String arg4 = this.jTextAreaHelpText.getText();
id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
return id;
}
public BootModesIdentification getId() {
return id;
}
public void setId(BootModesIdentification id) {
this.id = id;
}
} }

View File

@ -50,390 +50,393 @@ import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIde
*/ */
public class DataHubsDlg extends IDialog { public class DataHubsDlg extends IDialog {
// / // /
// / Define class Serial Version UID // / Define class Serial Version UID
// / // /
private static final long serialVersionUID = -3667906991966638892L; private static final long serialVersionUID = -3667906991966638892L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private JLabel jLabelDataHubRecord = null;
private JTextField jTextFieldDataHubRecord = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private DataHubsIdentification id = null;
private EnumerationData ed = new EnumerationData();
/**
* This method initializes jTextFieldDataHubRecord
*
* @return javax.swing.JTextField jTextFieldDataHubRecord
*
*/
private JTextField getJTextFieldDataHubRecord() {
if (jTextFieldDataHubRecord == null) {
jTextFieldDataHubRecord = new JTextField();
jTextFieldDataHubRecord
.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldDataHubRecord
.setToolTipText("Enter the C Name of the Data Hub Record");
}
return jTextFieldDataHubRecord;
}
/**
* 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>Module always consumes a Data Hub Entry<br>via registering a filter driver.</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module will use a Data Hub Entry if it exists<br>via registering a filter driver</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Always logs data into the Data Hub</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Log data into the Data Hub under<br>certain circumstances</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 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() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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,60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Data Hubs");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inDataHubsId
*
*/
private void init(DataHubsIdentification inDataHubsId) {
init();
this.id = inDataHubsId;
if (this.id != null) {
this.jTextFieldDataHubRecord.setText(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inDataHubsIdentification
* @param iFrame
*
*/
public DataHubsDlg(DataHubsIdentification inDataHubsIdentification,
IFrame iFrame) {
super(iFrame, true);
init(inDataHubsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jTextFieldDataHubRecord.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelDataHubRecord = new JLabel();
jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelDataHubRecord.setText("Data Hub Record");
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelDataHubRecord, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(jLabelArch, null);
jContentPane.add(getJTextFieldDataHubRecord(), null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentDataHubs();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check DataHubRecord // Define class members
// //
if (isEmpty(this.jTextFieldDataHubRecord.getText())) { private JPanel jContentPane = null;
Log.wrn("Update Hubs", "Data Hub Record must not be empty");
return false;
}
if (!isEmpty(this.jTextFieldDataHubRecord.getText())) { private JLabel jLabelUsage = null;
if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) {
Log.wrn("Update Hubs", "Incorrect data type for Data Hub Record"); private JComboBox jComboBoxUsage = null;
return false;
} private JLabel jLabelDataHubRecord = null;
}
private JTextField jTextFieldDataHubRecord = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
// //
// Check FeatureFlag // Not used by UI
// //
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { private DataHubsIdentification id = null;
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Hubs", "Incorrect data type for Feature Flag"); private EnumerationData ed = new EnumerationData();
return false;
} /**
* This method initializes jTextFieldDataHubRecord
*
* @return javax.swing.JTextField jTextFieldDataHubRecord
*
*/
private JTextField getJTextFieldDataHubRecord() {
if (jTextFieldDataHubRecord == null) {
jTextFieldDataHubRecord = new JTextField();
jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldDataHubRecord.setToolTipText("Enter the C Name of the Data Hub Record");
}
return jTextFieldDataHubRecord;
} }
return true; /**
} * 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table>"
+ "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes a Data Hub Entry<br>via registering a filter driver.</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMED</td><td>Module will use a Data Hub Entry if it exists<br>via registering a filter driver</td></tr>"
+ "<tr><td>ALWAYS_PRODUCED</td><td>Always logs data into the Data Hub</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>Log data into the Data Hub under<br>certain circumstances</td></tr>"
+ "</table></html>");
}
return jComboBoxUsage;
}
private DataHubsIdentification getCurrentDataHubs() { /**
String arg0 = this.jTextFieldDataHubRecord.getText(); * This method initializes jTextFieldFeatureFlag
String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); *
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
String arg2 = this.jTextFieldFeatureFlag.getText(); /**
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector(); * This method initializes jScrollPane
String arg4 = this.jTextAreaHelpText.getText(); *
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4); /**
return id; * This method initializes jTextAreaHelpText
} *
* @return javax.swing.JTextArea
public DataHubsIdentification getId() { *
return id; */
} private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
public void setId(DataHubsIdentification id) { /**
this.id = id; * 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, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Data Hubs");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inDataHubsId
*
*/
private void init(DataHubsIdentification inDataHubsId) {
init();
this.id = inDataHubsId;
if (this.id != null) {
this.jTextFieldDataHubRecord.setText(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inDataHubsIdentification
* @param iFrame
*
*/
public DataHubsDlg(DataHubsIdentification inDataHubsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inDataHubsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jTextFieldDataHubRecord.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelDataHubRecord = new JLabel();
jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelDataHubRecord.setText("Data Hub Record");
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelDataHubRecord, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(jLabelArch, null);
jContentPane.add(getJTextFieldDataHubRecord(), null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentDataHubs();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check DataHubRecord
//
if (isEmpty(this.jTextFieldDataHubRecord.getText())) {
Log.wrn("Update Hubs", "Data Hub Record must not be empty");
return false;
}
if (!isEmpty(this.jTextFieldDataHubRecord.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) {
Log.wrn("Update Hubs", "Incorrect data type for Data Hub Record");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Hubs", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private DataHubsIdentification getCurrentDataHubs() {
String arg0 = this.jTextFieldDataHubRecord.getText();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
String arg2 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
String arg4 = this.jTextAreaHelpText.getText();
id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
return id;
}
public DataHubsIdentification getId() {
return id;
}
public void setId(DataHubsIdentification id) {
this.id = id;
}
} }

View File

@ -46,467 +46,472 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
*/ */
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
//
private JPanel jContentPane = null;
private JLabel jLabelEventType = null;
private JLabel jLabelC_Name = null;
private JComboBox jComboBoxGuidC_Name = null;
private JLabel jLabelUsage = null;
private JLabel jLabelGroup = null;
private JComboBox jComboBoxUsage = null;
private JComboBox jComboBoxEventGroup = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private StarLabel jStarLabel4 = null;
private JComboBox jComboBoxEventsType = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelArch = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private EventsIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
* This method initializes jComboBoxType
*
* @return javax.swing.JComboBox jComboBoxType
*
*/
private JComboBox getJComboBoxEventsType() {
if (jComboBoxEventsType == null) {
jComboBoxEventsType = new JComboBox();
jComboBoxEventsType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxEventsType
.setToolTipText("<html>Select CreateEvents if the Module has an event that is waiting to be signaled.<br>Select SignalEvents if the Module will signal all events in an event group.<br>NOTE: Signal events are named by GUID.</html>");
}
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
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxEventGroup() {
if (jComboBoxEventGroup == null) {
jComboBoxEventGroup = new JComboBox();
jComboBoxEventGroup.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxEventGroup
.setToolTipText("Select Type of Event: Guid or Timer.");
}
return jComboBoxEventGroup;
}
/**
* 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;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag
.setBounds(new java.awt.Rectangle(160, 155, 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 jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 202, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 202, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 275);
this.setContentPane(getJScrollPane());
this.setTitle("Events");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inEventsId
*
*/
private void init(EventsIdentification inEventsId) {
init();
this.id = inEventsId;
if (this.id != null) {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxEventsType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
this.jComboBoxEventGroup.setSelectedItem(id.getGroup());
}
}
/**
* This is the override edit constructor
*
* @param inEventsIdentification
* @param iFrame
*
*/
public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inEventsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxGuidC_Name.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelEventType = new JLabel();
jLabelEventType.setText("Select Event Type");
jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
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 Group 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.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 230));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelEventType, null);
jContentPane.add(getJComboBoxEventsType(), null);
jContentPane.add(jStarLabel2, 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(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes events groups and usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType());
Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt
.getAllGuidDeclarationsFromWorkspace());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentEvents();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check Name // Define class members
// //
if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { private JPanel jContentPane = null;
Log.wrn("Update Events", "Event Name couldn't be empty");
return false;
}
if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { private JLabel jLabelEventType = null;
if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name
.getSelectedItem().toString())) { private JLabel jLabelC_Name = null;
Log.wrn("Update Events", "Incorrect data type for Event Name");
return false; private JComboBox jComboBoxGuidC_Name = null;
}
} private JLabel jLabelUsage = null;
private JLabel jLabelGroup = null;
private JComboBox jComboBoxUsage = null;
private JComboBox jComboBoxEventGroup = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private StarLabel jStarLabel4 = null;
private JComboBox jComboBoxEventsType = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelArch = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
// //
// Check FeatureFlag // Not used by UI
// //
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { private EventsIdentification id = null;
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Events", "Incorrect data type for Feature Flag"); private EnumerationData ed = new EnumerationData();
return false;
} private WorkspaceTools wt = new WorkspaceTools();
/**
* This method initializes jComboBoxType
*
* @return javax.swing.JComboBox jComboBoxType
*
*/
private JComboBox getJComboBoxEventsType() {
if (jComboBoxEventsType == null) {
jComboBoxEventsType = new JComboBox();
jComboBoxEventsType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxEventsType
.setToolTipText("<html>Select CreateEvents if the Module has an event that is waiting to be signaled.<br>"
+ "Select SignalEvents if the Module will signal all events in an event group.<br>"
+ "NOTE: Signal events are named by GUID.</html>");
}
return jComboBoxEventsType;
} }
return true; /**
} * 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;
}
private EventsIdentification getCurrentEvents() { /**
String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); * This method initializes jComboBoxEventsType
String arg1 = this.jComboBoxEventsType.getSelectedItem().toString(); *
String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); * @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxEventGroup() {
if (jComboBoxEventGroup == null) {
jComboBoxEventGroup = new JComboBox();
jComboBoxEventGroup.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxEventGroup.setToolTipText("Select Type of Event: Guid or Timer.");
String arg3 = this.jTextFieldFeatureFlag.getText(); }
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector(); return jComboBoxEventGroup;
String arg5 = this.jTextAreaHelpText.getText(); }
String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString();
id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
return id;
}
public EventsIdentification getId() {
return id;
}
public void setId(EventsIdentification id) { /**
this.id = id; * 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;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 155, 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 jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 202, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 202, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 275);
this.setContentPane(getJScrollPane());
this.setTitle("Events");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inEventsId
*
*/
private void init(EventsIdentification inEventsId) {
init();
this.id = inEventsId;
if (this.id != null) {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxEventsType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
this.jComboBoxEventGroup.setSelectedItem(id.getGroup());
}
}
/**
* This is the override edit constructor
*
* @param inEventsIdentification
* @param iFrame
*
*/
public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inEventsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxGuidC_Name.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelEventType = new JLabel();
jLabelEventType.setText("Select Event Type");
jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
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 Group 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.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 230));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelEventType, null);
jContentPane.add(getJComboBoxEventsType(), null);
jContentPane.add(jStarLabel2, 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(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes events groups and usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType());
Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentEvents();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check Name
//
if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
Log.wrn("Update Events", "Event Name couldn't be empty");
return false;
}
if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
Log.wrn("Update Events", "Incorrect data type for Event Name");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Events", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private EventsIdentification getCurrentEvents() {
String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString();
String arg1 = this.jComboBoxEventsType.getSelectedItem().toString();
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
String arg3 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
String arg5 = this.jTextAreaHelpText.getText();
String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString();
id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
return id;
}
public EventsIdentification getId() {
return id;
}
public void setId(EventsIdentification id) {
this.id = id;
}
} }

View File

@ -224,7 +224,7 @@ public class ExternsDlg extends IDialog implements ItemListener {
if (id.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { if (id.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
this.jComboBoxPcdIsDriver.setSelectedItem(id.getName()); this.jComboBoxPcdIsDriver.setSelectedItem(id.getName());
} else { } else {
this.jTextFieldC_Name.setText(id.getName()); this.jTextFieldC_Name.setText(id.getName());
} }
this.jComboBoxType.setSelectedItem(id.getType()); this.jComboBoxType.setSelectedItem(id.getType());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
@ -380,7 +380,7 @@ public class ExternsDlg extends IDialog implements ItemListener {
if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
arg0 = this.jComboBoxPcdIsDriver.getSelectedItem().toString(); arg0 = this.jComboBoxPcdIsDriver.getSelectedItem().toString();
} else { } else {
arg0 = this.jTextFieldC_Name.getText(); arg0 = this.jTextFieldC_Name.getText();
} }
String arg1 = this.jComboBoxType.getSelectedItem().toString(); String arg1 = this.jComboBoxType.getSelectedItem().toString();

View File

@ -44,373 +44,379 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
*/ */
public class GuidsDlg extends IDialog { public class GuidsDlg extends IDialog {
// / // /
// / Define class Serial Version UID // / Define class Serial Version UID
// / // /
private static final long serialVersionUID = 6710858997766979803L; private static final long serialVersionUID = 6710858997766979803L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelC_Name = null;
private JComboBox jComboBoxCName = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private GuidsIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
* 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, 10, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxCName.setToolTipText("Select the C Name of the GUID");
}
return jComboBoxCName;
}
/**
* 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the GUID</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module will use the GUID only if it is present</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces the GUID</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes produce the GUID</td></tr><tr><td>DEFAULT</td><td>Default is the the GUID that specified the<br>instance of the package</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 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() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
*
* This method initializes jScrollPaneHelpText
*
* @return javax.swing.JScrollPane jScrollPaneHelpText
*
**/
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.setLocation(new java.awt.Point(160,60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
*
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Guids");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
*
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inGuidsId
*
*/
private void init(GuidsIdentification inGuidsId) {
init();
this.id = inGuidsId;
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inGuidsIdentification
* @param iFrame
*
*/
public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inGuidsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("Select GUID's C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(490, 165));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxCName, wt
.getAllGuidDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentGuids();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check Name // Define class members
// //
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { private JPanel jContentPane = null;
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem()
.toString())) { private JLabel jLabelC_Name = null;
Log.wrn("Update Guids", "Incorrect data type for Guid Name");
return false; private JComboBox jComboBoxCName = null;
}
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private GuidsIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
* 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, 10, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxCName.setToolTipText("Select the C Name of the GUID");
}
return jComboBoxCName;
} }
// /**
// Check FeatureFlag * This method initializes jComboBoxUsage
// *
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { * @return javax.swing.JComboBox jComboBoxUsage
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { *
Log.wrn("Update Guids", "Incorrect data type for Feature Flag"); */
return false; private JComboBox getJComboBoxUsage() {
} if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table>"
+ "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the GUID</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMED</td><td>Module will use the GUID only if it is present</td></tr>"
+ "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the GUID</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes produce the GUID</td></tr>"
+ "<tr><td>DEFAULT</td><td>Default is the the GUID that specified the<br>instance of the package</td></tr>"
+ "</table></html>");
}
return jComboBoxUsage;
} }
return true; /**
} * This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
private GuidsIdentification getCurrentGuids() { /**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
*
* This method initializes jScrollPaneHelpText
*
* @return javax.swing.JScrollPane jScrollPaneHelpText
*
**/
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.setLocation(new java.awt.Point(160, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
*
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Guids");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
*
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inGuidsId
*
*/
private void init(GuidsIdentification inGuidsId) {
init();
this.id = inGuidsId;
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inGuidsIdentification
* @param iFrame
*
*/
public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inGuidsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("Select GUID's C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(490, 165));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllGuidDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentGuids();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check Name
//
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
Log.wrn("Update Guids", "Incorrect data type for Guid Name");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Guids", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private GuidsIdentification getCurrentGuids() {
String arg0 = this.jComboBoxCName.getSelectedItem().toString(); String arg0 = this.jComboBoxCName.getSelectedItem().toString();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
@ -420,11 +426,13 @@ private GuidsIdentification getCurrentGuids() {
id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4); id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
return id; return id;
} public GuidsIdentification getId() { }
return id;
}
public void setId(GuidsIdentification id) { public GuidsIdentification getId() {
this.id = id; return id;
} }
public void setId(GuidsIdentification id) {
this.id = id;
}
} }

View File

@ -44,409 +44,407 @@ import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPacka
*/ */
public class HiiPackagesDlg extends IDialog { public class HiiPackagesDlg extends IDialog {
// / // /
// / Define class Serial Version UID // / Define class Serial Version UID
// / // /
private static final long serialVersionUID = -6851574146786158116L; private static final long serialVersionUID = -6851574146786158116L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelName = null;
private JTextField jTextFieldName = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private HiiPackagesIdentification id = null;
private EnumerationData ed = new EnumerationData();
/**
*
* This method initializes jTextFieldName
*
* @return javax.swing.JTextField jTextFieldName
*
*/
private JTextField getJTextFieldName() {
if (jTextFieldName == null) {
jTextFieldName = new JTextField();
jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldName.setToolTipText("Enter the C Name of the HII Package");
}
return jTextFieldName;
}
/**
*
* 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td>ALWAYS_PRODUCED</td><td>Hii is always registered</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Some executions paths will require the Hii to be registered</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
*
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 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() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
*
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea jTextAreaHelpText
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
*
* 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, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
*
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
*
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
**/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
*
* This method initializes this
*
**/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Hii Packages");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inHiiPackagesId
*
**/
private void init(HiiPackagesIdentification inHiiPackagesId) {
init();
this.id = inHiiPackagesId;
if (this.id != null) {
this.jTextFieldName.setText(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inHiiPackagesIdentification
* @param iFrame
*
**/
public HiiPackagesDlg(HiiPackagesIdentification inHiiPackagesIdentification,
IFrame iFrame) {
super(iFrame, true);
init(inHiiPackagesIdentification);
}
/**
*
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
**/
public void setViewMode(boolean isView) {
if (isView) {
this.jTextFieldName.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
*
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelName = new JLabel();
jLabelName.setText("Hii Package C Name");
jLabelName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelName, null);
jContentPane.add(getJTextFieldName(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
*
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentHiiPackages();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
*
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check Hii Package Name // Define class members
// //
if (isEmpty(this.jTextFieldName.getText())) { private JPanel jContentPane = null;
Log.wrn("Update Hii Packages",
"Hii Package Name Record must not be empty");
return false;
}
if (!isEmpty(this.jTextFieldName.getText())) { private JLabel jLabelName = null;
if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) {
Log.wrn("Update Hii Packages", private JTextField jTextFieldName = null;
"Incorrect data type for Hii Package Name");
return false; private JLabel jLabelUsage = null;
}
} private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
// //
// Check FeatureFlag // Not used by UI
// //
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { private HiiPackagesIdentification id = null;
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Hii Packages", "Incorrect data type for Feature Flag"); private EnumerationData ed = new EnumerationData();
return false;
} /**
*
* This method initializes jTextFieldName
*
* @return javax.swing.JTextField jTextFieldName
*
*/
private JTextField getJTextFieldName() {
if (jTextFieldName == null) {
jTextFieldName = new JTextField();
jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldName.setToolTipText("Enter the C Name of the HII Package");
}
return jTextFieldName;
} }
return true; /**
} *
* 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table>"
+ "<tr><td>ALWAYS_PRODUCED</td><td>Hii is always registered</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>Some executions paths will require the Hii to be registered</td></tr>"
+ "</table></html>");
}
return jComboBoxUsage;
}
private HiiPackagesIdentification getCurrentHiiPackages() { /**
String arg0 = this.jTextFieldName.getText(); *
String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); * This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
String arg2 = this.jTextFieldFeatureFlag.getText(); /**
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector(); *
String arg4 = this.jTextAreaHelpText.getText(); * This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4); /**
return id; *
} * This method initializes jTextAreaHelpText
*
public HiiPackagesIdentification getId() { * @return javax.swing.JTextArea jTextAreaHelpText
return id; *
} */
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
public void setId(HiiPackagesIdentification id) { /**
this.id = id; *
} * 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, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
*
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
*
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
**/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
*
* This method initializes this
*
**/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Hii Packages");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inHiiPackagesId
*
**/
private void init(HiiPackagesIdentification inHiiPackagesId) {
init();
this.id = inHiiPackagesId;
if (this.id != null) {
this.jTextFieldName.setText(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inHiiPackagesIdentification
* @param iFrame
*
**/
public HiiPackagesDlg(HiiPackagesIdentification inHiiPackagesIdentification, IFrame iFrame) {
super(iFrame, true);
init(inHiiPackagesIdentification);
}
/**
*
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
**/
public void setViewMode(boolean isView) {
if (isView) {
this.jTextFieldName.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
*
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelName = new JLabel();
jLabelName.setText("Hii Package C Name");
jLabelName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelName, null);
jContentPane.add(getJTextFieldName(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
*
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentHiiPackages();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
*
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check Hii Package Name
//
if (isEmpty(this.jTextFieldName.getText())) {
Log.wrn("Update Hii Packages", "Hii Package Name Record must not be empty");
return false;
}
if (!isEmpty(this.jTextFieldName.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) {
Log.wrn("Update Hii Packages", "Incorrect data type for Hii Package Name");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Hii Packages", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private HiiPackagesIdentification getCurrentHiiPackages() {
String arg0 = this.jTextFieldName.getText();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
String arg2 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
String arg4 = this.jTextAreaHelpText.getText();
id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
return id;
}
public HiiPackagesIdentification getId() {
return id;
}
public void setId(HiiPackagesIdentification id) {
this.id = id;
}
} }

View File

@ -43,428 +43,440 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
*/ */
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
//
private JPanel jContentPane = null;
private JLabel jLabelC_Name = null;
private JComboBox jComboBoxGuidC_Name = null;
private JLabel jLabelUsage = null;
private JLabel jLabelHobType = null;
private JComboBox jComboBoxUsage = null;
private JComboBox jComboBoxHobType = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private HobsIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField jTextFieldC_Name
*
*/
private JComboBox getJComboBoxGuidC_Name() {
if (jComboBoxGuidC_Name == null) {
jComboBoxGuidC_Name = new JComboBox();
jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob");
}
return jComboBoxGuidC_Name;
}
/**
* This method initializes jComboBoxHobType
*
* @return javax.swing.JComboBox jComboBoxHobType
*
*/
private JComboBox getJComboBoxHobType() {
if (jComboBoxHobType == null) {
jComboBoxHobType = new JComboBox();
jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 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;
}
/**
* 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;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag
.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
/**
* This method initializes jTextFieldHelpText
*
* @return javax.swing.JTextField
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 255);
this.setContentPane(getJScrollPane());
this.setTitle("Hobs");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inHobsId
*
*/
private void init(HobsIdentification inHobsId) {
init();
this.id = inHobsId;
if (this.id != null) {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxHobType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inHobsIdentification
* @param iFrame
*
*/
public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inHobsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxGuidC_Name.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
this.jComboBoxHobType.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
public JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("Hob's Guid C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelHobType = new JLabel();
jLabelHobType.setText("Hob Type");
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.setText("Usage");
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.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.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelC_Name, 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(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type and Hob type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());
Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt
.getAllGuidDeclarationsFromWorkspace());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentHobs();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check Name // Define class members
// //
if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { private JPanel jContentPane = null;
Log.wrn("Update Hobs", "Hob Guid C Name must not be empty");
return false;
}
if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { private JLabel jLabelC_Name = null;
if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name
.getSelectedItem().toString())) { private JComboBox jComboBoxGuidC_Name = null;
Log.wrn("Update Hobs", "Incorrect data type for Hob Name");
return false; private JLabel jLabelUsage = null;
}
} private JLabel jLabelHobType = null;
private JComboBox jComboBoxUsage = null;
private JComboBox jComboBoxHobType = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
// //
// Check FeatureFlag // Not used by UI
// //
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { private HobsIdentification id = null;
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Hobs", "Incorrect data type for Feature Flag"); private EnumerationData ed = new EnumerationData();
return false;
} private WorkspaceTools wt = new WorkspaceTools();
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField jTextFieldC_Name
*
*/
private JComboBox getJComboBoxGuidC_Name() {
if (jComboBoxGuidC_Name == null) {
jComboBoxGuidC_Name = new JComboBox();
jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob");
}
return jComboBoxGuidC_Name;
} }
return true; /**
} * This method initializes jComboBoxHobType
*
* @return javax.swing.JComboBox jComboBoxHobType
*
*/
private JComboBox getJComboBoxHobType() {
if (jComboBoxHobType == null) {
jComboBoxHobType = new JComboBox();
jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 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;
}
private HobsIdentification getCurrentHobs() { /**
String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); * This method initializes jComboBoxUsage
String arg1 = this.jComboBoxHobType.getSelectedItem().toString(); *
String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); * @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;
}
String arg3 = this.jTextFieldFeatureFlag.getText(); /**
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector(); * This method initializes jScrollPane
String arg5 = this.jTextAreaHelpText.getText(); *
id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); * @return javax.swing.JScrollPane
return id; */
} private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
public HobsIdentification getId() { jScrollPane = new JScrollPane();
return id; jScrollPane.setViewportView(getJContentPane());
} }
return jScrollPane;
}
public void setId(HobsIdentification id) { /**
this.id = id; * This method initializes jTextFieldFeatureFlag
} *
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
/**
* This method initializes jTextFieldHelpText
*
* @return javax.swing.JTextField
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 255);
this.setContentPane(getJScrollPane());
this.setTitle("Hobs");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inHobsId
*
*/
private void init(HobsIdentification inHobsId) {
init();
this.id = inHobsId;
if (this.id != null) {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxHobType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inHobsIdentification
* @param iFrame
*
*/
public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inHobsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxGuidC_Name.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
this.jComboBoxHobType.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
public JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelC_Name = new JLabel();
jLabelC_Name.setText("Hob's Guid C Name");
jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelHobType = new JLabel();
jLabelHobType.setText("Hob Type");
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.setText("Usage");
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.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.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelC_Name, 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(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type and Hob type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());
Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentHobs();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check Name
//
if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
Log.wrn("Update Hobs", "Hob Guid C Name must not be empty");
return false;
}
if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
Log.wrn("Update Hobs", "Incorrect data type for Hob Name");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Hobs", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private HobsIdentification getCurrentHobs() {
String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString();
String arg1 = this.jComboBoxHobType.getSelectedItem().toString();
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
String arg3 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
String arg5 = this.jTextAreaHelpText.getText();
id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id;
}
public HobsIdentification getId() {
return id;
}
public void setId(HobsIdentification id) {
this.id = id;
}
} }

View File

@ -96,7 +96,7 @@ public class LibraryClassDefsDlg extends IDialog {
private JTextField jTextFieldHelpText = null; private JTextField jTextFieldHelpText = null;
private ArchCheckBox jArchCheckBox = null; private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null; private JButton jButtonOk = null;
private JButton jButtonCancel = null; private JButton jButtonCancel = null;
@ -212,6 +212,7 @@ public class LibraryClassDefsDlg extends IDialog {
jTextFieldFeatureFlag = new JTextField(); jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 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;
} }
@ -372,7 +373,7 @@ public class LibraryClassDefsDlg extends IDialog {
jLabelArch.setText("Supported Architectures"); jLabelArch.setText("Supported Architectures");
jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelFeatureFlag.setText("Feature Flag"); jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelRecommendedInstanceGuid = new JLabel(); jLabelRecommendedInstanceGuid = new JLabel();
jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20)); jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20));
jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid"); jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid");

View File

@ -45,69 +45,67 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
* *
*/ */
public class PackageDepDlg extends IDialog implements ItemListener { public class PackageDepDlg extends IDialog implements ItemListener {
// / // /
// / Define class Serial Version UID // / Define class Serial Version UID
// / // /
private static final long serialVersionUID = 3465193035145152131L; private static final long serialVersionUID = 3465193035145152131L;
// //
// Define class members // Define class members
// //
private JPanel jContentPane = null; private JPanel jContentPane = null;
private JLabel jLabelPackageName = null; private JLabel jLabelPackageName = null;
private StarLabel jStarLabel1 = null; private StarLabel jStarLabel1 = null;
private JComboBox jComboBoxPackageName = null; private JComboBox jComboBoxPackageName = null;
private JLabel jLabelPackageGuid = null; private JLabel jLabelPackageGuid = null;
private JTextField jTextFieldPackageGuid = null; private JTextField jTextFieldPackageGuid = null;
private JButton jButtonGenerateGuid = null; private JLabel jLabelPackageVersion = null;
private JLabel jLabelPackageVersion = null; private JTextField jTextFieldPackageVersion = null;
private JTextField jTextFieldPackageVersion = null; private JLabel jLabelFeatureFlag = null;
private JLabel jLabelFeatureFlag = null; private JTextField jTextFieldFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null; private JScrollPane jScrollPane = null;
private JScrollPane jScrollPane = null; private JLabel jLabelArch = null;
private JLabel jLabelArch = null; private ArchCheckBox jArchCheckBox = null;
private ArchCheckBox jArchCheckBox = null; private JButton jButtonOk = null;
private JButton jButtonOk = null; private JButton jButtonCancel = null;
private JButton jButtonCancel = null; //
// Not used by UI
//
private PackageDependenciesIdentification pdid = null;
// private WorkspaceTools wt = new WorkspaceTools();
// Not used by UI
//
private PackageDependenciesIdentification pdid = null;
private WorkspaceTools wt = new WorkspaceTools(); private Vector<PackageIdentification> vPackage = wt.getAllPackages();
private Vector<PackageIdentification> vPackage = wt.getAllPackages(); /**
* This method initializes jComboBoxPackageName
/** *
* This method initializes jComboBoxPackageName * @return javax.swing.JComboBox
* */
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxPackageName() { private JComboBox getJComboBoxPackageName() {
if (jComboBoxPackageName == null) { if (jComboBoxPackageName == null) {
jComboBoxPackageName = new JComboBox(); jComboBoxPackageName = new JComboBox();
jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPackageName.setToolTipText("If your Module requires a package list that here."); jComboBoxPackageName.setToolTipText("If your Module requires a package list that here.");
jComboBoxPackageName.addItemListener(this); jComboBoxPackageName.addItemListener(this);
} }
return jComboBoxPackageName; return jComboBoxPackageName;
} }
/** /**
@ -126,23 +124,6 @@ public class PackageDepDlg extends IDialog implements ItemListener {
return jTextFieldPackageGuid; return jTextFieldPackageGuid;
} }
/**
* This method initializes jButtonGenerateGuid
*
* @return javax.swing.JButton
*/
private JButton getJButtonGenerateGuid() {
if (jButtonGenerateGuid == null) {
jButtonGenerateGuid = new JButton();
jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20));
jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
jButtonGenerateGuid.setText("GEN");
jButtonGenerateGuid.addActionListener(this);
jButtonGenerateGuid.setVisible(false);
}
return jButtonGenerateGuid;
}
/** /**
* This method initializes jTextFieldPackageVersion * This method initializes jTextFieldPackageVersion
* *
@ -154,7 +135,11 @@ public class PackageDepDlg extends IDialog implements ItemListener {
jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldPackageVersion jTextFieldPackageVersion
.setToolTipText("If this module depends on a specific version of a package, enter the package version here. If the module can use the latest version that does not break backward compatibility, leave this field blank"); .setToolTipText("<html>If this module depends on a specific version of a package, <br>" +
"enter the package version here. <br>" +
"If the module can use the latest version <br>" +
"that does not break backward compatibility, <br>" +
"leave this field blank</html>");
} }
return jTextFieldPackageVersion; return jTextFieldPackageVersion;
} }
@ -281,36 +266,36 @@ public class PackageDepDlg extends IDialog implements ItemListener {
*/ */
private JPanel getJContentPane() { private JPanel getJContentPane() {
if (jContentPane == null) { if (jContentPane == null) {
jStarLabel1 = new StarLabel(); jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10)); jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelPackageName = new JLabel(); jLabelPackageName = new JLabel();
jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelPackageName.setText("Package Name"); jLabelPackageName.setText("Package Name");
jLabelPackageVersion = new JLabel(); jLabelPackageVersion = new JLabel();
jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelPackageVersion.setText("Package Version"); jLabelPackageVersion.setText("Package Version");
jLabelPackageGuid = new JLabel(); jLabelPackageGuid = new JLabel();
jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelPackageGuid.setText("Package Guid"); jLabelPackageGuid.setText("Package Guid");
jLabelPackageGuid.setVisible(false); jLabelPackageGuid.setVisible(false);
jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression"); jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel(); jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 145, 20));
jLabelArch.setText("Supported Architectures"); jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox(); jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(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(485, 145)); jContentPane.setPreferredSize(new java.awt.Dimension(485, 145));
jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelPackageName, null); jContentPane.add(jLabelPackageName, null);
jContentPane.add(getJComboBoxPackageName(), null); jContentPane.add(getJComboBoxPackageName(), null);
@ -378,12 +363,12 @@ public class PackageDepDlg extends IDialog implements ItemListener {
// //
// Check PackageGuid // Check PackageGuid
// //
// if (!isEmpty(this.jTextFieldPackageGuid.getText())) { // if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
// if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) { // if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
// Log.err("Incorrect data type for Package Guid"); // Log.err("Incorrect data type for Package Guid");
// return false; // return false;
// } // }
// } // }
// //
// Check PackageVersion // Check PackageVersion
@ -407,7 +392,6 @@ public class PackageDepDlg extends IDialog implements ItemListener {
return true; return true;
} }
private PackageDependenciesIdentification getCurrentPackageDependencies() { private PackageDependenciesIdentification getCurrentPackageDependencies() {
String arg0 = this.jComboBoxPackageName.getSelectedItem().toString(); String arg0 = this.jComboBoxPackageName.getSelectedItem().toString();

View File

@ -46,394 +46,391 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
*/ */
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
//
private JPanel jContentPane = null;
private JLabel jLabelC_Name = null;
private JComboBox jComboBoxCName = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelFeatureFlag = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private JLabel jLabelPpiType = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JComboBox jComboBoxPpiType = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private PpisIdentification id = null;
private WorkspaceTools wt = new WorkspaceTools();
private EnumerationData ed = new EnumerationData();
/**
* This method initializes jComboBoxPpiType
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxPpiType() {
if (jComboBoxPpiType == null) {
jComboBoxPpiType = new JComboBox();
jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPpiType.addItemListener(this);
jComboBoxPpiType.setToolTipText("<html>PPIs are named by GUID.<br>PPI Notify is consumed via a register PPI Notify mechanism");
}
return jComboBoxPpiType;
}
/**
* 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;
}
/**
* 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() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 255);
this.setContentPane(getJScrollPane());
this.setTitle("PPI Definitions");
initFrame();
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inProtocolsId
*
*/
private void init(PpisIdentification inPpisId) {
init();
this.id = inPpisId;
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxPpiType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inProtocolsIdentification
* @param iFrame
*
*/
public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) {
super(iFrame, true);
init(inPpisIdentification);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelPpiType = new JLabel();
jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelPpiType.setText("Select 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.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelPpiType, null);
jContentPane.add(getJComboBoxPpiType(), 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(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxCName, wt
.getAllPpiDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentPpis();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check Name // Define class members
// //
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { private JPanel jContentPane = null;
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem()
.toString())) { private JLabel jLabelC_Name = null;
Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name");
return false; private JComboBox jComboBoxCName = null;
}
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelFeatureFlag = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private JLabel jLabelPpiType = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JComboBox jComboBoxPpiType = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private PpisIdentification id = null;
private WorkspaceTools wt = new WorkspaceTools();
private EnumerationData ed = new EnumerationData();
/**
* This method initializes jComboBoxPpiType
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxPpiType() {
if (jComboBoxPpiType == null) {
jComboBoxPpiType = new JComboBox();
jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxPpiType.addItemListener(this);
jComboBoxPpiType
.setToolTipText("<html>PPIs are named by GUID.<br>PPI Notify is consumed via a register PPI Notify mechanism");
}
return jComboBoxPpiType;
} }
// /**
// Check FeatureFlag * This method initializes jTextFieldC_Name
// *
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { * @return javax.swing.JTextField jTextFieldC_Name
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { *
Log.wrn("Update Ppis", "Incorrect data type for Feature Flag"); */
return false; 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 true; /**
} * 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;
}
private PpisIdentification getCurrentPpis() { /**
* 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() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 255);
this.setContentPane(getJScrollPane());
this.setTitle("PPI Definitions");
initFrame();
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inProtocolsId
*
*/
private void init(PpisIdentification inPpisId) {
init();
this.id = inPpisId;
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxPpiType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inProtocolsIdentification
* @param iFrame
*
*/
public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) {
super(iFrame, true);
init(inPpisIdentification);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelPpiType = new JLabel();
jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelPpiType.setText("Select 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.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelPpiType, null);
jContentPane.add(getJComboBoxPpiType(), 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(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPpiDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentPpis();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check Name
//
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Ppis", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
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();
@ -444,32 +441,30 @@ private PpisIdentification getCurrentPpis() {
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) {
if (arg0.getSource() == this.jComboBoxPpiType public void itemStateChanged(ItemEvent arg0) {
&& arg0.getStateChange() == ItemEvent.SELECTED) { if (arg0.getSource() == this.jComboBoxPpiType && arg0.getStateChange() == ItemEvent.SELECTED) {
if (this.jComboBoxPpiType.getSelectedItem().toString().equals( if (this.jComboBoxPpiType.getSelectedItem().toString().equals(ed.getVPpiType().get(0))) {
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()); }
}
} }
}
public PpisIdentification getId() { public PpisIdentification getId() {
return id; return id;
} }
public void setId(PpisIdentification id) { public void setId(PpisIdentification id) {
this.id = id; this.id = id;
} }
} }

View File

@ -48,461 +48,449 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
*/ */
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
//
private JPanel jContentPane = null;
private JLabel jLabelC_Name = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JLabel jLabelProtocolType = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JComboBox jComboBoxProtocolType = null;
private JComboBox jComboBoxCName = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private ProtocolsIdentification id = null;
private WorkspaceTools wt = new WorkspaceTools();
private EnumerationData ed = new EnumerationData();
/**
* 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 jComboBoxUsage
*
* @return javax.swing.JComboBox jComboBoxUsage
*
*/
private JComboBox getJComboBoxProtocolUsage() {
if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td colspan=2 align=center><b>Protocol</b></td></tr>"
+ "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the protocol</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMES</td><td>Module sometimes consumes the protocol</td></tr>"
+ "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the protocol</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the protocol</td></tr>"
+ "<tr><td>TO_START</td><td>The protocol is consumed by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
+ "<tr><td>BY_START</td><td>Protocol is produced by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
+ "<tr><td colspan=2 align=center><b>Protocol Notify</b></td></tr>"
+ "<tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the protocol if it is produced.<br>Consumption is defined by executing the protocol notify<br>function.</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jComboBoxProtocolType
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxProtocolType() {
if (jComboBoxProtocolType == null) {
jComboBoxProtocolType = new JComboBox();
jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxProtocolType.addItemListener(this);
jComboBoxProtocolType
.setToolTipText("<html>Select Protocol Type<br>Protocol Notify is a register protocol notify mechanism.");
}
return jComboBoxProtocolType;
}
/**
* This method initializes jComboBoxCName
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxCName() {
if (jComboBoxCName == null) {
jComboBoxCName = new JComboBox();
jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol");
}
return jComboBoxCName;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 255);
this.setContentPane(getJScrollPane());
this.setTitle("Protocols");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inProtocolsId
*
*/
private void init(ProtocolsIdentification inProtocolsId) {
init();
this.id = inProtocolsId;
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxProtocolType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inProtocolsIdentification
* @param iFrame
*
*/
public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification,
IFrame iFrame) {
super(iFrame, true);
init(inProtocolsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxUsage.setEnabled(!isView);
this.jTextFieldFeatureFlag.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelProtocolType = new JLabel();
jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
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.setText("Usage");
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.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelProtocolType, null);
jContentPane.add(getJComboBoxProtocolType(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null);
jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxProtocolUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools
.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
Tools.generateComboBoxByVector(jComboBoxCName, wt
.getAllProtocolDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentProtocols();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check Name // Define class members
// //
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { private JPanel jContentPane = null;
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem()
.toString())) { private JLabel jLabelC_Name = null;
Log.wrn("Update Protocols",
"Incorrect data type for Protocol/ProtocolNotify Name"); private JLabel jLabelFeatureFlag = null;
return false;
} private JTextField jTextFieldFeatureFlag = null;
}
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private StarLabel jStarLabel3 = null;
private JLabel jLabelProtocolType = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JComboBox jComboBoxProtocolType = null;
private JComboBox jComboBoxCName = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
// //
// Check FeatureFlag // Not used by UI
// //
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { private ProtocolsIdentification id = null;
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Protocols", "Incorrect data type for Feature Flag"); private WorkspaceTools wt = new WorkspaceTools();
return false;
} private EnumerationData ed = new EnumerationData();
/**
* 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;
} }
return true; /**
} * This method initializes jComboBoxUsage
*
private ProtocolsIdentification getCurrentProtocols() { * @return javax.swing.JComboBox jComboBoxUsage
String arg0 = this.jComboBoxCName.getSelectedItem().toString(); *
String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString(); */
String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); private JComboBox getJComboBoxProtocolUsage() {
if (jComboBoxUsage == null) {
String arg3 = this.jTextFieldFeatureFlag.getText(); jComboBoxUsage = new JComboBox();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector(); jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
String arg5 = this.jTextAreaHelpText.getText(); jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); jComboBoxUsage
return id; .setToolTipText("<html><table><tr><td colspan=2 align=center><b>Protocol</b></td></tr>"
} + "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the protocol</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMES</td><td>Module sometimes consumes the protocol</td></tr>"
/* + "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the protocol</td></tr>"
* (non-Javadoc) + "<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>"
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) + "<tr><td>BY_START</td><td>Protocol is produced by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
* + "<tr><td colspan=2 align=center><b>Protocol Notify</b></td></tr>"
* Reflesh the frame when selected item changed + "<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;
public void itemStateChanged(ItemEvent arg0) {
if (arg0.getSource() == this.jComboBoxProtocolType
&& arg0.getStateChange() == ItemEvent.SELECTED) {
if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(
ed.getVProtocolType().get(0))) {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed
.getVProtocolUsage());
} else {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed
.getVProtocolNotifyUsage());
}
} }
}
public ProtocolsIdentification getId() { /**
return id; * This method initializes jScrollPane
} *
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
public void setId(ProtocolsIdentification id) { /**
this.id = id; * This method initializes jComboBoxProtocolType
} *
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxProtocolType() {
if (jComboBoxProtocolType == null) {
jComboBoxProtocolType = new JComboBox();
jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxProtocolType.addItemListener(this);
jComboBoxProtocolType
.setToolTipText("<html>Select Protocol Type<br>Protocol Notify is a register protocol notify mechanism.");
}
return jComboBoxProtocolType;
}
/**
* This method initializes jComboBoxCName
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxCName() {
if (jComboBoxCName == null) {
jComboBoxCName = new JComboBox();
jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol");
}
return jComboBoxCName;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* 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;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 255);
this.setContentPane(getJScrollPane());
this.setTitle("Protocols");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inProtocolsId
*
*/
private void init(ProtocolsIdentification inProtocolsId) {
init();
this.id = inProtocolsId;
if (this.id != null) {
this.jComboBoxCName.setSelectedItem(id.getName());
this.jComboBoxProtocolType.setSelectedItem(id.getType());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inProtocolsIdentification
* @param iFrame
*
*/
public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame) {
super(iFrame, true);
init(inProtocolsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxUsage.setEnabled(!isView);
this.jTextFieldFeatureFlag.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelProtocolType = new JLabel();
jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
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.setText("Usage");
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.setText("Feature Flag Expression");
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jLabelProtocolType, null);
jContentPane.add(getJComboBoxProtocolType(), null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelC_Name, null);
jContentPane.add(getJComboBoxCName(), null);
jContentPane.add(jStarLabel3, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxProtocolUsage(), null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentProtocols();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check Name
//
if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) {
if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) {
Log.wrn("Update Protocols", "Incorrect data type for Protocol/ProtocolNotify Name");
return false;
}
}
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Protocols", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private ProtocolsIdentification getCurrentProtocols() {
String arg0 = this.jComboBoxCName.getSelectedItem().toString();
String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString();
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
String arg3 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
String arg5 = this.jTextAreaHelpText.getText();
id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
return id;
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
*
* Reflesh the frame when selected item changed
*
*/
public void itemStateChanged(ItemEvent arg0) {
if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) {
if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolUsage());
} else {
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolNotifyUsage());
}
}
}
public ProtocolsIdentification getId() {
return id;
}
public void setId(ProtocolsIdentification id) {
this.id = id;
}
} }

View File

@ -27,9 +27,11 @@ import javax.swing.JTextField;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.EnumerationData;
import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Log;
import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
import org.tianocore.frameworkwizard.common.ui.IComboBox;
import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel; import org.tianocore.frameworkwizard.common.ui.StarLabel;
@ -76,6 +78,8 @@ public class SourceFilesDlg extends IDialog {
private JTextField jTextFieldToolCode = null; private JTextField jTextFieldToolCode = null;
private IComboBox iComboBoxToolCode = null;
private JTextField jTextFieldToolChainFamily = null; private JTextField jTextFieldToolChainFamily = null;
private JLabel jLabelFeatureFlag = null; private JLabel jLabelFeatureFlag = null;
@ -83,7 +87,7 @@ public class SourceFilesDlg extends IDialog {
private JTextField jTextFieldFeatureFlag = null; private JTextField jTextFieldFeatureFlag = null;
private ArchCheckBox jArchCheckBox = null; private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null; private JButton jButtonOk = null;
private JButton jButtonCancel = null; private JButton jButtonCancel = null;
@ -95,6 +99,8 @@ public class SourceFilesDlg extends IDialog {
private String msaFileName = ""; private String msaFileName = "";
private EnumerationData ed = new EnumerationData();
/** /**
This method initializes jTextFieldFileName This method initializes jTextFieldFileName
@ -156,6 +162,19 @@ public class SourceFilesDlg extends IDialog {
return jTextFieldTagName; return jTextFieldTagName;
} }
private IComboBox getIComboBoxToolCode() {
if (iComboBoxToolCode == null) {
iComboBoxToolCode = new IComboBox();
iComboBoxToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20));
iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
iComboBoxToolCode.setToolTipText("<html>You may select a specific tool command from drop down list, <br>"
+ "or you can DOUBLE-CLICK this fild to enter your customizing <br>"
+ "tool command.<br>"
+ "Press ENTER to save your input or press ESCAPE to quit</html>");
}
return iComboBoxToolCode;
}
/** /**
* This method initializes jTextFieldToolCode * This method initializes jTextFieldToolCode
* *
@ -167,6 +186,7 @@ public class SourceFilesDlg extends IDialog {
jTextFieldToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20)); jTextFieldToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20));
jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20)); jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM"); jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM");
jTextFieldToolCode.setVisible(false);
} }
return jTextFieldToolCode; return jTextFieldToolCode;
} }
@ -274,7 +294,32 @@ public class SourceFilesDlg extends IDialog {
if (inSourceFilesIdentifications != null) { if (inSourceFilesIdentifications != null) {
this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename()); this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename());
this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName()); this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName());
this.jTextFieldToolCode.setText(inSourceFilesIdentifications.getToolCode());
//
// Generate Tool Code selection list
//
Vector<String> v = ed.getVToolCode();
boolean isFind = false;
String strToolCode = inSourceFilesIdentifications.getToolCode();
//
// If the input value is not in the default list, add it to the list
//
if (strToolCode != null) {
for (int index = 0; index < v.size(); index++) {
if (v.elementAt(index).equals(strToolCode)) {
isFind = true;
break;
}
}
if (!isFind && !isEmpty(strToolCode)) {
v.addElement(strToolCode);
}
}
Tools.generateComboBoxByVector(iComboBoxToolCode, v);
this.iComboBoxToolCode.setSelectedItem(strToolCode);
this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily()); this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily());
jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag()); jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList()); this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList());
@ -341,6 +386,7 @@ public class SourceFilesDlg extends IDialog {
jContentPane.add(getJTextFieldTagName(), null); jContentPane.add(getJTextFieldTagName(), null);
jContentPane.add(jLabelToolCode, null); jContentPane.add(jLabelToolCode, null);
jContentPane.add(getJTextFieldToolCode(), null); jContentPane.add(getJTextFieldToolCode(), null);
jContentPane.add(getIComboBoxToolCode(), null);
jContentPane.add(getJTextFieldToolChainFamily(), null); jContentPane.add(getJTextFieldToolChainFamily(), null);
jContentPane.add(jLabelFeatureFlag, null); jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null); jContentPane.add(getJTextFieldFeatureFlag(), null);
@ -380,13 +426,16 @@ public class SourceFilesDlg extends IDialog {
String name = this.jTextFieldFileName.getText(); String name = this.jTextFieldFileName.getText();
String s[] = name.split(";"); String s[] = name.split(";");
String tagName = this.jTextFieldTagName.getText(); String tagName = this.jTextFieldTagName.getText();
String toolCode = this.jTextFieldToolCode.getText(); String toolCode = this.iComboBoxToolCode.getSelectedItem().toString();
if (toolCode.equals(DataType.EMPTY_SELECT_ITEM)) {
toolCode = "";
}
String tcf = this.jTextFieldToolChainFamily.getText(); String tcf = this.jTextFieldToolChainFamily.getText();
String featureFlag = this.jTextFieldFeatureFlag.getText(); String featureFlag = this.jTextFieldFeatureFlag.getText();
Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector(); Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
sfid = new SourceFilesIdentification[s.length]; sfid = new SourceFilesIdentification[s.length];
for (int index = 0; index < s.length; index++) { for (int index = 0; index < s.length; index++) {
sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch); sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch);
} }
return sfid; return sfid;
} }

View File

@ -47,375 +47,378 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
*/ */
public class SystemTablesDlg extends IDialog { public class SystemTablesDlg extends IDialog {
// / // /
// / Define class Serial Version UID // / Define class Serial Version UID
// / // /
private static final long serialVersionUID = 7488769180379442276L; private static final long serialVersionUID = 7488769180379442276L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelEntry = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JComboBox jComboBoxGuidC_Name = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private SystemTablesIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
* This method initializes jComboBoxGuidC_Name
*
* @return javax.swing.JComboBox jComboBoxGuidC_Name
*
*/
private JComboBox getJComboBoxGuidC_Name() {
if (jComboBoxGuidC_Name == null) {
jComboBoxGuidC_Name = new JComboBox();
jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxGuidC_Name
.setToolTipText("Select the GUID C Name of the System Table");
}
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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>Module requires a GUIDed entry in the system table</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module consumes a GUIDed entry in the system<br>table if it is present</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces a GUIDed entry in the system table</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Module produces a GUIDed entry in the system table<br>for some of its execution flows.</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 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() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* This method initializes jScrollPaneHelpText
*
* @returns javax.swing.JScrollPane jScrollPaneHelpText
*/
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, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("System Tables");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inSystemTablesId
*
*/
private void init(SystemTablesIdentification inSystemTablesId) {
init();
this.id = inSystemTablesId;
if (this.id != null) {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inBootModesIdentification
* @param iFrame
*
*/
public SystemTablesDlg(
SystemTablesIdentification inSystemTablesIdentification, IFrame iFrame) {
super(iFrame, true);
init(inSystemTablesIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelEntry = new JLabel();
jLabelEntry.setText("Table's GUID C Name");
jLabelEntry.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 140, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelEntry, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt
.getAllGuidDeclarationsFromWorkspace());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentSystemTables();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
// Check FeatureFlag // Define class members
// //
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { private JPanel jContentPane = null;
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update System Tables", "Incorrect data type for Feature Flag"); private JLabel jLabelEntry = null;
return false;
} private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JComboBox jComboBoxGuidC_Name = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private SystemTablesIdentification id = null;
private EnumerationData ed = new EnumerationData();
private WorkspaceTools wt = new WorkspaceTools();
/**
* This method initializes jComboBoxGuidC_Name
*
* @return javax.swing.JComboBox jComboBoxGuidC_Name
*
*/
private JComboBox getJComboBoxGuidC_Name() {
if (jComboBoxGuidC_Name == null) {
jComboBoxGuidC_Name = new JComboBox();
jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the System Table");
}
return jComboBoxGuidC_Name;
} }
return true; /**
} * 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, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table>"
+ "<tr><td>ALWAYS_CONSUMED</td><td>Module requires a GUIDed entry in the system table</td></tr>"
+ "<tr><td>SOMETIMES_CONSUMED</td><td>Module consumes a GUIDed entry in the system<br>table if it is present</td>"
+ "</tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces a GUIDed entry in the system table</td></tr>"
+ "<tr><td>SOMETIMES_PRODUCED</td><td>Module produces a GUIDed entry in the system table<br>for some of its execution flows.</td></tr>"
+ "</table></html>");
}
return jComboBoxUsage;
}
private SystemTablesIdentification getCurrentSystemTables() { /**
String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); * This method initializes jTextFieldFeatureFlag
String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); *
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
String arg2 = this.jTextFieldFeatureFlag.getText(); /**
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector(); * This method initializes jScrollPane
String arg4 = this.jTextAreaHelpText.getText(); *
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4); /**
return id; * This method initializes jTextAreaHelpText
} *
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
public SystemTablesIdentification getId() { /**
return id; * This method initializes jScrollPaneHelpText
} *
* @returns javax.swing.JScrollPane jScrollPaneHelpText
*/
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, 60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
public void setId(SystemTablesIdentification id) { /**
this.id = id; * This method initializes jButtonOk
} *
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("System Tables");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inSystemTablesId
*
*/
private void init(SystemTablesIdentification inSystemTablesId) {
init();
this.id = inSystemTablesId;
if (this.id != null) {
this.jComboBoxGuidC_Name.setSelectedItem(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inBootModesIdentification
* @param iFrame
*
*/
public SystemTablesDlg(SystemTablesIdentification inSystemTablesIdentification, IFrame iFrame) {
super(iFrame, true);
init(inSystemTablesIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelEntry = new JLabel();
jLabelEntry.setText("Table's GUID C Name");
jLabelEntry.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 140, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelEntry, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(getJComboBoxGuidC_Name(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage());
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentSystemTables();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update System Tables", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private SystemTablesIdentification getCurrentSystemTables() {
String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
String arg2 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
String arg4 = this.jTextAreaHelpText.getText();
id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4);
return id;
}
public SystemTablesIdentification getId() {
return id;
}
public void setId(SystemTablesIdentification id) {
this.id = id;
}
} }

View File

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