Fixed Absolute position of fields, Added ToolTipText and made HelpText a Scrolling Text Area

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1128 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lhauch 2006-07-27 22:22:01 +00:00
parent a5760d04fa
commit 5b38b75ba6
6 changed files with 1870 additions and 1728 deletions

View File

@ -1,6 +1,7 @@
/** @file /** @file
<<The file is used to create, update BootModes of MSA file>>
The file is used to create, update BootModes of MSA/MBD file <<The BootModesDlg is called to add or edit a Module's Boot Modes definitions.>>
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -11,6 +12,9 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Package Name: Tools
Module Name: FrameworkWizard
**/ **/
package org.tianocore.frameworkwizard.module.ui.dialog; package org.tianocore.frameworkwizard.module.ui.dialog;
@ -38,377 +42,379 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesIdentification; import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesIdentification;
/** /**
The class is used to create, update BootModes of MSA/MBD file * The class is used to create, update BootModes of MSA/MBD file It extends
It extends IDialog * IDialog
*
*
*
**/ */
public class BootModesDlg extends IDialog { public class BootModesDlg extends IDialog {
/// // /
/// Define class Serial Version UID // / Define class Serial Version UID
/// // /
private static final long serialVersionUID = -3888558623432442561L; private static final long serialVersionUID = -3888558623432442561L;
// //
//Define class members // Define class members
// //
private JPanel jContentPane = null; private JPanel jContentPane = null;
private JLabel jLabelBootModeName = null; private JLabel jLabelBootModeName = null;
private JComboBox jComboBoxBootModeName = null; private JComboBox jComboBoxBootModeName = null;
private JLabel jLabelUsage = null; private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null; private JComboBox jComboBoxUsage = null;
private StarLabel jStarLabel1 = null; private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null; private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null; private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null; private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null; private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null; private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null; private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null; private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null; private JScrollPane jScrollPaneHelpText = 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 // Not used by UI
// //
private BootModesIdentification id = null; private BootModesIdentification id = null;
private EnumerationData ed = new EnumerationData(); private EnumerationData ed = new EnumerationData();
/** /**
This method initializes jComboBoxBootModeName * This method initializes jComboBoxBootModeName
*
@return javax.swing.JComboBox jComboBoxBootModeName * @return javax.swing.JComboBox jComboBoxBootModeName
*
**/ */
private JComboBox getJComboBoxBootModeName() { private JComboBox getJComboBoxBootModeName() {
if (jComboBoxBootModeName == null) { if (jComboBoxBootModeName == null) {
jComboBoxBootModeName = new JComboBox(); jComboBoxBootModeName = new JComboBox();
jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(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>"); 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 jComboBoxBootModeName;
}
/** /**
This method initializes jComboBoxUsage * This method initializes jComboBoxUsage
*
@return javax.swing.JComboBox jComboBoxUsage * @return javax.swing.JComboBox jComboBoxUsage
*
**/ */
private JComboBox getJComboBoxUsage() { private JComboBox getJComboBoxUsage() {
if (jComboBoxUsage == null) { if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox(); jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(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>"); 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;
} }
return jComboBoxUsage;
}
/** /**
* This method initializes jTextFieldFeatureFlag * This method initializes jTextFieldFeatureFlag
* *
* @return javax.swing.JTextField * @return javax.swing.JTextField
*/ */
private JTextField getJTextFieldFeatureFlag() { private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) { if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField(); jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); jTextFieldFeatureFlag
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); .setBounds(new java.awt.Rectangle(160, 105, 320, 20));
} jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
return jTextFieldFeatureFlag; jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
} }
return jTextFieldFeatureFlag;
}
/** /**
This method initializes jScrollPane * This method initializes jScrollPane
*
@return javax.swing.JScrollPane * @return javax.swing.JScrollPane
*/ */
private JScrollPane getJScrollPane() { private JScrollPane getJScrollPane() {
if (jScrollPane == null) { if (jScrollPane == null) {
jScrollPane = new JScrollPane(); jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane()); jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
} }
return jScrollPane;
}
/** /**
This method initializes jTextAreaHelpText * This method initializes jTextAreaHelpText
*
@return javax.swing.JTextArea * @return javax.swing.JTextArea
*
**/ */
private JTextArea getJTextAreaHelpText() { private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) { if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea(); jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true); jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true); jTextAreaHelpText.setWrapStyleWord(true);
// jTextAreaHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
// jTextAreaHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
}
return jTextAreaHelpText;
} }
return jTextAreaHelpText;
}
/** /**
This method initializes jScrollPaneHelpText * 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;
}
@return javax.swing.JScrollPane /**
* 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;
}
**/ /**
private JScrollPane getJScrollPaneHelpText() { * This method initializes jButtonCancel
if (jScrollPaneHelpText == null) { *
jScrollPaneHelpText = new JScrollPane(); * @return javax.swing.JButton
jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); *
jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); */
jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); private JButton getJButtonCancel() {
jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); if (jButtonCancel == null) {
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); 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);
} }
return jScrollPaneHelpText;
} }
/** if (arg0.getSource() == jButtonCancel) {
This method initializes jButtonOk this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
@return javax.swing.JButton /**
* 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
//
**/ //
private JButton getJButtonOk() { // Check FeatureFlag
if (jButtonOk == null) { //
jButtonOk = new JButton(); if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
jButtonOk.setText("Ok"); Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag");
jButtonOk.addActionListener(this); return false;
} }
return jButtonOk;
} }
/** return true;
This method initializes jButtonCancel }
@return javax.swing.JButton private BootModesIdentification getCurrentBootModes() {
String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
**/ String arg2 = this.jTextFieldFeatureFlag.getText();
private JButton getJButtonCancel() { Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
if (jButtonCancel == null) { String arg4 = this.jTextAreaHelpText.getText();
jButtonCancel = new JButton(); id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); return id;
jButtonCancel.setText("Cancel"); }
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) { public BootModesIdentification getId() {
} return id;
}
/** public void setId(BootModesIdentification id) {
This method initializes this this.id = id;
}
**/
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");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Archectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelBootModeName, null);
jContentPane.add(getJComboBoxBootModeName(), null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jLabelArch, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
This method initializes BootModeName groups and Usage type
**/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames());
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage());
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentBootModes();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
Data validation for all fields
@retval true - All datas are valid
@retval false - At least one data is invalid
**/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
//
// Check FeatureFlag
//
if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag");
return false;
}
}
return true;
}
private BootModesIdentification getCurrentBootModes() {
String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
String arg2 = this.jTextFieldFeatureFlag.getText();
Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
String arg4 = this.jTextAreaHelpText.getText();
id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
return id;
}
public BootModesIdentification getId() {
return id;
}
public void setId(BootModesIdentification id) {
this.id = id;
}
} }

