From 5b38b75ba698d5815ccee4e10d335ef1273e2830 Mon Sep 17 00:00:00 2001 From: lhauch Date: Thu, 27 Jul 2006 22:22:01 +0000 Subject: [PATCH] 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 --- .../module/ui/dialog/BootModesDlg.java | 678 ++++++++--------- .../module/ui/dialog/DataHubsDlg.java | 678 +++++++++-------- .../module/ui/dialog/GuidsDlg.java | 659 +++++++++-------- .../module/ui/dialog/HiiPackagesDlg.java | 690 ++++++++++-------- .../module/ui/dialog/ProtocolsDlg.java | 4 +- .../module/ui/dialog/SystemTablesDlg.java | 651 +++++++++-------- 6 files changed, 1751 insertions(+), 1609 deletions(-) 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 778ac09924..1ff4c8bb99 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 @@ -1,6 +1,7 @@ /** @file - - The file is used to create, update BootModes of MSA/MBD file + <> + + <> Copyright (c) 2006, Intel Corporation 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, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + Package Name: Tools + Module Name: FrameworkWizard + **/ 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; /** - The class is used to create, update BootModes of MSA/MBD file - It extends IDialog - - - - **/ + * The class is used to create, update BootModes of MSA/MBD file It extends + * IDialog + * + * + * + */ public class BootModesDlg extends IDialog { - /// - /// Define class Serial Version UID - /// - private static final long serialVersionUID = -3888558623432442561L; - - // - //Define class members - // - private JPanel jContentPane = null; - - private JLabel jLabelBootModeName = null; - - private JComboBox jComboBoxBootModeName = null; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -3888558623432442561L; - private JLabel jLabelUsage = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JComboBox jComboBoxUsage = null; + private JLabel jLabelBootModeName = null; - private StarLabel jStarLabel1 = null; + private JComboBox jComboBoxBootModeName = null; - private StarLabel jStarLabel2 = null; + private JLabel jLabelUsage = null; - private JLabel jLabelFeatureFlag = null; + private JComboBox jComboBoxUsage = null; - private JTextField jTextFieldFeatureFlag = null; + private StarLabel jStarLabel1 = null; - private JLabel jLabelArch = null; + private StarLabel jStarLabel2 = null; - private JScrollPane jScrollPane = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelHelpText = null; + private JTextField jTextFieldFeatureFlag = null; - private JTextArea jTextAreaHelpText = null; + private JLabel jLabelArch = null; - private JScrollPane jScrollPaneHelpText = null; + private JScrollPane jScrollPane = null; - private ArchCheckBox jArchCheckBox = null; + private JLabel jLabelHelpText = null; - private JButton jButtonOk = null; + private JTextArea jTextAreaHelpText = null; - private JButton jButtonCancel = null; + private JScrollPane jScrollPaneHelpText = 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 ArchCheckBox jArchCheckBox = null; - /** - 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; - } + private JButton jButtonOk = null; - /** - * 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)); - } - return jTextFieldFeatureFlag; - } + private JButton jButtonCancel = null; - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); - } - return jScrollPane; - } + // + // Not used by UI + // + private BootModesIdentification id = null; - /** - This method initializes jTextAreaHelpText - - @return javax.swing.JTextArea - - **/ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); -// jTextAreaHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); -// jTextAreaHelpText.setPreferredSize(new java.awt.Dimension(320, 20)); - } - return jTextAreaHelpText; - } + private EnumerationData ed = new EnumerationData(); - /** - 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 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 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 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 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 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"); } - - public static void main(String[] args) { + 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 this - - **/ - private void init() { - this.setSize(500, 230); - this.setContentPane(getJScrollPane()); - this.setTitle("Boot Modes"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); + 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 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()); - } + 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 is the override edit constructor - - @param inBootModesIdentification - @param iFrame - - **/ - public BootModesDlg(BootModesIdentification inBootModesIdentification, IFrame iFrame) { - super(iFrame, true); - init(inBootModesIdentification); + 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); } - - /** - 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 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 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; + 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 BootModeName groups and Usage type - - **/ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); + } + + /** + * 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); } - - /* (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); - } + } + + /** + * 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); } - - /** - 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; + 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); + } } - 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; + 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 + // - public BootModesIdentification getId() { - return id; + // + // 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; + } } - public void setId(BootModesIdentification id) { - this.id = 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; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java index ba71a20f67..56a856e49d 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java @@ -1,6 +1,7 @@ /** @file + <> - The file is used to create, update DataHub of MSA/MBD file + <> Copyright (c) 2006, Intel Corporation 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, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + Package Name: Tools + Module Name: FrameworkWizard + **/ package org.tianocore.frameworkwizard.module.ui.dialog; @@ -24,6 +28,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; +import javax.swing.JTextArea; import org.tianocore.frameworkwizard.common.DataType; 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; /** - The class is used to create, update DataHub of MSA/MBD file - It extends IInternalFrame - + * The class is used to create, update DataHub of MSA/MBD file It extends + * IInternalFrame + * + * + * + */ +public class DataHubsDlg extends IDialog { + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -3667906991966638892L; - **/ -public class DataHubsDlg extends IDialog { + // + // Define class members + // + private JPanel jContentPane = null; - /// - /// Define class Serial Version UID - /// - private static final long serialVersionUID = -3667906991966638892L; + private JLabel jLabelUsage = null; - // - //Define class members - // - private JPanel jContentPane = null; + private JComboBox jComboBoxUsage = null; - private JLabel jLabelUsage = null; + private JLabel jLabelDataHubRecord = null; - private JComboBox jComboBoxUsage = null; + private JTextField jTextFieldDataHubRecord = null; - private JLabel jLabelDataHubRecord = null; + private StarLabel jStarLabel1 = null; - private JTextField jTextFieldDataHubRecord = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel1 = null; + private JLabel jLabelFeatureFlag = null; - private StarLabel jStarLabel2 = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelArch = null; - private JTextField jTextFieldFeatureFlag = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelArch = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPane = null; + private JTextArea jTextAreaHelpText = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private JTextField jTextFieldHelpText = null; + private ArchCheckBox jArchCheckBox = null; - private ArchCheckBox jArchCheckBox = null; + private JButton jButtonOk = null; - private JButton jButtonOk = null; + private JButton jButtonCancel = null; - private JButton jButtonCancel = null; + // + // Not used by UI + // + private DataHubsIdentification id = null; - // - // Not used by UI - // - private DataHubsIdentification id = null; - - 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)); - } - return jComboBoxUsage; - } + 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 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"); } - - /** - * 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; + 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("
ALWAYS_CONSUMEDModule always consumes a Data Hub Entry
via registering a filter driver.
SOMETIMES_CONSUMEDModule will use a Data Hub Entry if it exists
via registering a filter driver
ALWAYS_PRODUCEDAlways logs data into the Data Hub
SOMETIMES_PRODUCEDLog data into the Data Hub under
certain circumstances
"); } - - /** - 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 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; + 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 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; + 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 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; + 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()); } - - public static void main(String[] args) { - + 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); } - - /** - This method initializes this - - **/ - private void init() { - this.setSize(508, 220); - this.setContentPane(getJScrollPane()); - this.setTitle("Data Hubs"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); + 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 - 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()); - } + 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); + } + + /** + * 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); } - - /** - 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); + } } - /** - 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; + 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 + // - /** - This method initializes Usage type - - **/ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage()); + // + // Check DataHubRecord + // + if (isEmpty(this.jTextFieldDataHubRecord.getText())) { + Log.wrn("Update Hubs", "Data Hub Record must not be empty"); + 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()) { - getCurrentDataHubs(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } - } - - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(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; + } } - /** - 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; + // + // 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; + } } - private DataHubsIdentification getCurrentDataHubs() { - String arg0 = this.jTextFieldDataHubRecord.getText(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); + return true; + } - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextFieldHelpText.getText(); + private DataHubsIdentification getCurrentDataHubs() { + String arg0 = this.jTextFieldDataHubRecord.getText(); + String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4); - return id; - } + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); - public DataHubsIdentification getId() { - return id; - } + id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4); + return id; + } + + public DataHubsIdentification getId() { + return id; + } - public void setId(DataHubsIdentification id) { - this.id = id; - } + public void setId(DataHubsIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java index f9eaa3a0a7..7bfff4dad7 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java @@ -1,6 +1,5 @@ /** @file - - The file is used to create, update Guids of MSA/MBD file + <> Copyright (c) 2006, Intel Corporation All rights reserved. This program and the accompanying materials @@ -23,6 +22,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; +import javax.swing.JTextArea; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; @@ -37,367 +37,394 @@ import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentific import org.tianocore.frameworkwizard.workspace.WorkspaceTools; /** - The class is used to create, update Guids of MSA/MBD file - It extends IInternalFrame - + * The class is used to create, update Guids of the MSA file + * + * It extends IDialog + * + */ +public class GuidsDlg extends IDialog { + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = 6710858997766979803L; - **/ -public class GuidsDlg extends IDialog { + // + // Define class members + // + private JPanel jContentPane = null; - /// - /// Define class Serial Version UID - /// - private static final long serialVersionUID = 6710858997766979803L; + private JLabel jLabelC_Name = null; - // - //Define class members - // - private JPanel jContentPane = null; + private JComboBox jComboBoxCName = null; - private JLabel jLabelC_Name = null; + private JLabel jLabelUsage = null; - private JComboBox jComboBoxCName = null; + private JComboBox jComboBoxUsage = null; - private JLabel jLabelUsage = null; + private StarLabel jStarLabel1 = null; - private JComboBox jComboBoxUsage = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel1 = null; + private JLabel jLabelFeatureFlag = null; - private StarLabel jStarLabel2 = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelArch = null; - private JTextField jTextFieldFeatureFlag = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelArch = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPane = null; + private JTextArea jTextAreaHelpText = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPaneHelpText = null; + + private ArchCheckBox jArchCheckBox = null; - private JTextField jTextFieldHelpText = null; + private JButton jButtonOk = null; - private ArchCheckBox jArchCheckBox = null; + private JButton jButtonCancel = null; - private JButton jButtonOk = null; + // + // Not used by UI + // + private GuidsIdentification id = null; - private JButton jButtonCancel = null; + private EnumerationData ed = new EnumerationData(); - // - // 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)); - } - return jComboBoxCName; - } + 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; + /** + * 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"); } - - /** - 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; + 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("
ALWAYS_CONSUMEDModule always consumes the GUID
SOMETIMES_CONSUMEDModule will use the GUID only if it is present
ALWAYS_PRODUCEDModule always produces the GUID
SOMETIMES_PRODUCEDModule will sometimes produce the GUID
DEFAULTDefault is the the GUID that specified the
instance of the package
"); } - - /** - 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 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; + 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 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; + 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 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; + 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()); } - - public static void main(String[] args) { - + 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); } - - /** - This method initializes this - - **/ - private void init() { - this.setSize(508, 220); - this.setContentPane(getJScrollPane()); - this.setTitle("Guids"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); + 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 - 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()); - } + 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); + } + + /** + * 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); } - - /** - 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); } - - /** - 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; + 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); + } } - /** - This method initializes Usage type - - **/ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllGuidDeclarationsFromWorkspace()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage()); + 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 + // - /* (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); - } + // + // 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; + } } - /** - 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; + // + // 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; + } } - private GuidsIdentification getCurrentGuids() { + return true; + } + +private GuidsIdentification getCurrentGuids() { String arg0 = this.jComboBoxCName.getSelectedItem().toString(); String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); String arg2 = this.jTextFieldFeatureFlag.getText(); Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextFieldHelpText.getText(); + String arg4 = this.jTextAreaHelpText.getText(); id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4); return id; - } - - public GuidsIdentification getId() { - return id; - } + } public GuidsIdentification getId() { + return id; + } - public void setId(GuidsIdentification id) { - this.id = id; - } + public void setId(GuidsIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java index 216d2e04fd..5db8cd5957 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java @@ -23,6 +23,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; +import javax.swing.JTextArea; import org.tianocore.frameworkwizard.common.DataType; 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; /** - The class is used to create, update Formset of MSA/MBD file - It extends IInternalFrame - + * The class is used to create, update Hii Packages of the MSA file + * + * It extends IDialog + * + */ +public class HiiPackagesDlg extends IDialog { + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -6851574146786158116L; - **/ -public class HiiPackagesDlg extends IDialog { + // + // Define class members + // + private JPanel jContentPane = null; - /// - /// Define class Serial Version UID - /// - private static final long serialVersionUID = -6851574146786158116L; + private JLabel jLabelName = null; - // - //Define class members - // - private JPanel jContentPane = null; + private JTextField jTextFieldName = null; - private JLabel jLabelName = null; + private JLabel jLabelUsage = null; - private JTextField jTextFieldName = null; + private JComboBox jComboBoxUsage = null; - private JLabel jLabelUsage = null; + private StarLabel jStarLabel1 = null; - private JComboBox jComboBoxUsage = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel1 = null; + private JLabel jLabelFeatureFlag = null; - private StarLabel jStarLabel2 = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelArch = null; - private JTextField jTextFieldFeatureFlag = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelArch = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPane = null; + private JTextArea jTextAreaHelpText = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private JTextField jTextFieldHelpText = null; + private ArchCheckBox jArchCheckBox = null; - private ArchCheckBox jArchCheckBox = null; + private JButton jButtonOk = null; - private JButton jButtonOk = null; + private JButton jButtonCancel = null; - private JButton jButtonCancel = null; + // + // Not used by UI + // + private HiiPackagesIdentification id = 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; - } + 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)); - } - return jComboBoxUsage; + /** + * + * 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"); } - - /** - * 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; + 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("
ALWAYS_PRODUCEDHii is always registered
SOMETIMES_PRODUCEDSome executions paths will require the Hii to be registered
"); } - - /** - 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 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; + 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 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; + 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); } - - /** - 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; + 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()); } - - public static void main(String[] args) { - + 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); } - - /** - This method initializes this - - **/ - private void init() { - this.setSize(508, 220); - this.setContentPane(getJScrollPane()); - this.setTitle("Hii Packages"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); + 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 - 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()); - } + 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); + } + + /** + * 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); } - - /** - 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); + } } - /** - 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; + 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 + // - /** - This method initializes Usage type - - **/ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage()); + // + // Check Hii Package Name + // + if (isEmpty(this.jTextFieldName.getText())) { + Log.wrn("Update Hii Packages", + "Hii Package Name Record must not be empty"); + 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()) { - getCurrentHiiPackages(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } - } - - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(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; + } } - /** - 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; + // + // 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; + } } - private HiiPackagesIdentification getCurrentHiiPackages() { - String arg0 = this.jTextFieldName.getText(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); + return true; + } - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextFieldHelpText.getText(); + private HiiPackagesIdentification getCurrentHiiPackages() { + String arg0 = this.jTextFieldName.getText(); + String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4); - return id; - } + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); - public HiiPackagesIdentification getId() { - return id; - } + id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4); + return id; + } + + public HiiPackagesIdentification getId() { + return id; + } - public void setId(HiiPackagesIdentification id) { - this.id = id; - } + public void setId(HiiPackagesIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java index 5ca71a0ac5..6a794f41fe 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java @@ -127,6 +127,7 @@ public class ProtocolsDlg extends IDialog implements ItemListener { jComboBoxUsage = new JComboBox(); jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage.setToolTipText("ALWAYS_CONSUMED is the only valid usage for type ProtocolNotify."); } return jComboBoxUsage; } @@ -155,7 +156,7 @@ public class ProtocolsDlg extends IDialog implements ItemListener { jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxProtocolType.addItemListener(this); - jComboBoxProtocolType.setToolTipText("Select Protocol Type"); + jComboBoxProtocolType.setToolTipText("Select Protocol Type
Protocol Notify is a register protocol notify mechanism."); } return jComboBoxProtocolType; } @@ -170,6 +171,7 @@ public class ProtocolsDlg extends IDialog implements ItemListener { jComboBoxCName = new JComboBox(); jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol"); } return jComboBoxCName; diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java index 741ee3da77..465a428060 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java @@ -1,6 +1,7 @@ /** @file - - The file is used to create, update SystemTable of MSA/MBD file + <> + + <> Copyright (c) 2006, Intel Corporation All rights reserved. This program and the accompanying materials @@ -23,6 +24,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; +import javax.swing.JTextArea; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; @@ -37,356 +39,383 @@ import org.tianocore.frameworkwizard.module.Identifications.SystemTables.SystemT import org.tianocore.frameworkwizard.workspace.WorkspaceTools; /** - The class is used to create, update SystemTable of MSA/MBD file - It extends IInternalFrame - + * The class is used to create, update SystemTable of MSA/MBD file It extends + * IInternalFrame + * + * + * + */ +public class SystemTablesDlg extends IDialog { + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = 7488769180379442276L; - **/ -public class SystemTablesDlg extends IDialog { + // + // Define class members + // + private JPanel jContentPane = null; - /// - /// Define class Serial Version UID - /// - private static final long serialVersionUID = 7488769180379442276L; + private JLabel jLabelEntry = null; - // - //Define class members - // - private JPanel jContentPane = null; + private JLabel jLabelUsage = null; - private JLabel jLabelEntry = null; + private JComboBox jComboBoxUsage = null; - private JLabel jLabelUsage = null; + private StarLabel jStarLabel1 = null; - private JComboBox jComboBoxUsage = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel1 = null; + private JComboBox jComboBoxGuidC_Name = null; - private StarLabel jStarLabel2 = null; + private JLabel jLabelFeatureFlag = null; - private JComboBox jComboBoxGuidC_Name = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelArch = null; - private JTextField jTextFieldFeatureFlag = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelArch = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPane = null; + private JTextArea jTextAreaHelpText = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private JTextField jTextFieldHelpText = null; + private ArchCheckBox jArchCheckBox = null; - private ArchCheckBox jArchCheckBox = null; + private JButton jButtonOk = null; - private JButton jButtonOk = null; + private JButton jButtonCancel = null; - private JButton jButtonCancel = null; + // + // Not used by UI + // + private SystemTablesIdentification id = 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; - } + private EnumerationData ed = new EnumerationData(); - /** - This method initializes jTextField - - @return javax.swing.JTextField jTextFieldC_Name - - **/ - private JComboBox getJComboBoxGuidC_Name() { - if (jComboBoxGuidC_Name == null) { - jComboBoxGuidC_Name = new JComboBox(); - jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob"); - } - return jComboBoxGuidC_Name; - } + private WorkspaceTools wt = new WorkspaceTools(); - /** - * 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 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"); } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); - } - return jScrollPane; + 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("
ALWAYS_CONSUMEDModule requires a GUIDed entry in the system table
SOMETIMES_CONSUMEDModule consumes a GUIDed entry in the system
table if it is present
ALWAYS_PRODUCEDModule always produces a GUIDed entry in the system table
SOMETIMES_PRODUCEDModule produces a GUIDed entry in the system table
for some of its execution flows.
"); } - - /** - 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; + 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 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; + 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 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; + 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); } - - public static void main(String[] args) { - + 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()); } - - /** - This method initializes this - - **/ - private void init() { - this.setSize(508, 215); - this.setContentPane(getJScrollPane()); - this.setTitle("System Tables"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); + 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); } - - /** - 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()); - } + 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 is the override edit constructor - - @param inBootModesIdentification - @param iFrame - - **/ - public SystemTablesDlg(SystemTablesIdentification inSystemTablesIdentification, IFrame iFrame) { - super(iFrame, true); - init(inSystemTablesIdentification); + 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()); } - - /** - 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 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 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); } - - /** - This method initializes Usage type - - **/ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage()); - Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace()); + 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); + } } - /* (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); - } + 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 + // - /** - 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; + // + // 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; + } } - private SystemTablesIdentification getCurrentSystemTables() { - String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); + return true; + } - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextFieldHelpText.getText(); + private SystemTablesIdentification getCurrentSystemTables() { + String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); + String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4); - return id; - } + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); - public SystemTablesIdentification getId() { - return id; - } + id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4); + return id; + } - public void setId(SystemTablesIdentification id) { - this.id = id; - } + public SystemTablesIdentification getId() { + return id; + } + + public void setId(SystemTablesIdentification id) { + this.id = id; + } } -- 2.39.2