mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 08:34:07 +02:00
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:
parent
ccb063b1f2
commit
a929458e66
@ -2599,10 +2599,12 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
||||
|
||||
**/
|
||||
private void doubleClickModuleTreeNode() {
|
||||
Identification id = iTree.getSelectNode().getId();
|
||||
int intCategory = iTree.getSelectCategory();
|
||||
Identification id = null;
|
||||
int intCategory = -1;
|
||||
String path = null;
|
||||
try {
|
||||
id = iTree.getSelectNode().getId();
|
||||
intCategory = iTree.getSelectCategory();
|
||||
//
|
||||
// If the node is not opened yet
|
||||
// Insert top level elements first
|
||||
@ -2894,8 +2896,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
||||
try {
|
||||
wt.addPackageToDatabase(smb.getPid());
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
Log.err("addPackageToDatabase", e.getMessage());
|
||||
}
|
||||
vPackageList.addElement(smb.getPid());
|
||||
|
||||
@ -2932,8 +2933,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
||||
try {
|
||||
wt.addPlatformToDatabase(smb.getFid());
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
Log.err("addPlatformToDatabase", e.getMessage());
|
||||
}
|
||||
vPlatformList.addElement(smb.getFid());
|
||||
//
|
||||
|
@ -84,6 +84,8 @@ public class EnumerationData {
|
||||
|
||||
public Vector<String> vSourceFilesFileType = new Vector<String>();
|
||||
|
||||
public Vector<String> vToolCode = new Vector<String>();
|
||||
|
||||
//
|
||||
// Used by Package Dependencies
|
||||
//
|
||||
@ -203,6 +205,7 @@ public class EnumerationData {
|
||||
//
|
||||
initSourceFilesToolChainFamily();
|
||||
initSourceFilesFileType();
|
||||
initToolCode();
|
||||
|
||||
//
|
||||
// Used by Package Dependencies
|
||||
@ -491,6 +494,18 @@ public class EnumerationData {
|
||||
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() {
|
||||
vPackageUsage.removeAllElements();
|
||||
vPackageUsage.addElement("ALWAYS_CONSUMED");
|
||||
@ -1010,4 +1025,12 @@ public class EnumerationData {
|
||||
public void setVPackageUsage(Vector<String> packageUsage) {
|
||||
vPackageUsage = packageUsage;
|
||||
}
|
||||
|
||||
public Vector<String> getVToolCode() {
|
||||
return vToolCode;
|
||||
}
|
||||
|
||||
public void setVToolCode(Vector<String> toolCode) {
|
||||
vToolCode = toolCode;
|
||||
}
|
||||
}
|
||||
|
@ -40,26 +40,8 @@ public class FileOperation {
|
||||
**/
|
||||
public static void newFolder(String folderPath) throws Exception {
|
||||
folderPath = Tools.convertPathToCurrentOsType(folderPath);
|
||||
String temp = "";
|
||||
while (folderPath.length() > 0) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
File f = new File(folderPath);
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -320,7 +320,7 @@ public class Tools {
|
||||
|
||||
**/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,8 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
|
||||
this.addKeyListener(this);
|
||||
this.getEditor().getEditorComponent().addKeyListener(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) {
|
||||
@ -122,6 +123,7 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
|
||||
}
|
||||
this.setEditable(false);
|
||||
}
|
||||
|
||||
if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
closeEdit();
|
||||
}
|
||||
@ -160,7 +162,6 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
|
||||
this.setEditable(true);
|
||||
this.getEditor().setItem("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
@ -190,8 +191,5 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener,
|
||||
private void closeEdit() {
|
||||
this.setEditable(false);
|
||||
this.getEditor().setItem("");
|
||||
if (this.getItemCount() > 0) {
|
||||
this.setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,9 +65,9 @@ public class ModuleDefinitions extends IInternalFrame {
|
||||
private StarLabel jStarLabel2 = null;
|
||||
|
||||
private StarLabel jStarLabel3 = null;
|
||||
|
||||
|
||||
private OpeningModuleType omt = null;
|
||||
|
||||
|
||||
private ClonedFrom cf = null;
|
||||
|
||||
private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
|
||||
@ -136,12 +136,12 @@ public class ModuleDefinitions extends IInternalFrame {
|
||||
if (iCheckBoxListArch == null) {
|
||||
iCheckBoxListArch = new ICheckBoxList();
|
||||
iCheckBoxListArch.addFocusListener(this);
|
||||
iCheckBoxListArch.setToolTipText("<html>Deselecting a checkbox will restrict this module<br>" +
|
||||
"for use with the selected architectures, <br>" +
|
||||
"based on the list of items that are checked. <br>" +
|
||||
"If all boxes are checked, <br>" +
|
||||
"then the module will support all <br>" +
|
||||
"current AND FUTURE architectures</html>");
|
||||
iCheckBoxListArch.setToolTipText("<html>Deselecting a checkbox will restrict this module<br>"
|
||||
+ "for use with the selected architectures, <br>"
|
||||
+ "based on the list of items that are checked. <br>"
|
||||
+ "If all boxes are checked, <br>"
|
||||
+ "then the module will support all <br>"
|
||||
+ "current AND FUTURE architectures</html>");
|
||||
}
|
||||
return iCheckBoxListArch;
|
||||
}
|
||||
@ -157,14 +157,14 @@ public class ModuleDefinitions extends IInternalFrame {
|
||||
jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
|
||||
jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jComboBoxBinaryModule.addFocusListener(this);
|
||||
jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>" +
|
||||
"which can be compiled or binary <br>" +
|
||||
"modules which are linked. <br>" +
|
||||
"A module cannot contain both. <br>" +
|
||||
"The GUID numbers should be identical <br>" +
|
||||
"for a binary and source MSA, <br>" +
|
||||
"but the BINARY MSA should have <br>" +
|
||||
"a higher version number.</html>");
|
||||
jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>"
|
||||
+ "which can be compiled or binary <br>"
|
||||
+ "modules which are linked. <br>"
|
||||
+ "A module cannot contain both. <br>"
|
||||
+ "The GUID numbers should be identical <br>"
|
||||
+ "for a binary and source MSA, <br>"
|
||||
+ "but the BINARY MSA should have <br>"
|
||||
+ "a higher version number.</html>");
|
||||
}
|
||||
return jComboBoxBinaryModule;
|
||||
}
|
||||
@ -231,7 +231,7 @@ public class ModuleDefinitions extends IInternalFrame {
|
||||
this.omt = inOmt;
|
||||
this.msa = omt.getXmlMsa();
|
||||
if (msa.getModuleDefinitions() != null) {
|
||||
this.cf = msa.getModuleDefinitions().getClonedFrom();
|
||||
this.cf = msa.getModuleDefinitions().getClonedFrom();
|
||||
}
|
||||
init(msa.getModuleDefinitions());
|
||||
this.setVisible(true);
|
||||
@ -283,7 +283,7 @@ public class ModuleDefinitions extends IInternalFrame {
|
||||
this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());
|
||||
Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());
|
||||
}
|
||||
|
||||
|
||||
private boolean check() {
|
||||
if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {
|
||||
Log.wrn("Update Definitions", "Output File Basename couldn't be empty!");
|
||||
@ -332,7 +332,7 @@ public class ModuleDefinitions extends IInternalFrame {
|
||||
} else {
|
||||
md.setBinaryModule(true);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Set ClonedFrom field
|
||||
//
|
||||
@ -344,9 +344,9 @@ public class ModuleDefinitions extends IInternalFrame {
|
||||
// Save Arch list
|
||||
//
|
||||
md.setSupportedArchitectures(this.iCheckBoxListArch.getAllCheckedItemsString());
|
||||
|
||||
|
||||
msa.setModuleDefinitions(md);
|
||||
|
||||
|
||||
this.omt.setSaved(false);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -313,7 +313,7 @@ public class ModuleEvents extends IInternalFrame {
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
|
||||
private void showEdit(int index) {
|
||||
EventsDlg dlg = new EventsDlg(vid.getEvents(index), new IFrame());
|
||||
int result = dlg.showDialog();
|
||||
|
@ -307,7 +307,7 @@ public class ModuleProtocols extends IInternalFrame {
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
|
||||
private void showEdit(int index) {
|
||||
ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), new IFrame());
|
||||
int result = dlg.showDialog();
|
||||
@ -450,7 +450,7 @@ public class ModuleProtocols extends IInternalFrame {
|
||||
Log.err("Update Protocols", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
|
||||
*
|
||||
|
@ -348,7 +348,8 @@ public class ModuleSourceFiles extends IInternalFrame {
|
||||
}
|
||||
|
||||
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();
|
||||
if (result == DataType.RETURN_TYPE_OK) {
|
||||
if (index == -1) {
|
||||
|
@ -1052,7 +1052,7 @@ public class MsaHeader extends IInternalFrame {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
|
@ -50,371 +50,386 @@ import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesI
|
||||
*/
|
||||
public class BootModesDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -3888558623432442561L;
|
||||
|
||||
//
|
||||
// Check FeatureFlag
|
||||
// Define class members
|
||||
//
|
||||
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
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();
|
||||
id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
|
||||
return id;
|
||||
}
|
||||
|
||||
public BootModesIdentification 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(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;
|
||||
}
|
||||
}
|
||||
|
@ -50,390 +50,393 @@ import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIde
|
||||
*/
|
||||
public class DataHubsDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -3667906991966638892L;
|
||||
|
||||
//
|
||||
// Check DataHubRecord
|
||||
// Define class members
|
||||
//
|
||||
if (isEmpty(this.jTextFieldDataHubRecord.getText())) {
|
||||
Log.wrn("Update Hubs", "Data Hub Record must not be empty");
|
||||
return false;
|
||||
}
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
//
|
||||
// Check FeatureFlag
|
||||
// Not used by UI
|
||||
//
|
||||
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update Hubs", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
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 DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
|
||||
return id;
|
||||
}
|
||||
|
||||
public DataHubsIdentification getId() {
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
@ -46,467 +46,472 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*/
|
||||
public class EventsDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -4396143706422842331L;
|
||||
|
||||
//
|
||||
// Check Name
|
||||
// Define class members
|
||||
//
|
||||
if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
|
||||
Log.wrn("Update Events", "Event Name couldn't be empty");
|
||||
return false;
|
||||
}
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
//
|
||||
// Check FeatureFlag
|
||||
// Not used by UI
|
||||
//
|
||||
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update Events", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
String arg1 = this.jComboBoxEventsType.getSelectedItem().toString();
|
||||
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
|
||||
/**
|
||||
* 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.");
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
return jComboBoxEventGroup;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class ExternsDlg extends IDialog implements ItemListener {
|
||||
if (id.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) {
|
||||
this.jComboBoxPcdIsDriver.setSelectedItem(id.getName());
|
||||
} else {
|
||||
this.jTextFieldC_Name.setText(id.getName());
|
||||
this.jTextFieldC_Name.setText(id.getName());
|
||||
}
|
||||
this.jComboBoxType.setSelectedItem(id.getType());
|
||||
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)) {
|
||||
arg0 = this.jComboBoxPcdIsDriver.getSelectedItem().toString();
|
||||
} else {
|
||||
arg0 = this.jTextFieldC_Name.getText();
|
||||
arg0 = this.jTextFieldC_Name.getText();
|
||||
}
|
||||
String arg1 = this.jComboBoxType.getSelectedItem().toString();
|
||||
|
||||
|
@ -44,373 +44,379 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*/
|
||||
public class GuidsDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = 6710858997766979803L;
|
||||
|
||||
//
|
||||
// Check Name
|
||||
// Define class members
|
||||
//
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
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 arg1 = this.jComboBoxUsage.getSelectedItem().toString();
|
||||
|
||||
@ -420,11 +426,13 @@ private GuidsIdentification getCurrentGuids() {
|
||||
|
||||
id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
|
||||
return id;
|
||||
} public GuidsIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
public void setId(GuidsIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
public GuidsIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(GuidsIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
@ -44,409 +44,407 @@ import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPacka
|
||||
*/
|
||||
public class HiiPackagesDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -6851574146786158116L;
|
||||
|
||||
//
|
||||
// Check Hii Package Name
|
||||
// Define class members
|
||||
//
|
||||
if (isEmpty(this.jTextFieldName.getText())) {
|
||||
Log.wrn("Update Hii Packages",
|
||||
"Hii Package Name Record must not be empty");
|
||||
return false;
|
||||
}
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
//
|
||||
// Check FeatureFlag
|
||||
// Not used by UI
|
||||
//
|
||||
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update Hii Packages", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public HiiPackagesIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -43,428 +43,440 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*/
|
||||
public class HobsDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -553473437579358325L;
|
||||
|
||||
//
|
||||
// Check Name
|
||||
// Define class members
|
||||
//
|
||||
if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) {
|
||||
Log.wrn("Update Hobs", "Hob Guid C Name must not be empty");
|
||||
return false;
|
||||
}
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
//
|
||||
// Check FeatureFlag
|
||||
// Not used by UI
|
||||
//
|
||||
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update Hobs", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
String arg1 = this.jComboBoxHobType.getSelectedItem().toString();
|
||||
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* 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(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;
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||
private JTextField jTextFieldHelpText = null;
|
||||
|
||||
private ArchCheckBox jArchCheckBox = null;
|
||||
|
||||
|
||||
private JButton jButtonOk = null;
|
||||
|
||||
private JButton jButtonCancel = null;
|
||||
@ -212,6 +212,7 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||
jTextFieldFeatureFlag = new JTextField();
|
||||
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
|
||||
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
|
||||
}
|
||||
return jTextFieldFeatureFlag;
|
||||
}
|
||||
@ -372,7 +373,7 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||
jLabelArch.setText("Supported Architectures");
|
||||
jLabelFeatureFlag = new JLabel();
|
||||
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
|
||||
jLabelFeatureFlag.setText("Feature Flag");
|
||||
jLabelFeatureFlag.setText("Feature Flag Expression");
|
||||
jLabelRecommendedInstanceGuid = new JLabel();
|
||||
jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20));
|
||||
jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid");
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -45,69 +45,67 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*
|
||||
*/
|
||||
public class PackageDepDlg extends IDialog implements ItemListener {
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = 3465193035145152131L;
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = 3465193035145152131L;
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private JPanel jContentPane = null;
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JLabel jLabelPackageName = null;
|
||||
private JLabel jLabelPackageName = null;
|
||||
|
||||
private StarLabel jStarLabel1 = null;
|
||||
private StarLabel jStarLabel1 = null;
|
||||
|
||||
private JComboBox jComboBoxPackageName = null;
|
||||
private JComboBox jComboBoxPackageName = null;
|
||||
|
||||
private JLabel jLabelPackageGuid = null;
|
||||
private JLabel jLabelPackageGuid = null;
|
||||
|
||||
private JTextField jTextFieldPackageGuid = null;
|
||||
private JTextField jTextFieldPackageGuid = null;
|
||||
|
||||
private JButton jButtonGenerateGuid = null;
|
||||
private JLabel jLabelPackageVersion = null;
|
||||
|
||||
private JLabel jLabelPackageVersion = null;
|
||||
private JTextField jTextFieldPackageVersion = null;
|
||||
|
||||
private JTextField jTextFieldPackageVersion = null;
|
||||
private JLabel jLabelFeatureFlag = null;
|
||||
|
||||
private JLabel jLabelFeatureFlag = null;
|
||||
private JTextField jTextFieldFeatureFlag = null;
|
||||
|
||||
private JTextField jTextFieldFeatureFlag = null;
|
||||
private JScrollPane jScrollPane = null;
|
||||
|
||||
private JScrollPane jScrollPane = null;
|
||||
private JLabel jLabelArch = null;
|
||||
|
||||
private JLabel jLabelArch = null;
|
||||
private ArchCheckBox jArchCheckBox = null;
|
||||
|
||||
private ArchCheckBox jArchCheckBox = null;
|
||||
private JButton jButtonOk = null;
|
||||
|
||||
private JButton jButtonOk = null;
|
||||
private JButton jButtonCancel = null;
|
||||
|
||||
private JButton jButtonCancel = null;
|
||||
//
|
||||
// Not used by UI
|
||||
//
|
||||
private PackageDependenciesIdentification pdid = null;
|
||||
|
||||
//
|
||||
// Not used by UI
|
||||
//
|
||||
private PackageDependenciesIdentification pdid = null;
|
||||
private WorkspaceTools wt = new WorkspaceTools();
|
||||
|
||||
private WorkspaceTools wt = new WorkspaceTools();
|
||||
private Vector<PackageIdentification> vPackage = wt.getAllPackages();
|
||||
|
||||
private Vector<PackageIdentification> vPackage = wt.getAllPackages();
|
||||
|
||||
/**
|
||||
* This method initializes jComboBoxPackageName
|
||||
*
|
||||
* @return javax.swing.JComboBox
|
||||
*/
|
||||
/**
|
||||
* This method initializes jComboBoxPackageName
|
||||
*
|
||||
* @return javax.swing.JComboBox
|
||||
*/
|
||||
private JComboBox getJComboBoxPackageName() {
|
||||
if (jComboBoxPackageName == null) {
|
||||
jComboBoxPackageName = new JComboBox();
|
||||
jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
|
||||
jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jComboBoxPackageName.setToolTipText("If your Module requires a package list that here.");
|
||||
jComboBoxPackageName.addItemListener(this);
|
||||
}
|
||||
return jComboBoxPackageName;
|
||||
if (jComboBoxPackageName == null) {
|
||||
jComboBoxPackageName = new JComboBox();
|
||||
jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
|
||||
jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jComboBoxPackageName.setToolTipText("If your Module requires a package list that here.");
|
||||
jComboBoxPackageName.addItemListener(this);
|
||||
}
|
||||
return jComboBoxPackageName;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,23 +124,6 @@ public class PackageDepDlg extends IDialog implements ItemListener {
|
||||
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
|
||||
*
|
||||
@ -154,7 +135,11 @@ public class PackageDepDlg extends IDialog implements ItemListener {
|
||||
jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
|
||||
jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
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;
|
||||
}
|
||||
@ -281,36 +266,36 @@ public class PackageDepDlg extends IDialog implements ItemListener {
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jStarLabel1 = new StarLabel();
|
||||
jStarLabel1.setLocation(new java.awt.Point(2, 10));
|
||||
jLabelPackageName = new JLabel();
|
||||
jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
|
||||
jLabelPackageName.setText("Package Name");
|
||||
jStarLabel1 = new StarLabel();
|
||||
jStarLabel1.setLocation(new java.awt.Point(2, 10));
|
||||
jLabelPackageName = new JLabel();
|
||||
jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
|
||||
jLabelPackageName.setText("Package Name");
|
||||
|
||||
jLabelPackageVersion = new JLabel();
|
||||
jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
|
||||
jLabelPackageVersion.setText("Package Version");
|
||||
jLabelPackageVersion = new JLabel();
|
||||
jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
|
||||
jLabelPackageVersion.setText("Package Version");
|
||||
|
||||
jLabelPackageGuid = new JLabel();
|
||||
jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
|
||||
jLabelPackageGuid.setText("Package Guid");
|
||||
jLabelPackageGuid.setVisible(false);
|
||||
jLabelPackageGuid = new JLabel();
|
||||
jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
|
||||
jLabelPackageGuid.setText("Package Guid");
|
||||
jLabelPackageGuid.setVisible(false);
|
||||
|
||||
jLabelFeatureFlag = new JLabel();
|
||||
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
|
||||
jLabelFeatureFlag.setText("Feature Flag Expression");
|
||||
jLabelFeatureFlag = new JLabel();
|
||||
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
|
||||
jLabelFeatureFlag.setText("Feature Flag Expression");
|
||||
|
||||
jLabelArch = new JLabel();
|
||||
jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 145, 20));
|
||||
jLabelArch.setText("Supported Architectures");
|
||||
jArchCheckBox = new ArchCheckBox();
|
||||
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
|
||||
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jLabelArch = new JLabel();
|
||||
jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 145, 20));
|
||||
jLabelArch.setText("Supported Architectures");
|
||||
jArchCheckBox = new ArchCheckBox();
|
||||
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
|
||||
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.setPreferredSize(new java.awt.Dimension(485, 145));
|
||||
|
||||
|
||||
jContentPane.add(jStarLabel1, null);
|
||||
jContentPane.add(jLabelPackageName, null);
|
||||
jContentPane.add(getJComboBoxPackageName(), null);
|
||||
@ -378,12 +363,12 @@ public class PackageDepDlg extends IDialog implements ItemListener {
|
||||
//
|
||||
// Check PackageGuid
|
||||
//
|
||||
// if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
|
||||
// if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
|
||||
// Log.err("Incorrect data type for Package Guid");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
|
||||
// if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
|
||||
// Log.err("Incorrect data type for Package Guid");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// Check PackageVersion
|
||||
@ -407,7 +392,6 @@ public class PackageDepDlg extends IDialog implements ItemListener {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private PackageDependenciesIdentification getCurrentPackageDependencies() {
|
||||
String arg0 = this.jComboBoxPackageName.getSelectedItem().toString();
|
||||
|
@ -46,394 +46,391 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*/
|
||||
public class PpisDlg extends IDialog implements ItemListener {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -4284901202357037724L;
|
||||
|
||||
//
|
||||
// Check Name
|
||||
// Define class members
|
||||
//
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
/**
|
||||
* This method initializes jTextFieldC_Name
|
||||
*
|
||||
* @return javax.swing.JTextField jTextFieldC_Name
|
||||
*
|
||||
*/
|
||||
private JComboBox getJComboBoxCName() {
|
||||
if (jComboBoxCName == null) {
|
||||
jComboBoxCName = new JComboBox();
|
||||
jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
|
||||
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jComboBoxCName.setToolTipText("Select Guid C Name of PPI");
|
||||
}
|
||||
return jComboBoxCName;
|
||||
}
|
||||
|
||||
return 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 arg1 = this.jComboBoxPpiType.getSelectedItem().toString();
|
||||
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
|
||||
@ -444,32 +441,30 @@ private PpisIdentification getCurrentPpis() {
|
||||
|
||||
id = new PpisIdentification(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.jComboBoxPpiType
|
||||
&& arg0.getStateChange() == ItemEvent.SELECTED) {
|
||||
if (this.jComboBoxPpiType.getSelectedItem().toString().equals(
|
||||
ed.getVPpiType().get(0))) {
|
||||
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage());
|
||||
} else {
|
||||
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed
|
||||
.getVPpiNotifyUsage());
|
||||
}
|
||||
} /*
|
||||
* (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.jComboBoxPpiType && arg0.getStateChange() == ItemEvent.SELECTED) {
|
||||
if (this.jComboBoxPpiType.getSelectedItem().toString().equals(ed.getVPpiType().get(0))) {
|
||||
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage());
|
||||
} else {
|
||||
Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiNotifyUsage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PpisIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
public PpisIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(PpisIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(PpisIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
@ -48,461 +48,449 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*/
|
||||
public class ProtocolsDlg extends IDialog implements ItemListener {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -9084913640747858848L;
|
||||
|
||||
//
|
||||
// Check Name
|
||||
// Define class members
|
||||
//
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
//
|
||||
// Check FeatureFlag
|
||||
// Not used by UI
|
||||
//
|
||||
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update Protocols", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,11 @@ import javax.swing.JTextField;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.DataValidation;
|
||||
import org.tianocore.frameworkwizard.common.EnumerationData;
|
||||
import org.tianocore.frameworkwizard.common.Log;
|
||||
import org.tianocore.frameworkwizard.common.Tools;
|
||||
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.IFrame;
|
||||
import org.tianocore.frameworkwizard.common.ui.StarLabel;
|
||||
@ -76,6 +78,8 @@ public class SourceFilesDlg extends IDialog {
|
||||
|
||||
private JTextField jTextFieldToolCode = null;
|
||||
|
||||
private IComboBox iComboBoxToolCode = null;
|
||||
|
||||
private JTextField jTextFieldToolChainFamily = null;
|
||||
|
||||
private JLabel jLabelFeatureFlag = null;
|
||||
@ -83,7 +87,7 @@ public class SourceFilesDlg extends IDialog {
|
||||
private JTextField jTextFieldFeatureFlag = null;
|
||||
|
||||
private ArchCheckBox jArchCheckBox = null;
|
||||
|
||||
|
||||
private JButton jButtonOk = null;
|
||||
|
||||
private JButton jButtonCancel = null;
|
||||
@ -95,6 +99,8 @@ public class SourceFilesDlg extends IDialog {
|
||||
|
||||
private String msaFileName = "";
|
||||
|
||||
private EnumerationData ed = new EnumerationData();
|
||||
|
||||
/**
|
||||
This method initializes jTextFieldFileName
|
||||
|
||||
@ -156,6 +162,19 @@ public class SourceFilesDlg extends IDialog {
|
||||
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
|
||||
*
|
||||
@ -167,6 +186,7 @@ public class SourceFilesDlg extends IDialog {
|
||||
jTextFieldToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20));
|
||||
jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
|
||||
jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM");
|
||||
jTextFieldToolCode.setVisible(false);
|
||||
}
|
||||
return jTextFieldToolCode;
|
||||
}
|
||||
@ -274,7 +294,32 @@ public class SourceFilesDlg extends IDialog {
|
||||
if (inSourceFilesIdentifications != null) {
|
||||
this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename());
|
||||
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());
|
||||
jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag());
|
||||
this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList());
|
||||
@ -341,6 +386,7 @@ public class SourceFilesDlg extends IDialog {
|
||||
jContentPane.add(getJTextFieldTagName(), null);
|
||||
jContentPane.add(jLabelToolCode, null);
|
||||
jContentPane.add(getJTextFieldToolCode(), null);
|
||||
jContentPane.add(getIComboBoxToolCode(), null);
|
||||
jContentPane.add(getJTextFieldToolChainFamily(), null);
|
||||
jContentPane.add(jLabelFeatureFlag, null);
|
||||
jContentPane.add(getJTextFieldFeatureFlag(), null);
|
||||
@ -380,13 +426,16 @@ public class SourceFilesDlg extends IDialog {
|
||||
String name = this.jTextFieldFileName.getText();
|
||||
String s[] = name.split(";");
|
||||
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 featureFlag = this.jTextFieldFeatureFlag.getText();
|
||||
Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
|
||||
sfid = new SourceFilesIdentification[s.length];
|
||||
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;
|
||||
}
|
||||
|
@ -47,375 +47,378 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*/
|
||||
public class SystemTablesDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
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
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = 7488769180379442276L;
|
||||
|
||||
//
|
||||
// Check FeatureFlag
|
||||
// Define class members
|
||||
//
|
||||
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update System Tables", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
@ -45,432 +45,428 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
*/
|
||||
public class VariablesDlg extends IDialog {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -6998982978030439446L;
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JLabel jLabelVariableName = null;
|
||||
|
||||
private JTextField jTextFieldVariableName = null;
|
||||
|
||||
private JLabel jLabelUsage = null;
|
||||
|
||||
private JComboBox jComboBoxUsage = null;
|
||||
|
||||
private StarLabel jStarLabel1 = null;
|
||||
|
||||
private StarLabel jStarLabel2 = null;
|
||||
|
||||
private StarLabel jStarLabel3 = null;
|
||||
|
||||
private JScrollPane jScrollPane = null;
|
||||
|
||||
private JLabel jLabelGuidCName = null;
|
||||
|
||||
private JComboBox jComboBoxGuidC_Name = null;
|
||||
|
||||
private JTextField jTextFieldFeatureFlag = null;
|
||||
|
||||
private JLabel jLabelFeatureFlag = null;
|
||||
|
||||
private JLabel jLabelArch = null;
|
||||
|
||||
private JLabel jLabelHelpText = null;
|
||||
|
||||
private JTextArea jTextAreaHelpText = null;
|
||||
|
||||
private JScrollPane jScrollPaneHelpText = null;
|
||||
|
||||
private ArchCheckBox jArchCheckBox = null;
|
||||
|
||||
private JButton jButtonOk = null;
|
||||
|
||||
private JButton jButtonCancel = null;
|
||||
|
||||
//
|
||||
// Not used by UI
|
||||
//
|
||||
private VariablesIdentification id = null;
|
||||
|
||||
private EnumerationData ed = new EnumerationData();
|
||||
|
||||
private WorkspaceTools wt = new WorkspaceTools();
|
||||
|
||||
/**
|
||||
* This method initializes jTextFieldString
|
||||
*
|
||||
* @return javax.swing.JTextField jTextFieldString
|
||||
*
|
||||
*/
|
||||
private JTextField getJTextFieldString() {
|
||||
if (jTextFieldVariableName == null) {
|
||||
jTextFieldVariableName = new JTextField();
|
||||
jTextFieldVariableName.setSize(new java.awt.Dimension(320, 20));
|
||||
jTextFieldVariableName.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jTextFieldVariableName.setLocation(new java.awt.Point(160, 10));
|
||||
jTextFieldVariableName
|
||||
.setToolTipText("Enter a Hex Word Array, you must provide leading Zeros. 0x000a, 0x0010, 0x00FF");
|
||||
}
|
||||
return jTextFieldVariableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jComboBoxUsage
|
||||
*
|
||||
* @return javax.swing.JComboBox jComboBoxUsage
|
||||
*
|
||||
*/
|
||||
private JComboBox getJComboBoxUsage() {
|
||||
if (jComboBoxUsage == null) {
|
||||
jComboBoxUsage = new JComboBox();
|
||||
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
|
||||
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jComboBoxUsage
|
||||
.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>The module requires the variable entry to be set</td></tr>"
|
||||
+ "<tr><td>SOMETIMES_CONSUMED</td><td>The module will use the variable entry if it’s set.</td></tr>"
|
||||
+ "<tr><td>ALWAYS_PRODUCED</td><td>The module will always write the variable.</td></tr>"
|
||||
+ "<tr><td>SOMETIMES_PRODUCED</td><td>The module will sometimes write the variable.</td></tr></table></html>");
|
||||
}
|
||||
return jComboBoxUsage;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jScrollPane
|
||||
*
|
||||
* @return javax.swing.JScrollPane
|
||||
*/
|
||||
private JScrollPane getJScrollPane() {
|
||||
if (jScrollPane == null) {
|
||||
jScrollPane = new JScrollPane();
|
||||
jScrollPane.setViewportView(getJContentPane());
|
||||
}
|
||||
return jScrollPane;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTextFieldFeatureFlag
|
||||
*
|
||||
* @return javax.swing.JTextField jTextFieldFeatureFlag
|
||||
*
|
||||
*/
|
||||
private JTextField getJTextFieldFeatureFlag() {
|
||||
if (jTextFieldFeatureFlag == null) {
|
||||
jTextFieldFeatureFlag = new JTextField();
|
||||
jTextFieldFeatureFlag
|
||||
.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
|
||||
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
|
||||
}
|
||||
return jTextFieldFeatureFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTextFieldHelpText
|
||||
*
|
||||
* @return javax.swing.JTextField
|
||||
*
|
||||
*/
|
||||
private JTextArea getJTextAreaHelpText() {
|
||||
if (jTextAreaHelpText == null) {
|
||||
jTextAreaHelpText = new JTextArea();
|
||||
jTextAreaHelpText.setLineWrap(true);
|
||||
jTextAreaHelpText.setWrapStyleWord(true);
|
||||
jTextAreaHelpText
|
||||
.setToolTipText("Enter information on how to use this Variable.");
|
||||
}
|
||||
return jTextAreaHelpText;
|
||||
}
|
||||
|
||||
|
||||
private JScrollPane getJScrollPaneHelpText() {
|
||||
if (jScrollPaneHelpText == null) {
|
||||
jScrollPaneHelpText = new JScrollPane();
|
||||
jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
jScrollPaneHelpText.setSize(new java.awt.Dimension(320,40));
|
||||
jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320,40));
|
||||
jScrollPaneHelpText.setLocation(new java.awt.Point(160,85));
|
||||
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
|
||||
}
|
||||
return jScrollPaneHelpText;
|
||||
}
|
||||
/**
|
||||
* This method initializes jComboBoxGuidC_Name
|
||||
*
|
||||
* @return javax.swing.JComboBox jComboBoxGuidC_Name
|
||||
*
|
||||
*/
|
||||
private JComboBox getJComboBoxGuidC_Name() {
|
||||
if (jComboBoxGuidC_Name == null) {
|
||||
jComboBoxGuidC_Name = new JComboBox();
|
||||
jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
|
||||
jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
jComboBoxGuidC_Name
|
||||
.setToolTipText("Select the GUID C Name of the Variable.");
|
||||
}
|
||||
return jComboBoxGuidC_Name;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonOk
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*
|
||||
*/
|
||||
private JButton getJButtonOk() {
|
||||
if (jButtonOk == null) {
|
||||
jButtonOk = new JButton();
|
||||
jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20));
|
||||
jButtonOk.setText("Ok");
|
||||
jButtonOk.addActionListener(this);
|
||||
}
|
||||
return jButtonOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonCancel
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*
|
||||
*/
|
||||
private JButton getJButtonCancel() {
|
||||
if (jButtonCancel == null) {
|
||||
jButtonCancel = new JButton();
|
||||
jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20));
|
||||
jButtonCancel.setText("Cancel");
|
||||
jButtonCancel.addActionListener(this);
|
||||
}
|
||||
return jButtonCancel;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
*/
|
||||
private void init() {
|
||||
this.setSize(500, 255);
|
||||
this.setContentPane(getJScrollPane());
|
||||
this.setTitle("Variables");
|
||||
initFrame();
|
||||
this.setViewMode(false);
|
||||
this.centerWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this Fill values to all fields if these values are
|
||||
* not empty
|
||||
*
|
||||
* @param inVariablesId
|
||||
*
|
||||
*/
|
||||
private void init(VariablesIdentification inVariablesId) {
|
||||
init();
|
||||
this.id = inVariablesId;
|
||||
|
||||
if (this.id != null) {
|
||||
this.jTextFieldVariableName.setText(id.getName());
|
||||
this.jComboBoxGuidC_Name.setSelectedItem(id.getGuid());
|
||||
this.jComboBoxUsage.setSelectedItem(id.getUsage());
|
||||
this.jTextAreaHelpText.setText(id.getHelp());
|
||||
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
|
||||
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the override edit constructor
|
||||
*
|
||||
* @param inVariablesIdentification
|
||||
* @param iFrame
|
||||
*
|
||||
*/
|
||||
public VariablesDlg(VariablesIdentification inVariablesIdentification,
|
||||
IFrame iFrame) {
|
||||
super(iFrame, true);
|
||||
init(inVariablesIdentification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable all components when the mode is view
|
||||
*
|
||||
* @param isView
|
||||
* true - The view mode; false - The non-view mode
|
||||
*
|
||||
*/
|
||||
public void setViewMode(boolean isView) {
|
||||
if (isView) {
|
||||
this.jTextFieldVariableName.setEnabled(!isView);
|
||||
this.jComboBoxUsage.setEnabled(!isView);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel jContentPane
|
||||
*
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jStarLabel1 = new StarLabel();
|
||||
jStarLabel1.setLocation(new java.awt.Point(2, 10));
|
||||
jLabelVariableName = new JLabel();
|
||||
jLabelVariableName.setText("Variable Name");
|
||||
jLabelVariableName.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
|
||||
|
||||
jStarLabel2 = new StarLabel();
|
||||
jStarLabel2.setLocation(new java.awt.Point(2, 35));
|
||||
jLabelGuidCName = new JLabel();
|
||||
jLabelGuidCName.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
|
||||
jLabelGuidCName.setText("Variable Guid C Name");
|
||||
|
||||
jStarLabel3 = new StarLabel();
|
||||
jStarLabel3.setLocation(new java.awt.Point(2, 60));
|
||||
jLabelUsage = new JLabel();
|
||||
jLabelUsage.setText("Usage");
|
||||
jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20));
|
||||
|
||||
jLabelHelpText = new JLabel();
|
||||
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20));
|
||||
jLabelHelpText.setText("Help Text");
|
||||
|
||||
jLabelFeatureFlag = new JLabel();
|
||||
jLabelFeatureFlag.setText("Feature Flag Expression");
|
||||
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
|
||||
|
||||
jLabelArch = new JLabel();
|
||||
jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20));
|
||||
jLabelArch.setText("Supported Architectures");
|
||||
jArchCheckBox = new ArchCheckBox();
|
||||
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20));
|
||||
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.setPreferredSize(new java.awt.Dimension(485, 210));
|
||||
|
||||
jContentPane.add(jStarLabel1, null);
|
||||
jContentPane.add(jLabelVariableName, null);
|
||||
jContentPane.add(getJTextFieldString(), null);
|
||||
jContentPane.add(jStarLabel2, null);
|
||||
jContentPane.add(jLabelGuidCName, null);
|
||||
jContentPane.add(getJComboBoxGuidC_Name(), null);
|
||||
jContentPane.add(jStarLabel3, null);
|
||||
jContentPane.add(jLabelUsage, null);
|
||||
jContentPane.add(getJComboBoxUsage(), null);
|
||||
jContentPane.add(jLabelHelpText, null);
|
||||
jContentPane.add(getJScrollPaneHelpText(), null);
|
||||
jContentPane.add(jLabelFeatureFlag, null);
|
||||
jContentPane.add(getJTextFieldFeatureFlag(), null);
|
||||
jContentPane.add(jLabelArch, null);
|
||||
jContentPane.add(jArchCheckBox, null);
|
||||
jContentPane.add(getJButtonOk(), null);
|
||||
jContentPane.add(getJButtonCancel(), null);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*
|
||||
* Override actionPerformed to listen all actions
|
||||
*
|
||||
*/
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == jButtonOk) {
|
||||
if (checkAdd()) {
|
||||
getCurrentVariables();
|
||||
this.returnType = DataType.RETURN_TYPE_OK;
|
||||
this.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonCancel) {
|
||||
this.returnType = DataType.RETURN_TYPE_CANCEL;
|
||||
this.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes Usage type
|
||||
*
|
||||
*/
|
||||
private void initFrame() {
|
||||
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
|
||||
Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt
|
||||
.getAllGuidDeclarationsFromWorkspace());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data validation for all fields
|
||||
*
|
||||
* @retval true - All datas are valid
|
||||
* @retval false - At least one data is invalid
|
||||
*
|
||||
*/
|
||||
public boolean checkAdd() {
|
||||
//
|
||||
// Check if all fields have correct data types
|
||||
//
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -6998982978030439446L;
|
||||
|
||||
//
|
||||
// Check VariableName
|
||||
// Define class members
|
||||
//
|
||||
if (isEmpty(this.jTextFieldVariableName.getText())) {
|
||||
Log.wrn("Update Variables", "Variable Name must not be empty");
|
||||
return false;
|
||||
}
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
if (!isEmpty(this.jTextFieldVariableName.getText())) {
|
||||
if (!DataValidation.isHexWordArrayType(this.jTextFieldVariableName
|
||||
.getText())) {
|
||||
Log.wrn("Update Variables", "Incorrect data type for Variable Name");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private JLabel jLabelVariableName = null;
|
||||
|
||||
private JTextField jTextFieldVariableName = null;
|
||||
|
||||
private JLabel jLabelUsage = null;
|
||||
|
||||
private JComboBox jComboBoxUsage = null;
|
||||
|
||||
private StarLabel jStarLabel1 = null;
|
||||
|
||||
private StarLabel jStarLabel2 = null;
|
||||
|
||||
private 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())) {
|
||||
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
|
||||
Log.wrn("Update Variables", "Incorrect data type for Feature Flag");
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
String arg1 = this.jComboBoxGuidC_Name.getSelectedItem().toString();
|
||||
String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
|
||||
/**
|
||||
* This method initializes jScrollPane
|
||||
*
|
||||
* @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();
|
||||
String arg5 = this.jTextAreaHelpText.getText();
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
return id;
|
||||
}
|
||||
|
||||
public VariablesIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public void setId(VariablesIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
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
|
||||
//
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user