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=a180910a9f02ac8b88f9c1330bbc0c477ad0194a;hp=c4576a8327bedc85ab024f63bcf8af0b5aa5cb68;hb=9d0ac02b2d2139bb378eb53c1182d34607307590;hpb=a13899c5acad2f5e125abdae972b4c3d1e522f69 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 c4576a8327..a180910a9f 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,10 @@ 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.JButton; +import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; @@ -27,6 +29,7 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; +import org.tianocore.ModuleDefinitionsDocument; import org.tianocore.ModuleSurfaceAreaDocument; import org.tianocore.ModuleTypeDef; import org.tianocore.MsaHeaderDocument; @@ -35,8 +38,8 @@ import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.EnumerationData; import org.tianocore.frameworkwizard.common.Log; -import org.tianocore.frameworkwizard.common.OpeningModuleType; 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; @@ -54,6 +57,10 @@ public class MsaHeader extends IInternalFrame { /// private static final long serialVersionUID = -8152099582923006900L; + private int dialogWidth = 500; + + private int dialogHeight = 630; + // //Define class members // @@ -103,6 +110,26 @@ public class MsaHeader extends IInternalFrame { private JComboBox jComboBoxModuleType = null; + private JLabel jLabelArch = null; + + private JLabel jLabelBinaryModule = null; + + private JComboBox jComboBoxBinaryModule = 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 +148,132 @@ public class MsaHeader extends IInternalFrame { private StarLabel jStarLabel12 = null; + private StarLabel jStarLabel13 = null; + + private StarLabel jStarLabel14 = null; + +// private StarLabel jStarLabel15 = 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; + + // + // Not used for UI + // private MsaHeaderDocument.MsaHeader msaHeader = null; + private ModuleDefinitionsDocument.ModuleDefinitions md = null; + private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; - private JTextField jTextFieldCopyright = null; + private OpeningModuleType omt = null; - private JLabel jLabelURL = null; + private EnumerationData ed = new EnumerationData(); - private JTextField jTextFieldURL = null; + /** + * This method initializes jCheckBoxIa32 + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxIa32() { + if (jCheckBoxIa32 == null) { + jCheckBoxIa32 = new JCheckBox(); + jCheckBoxIa32.setBounds(new java.awt.Rectangle(160, 505, 55, 20)); + jCheckBoxIa32.setText("IA32"); + jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxIa32.addFocusListener(this); + } + return jCheckBoxIa32; + } - private JScrollPane jScrollPane = null; + /** + * This method initializes jCheckBoxX64 + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxX64() { + if (jCheckBoxX64 == null) { + jCheckBoxX64 = new JCheckBox(); + jCheckBoxX64.setBounds(new java.awt.Rectangle(215, 505, 53, 20)); + jCheckBoxX64.setText("X64"); + jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxX64.addFocusListener(this); + } + return jCheckBoxX64; + } - private OpeningModuleType omt = null; + /** + * This method initializes jCheckBoxIpf + * + * @return javax.swing.JCheckBox + */ + private JCheckBox getJCheckBoxIpf() { + if (jCheckBoxIpf == null) { + jCheckBoxIpf = new JCheckBox(); + jCheckBoxIpf.setBounds(new java.awt.Rectangle(270, 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(325, 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(380, 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(435, 505, 53, 20)); + jCheckBoxPpc.setText("PPC"); + jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT); + jCheckBoxPpc.addFocusListener(this); + } + return jCheckBoxPpc; + } /** This method initializes jTextFieldBaseName @@ -147,7 +287,7 @@ public class MsaHeader extends IInternalFrame { jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 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; } @@ -165,7 +305,7 @@ public class MsaHeader extends IInternalFrame { jTextFieldGuid.setLocation(new java.awt.Point(160, 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; } @@ -183,7 +323,7 @@ public class MsaHeader extends IInternalFrame { jTextFieldVersion.setLocation(new java.awt.Point(160, 85)); jTextFieldVersion.setSize(new java.awt.Dimension(320, 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; } @@ -218,7 +358,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 +377,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; } @@ -248,18 +394,16 @@ public class MsaHeader extends IInternalFrame { private JTextField getJTextFieldSpecification() { if (jTextFieldSpecification == null) { jTextFieldSpecification = new JTextField(); + jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"); + jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052"); + jTextFieldSpecification.setBorder(null); + + jTextFieldSpecification.setSize(new java.awt.Dimension(320, 20)); - jTextFieldSpecification.setLocation(new java.awt.Point(160, 435)); + jTextFieldSpecification.setLocation(new java.awt.Point(2, 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; } @@ -311,7 +455,7 @@ public class MsaHeader extends IInternalFrame { 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.setLocation(new java.awt.Point(160, 305)); jScrollPaneLicense.setViewportView(getJTextAreaLicense()); jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(320, 120)); } @@ -349,7 +493,7 @@ public class MsaHeader extends IInternalFrame { jTextFieldAbstract.setLocation(new java.awt.Point(160, 110)); jTextFieldAbstract.setSize(new java.awt.Dimension(320, 20)); jTextFieldAbstract.addFocusListener(this); - jTextFieldAbstract.setToolTipText("A one sentence description of this module"); + jTextFieldAbstract.setToolTipText("A one sentence description of this module."); } return jTextFieldAbstract; } @@ -371,45 +515,29 @@ public class MsaHeader extends IInternalFrame { } /** - 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.setLocation(new java.awt.Point(160, 430)); jTextFieldURL.setSize(new java.awt.Dimension(320, 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 +546,80 @@ 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(160, 260, 320, 40)); + jScrollPaneCopyright.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneCopyright.setViewportView(getJTextAreaCopyright()); + jScrollPaneCopyright.setSize(new java.awt.Dimension(320, 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, 320, 40)); + jTextAreaCopyright.setToolTipText("One or more copyright lines."); + } + return jTextAreaCopyright; + } + /** + * This method initializes jComboBoxBinaryModule + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxBinaryModule() { + if (jComboBoxBinaryModule == null) { + jComboBoxBinaryModule = new JComboBox(); + jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 480, 320, 20)); + jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxBinaryModule.addFocusListener(this); + jComboBoxBinaryModule.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 jComboBoxBinaryModule; + } + + /** + * This method initializes jTextFieldOutputFileBasename + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldOutputFileBasename() { + if (jTextFieldOutputFileBasename == null) { + jTextFieldOutputFileBasename = new JTextField(); + jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(160, 455, 320, 20)); + jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldOutputFileBasename.addFocusListener(this); + jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names."); + } + return jTextFieldOutputFileBasename; } /** @@ -442,7 +642,20 @@ 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(msa.getMsaHeader()); + init(msa.getModuleDefinitions()); this.setVisible(true); this.setViewMode(false); } @@ -454,14 +667,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 +688,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 +723,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 +743,30 @@ 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.jComboBoxBinaryModule.setSelectedIndex(1); + } else { + this.jComboBoxBinaryModule.setSelectedIndex(0); + } + if (md.getOutputFileBasename() != null) { + this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename()); + } + } + } + /** This method initializes jContentPane @@ -539,7 +778,7 @@ public class MsaHeader extends IInternalFrame { jLabelURL = new JLabel(); jLabelURL.setText("License URL"); - jLabelURL.setLocation(new java.awt.Point(15, 410)); + jLabelURL.setLocation(new java.awt.Point(15, 430)); jLabelURL.setSize(new java.awt.Dimension(140, 20)); jLabelBaseName = new JLabel(); jLabelBaseName.setText("Module Name"); @@ -569,16 +808,27 @@ public class MsaHeader extends IInternalFrame { jLabelCopyright.setSize(new java.awt.Dimension(140, 20)); jLabelLicense = new JLabel(); jLabelLicense.setText("License"); - jLabelLicense.setLocation(new java.awt.Point(15, 285)); + jLabelLicense.setLocation(new java.awt.Point(15, 305)); jLabelLicense.setSize(new java.awt.Dimension(140, 20)); + jLabelOutputFileBasename = new JLabel(); + jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(15, 455, 140, 20)); + jLabelOutputFileBasename.setText("Output File Basename"); + jLabelBinaryModule = new JLabel(); + jLabelBinaryModule.setBounds(new java.awt.Rectangle(15, 480, 140, 20)); + jLabelBinaryModule.setText("Binary Module"); + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 505, 140, 20)); + jLabelArch.setText("Supported Architectures"); jLabelSpecification = new JLabel(); jLabelSpecification.setText("Specification"); - jLabelSpecification.setLocation(new java.awt.Point(14, 435)); + jLabelSpecification.setLocation(new java.awt.Point(14, 530)); jLabelSpecification.setSize(new java.awt.Dimension(140, 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 +840,7 @@ public class MsaHeader extends IInternalFrame { jContentPane.add(jLabelLicense, null); jContentPane.add(jLabelCopyright, null); jContentPane.add(jLabelDescription, null); - jContentPane.add(jLabelSpecification, null); +// jContentPane.add(jLabelSpecification, null); jContentPane.add(getJTextFieldSpecification(), null); jContentPane.add(getJButtonOk(), null); jContentPane.add(getJButtonCancel(), null); @@ -602,7 +852,12 @@ 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(getJComboBoxBinaryModule(), null); + jContentPane.add(jLabelArch, null); + jStarLabel1 = new StarLabel(); jStarLabel1.setLocation(new java.awt.Point(0, 10)); jStarLabel2 = new StarLabel(); @@ -616,11 +871,17 @@ 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)); +// jStarLabel15 = new StarLabel(); +// jStarLabel15.setLocation(new java.awt.Point(0, 530)); jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel2, null); @@ -631,6 +892,17 @@ 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(jStarLabel15, 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); } return jContentPane; } @@ -676,12 +948,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 +962,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 +976,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 +990,12 @@ 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 +1004,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 +1012,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 +1022,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 +1031,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 +1055,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 +1072,8 @@ public class MsaHeader extends IInternalFrame { private void initFrame() { EnumerationData ed = new EnumerationData(); Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType()); + Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean()); + this.setSelectedItems(ed.getVSupportedArchitectures()); } /** @@ -845,17 +1105,20 @@ 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, + 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.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth); + + Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth, DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON); } @@ -863,29 +1126,37 @@ public class MsaHeader extends IInternalFrame { 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 +1164,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 +1206,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 +1227,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 +1259,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 +1286,152 @@ 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.jComboBoxBinaryModule) { + if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.TRUE)) { + if (md.getBinaryModule()) { + return; + } else { + md.setBinaryModule(true); + } + } else if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.FALSE)) { + 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; + } + } + 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; + } + } + } + } }