X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2Fdialog%2FBootModesDlg.java;h=f7cc1a9a45fe41cd3a80f8ac89e251be28cc2072;hp=1ff4c8bb9988d7ec0804fe9dc62264a044063b7c;hb=a929458e6682db26d87d4ebe80150e13820d3e50;hpb=ccb063b1f27dcc84d67fa82592dd79b7e0be1e3f diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java index 1ff4c8bb99..f7cc1a9a45 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java @@ -50,371 +50,386 @@ import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesI */ public class BootModesDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -3888558623432442561L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -3888558623432442561L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + 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 - // - private BootModesIdentification id = null; + // + // Not used by UI + // + private BootModesIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + /** + * This method initializes jComboBoxBootModeName + * + * @return javax.swing.JComboBox jComboBoxBootModeName + * + */ + private JComboBox getJComboBoxBootModeName() { + if (jComboBoxBootModeName == null) { + jComboBoxBootModeName = new JComboBox(); + jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxBootModeName + .setToolTipText("" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
FULLBoot with full configuration
MINIMALBoot with minimal configuration
NO_CHANGEBoot assuming no configuration changes
DIAGNOSTICSBoot with full configuration plus diagnostics
DEFAULTBoot with default settings
BOOT_ON_S#_RESUMEwhere # is 2, 3, 4 or 5
FLASH_UPDATEBoot on flash update
RECOVERYBoot in recovery mode
"); + } + return jComboBoxBootModeName; + } - private EnumerationData ed = new EnumerationData(); + /** + * 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("" + + "" + + "" + + "" + + "" + + "
ALWAYS_CONSUMEDIndicates Supports the specified boot mode
SOMETIMES_CONSUMEDIndicates Supports the specified boot mode on some execution paths
ALWAYS_PRODUCEDAlways changes the boot mode
SOMETIMES_PRODUCEDChange the boot mode sometimes
"); + } + return jComboBoxUsage; + } - /** - * This method initializes jComboBoxBootModeName - * - * @return javax.swing.JComboBox jComboBoxBootModeName - * - */ - private JComboBox getJComboBoxBootModeName() { - if (jComboBoxBootModeName == null) { - jComboBoxBootModeName = new JComboBox(); - jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxBootModeName.setToolTipText("
FULLBoot with full configuration
MINIMALBoot with minimal configuration
NO_CHANGEBoot assuming no configuration changes
DIAGNOSTICSBoot with full configuration plus diagnostics
DEFAULTBoot with default settings
BOOT_ON_S#_RESUMEwhere # is 2, 3, 4 or 5
FLASH_UPDATEBoot on flash update
RECOVERYBoot in recovery mode
"); + /** + * 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; } - return jComboBoxBootModeName; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage.setToolTipText("
ALWAYS_CONSUMEDIndicates Supports the specified boot mode
SOMETIMES_CONSUMEDIndicates Supports the specified boot mode on some execution paths
ALWAYS_PRODUCEDAlways changes the boot mode
SOMETIMES_PRODUCEDChange the boot mode sometimes
"); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - 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"); + + /** + * 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; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * 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 jScrollPane; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * 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; } - 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()); + + /** + * 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; } - 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); + + public static void main(String[] args) { } - 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); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 230); + this.setContentPane(getJScrollPane()); + this.setTitle("Boot Modes"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - 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 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 is the override edit constructor + * + * @param inBootModesIdentification + * @param iFrame + * + */ + public BootModesDlg(BootModesIdentification inBootModesIdentification, IFrame iFrame) { + super(iFrame, true); + init(inBootModesIdentification); } - } - - /** - * 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); + + /** + * 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); + } } - 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); - } + + /** + * 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; } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes BootModeName groups and Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); } - } - - /** - * 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; - } + /* + * (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 arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); + id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4); + return id; } - return true; - } - - private BootModesIdentification getCurrentBootModes() { - String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector 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; - } + public BootModesIdentification getId() { + return id; + } + + public void setId(BootModesIdentification id) { + this.id = id; + } }