X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2FMsaHeader.java;h=bf7afce417a1b7a7eaceff60240e8fbb0140aca7;hp=11e1aa89c9adef7a131532f56af4fdba8d4c35d1;hb=8de0094c045201cf92891ef78df2761cf47a6fca;hpb=79cb6fdbc073e47380880d84c3eef43bef0c0826 diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java index 11e1aa89c9..bf7afce417 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java @@ -18,8 +18,11 @@ package org.tianocore.frameworkwizard.module.ui; import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; import java.awt.event.FocusEvent; +import java.util.Vector; +import javax.swing.ButtonGroup; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; @@ -27,9 +30,12 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; +import org.tianocore.ExternsDocument; +import org.tianocore.ModuleDefinitionsDocument; import org.tianocore.ModuleSurfaceAreaDocument; import org.tianocore.ModuleTypeDef; import org.tianocore.MsaHeaderDocument; +import org.tianocore.PcdDriverTypes; import org.tianocore.LicenseDocument.License; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; @@ -39,6 +45,7 @@ import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; +import javax.swing.JRadioButton; /** The class is used to create, update MsaHeader of MSA file @@ -54,6 +61,17 @@ public class MsaHeader extends IInternalFrame { /// private static final long serialVersionUID = -8152099582923006900L; + private int dialogWidth = 500; + + private int dialogHeight = 630; + + private final int labelWidth = 155; + + private int valueWidth = 320; + + private final int labelCol = 12; + + private final int valueCol = 168; // //Define class members // @@ -103,6 +121,24 @@ public class MsaHeader extends IInternalFrame { private JComboBox jComboBoxModuleType = null; + private JLabel jLabelArch = null; + + private JLabel jLabelBinaryModule = null; + + private JLabel jLabelOutputFileBasename = null; + + private JTextField jTextFieldOutputFileBasename = null; + + private JScrollPane jScrollPaneCopyright = null; + + private JTextArea jTextAreaCopyright = null; + + private JLabel jLabelURL = null; + + private JTextField jTextFieldURL = null; + + private JScrollPane jScrollPane = null; + private StarLabel jStarLabel1 = null; private StarLabel jStarLabel2 = null; @@ -121,19 +157,142 @@ public class MsaHeader extends IInternalFrame { private StarLabel jStarLabel12 = null; + private StarLabel jStarLabel13 = null; + + private StarLabel jStarLabel14 = null; + + private JCheckBox jCheckBoxIa32 = null; + + private JCheckBox jCheckBoxX64 = null; + + private JCheckBox jCheckBoxIpf = null; + + private JCheckBox jCheckBoxEbc = null; + + private JCheckBox jCheckBoxArm = null; + + private JCheckBox jCheckBoxPpc = null; + + private JComboBox jComboBoxPcdIsDriver = null; + + private JCheckBox jCheckBoxPcd = null; + + private JCheckBox jCheckBoxFlashMap = null; + + // + // Not used for UI + // private MsaHeaderDocument.MsaHeader msaHeader = null; + private ModuleDefinitionsDocument.ModuleDefinitions md = null; + private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; - private JTextField jTextFieldCopyright = null; + private ExternsDocument.Externs ex = null; - private JLabel jLabelURL = null; + private OpeningModuleType omt = null; - private JTextField jTextFieldURL = null; + private EnumerationData ed = new EnumerationData(); - private JScrollPane jScrollPane = null; + private JRadioButton jRadioButtonBinaryModuleTrue = null; - private OpeningModuleType omt = null; + private JRadioButton jRadioButtonBinaryModuleFalse = null; + + /** + * This method initializes jCheckBoxIa32 + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxIa32() { + if (jCheckBoxIa32 == null) { + jCheckBoxIa32 = new JCheckBox(); + jCheckBoxIa32.setBounds(new java.awt.Rectangle(valueCol, 505, 55, 20)); + jCheckBoxIa32.setText("IA32"); + jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxIa32.addFocusListener(this); + } + return jCheckBoxIa32; + } + + /** + * This method initializes jCheckBoxX64 + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxX64() { + if (jCheckBoxX64 == null) { + jCheckBoxX64 = new JCheckBox(); + jCheckBoxX64.setBounds(new java.awt.Rectangle(valueCol + 55, 505, 53, 20)); + jCheckBoxX64.setText("X64"); + jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxX64.addFocusListener(this); + } + return jCheckBoxX64; + } + + /** + * This method initializes jCheckBoxIpf + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxIpf() { + if (jCheckBoxIpf == null) { + jCheckBoxIpf = new JCheckBox(); + jCheckBoxIpf.setBounds(new java.awt.Rectangle(valueCol + 110, 505, 52, 20)); + jCheckBoxIpf.setText("IPF"); + jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxIpf.addFocusListener(this); + } + return jCheckBoxIpf; + } + + /** + * This method initializes jCheckBoxEbc + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxEbc() { + if (jCheckBoxEbc == null) { + jCheckBoxEbc = new JCheckBox(); + jCheckBoxEbc.setBounds(new java.awt.Rectangle(valueCol + 165, 505, 53, 20)); + jCheckBoxEbc.setText("EBC"); + jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxEbc.addFocusListener(this); + } + return jCheckBoxEbc; + } + + /** + * This method initializes jCheckBoxArm + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxArm() { + if (jCheckBoxArm == null) { + jCheckBoxArm = new JCheckBox(); + jCheckBoxArm.setBounds(new java.awt.Rectangle(valueCol + 220, 505, 54, 20)); + jCheckBoxArm.setText("ARM"); + jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxArm.addFocusListener(this); + } + return jCheckBoxArm; + } + + /** + * This method initializes jCheckBoxPpc + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxPpc() { + if (jCheckBoxPpc == null) { + jCheckBoxPpc = new JCheckBox(); + jCheckBoxPpc.setBounds(new java.awt.Rectangle(valueCol + 285, 505, 53, 20)); + jCheckBoxPpc.setText("PPC"); + jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxPpc.addFocusListener(this); + } + return jCheckBoxPpc; + } /** This method initializes jTextFieldBaseName @@ -144,10 +303,10 @@ public class MsaHeader extends IInternalFrame { private JTextField getJTextFieldBaseName() { if (jTextFieldBaseName == null) { jTextFieldBaseName = new JTextField(); - jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueCol, 10, valueWidth, 20)); jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldBaseName.addFocusListener(this); - jTextFieldBaseName.setToolTipText("An brief Identifier, such as USB I/O Library, of the module"); + jTextFieldBaseName.setToolTipText("A brief Identifier, such as USB I/O Library, of the module"); } return jTextFieldBaseName; } @@ -162,10 +321,10 @@ public class MsaHeader extends IInternalFrame { if (jTextFieldGuid == null) { jTextFieldGuid = new JTextField(); jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250, 20)); - jTextFieldGuid.setLocation(new java.awt.Point(160, 60)); + jTextFieldGuid.setLocation(new java.awt.Point(valueCol, 60)); jTextFieldGuid.setSize(new java.awt.Dimension(250, 20)); jTextFieldGuid.addFocusListener(this); - jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number (8-4-4-4-12)"); + jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number, Registry Format (8-4-4-4-12)"); } return jTextFieldGuid; } @@ -179,11 +338,11 @@ public class MsaHeader extends IInternalFrame { private JTextField getJTextFieldVersion() { if (jTextFieldVersion == null) { jTextFieldVersion = new JTextField(); - jTextFieldVersion.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldVersion.setLocation(new java.awt.Point(160, 85)); - jTextFieldVersion.setSize(new java.awt.Dimension(320, 20)); + jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth, 20)); + jTextFieldVersion.setLocation(new java.awt.Point(valueCol, 85)); + jTextFieldVersion.setSize(new java.awt.Dimension(valueWidth, 20)); jTextFieldVersion.addFocusListener(this); - jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01"); + jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01, 1.0.1"); } return jTextFieldVersion; } @@ -196,10 +355,11 @@ public class MsaHeader extends IInternalFrame { **/ private JButton getJButtonGenerateGuid() { if (jButtonGenerateGuid == null) { + int genGuidCol = valueCol + 285; jButtonGenerateGuid = new JButton(); jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20)); jButtonGenerateGuid.setSize(new java.awt.Dimension(65, 20)); - jButtonGenerateGuid.setLocation(new java.awt.Point(415, 60)); + jButtonGenerateGuid.setLocation(new java.awt.Point(genGuidCol, 60)); jButtonGenerateGuid.setText("GEN"); jButtonGenerateGuid.addActionListener(this); } @@ -218,7 +378,10 @@ public class MsaHeader extends IInternalFrame { jTextAreaLicense.setText(""); jTextAreaLicense.setLineWrap(true); jTextAreaLicense.addFocusListener(this); - jTextAreaLicense.setToolTipText("The License for this file"); + jTextAreaLicense.setWrapStyleWord(true); + jTextAreaLicense.setSelectionStart(0); + jTextAreaLicense.setSelectionEnd(0); + jTextAreaLicense.setToolTipText("The License for this Module."); } return jTextAreaLicense; } @@ -234,7 +397,10 @@ public class MsaHeader extends IInternalFrame { jTextAreaDescription = new JTextArea(); jTextAreaDescription.setLineWrap(true); jTextAreaDescription.addFocusListener(this); - jTextAreaDescription.setToolTipText("A verbose description of the module"); + jTextAreaDescription.setToolTipText("A verbose description of the module."); + jTextAreaDescription.setWrapStyleWord(true); + jTextAreaDescription.setSelectionStart(0); + jTextAreaDescription.setSelectionEnd(0); } return jTextAreaDescription; } @@ -247,19 +413,17 @@ public class MsaHeader extends IInternalFrame { **/ private JTextField getJTextFieldSpecification() { if (jTextFieldSpecification == null) { + int specWidth = valueWidth + 50; jTextFieldSpecification = new JTextField(); - jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"); - jTextFieldSpecification.setSize(new java.awt.Dimension(320, 20)); - jTextFieldSpecification.setLocation(new java.awt.Point(160, 435)); + + jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth, 20)); + jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"); + jTextFieldSpecification.setBorder(null); + + jTextFieldSpecification.setSize(new java.awt.Dimension(specWidth, 20)); + jTextFieldSpecification.setLocation(new java.awt.Point(labelCol, dialogHeight - 30)); jTextFieldSpecification.setEditable(false); jTextFieldSpecification.addFocusListener(this); - jTextFieldSpecification - .setToolTipText("Deselecting a checkbox" - + " will restrict this module for use with the selected architectures, " - + "based on the list of items that are checked. " - + "If all boxes are checked, " - + "then the module will support all current AND FUTURE architectures"); } return jTextFieldSpecification; } @@ -310,10 +474,10 @@ public class MsaHeader extends IInternalFrame { if (jScrollPaneLicense == null) { jScrollPaneLicense = new JScrollPane(); jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneLicense.setSize(new java.awt.Dimension(320, 120)); - jScrollPaneLicense.setLocation(new java.awt.Point(160, 285)); + jScrollPaneLicense.setSize(new java.awt.Dimension(valueWidth, 120)); + jScrollPaneLicense.setLocation(new java.awt.Point(valueCol, 305)); jScrollPaneLicense.setViewportView(getJTextAreaLicense()); - jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(320, 120)); + jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth, 120)); } return jScrollPaneLicense; } @@ -328,10 +492,10 @@ public class MsaHeader extends IInternalFrame { if (jScrollPaneDescription == null) { jScrollPaneDescription = new JScrollPane(); jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneDescription.setSize(new java.awt.Dimension(320, 120)); - jScrollPaneDescription.setLocation(new java.awt.Point(160, 135)); + jScrollPaneDescription.setSize(new java.awt.Dimension(valueWidth, 120)); + jScrollPaneDescription.setLocation(new java.awt.Point(valueCol, 135)); jScrollPaneDescription.setViewportView(getJTextAreaDescription()); - jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(320, 120)); + jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, 120)); } return jScrollPaneDescription; } @@ -345,11 +509,11 @@ public class MsaHeader extends IInternalFrame { private JTextField getJTextFieldAbstract() { if (jTextFieldAbstract == null) { jTextFieldAbstract = new JTextField(); - jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldAbstract.setLocation(new java.awt.Point(160, 110)); - jTextFieldAbstract.setSize(new java.awt.Dimension(320, 20)); + jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, 20)); + jTextFieldAbstract.setLocation(new java.awt.Point(valueCol, 110)); + jTextFieldAbstract.setSize(new java.awt.Dimension(valueWidth, 20)); jTextFieldAbstract.addFocusListener(this); - jTextFieldAbstract.setToolTipText("A one sentence description of this module"); + jTextFieldAbstract.setToolTipText("A one sentence description of this module."); } return jTextFieldAbstract; } @@ -363,53 +527,37 @@ public class MsaHeader extends IInternalFrame { private JComboBox getJComboBoxModuleType() { if (jComboBoxModuleType == null) { jComboBoxModuleType = new JComboBox(); - jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxModuleType.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxModuleType.setBounds(new java.awt.Rectangle(valueCol, 35, valueWidth, 20)); + jComboBoxModuleType.setPreferredSize(new java.awt.Dimension(valueWidth, 20)); jComboBoxModuleType.addFocusListener(this); } return jComboBoxModuleType; } /** - This method initializes jTextFieldCopyright + This method initializes jTextFieldURL - @return javax.swing.JTextField jTextFieldCopyright + @return javax.swing.JTextField **/ - private JTextField getJTextFieldCopyright() { - if (jTextFieldCopyright == null) { - jTextFieldCopyright = new JTextField(); - jTextFieldCopyright.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldCopyright.setLocation(new java.awt.Point(160, 260)); - jTextFieldCopyright.setSize(new java.awt.Dimension(320, 20)); - jTextFieldCopyright.addFocusListener(this); - jTextFieldCopyright.setToolTipText("One or more copyright lines"); - } - return jTextFieldCopyright; - } - - /** - * This method initializes jTextFieldURL - * - * @return javax.swing.JTextField - */ private JTextField getJTextFieldURL() { if (jTextFieldURL == null) { jTextFieldURL = new JTextField(); - jTextFieldURL.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldURL.setLocation(new java.awt.Point(160, 410)); - jTextFieldURL.setSize(new java.awt.Dimension(320, 20)); + jTextFieldURL.setPreferredSize(new java.awt.Dimension(valueWidth, 20)); + jTextFieldURL.setLocation(new java.awt.Point(valueCol, 430)); + jTextFieldURL.setSize(new java.awt.Dimension(valueWidth, 20)); jTextFieldURL.addFocusListener(this); - jTextFieldURL.setToolTipText("A URL for the latest version of the license"); + jTextFieldURL.setToolTipText("A URL for the latest version of the license."); } return jTextFieldURL; } /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ + This method initializes jScrollPane + + @return javax.swing.JScrollPane + + **/ private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); @@ -418,8 +566,76 @@ public class MsaHeader extends IInternalFrame { return jScrollPane; } - public static void main(String[] args) { + /** + This method initializes jScrollPaneCopyright + + @return javax.swing.JScrollPane + + **/ + private JScrollPane getJScrollPaneCopyright() { + if (jScrollPaneCopyright == null) { + jScrollPaneCopyright = new JScrollPane(); + jScrollPaneCopyright.setBounds(new java.awt.Rectangle(valueCol, 260, valueWidth, 40)); + jScrollPaneCopyright.setPreferredSize(new java.awt.Dimension(valueWidth, 40)); + jScrollPaneCopyright.setViewportView(getJTextAreaCopyright()); + jScrollPaneCopyright.setSize(new java.awt.Dimension(valueWidth, 40)); + } + return jScrollPaneCopyright; + } + + /** + This method initializes jTextAreaCopyright + + @return javax.swing.JTextArea + + **/ + private JTextArea getJTextAreaCopyright() { + if (jTextAreaCopyright == null) { + jTextAreaCopyright = new JTextArea(); + jTextAreaCopyright.setLineWrap(true); + jTextAreaCopyright.addFocusListener(this); + jTextAreaCopyright.setWrapStyleWord(true); + jTextAreaCopyright.setSelectionStart(0); + jTextAreaCopyright.setSelectionEnd(0); + jTextAreaCopyright.setBounds(new java.awt.Rectangle(0, 0, valueWidth, 40)); + jTextAreaCopyright.setToolTipText("One or more copyright lines."); + } + return jTextAreaCopyright; + } + + /** + * This method initializes jTextFieldOutputFileBasename + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldOutputFileBasename() { + if (jTextFieldOutputFileBasename == null) { + jTextFieldOutputFileBasename = new JTextField(); + jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(valueCol, 455, valueWidth, 20)); + jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(valueWidth, 20)); + jTextFieldOutputFileBasename.addFocusListener(this); + jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names."); + } + return jTextFieldOutputFileBasename; + } + /** + * This method initializes jComboBoxPcdIsDriver + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxPcdIsDriver() { + if (jComboBoxPcdIsDriver == null) { + jComboBoxPcdIsDriver = new JComboBox(); + jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(valueWidth, 20)); + jComboBoxPcdIsDriver.setBounds(new java.awt.Rectangle(valueCol, 530, valueWidth, 20)); + jComboBoxPcdIsDriver.addItemListener(this); + jComboBoxPcdIsDriver.addFocusListener(this); + jComboBoxPcdIsDriver.setEnabled(false); + Tools.generateComboBoxByVector(jComboBoxPcdIsDriver, ed.getVPcdDriverTypes()); + jComboBoxPcdIsDriver.setVisible(false); + } + return jComboBoxPcdIsDriver; } /** @@ -442,7 +658,26 @@ public class MsaHeader extends IInternalFrame { super(); this.omt = inMsa; this.msa = omt.getXmlMsa(); + + // + // Set module definitions default value + // + if (msa.getModuleDefinitions() == null) { + ModuleDefinitionsDocument.ModuleDefinitions md = ModuleDefinitionsDocument.ModuleDefinitions.Factory + .newInstance(); + md.setOutputFileBasename(msa.getMsaHeader().getModuleName()); + md.setBinaryModule(false); + md.setSupportedArchitectures(ed.getVSupportedArchitectures()); + msa.setModuleDefinitions(md); + } + + // + // Init items of Header, Definitions and Externs + // init(msa.getMsaHeader()); + init(msa.getModuleDefinitions()); + init(msa.getExterns()); + this.setVisible(true); this.setViewMode(false); } @@ -454,14 +689,12 @@ public class MsaHeader extends IInternalFrame { **/ public void setViewMode(boolean isView) { - //this.jButtonOk.setVisible(false); - //this.jButtonCancel.setVisible(false); if (isView) { this.jTextFieldBaseName.setEnabled(!isView); this.jTextFieldGuid.setEnabled(!isView); this.jTextFieldVersion.setEnabled(!isView); this.jTextAreaLicense.setEnabled(!isView); - this.jTextFieldCopyright.setEnabled(!isView); + this.jTextAreaCopyright.setEnabled(!isView); this.jTextAreaDescription.setEnabled(!isView); this.jTextFieldSpecification.setEnabled(!isView); this.jTextFieldAbstract.setEnabled(!isView); @@ -477,8 +710,8 @@ public class MsaHeader extends IInternalFrame { **/ private void init() { - this.setSize(500, 515); - this.setPreferredSize(new java.awt.Dimension(490, 520)); + this.setSize(dialogWidth, dialogHeight); + this.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight)); this.setContentPane(getJScrollPane()); this.setTitle("Module Surface Area Header"); initFrame(); @@ -512,12 +745,16 @@ public class MsaHeader extends IInternalFrame { } if (this.msaHeader.getDescription() != null) { this.jTextAreaDescription.setText(this.msaHeader.getDescription()); + jTextAreaDescription.setSelectionStart(0); + jTextAreaDescription.setSelectionEnd(0); } if (this.msaHeader.getCopyright() != null) { - this.jTextFieldCopyright.setText(this.msaHeader.getCopyright()); + this.jTextAreaCopyright.setText(this.msaHeader.getCopyright()); } if (this.msaHeader.getLicense() != null) { this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue()); + jTextAreaLicense.setSelectionStart(0); + jTextAreaLicense.setSelectionEnd(0); } if (this.msaHeader.getLicense() != null && this.msaHeader.getLicense().getURL() != null) { this.jTextFieldURL.setText(this.msaHeader.getLicense().getURL()); @@ -528,6 +765,52 @@ public class MsaHeader extends IInternalFrame { } } + /** + This method initializes this + Fill values to all fields if these values are not empty + + @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader + + **/ + private void init(ModuleDefinitionsDocument.ModuleDefinitions inMd) { + if (inMd != null) { + this.md = inMd; + if (md.getSupportedArchitectures() != null) { + this.setSelectedItems(Tools.convertListToVector(md.getSupportedArchitectures())); + } + if (md.getBinaryModule()) { + this.jRadioButtonBinaryModuleTrue.setSelected(true); + } else { + this.jRadioButtonBinaryModuleFalse.setSelected(true); + } + if (md.getOutputFileBasename() != null) { + this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename()); + } + } + } + + /** + This method initializes this + Fill values to all fields if these values are not empty + + @param inEx The input data of ExternsDocument.Externs + + **/ + private void init(ExternsDocument.Externs inEx) { + if (inEx != null) { + this.ex = inEx; + if (ex.getPcdIsDriver() != null) { + this.jCheckBoxPcd.setSelected(true); + this.jComboBoxPcdIsDriver.setEnabled(true); + this.jComboBoxPcdIsDriver.setSelectedItem(ex.getPcdIsDriver()); + // TODO: If the module type is DXE_DRIVER, set PCD_DXE_DRIVER + // If the module type is PEIM, set PCD_PEI_DRIVER + // If the module type is anything else, unset this! + } + this.jCheckBoxFlashMap.setSelected(ex.getTianoR8FlashMapH()); + } + } + /** This method initializes jContentPane @@ -539,46 +822,57 @@ public class MsaHeader extends IInternalFrame { jLabelURL = new JLabel(); jLabelURL.setText("License URL"); - jLabelURL.setLocation(new java.awt.Point(15, 410)); - jLabelURL.setSize(new java.awt.Dimension(140, 20)); + jLabelURL.setLocation(new java.awt.Point(labelCol, 430)); + jLabelURL.setSize(new java.awt.Dimension(labelWidth, 20)); jLabelBaseName = new JLabel(); jLabelBaseName.setText("Module Name"); - jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); + jLabelBaseName.setBounds(new java.awt.Rectangle(labelCol, 10, labelWidth, 20)); jLabelModuleType = new JLabel(); - jLabelModuleType.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); + jLabelModuleType.setBounds(new java.awt.Rectangle(labelCol, 35, labelWidth, 20)); jLabelModuleType.setText("Module Type"); jLabelGuid = new JLabel(); jLabelGuid.setText("Guid Value"); - jLabelGuid.setLocation(new java.awt.Point(15, 60)); - jLabelGuid.setSize(new java.awt.Dimension(140, 20)); + jLabelGuid.setLocation(new java.awt.Point(labelCol, 60)); + jLabelGuid.setSize(new java.awt.Dimension(labelWidth, 20)); jLabelVersion = new JLabel(); jLabelVersion.setText("Version"); - jLabelVersion.setLocation(new java.awt.Point(15, 85)); - jLabelVersion.setSize(new java.awt.Dimension(140, 20)); + jLabelVersion.setLocation(new java.awt.Point(labelCol, 85)); + jLabelVersion.setSize(new java.awt.Dimension(labelWidth, 20)); jLabelAbstract = new JLabel(); jLabelAbstract.setText("Abstract"); - jLabelAbstract.setLocation(new java.awt.Point(15, 110)); - jLabelAbstract.setSize(new java.awt.Dimension(140, 20)); + jLabelAbstract.setLocation(new java.awt.Point(labelCol, 110)); + jLabelAbstract.setSize(new java.awt.Dimension(labelWidth, 20)); jLabelDescription = new JLabel(); jLabelDescription.setText("Description"); - jLabelDescription.setLocation(new java.awt.Point(15, 135)); - jLabelDescription.setSize(new java.awt.Dimension(140, 20)); + jLabelDescription.setLocation(new java.awt.Point(labelCol, 135)); + jLabelDescription.setSize(new java.awt.Dimension(labelWidth, 20)); jLabelCopyright = new JLabel(); jLabelCopyright.setText("Copyright"); - jLabelCopyright.setLocation(new java.awt.Point(15, 260)); - jLabelCopyright.setSize(new java.awt.Dimension(140, 20)); + jLabelCopyright.setLocation(new java.awt.Point(labelCol, 260)); + jLabelCopyright.setSize(new java.awt.Dimension(labelWidth, 20)); jLabelLicense = new JLabel(); jLabelLicense.setText("License"); - jLabelLicense.setLocation(new java.awt.Point(15, 285)); - jLabelLicense.setSize(new java.awt.Dimension(140, 20)); + jLabelLicense.setLocation(new java.awt.Point(labelCol, 305)); + jLabelLicense.setSize(new java.awt.Dimension(labelWidth, 20)); + jLabelOutputFileBasename = new JLabel(); + jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(labelCol, 455, labelWidth, 20)); + jLabelOutputFileBasename.setText("Output File Basename"); + jLabelBinaryModule = new JLabel(); + jLabelBinaryModule.setBounds(new java.awt.Rectangle(labelCol, 480, labelWidth, 20)); + jLabelBinaryModule.setText("Binary Module"); + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(labelCol, 505, labelWidth, 20)); + jLabelArch.setText("Supported Architectures"); jLabelSpecification = new JLabel(); jLabelSpecification.setText("Specification"); - jLabelSpecification.setLocation(new java.awt.Point(14, 435)); - jLabelSpecification.setSize(new java.awt.Dimension(140, 20)); + jLabelSpecification.setLocation(new java.awt.Point(labelCol, 530)); + jLabelSpecification.setSize(new java.awt.Dimension(labelWidth, 20)); jContentPane = new JPanel(); jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(490, 470)); + jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 10, dialogHeight - 10)); + + jContentPane.addFocusListener(this); jContentPane.add(jLabelBaseName, null); jContentPane.add(getJTextFieldBaseName(), null); @@ -590,7 +884,6 @@ public class MsaHeader extends IInternalFrame { jContentPane.add(jLabelLicense, null); jContentPane.add(jLabelCopyright, null); jContentPane.add(jLabelDescription, null); - jContentPane.add(jLabelSpecification, null); jContentPane.add(getJTextFieldSpecification(), null); jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonCancel(), null); @@ -602,7 +895,11 @@ public class MsaHeader extends IInternalFrame { jContentPane.add(getJComboBoxModuleType(), null); jContentPane.add(jLabelURL, null); jContentPane.add(getJTextFieldURL(), null); - jContentPane.add(getJTextFieldCopyright(), null); + jContentPane.add(jLabelOutputFileBasename, null); + jContentPane.add(getJTextFieldOutputFileBasename(), null); + jContentPane.add(jLabelBinaryModule, null); + jContentPane.add(jLabelArch, null); + jStarLabel1 = new StarLabel(); jStarLabel1.setLocation(new java.awt.Point(0, 10)); jStarLabel2 = new StarLabel(); @@ -616,11 +913,15 @@ public class MsaHeader extends IInternalFrame { jStarLabel7 = new StarLabel(); jStarLabel7.setLocation(new java.awt.Point(0, 260)); jStarLabel8 = new StarLabel(); - jStarLabel8.setLocation(new java.awt.Point(0, 285)); + jStarLabel8.setLocation(new java.awt.Point(0, 305)); jStarLabel10 = new StarLabel(); jStarLabel10.setLocation(new java.awt.Point(0, 110)); jStarLabel12 = new StarLabel(); - jStarLabel12.setLocation(new java.awt.Point(0, 435)); + jStarLabel12.setLocation(new java.awt.Point(0, 455)); + jStarLabel13 = new StarLabel(); + jStarLabel13.setLocation(new java.awt.Point(0, 480)); + jStarLabel14 = new StarLabel(); + jStarLabel14.setLocation(new java.awt.Point(0, 505)); jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel2, null); @@ -631,6 +932,26 @@ public class MsaHeader extends IInternalFrame { jContentPane.add(jStarLabel8, null); jContentPane.add(jStarLabel10, null); jContentPane.add(jStarLabel12, null); + jContentPane.add(jStarLabel13, null); + jContentPane.add(jStarLabel14, null); + jContentPane.add(getJScrollPaneCopyright(), null); + + jContentPane.add(getJCheckBoxIa32(), null); + jContentPane.add(getJCheckBoxX64(), null); + jContentPane.add(getJCheckBoxIpf(), null); + jContentPane.add(getJCheckBoxEbc(), null); + jContentPane.add(getJCheckBoxArm(), null); + jContentPane.add(getJCheckBoxPpc(), null); + + jContentPane.add(getJCheckBoxPcd(), null); + jContentPane.add(getJComboBoxPcdIsDriver(), null); + jContentPane.add(getJCheckBoxFlashMap(), null); + + ButtonGroup bg = new ButtonGroup(); + jContentPane.add(getJRadioButtonBinaryModuleTrue(), null); + jContentPane.add(getJRadioButtonBinaryModuleFalse(), null); + bg.add(getJRadioButtonBinaryModuleTrue()); + bg.add(getJRadioButtonBinaryModuleFalse()); } return jContentPane; } @@ -651,11 +972,19 @@ public class MsaHeader extends IInternalFrame { this.setEdited(true); this.dispose(); } + if (arg0.getSource() == jButtonCancel) { this.setEdited(false); } + if (arg0.getSource() == jButtonGenerateGuid) { jTextFieldGuid.setText(Tools.generateUuidString()); + jTextFieldGuid.requestFocus(); + jButtonGenerateGuid.requestFocus(); + } + + if (arg0.getSource() == this.jCheckBoxPcd) { + this.jComboBoxPcdIsDriver.setEnabled(this.jCheckBoxPcd.isSelected()); } } @@ -676,12 +1005,12 @@ public class MsaHeader extends IInternalFrame { // Check Base Name // if (isEmpty(this.jTextFieldBaseName.getText())) { - Log.err("Base Name couldn't be empty"); + Log.wrn("Update Msa Header", "Name must be entered!"); //this.jTextFieldBaseName.requestFocus(); return false; } if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) { - Log.err("Incorrect data type for Base Name"); + Log.wrn("Update Msa Header", "Incorrect data type for Name, it must start with an alpha character!"); //this.jTextFieldBaseName.requestFocus(); return false; } @@ -690,12 +1019,12 @@ public class MsaHeader extends IInternalFrame { // Check Guid // if (isEmpty(this.jTextFieldGuid.getText())) { - Log.err("Guid Value couldn't be empty"); + Log.wrn("Update Msa Header", "The Guid Value must be entered!"); //this.jTextFieldGuid.requestFocus(); return false; } if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) { - Log.err("Incorrect data type for Guid"); + Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format, 8-4-4-4-12"); //this.jTextFieldGuid.requestFocus(); return false; } @@ -704,12 +1033,12 @@ public class MsaHeader extends IInternalFrame { // Check Version // if (isEmpty(this.jTextFieldVersion.getText())) { - Log.err("Version couldn't be empty"); + Log.wrn("Update Msa Header", "Version must be entered!"); //this.jTextFieldVersion.requestFocus(); return false; } if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) { - Log.err("Incorrect data type for Version"); + Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit."); //this.jTextFieldVersion.requestFocus(); return false; } @@ -718,12 +1047,13 @@ public class MsaHeader extends IInternalFrame { // Check Abstact // if (isEmpty(this.jTextFieldAbstract.getText())) { - Log.err("Abstract couldn't be empty"); + Log.wrn("Update Msa Header", "Abstract must be entered!"); //this.jTextFieldAbstract.requestFocus(); return false; } if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) { - Log.err("Incorrect data type for Abstract"); + Log.wrn("Update Msa Header", + "Incorrect data type for Abstract, is should be a sentence describing the module."); //this.jTextFieldAbstract.requestFocus(); return false; } @@ -732,7 +1062,7 @@ public class MsaHeader extends IInternalFrame { // Check Description // if (isEmpty(this.jTextAreaDescription.getText())) { - Log.err("Description couldn't be empty"); + Log.wrn("Update Msa Header", "Description must be entered!"); //this.jTextAreaDescription.requestFocus(); return false; } @@ -740,8 +1070,8 @@ public class MsaHeader extends IInternalFrame { // // Check Copyright // - if (isEmpty(this.jTextFieldCopyright.getText())) { - Log.err("Copyright couldn't be empty"); + if (isEmpty(this.jTextAreaCopyright.getText())) { + Log.wrn("Update Msa Header", "Copyright must be entered!"); //this.jTextFieldCopyright.requestFocus(); return false; } @@ -750,7 +1080,7 @@ public class MsaHeader extends IInternalFrame { // Check License // if (isEmpty(this.jTextAreaLicense.getText())) { - Log.err("License couldn't be empty"); + Log.wrn("Update Msa Header", "License must be entered!"); //this.jTextAreaLicense.requestFocus(); return false; } @@ -759,12 +1089,15 @@ public class MsaHeader extends IInternalFrame { // Check Specification // if (isEmpty(this.jTextFieldSpecification.getText())) { - Log.err("Specification couldn't be empty"); + Log.wrn("Update Msa Header", "Specification must exist."); //this.jTextFieldSpecification.requestFocus(); return false; } if (!DataValidation.isSpecification(this.jTextFieldSpecification.getText())) { - Log.err("Incorrect data type for Specification"); + // TODO Add code to check the specification number. + // Future releases of Schema may require that we process these files + // differently. + Log.wrn("Update Msa Header", "Incorrect data type for Specification"); //this.jTextFieldSpecification.requestFocus(); return false; } @@ -780,29 +1113,12 @@ public class MsaHeader extends IInternalFrame { **/ public void save() { try { - // this.msaHeader.setModuleName(this.jTextFieldBaseName.getText()); - // this.msaHeader.setModuleType(ModuleTypeDef.Enum.forString(this.jComboBoxModuleType.getSelectedItem() - // .toString())); - // this.msaHeader.setGuidValue(this.jTextFieldGuid.getText()); - // this.msaHeader.setVersion(this.jTextFieldVersion.getText()); - // this.msaHeader.setAbstract(this.jTextFieldAbstract.getText()); - // this.msaHeader.setDescription(this.jTextAreaDescription.getText()); - // this.msaHeader.setCopyright(this.jTextFieldCopyright.getText()); - // if (this.msaHeader.getLicense() != null) { - // this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText()); - // } else { - // License mLicense = License.Factory.newInstance(); - // mLicense.setStringValue(this.jTextAreaLicense.getText()); - // this.msaHeader.setLicense(mLicense); - // } - // if (!isEmpty(this.jTextFieldURL.getText())) { - // this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText()); - // } - // this.msaHeader.setSpecification(this.jTextFieldSpecification.getText()); - + msaHeader.setSpecification(this.jTextFieldSpecification.getText()); msa.setMsaHeader(msaHeader); + msa.setModuleDefinitions(md); this.omt.setSaved(false); } catch (Exception e) { + Log.wrn("Save Module", e.getMessage()); Log.err("Save Module", e.getMessage()); } } @@ -814,6 +1130,7 @@ public class MsaHeader extends IInternalFrame { private void initFrame() { EnumerationData ed = new EnumerationData(); Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType()); + this.setSelectedItems(ed.getVSupportedArchitectures()); } /** @@ -845,47 +1162,58 @@ public class MsaHeader extends IInternalFrame { int intCurrentWidth = this.getJContentPane().getWidth(); int intPreferredWidth = this.getJContentPane().getPreferredSize().width; - resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jTextFieldCopyright, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth); - resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth); - relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth, - DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON); + Tools.resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth); + + Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth, + DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON); } public void focusLost(FocusEvent arg0) { if (this.msaHeader == null) { msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance(); } - + // // Check BaseName // if (arg0.getSource() == this.jTextFieldBaseName) { if (isEmpty(this.jTextFieldBaseName.getText())) { - Log.err("Base Name couldn't be empty"); + Log.wrn("Update Msa Header", "The Name must be entered!"); //this.jTextFieldBaseName.requestFocus(); return; } if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) { - Log.err("Incorrect data type for Base Name"); + Log.wrn("Update Msa Header", "Incorrect data type for Name, it must begin with an alpha character."); //this.jTextFieldBaseName.requestFocus(); return; } - this.msaHeader.setModuleName(this.jTextFieldBaseName.getText()); + if (!this.jTextFieldBaseName.getText().equals(msaHeader.getModuleName())) { + this.msaHeader.setModuleName(this.jTextFieldBaseName.getText()); + } else { + return; + } } // // Check Module Type // if (arg0.getSource() == this.jComboBoxModuleType) { - msaHeader.setModuleType(ModuleTypeDef.Enum.forString(jComboBoxModuleType.getSelectedItem().toString())); + if (!jComboBoxModuleType.getSelectedItem().toString().equals(msaHeader.getModuleType().toString())) { + msaHeader.setModuleType(ModuleTypeDef.Enum.forString(jComboBoxModuleType.getSelectedItem().toString())); + } else { + return; + } } // @@ -893,34 +1221,41 @@ public class MsaHeader extends IInternalFrame { // if (arg0.getSource() == this.jTextFieldGuid) { if (isEmpty(this.jTextFieldGuid.getText())) { - Log.err("Guid Value couldn't be empty"); + Log.wrn("Update Msa Header", "Guid must be entered!"); //this.jTextFieldGuid.requestFocus(); return; } if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) { - Log.err("Incorrect data type for Guid"); + Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format. (8-4-4-4-12)"); //this.jTextFieldGuid.requestFocus(); return; } - this.msaHeader.setGuidValue(jTextFieldGuid.getText()); + if (!this.jTextFieldGuid.getText().equals(msaHeader.getGuidValue())) { + this.msaHeader.setGuidValue(this.jTextFieldGuid.getText()); + } else { + return; + } } // // Check Version // if (arg0.getSource() == this.jTextFieldVersion) { - if (isEmpty(this.jTextFieldVersion.getText())) { - Log.err("Version couldn't be empty"); + Log.wrn("Update Msa Header", "Version must be entered!"); //this.jTextFieldVersion.requestFocus(); return; } if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) { - Log.err("Incorrect data type for Version"); + Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit."); //this.jTextFieldVersion.requestFocus(); return; } - this.msaHeader.setVersion(this.jTextFieldVersion.getText()); + if (!this.jTextFieldVersion.getText().equals(msaHeader.getVersion())) { + this.msaHeader.setVersion(this.jTextFieldVersion.getText()); + } else { + return; + } } // @@ -928,16 +1263,20 @@ public class MsaHeader extends IInternalFrame { // if (arg0.getSource() == this.jTextFieldAbstract) { if (isEmpty(this.jTextFieldAbstract.getText())) { - Log.err("Abstract couldn't be empty"); + Log.wrn("Update Msa Header", "Abstract must be entered!"); //this.jTextFieldAbstract.requestFocus(); return; } if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) { - Log.err("Incorrect data type for Abstract"); + Log.wrn("Update Msa Header", "Incorrect data type for Abstract, it must be sentence."); //this.jTextFieldAbstract.requestFocus(); return; } - this.msaHeader.setAbstract(this.jTextFieldAbstract.getText()); + if (!this.jTextFieldAbstract.getText().equals(msaHeader.getAbstract())) { + this.msaHeader.setAbstract(this.jTextFieldAbstract.getText()); + } else { + return; + } } // @@ -945,23 +1284,31 @@ public class MsaHeader extends IInternalFrame { // if (arg0.getSource() == this.jTextAreaDescription) { if (isEmpty(this.jTextAreaDescription.getText())) { - Log.err("Description couldn't be empty"); + Log.wrn("Update Msa Header", "Description must be entered!"); //this.jTextAreaDescription.requestFocus(); return; } - this.msaHeader.setDescription(this.jTextAreaDescription.getText()); + if (!this.jTextAreaDescription.getText().equals(msaHeader.getDescription())) { + this.msaHeader.setDescription(this.jTextAreaDescription.getText()); + } else { + return; + } } // // Check Copyright // - if (arg0.getSource() == this.jTextFieldCopyright) { - if (isEmpty(this.jTextFieldCopyright.getText())) { - Log.err("Copyright couldn't be empty"); + if (arg0.getSource() == this.jTextAreaCopyright) { + if (isEmpty(this.jTextAreaCopyright.getText())) { + Log.wrn("Update Msa Header", "Copyright must be entered!"); //this.jTextFieldCopyright.requestFocus(); return; } - this.msaHeader.setDescription(this.jTextFieldCopyright.getText()); + if (!this.jTextAreaCopyright.getText().equals(msaHeader.getCopyright())) { + this.msaHeader.setCopyright(this.jTextAreaCopyright.getText()); + } else { + return; + } } // @@ -969,12 +1316,16 @@ public class MsaHeader extends IInternalFrame { // if (arg0.getSource() == this.jTextAreaLicense) { if (isEmpty(this.jTextAreaLicense.getText())) { - Log.err("License couldn't be empty"); + Log.wrn("Update Msa Header", "License must be entered!"); //this.jTextAreaLicense.requestFocus(); return; } if (this.msaHeader.getLicense() != null) { - this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText()); + if (!this.jTextAreaLicense.getText().equals(msaHeader.getLicense().getStringValue())) { + this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText()); + } else { + return; + } } else { License mLicense = License.Factory.newInstance(); mLicense.setStringValue(this.jTextAreaLicense.getText()); @@ -992,11 +1343,315 @@ public class MsaHeader extends IInternalFrame { mLicense.setURL(this.jTextFieldURL.getText()); this.msaHeader.setLicense(mLicense); } else { - this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText()); + if (!this.jTextFieldURL.getText().equals(msaHeader.getLicense().getURL())) { + this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText()); + } else { + return; + } + } + } + } + + // + // Check Output File Basename + // + if (arg0.getSource() == this.jTextFieldOutputFileBasename) { + if (isEmpty(this.jTextFieldOutputFileBasename.getText())) { + Log.wrn("Update Msa Header", "Output File Basename must be entered!"); + // jTextFieldOutputFileBasename.removeFocusListener(this); + // jTextFieldOutputFileBasename.requestFocus(); + // jTextFieldOutputFileBasename.addFocusListener(this); + return; + } + if (!this.jTextFieldOutputFileBasename.getText().equals(md.getOutputFileBasename())) { + this.md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText()); + } else { + return; + } + } + + // + // Check Binary Module Type + // + if (arg0.getSource() == this.jRadioButtonBinaryModuleTrue) { + if (jRadioButtonBinaryModuleTrue.isSelected()) { + if (md.getBinaryModule()) { + return; + } else { + md.setBinaryModule(true); + } + } + } + + // + // Check Binary Module Type + // + if (arg0.getSource() == this.jRadioButtonBinaryModuleFalse) { + if (jRadioButtonBinaryModuleFalse.isSelected()) { + if (md.getBinaryModule()) { + md.setBinaryModule(false); + } else { + return; + } + } + } + + // + // Check Supported Arch + // + if (arg0.getSource() == this.jCheckBoxArm || arg0.getSource() == this.jCheckBoxEbc + || arg0.getSource() == this.jCheckBoxIa32 || arg0.getSource() == this.jCheckBoxIpf + || arg0.getSource() == this.jCheckBoxPpc || arg0.getSource() == this.jCheckBoxX64) { + if (!this.getSelectedItemsString().equals(md.getSupportedArchitectures().toString())) { + md.setSupportedArchitectures(this.getSelectedItemsVector()); + } else { + return; + } + } + + // + // Check Pcd is Driver + // + if (arg0.getSource() == this.jCheckBoxPcd || arg0.getSource() == this.jComboBoxPcdIsDriver) { + if ((this.ex == null) && this.jCheckBoxPcd.isSelected()) { + this.ex = ExternsDocument.Externs.Factory.newInstance(); + this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem() + .toString())); + this.msa.setExterns(this.ex); + } else if ((this.ex != null) && (this.ex.getPcdIsDriver() == null) && this.jCheckBoxPcd.isSelected()) { + this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem() + .toString())); + this.msa.setExterns(this.ex); + } else if ((this.ex != null) && (this.ex.getPcdIsDriver() != null)) { + if (this.jCheckBoxPcd.isSelected() + && !this.jComboBoxPcdIsDriver.getSelectedItem().toString().equals( + this.ex.getPcdIsDriver() + .toString())) { + this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getSelectedItem() + .toString())); + this.msa.setExterns(this.ex); + } + if (!this.jCheckBoxPcd.isSelected()) { + ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance(); + if (this.ex.getExternList() != null) { + for (int index = 0; index < this.ex.getExternList().size(); index++) { + newEx.addNewExtern(); + newEx.setExternArray(index, this.ex.getExternArray(index)); + } + } + if (this.ex.getSpecificationList() != null) { + for (int index = 0; index < this.ex.getSpecificationList().size(); index++) { + newEx.addNewSpecification(); + newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index)); + } + } + if (this.ex.getTianoR8FlashMapH()) { + newEx.setTianoR8FlashMapH(this.ex.getTianoR8FlashMapH()); + } + this.ex = newEx; + this.msa.setExterns(this.ex); + } + } + } + + // + // Check Flash Map + // + if (arg0.getSource() == this.jCheckBoxFlashMap) { + if ((this.ex == null) && this.jCheckBoxFlashMap.isSelected()) { + this.ex = ExternsDocument.Externs.Factory.newInstance(); + this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected()); + this.msa.setExterns(this.ex); + } else if ((this.ex != null) && this.jCheckBoxFlashMap.isSelected()) { + this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected()); + this.msa.setExterns(this.ex); + } else if ((this.ex != null) && !this.jCheckBoxFlashMap.isSelected()) { + ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance(); + if (this.ex.getExternList() != null) { + for (int index = 0; index < this.ex.getExternList().size(); index++) { + newEx.addNewExtern(); + newEx.setExternArray(index, this.ex.getExternArray(index)); + } + } + if (this.ex.getSpecificationList() != null) { + for (int index = 0; index < this.ex.getSpecificationList().size(); index++) { + newEx.addNewSpecification(); + newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index)); + } + } + if (this.ex.getPcdIsDriver() != null) { + newEx.setPcdIsDriver(this.ex.getPcdIsDriver()); } + this.ex = newEx; + this.msa.setExterns(this.ex); } } this.save(); } + + private Vector getSelectedItemsVector() { + Vector v = new Vector(); + if (this.jCheckBoxIa32.isSelected()) { + v.addElement(jCheckBoxIa32.getText()); + } + if (this.jCheckBoxX64.isSelected()) { + v.addElement(jCheckBoxX64.getText()); + } + if (this.jCheckBoxIpf.isSelected()) { + v.addElement(jCheckBoxIpf.getText()); + } + if (this.jCheckBoxEbc.isSelected()) { + v.addElement(jCheckBoxEbc.getText()); + } + if (this.jCheckBoxArm.isSelected()) { + v.addElement(jCheckBoxArm.getText()); + } + if (this.jCheckBoxPpc.isSelected()) { + v.addElement(jCheckBoxPpc.getText()); + } + return v; + } + + private String getSelectedItemsString() { + String s = ""; + if (this.jCheckBoxIa32.isSelected()) { + s = s + jCheckBoxIa32.getText() + " "; + } + if (this.jCheckBoxX64.isSelected()) { + s = s + jCheckBoxX64.getText() + " "; + } + if (this.jCheckBoxIpf.isSelected()) { + s = s + jCheckBoxIpf.getText() + " "; + } + if (this.jCheckBoxEbc.isSelected()) { + s = s + jCheckBoxEbc.getText() + " "; + } + if (this.jCheckBoxArm.isSelected()) { + s = s + jCheckBoxArm.getText() + " "; + } + if (this.jCheckBoxPpc.isSelected()) { + s = s + jCheckBoxPpc.getText() + " "; + } + return s.trim(); + } + + private void setAllItemsSelected(boolean isSelected) { + this.jCheckBoxIa32.setSelected(isSelected); + this.jCheckBoxX64.setSelected(isSelected); + this.jCheckBoxIpf.setSelected(isSelected); + this.jCheckBoxEbc.setSelected(isSelected); + this.jCheckBoxArm.setSelected(isSelected); + this.jCheckBoxPpc.setSelected(isSelected); + } + + private void setSelectedItems(Vector v) { + setAllItemsSelected(false); + if (v != null) { + for (int index = 0; index < v.size(); index++) { + if (v.get(index).equals(this.jCheckBoxIa32.getText())) { + this.jCheckBoxIa32.setSelected(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxIpf.getText())) { + this.jCheckBoxIpf.setSelected(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxX64.getText())) { + this.jCheckBoxX64.setSelected(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxEbc.getText())) { + this.jCheckBoxEbc.setSelected(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxArm.getText())) { + this.jCheckBoxArm.setSelected(true); + continue; + } + if (v.get(index).equals(this.jCheckBoxPpc.getText())) { + this.jCheckBoxPpc.setSelected(true); + continue; + } + } + } + } + + /** + * This method initializes jCheckBoxPcd + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxPcd() { + if (jCheckBoxPcd == null) { + jCheckBoxPcd = new JCheckBox(); + jCheckBoxPcd.setBounds(new java.awt.Rectangle(labelCol, 530, labelWidth, 20)); + jCheckBoxPcd.setText("Is this a PCD Driver?"); + jCheckBoxPcd.addFocusListener(this); + jCheckBoxPcd.addActionListener(this); + } + return jCheckBoxPcd; + } + + /** + * This method initializes jCheckBoxFlashMap + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxFlashMap() { + if (jCheckBoxFlashMap == null) { + jCheckBoxFlashMap = new JCheckBox(); + jCheckBoxFlashMap.setBounds(new java.awt.Rectangle(labelCol, 555, 480, 20)); + jCheckBoxFlashMap.setText("Does this module require a legacy FlashMap header file?"); + jCheckBoxFlashMap.addFocusListener(this); + } + return jCheckBoxFlashMap; + } + + /** + * This method initializes jRadioButtonBinaryModuleTrue + * + * @return javax.swing.JRadioButton + */ + private JRadioButton getJRadioButtonBinaryModuleTrue() { + if (jRadioButtonBinaryModuleTrue == null) { + jRadioButtonBinaryModuleTrue = new JRadioButton(); + jRadioButtonBinaryModuleTrue.setBounds(new java.awt.Rectangle(valueCol, 480, 140, 20)); + jRadioButtonBinaryModuleTrue.setText("True"); + jRadioButtonBinaryModuleTrue.setSelected(true); + jRadioButtonBinaryModuleTrue.addFocusListener(this); + jRadioButtonBinaryModuleTrue.setToolTipText("Modules are either source modules
" + + "which can be compiled or binary
" + + "modules which are linked.
" + + "A module cannot contain both.
" + + "The GUID numbers should be identical
" + + "for a binary and source MSA,
" + + "however the BINARY MSA should have
" + + "a higher version number."); + } + return jRadioButtonBinaryModuleTrue; + } + + /** + * This method initializes jRadioButtonBinaryModuleFalse + * + * @return javax.swing.JRadioButton + */ + private JRadioButton getJRadioButtonBinaryModuleFalse() { + if (jRadioButtonBinaryModuleFalse == null) { + jRadioButtonBinaryModuleFalse = new JRadioButton(); + jRadioButtonBinaryModuleFalse.setBounds(new java.awt.Rectangle(valueCol + 140, 480, 140, 20)); + jRadioButtonBinaryModuleFalse.setText("False"); + jRadioButtonBinaryModuleFalse.addFocusListener(this); + jRadioButtonBinaryModuleFalse.setToolTipText("Modules are either source modules
" + + "which can be compiled or binary
" + + "modules which are linked.
" + + "A module cannot contain both.
" + + "The GUID numbers should be identical
" + + "for a binary and source MSA,
" + + "however the BINARY MSA should have
" + + "a higher version number."); + } + return jRadioButtonBinaryModuleFalse; + } }