View File

@ -1,6 +1,7 @@
/** @file /** @file
<<The file is used to create, update Data Hub Record entries in a MSA file.>>
The file is used to create, update DataHub of MSA/MBD file <<The DataHbsDlg is a dialog called to add or edit a Data Hub Record within a MSA file.>>
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
@ -11,6 +12,9 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Package Name: Tools
Module Name: FrameworkWizard
**/ **/
package org.tianocore.frameworkwizard.module.ui.dialog; package org.tianocore.frameworkwizard.module.ui.dialog;
@ -24,6 +28,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.JTextArea;
import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.DataValidation;
@ -37,371 +42,398 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel;
import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIdentification; import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIdentification;
/** /**
The class is used to create, update DataHub of MSA/MBD file * The class is used to create, update DataHub of MSA/MBD file It extends
It extends IInternalFrame * IInternalFrame
*
*
*
**/ */
public class DataHubsDlg extends IDialog { public class DataHubsDlg extends IDialog {
/// // /
/// Define class Serial Version UID // / Define class Serial Version UID
/// // /
private static final long serialVersionUID = -3667906991966638892L; private static final long serialVersionUID = -3667906991966638892L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelUsage = null;
private JComboBox jComboBoxUsage = null;
private JLabel jLabelDataHubRecord = null;
private JTextField jTextFieldDataHubRecord = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextArea jTextAreaHelpText = null;
private JScrollPane jScrollPaneHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
//
// Not used by UI
//
private DataHubsIdentification id = null;
private EnumerationData ed = new EnumerationData();
/**
* This method initializes jTextFieldDataHubRecord
*
* @return javax.swing.JTextField jTextFieldDataHubRecord
*
*/
private JTextField getJTextFieldDataHubRecord() {
if (jTextFieldDataHubRecord == null) {
jTextFieldDataHubRecord = new JTextField();
jTextFieldDataHubRecord
.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldDataHubRecord
.setToolTipText("Enter the C Name of the Data Hub Record");
}
return jTextFieldDataHubRecord;
}
/**
* This method initializes jComboBoxUsage
*
* @return javax.swing.JComboBox jComboBoxUsage
*
*/
private JComboBox getJComboBoxUsage() {
if (jComboBoxUsage == null) {
jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage
.setToolTipText("<html><table><tr><td>ALWAYS_CONSUMED</td><td>Module always consumes a Data Hub Entry<br>via registering a filter driver.</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module will use a Data Hub Entry if it exists<br>via registering a filter driver</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Always logs data into the Data Hub</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Log data into the Data Hub under<br>certain circumstances</td></tr></table></html>");
}
return jComboBoxUsage;
}
/**
* This method initializes jTextFieldFeatureFlag
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
}
return jTextFieldFeatureFlag;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
* This method initializes jTextAreaHelpText
*
* @return javax.swing.JTextArea
*
*/
private JTextArea getJTextAreaHelpText() {
if (jTextAreaHelpText == null) {
jTextAreaHelpText = new JTextArea();
jTextAreaHelpText.setLineWrap(true);
jTextAreaHelpText.setWrapStyleWord(true);
}
return jTextAreaHelpText;
}
/**
* This method initializes jScrollPaneHelpText
*
* @return javax.swing.JScrollPane
*
*/
private JScrollPane getJScrollPaneHelpText() {
if (jScrollPaneHelpText == null) {
jScrollPaneHelpText = new JScrollPane();
jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40));
jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320,40));
jScrollPaneHelpText.setLocation(new java.awt.Point(160,60));
jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
}
return jScrollPaneHelpText;
}
/**
* This method initializes jButtonOk
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20));
jButtonOk.setText("Ok");
jButtonOk.addActionListener(this);
}
return jButtonOk;
}
/**
* This method initializes jButtonCancel
*
* @return javax.swing.JButton
*
*/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20));
jButtonCancel.setText("Cancel");
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
public static void main(String[] args) {
}
/**
* This method initializes this
*
*/
private void init() {
this.setSize(500, 230);
this.setContentPane(getJScrollPane());
this.setTitle("Data Hubs");
initFrame();
this.setViewMode(false);
this.centerWindow();
}
/**
* This method initializes this Fill values to all fields if these values are
* not empty
*
* @param inDataHubsId
*
*/
private void init(DataHubsIdentification inDataHubsId) {
init();
this.id = inDataHubsId;
if (this.id != null) {
this.jTextFieldDataHubRecord.setText(id.getName());
this.jComboBoxUsage.setSelectedItem(id.getUsage());
this.jTextAreaHelpText.setText(id.getHelp());
this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
this.jArchCheckBox.setSelectedItems(id.getSupArchList());
}
}
/**
* This is the override edit constructor
*
* @param inDataHubsIdentification
* @param iFrame
*
*/
public DataHubsDlg(DataHubsIdentification inDataHubsIdentification,
IFrame iFrame) {
super(iFrame, true);
init(inDataHubsIdentification);
}
/**
* Disable all components when the mode is view
*
* @param isView
* true - The view mode; false - The non-view mode
*
*/
public void setViewMode(boolean isView) {
if (isView) {
this.jTextFieldDataHubRecord.setEnabled(!isView);
this.jComboBoxUsage.setEnabled(!isView);
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel jContentPane
*
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(2, 10));
jLabelDataHubRecord = new JLabel();
jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 145, 20));
jLabelDataHubRecord.setText("Data Hub Record");
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(2, 35));
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20));
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20));
jLabelHelpText.setText("Help Text");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20));
jLabelFeatureFlag.setText("Feature Flag Expression");
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20));
jLabelArch.setText("Supported Architectures");
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(485, 185));
jContentPane.add(jLabelDataHubRecord, null);
jContentPane.add(jLabelUsage, null);
jContentPane.add(jLabelFeatureFlag, null);
jContentPane.add(jLabelArch, null);
jContentPane.add(getJTextFieldDataHubRecord(), null);
jContentPane.add(getJComboBoxUsage(), null);
jContentPane.add(getJTextFieldFeatureFlag(), null);
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJScrollPaneHelpText(), null);
jContentPane.add(jArchCheckBox, null);
jContentPane.add(getJButtonOk(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/**
* This method initializes Usage type
*
*/
private void initFrame() {
Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage());
}
/*
* (non-Javadoc)
*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == jButtonOk) {
if (checkAdd()) {
getCurrentDataHubs();
this.returnType = DataType.RETURN_TYPE_OK;
this.setVisible(false);
}
}
if (arg0.getSource() == jButtonCancel) {
this.returnType = DataType.RETURN_TYPE_CANCEL;
this.setVisible(false);
}
}
/**
* Data validation for all fields
*
* @retval true - All datas are valid
* @retval false - At least one data is invalid
*
*/
public boolean checkAdd() {
//
// Check if all fields have correct data types
//
// //
//Define class members // Check DataHubRecord
// //
private JPanel jContentPane = null; if (isEmpty(this.jTextFieldDataHubRecord.getText())) {
Log.wrn("Update Hubs", "Data Hub Record must not be empty");
return false;
}
private JLabel jLabelUsage = null; if (!isEmpty(this.jTextFieldDataHubRecord.getText())) {
if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) {
private JComboBox jComboBoxUsage = null; Log.wrn("Update Hubs", "Incorrect data type for Data Hub Record");
return false;
private JLabel jLabelDataHubRecord = null; }
}
private JTextField jTextFieldDataHubRecord = null;
private StarLabel jStarLabel1 = null;
private StarLabel jStarLabel2 = null;
private JLabel jLabelFeatureFlag = null;
private JTextField jTextFieldFeatureFlag = null;
private JLabel jLabelArch = null;
private JScrollPane jScrollPane = null;
private JLabel jLabelHelpText = null;
private JTextField jTextFieldHelpText = null;
private ArchCheckBox jArchCheckBox = null;
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
// //
// Not used by UI // Check FeatureFlag
// //
private DataHubsIdentification id = null; if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
private EnumerationData ed = new EnumerationData(); Log.wrn("Update Hubs", "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));
}
return jComboBoxUsage;
} }
/** return true;
This method initializes jTextFieldDataHubRecord }
@return javax.swing.JTextField jTextFieldDataHubRecord private DataHubsIdentification getCurrentDataHubs() {
String arg0 = this.jTextFieldDataHubRecord.getText();
String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
**/ String arg2 = this.jTextFieldFeatureFlag.getText();
private JTextField getJTextFieldDataHubRecord() { Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
if (jTextFieldDataHubRecord == null) { String arg4 = this.jTextAreaHelpText.getText();
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;
}
/** id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
* This method initializes jTextFieldFeatureFlag return id;
* }
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldFeatureFlag() {
if (jTextFieldFeatureFlag == null) {
jTextFieldFeatureFlag = new JTextField();
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
}
return jTextFieldFeatureFlag;
}
/** public DataHubsIdentification getId() {
This method initializes jScrollPane return id;
}
@return javax.swing.JScrollPane public void setId(DataHubsIdentification id) {
*/ this.id = id;
private JScrollPane getJScrollPane() { }
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJContentPane());
}
return jScrollPane;
}
/**
This method initializes jTextFieldHelpText
@return javax.swing.JTextField
**/
private JTextField getJTextFieldHelpText() {
if (jTextFieldHelpText == null) {
jTextFieldHelpText = new JTextField();
jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
}
return jTextFieldHelpText;
}
/**
This method initializes jButtonOk
@return javax.swing.JButton
**/
private JButton getJButtonOk() {
if (jButtonOk == null) {
jButtonOk = new JButton();
jButtonOk.setBounds(new java.awt.Rectangle(290, 140, 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, 140, 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(508, 220);
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.jTextFieldHelpText.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) {
jArchCheckBox = new ArchCheckBox();
jArchCheckBox.setBounds(new java.awt.Rectangle(160, 110, 320, 20));
jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
jLabelDataHubRecord = new JLabel();
jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 140, 20));
jLabelDataHubRecord.setText("Data Hub Record");
jLabelUsage = new JLabel();
jLabelUsage.setText("Usage");
jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));
jLabelArch = new JLabel();
jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));
jLabelArch.setText("Arch");
jLabelFeatureFlag = new JLabel();
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20));
jLabelFeatureFlag.setText("Feature Flag");
jLabelHelpText = new JLabel();
jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));
jLabelHelpText.setText("Help Text");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setPreferredSize(new java.awt.Dimension(490, 165));
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);
jStarLabel1 = new StarLabel();
jStarLabel1.setLocation(new java.awt.Point(0, 10));
jStarLabel2 = new StarLabel();
jStarLabel2.setLocation(new java.awt.Point(0, 35));
jContentPane.add(jStarLabel1, null);
jContentPane.add(jStarLabel2, null);
jContentPane.add(jLabelHelpText, null);
jContentPane.add(getJTextFieldHelpText(), 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 couldn't 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.jTextFieldHelpText.getText();
id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
return id;
}
public DataHubsIdentification getId() {
return id;
}
public void setId(DataHubsIdentification id) {
this.id = id;
}
} }

View File

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

View File

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

View File

@ -127,6 +127,7 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
jComboBoxUsage = new JComboBox(); jComboBoxUsage = new JComboBox();
jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20));
jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxUsage.setToolTipText("ALWAYS_CONSUMED is the only valid usage for type ProtocolNotify.");
} }
return jComboBoxUsage; return jComboBoxUsage;
} }
@ -155,7 +156,7 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20));
jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxProtocolType.addItemListener(this); jComboBoxProtocolType.addItemListener(this);
jComboBoxProtocolType.setToolTipText("Select Protocol Type"); jComboBoxProtocolType.setToolTipText("<html>Select Protocol Type<br>Protocol Notify is a register protocol notify mechanism.");
} }
return jComboBoxProtocolType; return jComboBoxProtocolType;
} }
@ -170,6 +171,7 @@ public class ProtocolsDlg extends IDialog implements ItemListener {
jComboBoxCName = new JComboBox(); jComboBoxCName = new JComboBox();
jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20));
jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol");
} }
return jComboBoxCName; return jComboBoxCName;

View File

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