X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdHeader.java;h=6265f27fefc1b9fd2a8f2d70351bf748f4242965;hp=d897959aeaf9474daf9f691ef7baa8e814e52e76;hb=01fa6a61998d6b38fd1a7edd6f57739b19791826;hpb=440537339ee813c0d52ab4e88746cd3fe42fdc33 diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java index d897959aea..6265f27fef 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java @@ -20,9 +20,12 @@ import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; +import java.util.Vector; import javax.swing.JButton; +import javax.swing.JFrame; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -33,8 +36,8 @@ import javax.swing.JTextField; import org.tianocore.PlatformSurfaceAreaDocument; import org.tianocore.frameworkwizard.common.DataValidation; -import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Tools; +import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; @@ -47,11 +50,55 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel; **/ public class FpdHeader extends IInternalFrame { + private int dialogWidth = 560; + + private int labelColumn = 12; + + private int labelWidth = 155; + + private int buttonWidth = 60; + + private final int valueColumn = 168; + + private final int valueWidth = 320; + + private final int specWidth = 420; + + private int shortValueWidth = valueWidth - (buttonWidth + 5); + + private final int oneRowHeight = 20; + + private final int threeRowHeight = 60; + + private final int fourRowHeight = 80; + + private final int rowSep = 5; + + private final int rowOne = 12; + + private final int rowTwo = rowOne + oneRowHeight + rowSep; + + private final int rowThree = rowTwo + oneRowHeight + rowSep; + + private final int rowFour = rowThree + oneRowHeight + rowSep; + + private final int rowFive = rowFour + threeRowHeight + rowSep; + + private final int rowSix = rowFive + fourRowHeight + rowSep; + + private final int rowSeven = rowSix + oneRowHeight + rowSep; + + private final int rowEight = rowSeven + oneRowHeight + rowSep; + + private final int rowNine = rowEight + fourRowHeight + threeRowHeight +rowSep; + + private int dialogHeight = rowNine + threeRowHeight; /// /// Define class Serial Version UID /// private static final long serialVersionUID = -8152099582923006900L; + static JFrame frame; // //Define class members // @@ -81,8 +128,6 @@ public class FpdHeader extends IInternalFrame { private JTextArea jTextAreaDescription = null; - private JLabel jLabelSpecification = null; - private JTextField jTextFieldSpecification = null; private JButton jButtonOk = null; @@ -92,6 +137,8 @@ public class FpdHeader extends IInternalFrame { private JScrollPane jScrollPaneLicense = null; private JScrollPane jScrollPaneDescription = null; + + private JScrollPane jCopyrightScrollPane = null; private JLabel jLabelAbstract = null; @@ -107,21 +154,19 @@ public class FpdHeader extends IInternalFrame { private StarLabel jStarLabel5 = null; - private StarLabel jStarLabel6 = null; - private StarLabel jStarLabel7 = null; private StarLabel jStarLabel8 = null; - - private StarLabel jStarLabel9 = null; - private JTextField jTextFieldCopyright = null; + private JTextArea jCopyrightTextArea = null; private JLabel jLabel = null; - private JTextField jTextField = null; + private JTextField jTextFieldUrl = null; private FpdFileContents ffc = null; + + private OpeningPlatformType docConsole = null; /** This method initializes jTextFieldBaseName @@ -132,10 +177,18 @@ public class FpdHeader extends IInternalFrame { private JTextField getJTextFieldBaseName() { if (jTextFieldBaseName == null) { jTextFieldBaseName = new JTextField(); - jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320,20)); + jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight)); + jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight)); jTextFieldBaseName.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { + if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) { + JOptionPane.showMessageDialog(frame, "Package Name does not match the UiNameType datatype."); + return; + } + if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) { + return; + } + docConsole.setSaved(false); ffc.setFpdHdrPlatformName(jTextFieldBaseName.getText()); } }); @@ -152,10 +205,18 @@ public class FpdHeader extends IInternalFrame { private JTextField getJTextFieldGuid() { if (jTextFieldGuid == null) { jTextFieldGuid = new JTextField(); - jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 250, 20)); - jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250,20)); + jTextFieldGuid.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight)); + jTextFieldGuid.setPreferredSize(new java.awt.Dimension(shortValueWidth,oneRowHeight)); jTextFieldGuid.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { + if (!DataValidation.isGuid(jTextFieldGuid.getText())) { + JOptionPane.showMessageDialog(frame, "Guid must be in registry (8-4-4-4-12) format."); + return; + } + if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) { + return; + } + docConsole.setSaved(false); ffc.setFpdHdrGuidValue(jTextFieldGuid.getText()); } }); @@ -172,10 +233,18 @@ public class FpdHeader extends IInternalFrame { private JTextField getJTextFieldVersion() { if (jTextFieldVersion == null) { jTextFieldVersion = new JTextField(); - jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jTextFieldVersion.setPreferredSize(new java.awt.Dimension(320,20)); + jTextFieldVersion.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight)); + jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight)); jTextFieldVersion.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { + if (!DataValidation.isVersion(jTextFieldVersion.getText())) { + JOptionPane.showMessageDialog(frame, "Version does not match the Version datatype."); + return; + } + if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) { + return; + } + docConsole.setSaved(false); ffc.setFpdHdrVer(jTextFieldVersion.getText()); } }); @@ -192,7 +261,7 @@ public class FpdHeader extends IInternalFrame { private JButton getJButtonGenerateGuid() { if (jButtonGenerateGuid == null) { jButtonGenerateGuid = new JButton(); - jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20)); + jButtonGenerateGuid.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight)); jButtonGenerateGuid.setText("GEN"); jButtonGenerateGuid.addActionListener(this); } @@ -209,10 +278,17 @@ public class FpdHeader extends IInternalFrame { if (jTextAreaLicense == null) { jTextAreaLicense = new JTextArea(); jTextAreaLicense.setText(""); - jTextAreaLicense.setPreferredSize(new java.awt.Dimension(317,77)); jTextAreaLicense.setLineWrap(true); jTextAreaLicense.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { + if (jTextAreaLicense.getText().length() == 0) { + JOptionPane.showMessageDialog(frame, "License must be entered!"); + return; + } + if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) { + return; + } + docConsole.setSaved(false); ffc.setFpdHdrLicense(jTextAreaLicense.getText()); } }); @@ -230,9 +306,16 @@ public class FpdHeader extends IInternalFrame { if (jTextAreaDescription == null) { jTextAreaDescription = new JTextArea(); jTextAreaDescription.setLineWrap(true); - jTextAreaDescription.setPreferredSize(new java.awt.Dimension(317,77)); jTextAreaDescription.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { + if (jTextAreaDescription.getText().length() == 0) { + JOptionPane.showMessageDialog(frame, "Description must be entered."); + return; + } + if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) { + return; + } + docConsole.setSaved(false); ffc.setFpdHdrDescription(jTextAreaDescription.getText()); } }); @@ -249,9 +332,10 @@ public class FpdHeader extends IInternalFrame { private JTextField getJTextFieldSpecification() { if (jTextFieldSpecification == null) { jTextFieldSpecification = new JTextField(); - jTextFieldSpecification.setBounds(new java.awt.Rectangle(160, 305, 320, 20)); + jTextFieldSpecification.setBounds(new java.awt.Rectangle(labelColumn,rowNine,specWidth,oneRowHeight)); jTextFieldSpecification.setEditable(false); - jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320,20)); + jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth,oneRowHeight)); + jTextFieldSpecification.setBorder(null); jTextFieldSpecification.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { ffc.setFpdHdrSpec(jTextFieldSpecification.getText()); @@ -304,9 +388,9 @@ public class FpdHeader extends IInternalFrame { private JScrollPane getJScrollPaneLicense() { if (jScrollPaneLicense == null) { jScrollPaneLicense = new JScrollPane(); - jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80)); + jScrollPaneLicense.setBounds(new java.awt.Rectangle(valueColumn,rowFive,valueWidth,fourRowHeight)); jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(320,80)); + jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth,fourRowHeight)); jScrollPaneLicense.setViewportView(getJTextAreaLicense()); } return jScrollPaneLicense; @@ -321,8 +405,9 @@ public class FpdHeader extends IInternalFrame { private JScrollPane getJScrollPaneDescription() { if (jScrollPaneDescription == null) { jScrollPaneDescription = new JScrollPane(); - jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 220, 320, 80)); + jScrollPaneDescription.setBounds(new java.awt.Rectangle(valueColumn,rowEight,valueWidth,fourRowHeight)); jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight)); jScrollPaneDescription.setViewportView(getJTextAreaDescription()); } return jScrollPaneDescription; @@ -337,10 +422,18 @@ public class FpdHeader extends IInternalFrame { private JTextField getJTextFieldAbstract() { if (jTextFieldAbstract == null) { jTextFieldAbstract = new JTextField(); - jTextFieldAbstract.setBounds(new java.awt.Rectangle(160,195,320,20)); - jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldAbstract.setBounds(new java.awt.Rectangle(valueColumn,rowSeven,valueWidth,oneRowHeight)); + jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight)); jTextFieldAbstract.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { + if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) { + JOptionPane.showMessageDialog(frame, "Abstract must be entered."); + return; + } + if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) { + return; + } + docConsole.setSaved(false); ffc.setFpdHdrAbs(jTextFieldAbstract.getText()); } }); @@ -348,24 +441,41 @@ public class FpdHeader extends IInternalFrame { return jTextFieldAbstract; } + private JScrollPane getCopyrightScrollPane() { + if (jCopyrightScrollPane == null) { + jCopyrightScrollPane = new JScrollPane(); + jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight)); + jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight)); + jCopyrightScrollPane.setViewportView(getJCopyrightTextArea()); + } + return jCopyrightScrollPane; + } /** This method initializes jTextFieldCopyright @return javax.swing.JTextField jTextFieldCopyright **/ - private JTextField getJTextFieldCopyright() { - if (jTextFieldCopyright == null) { - jTextFieldCopyright = new JTextField(); - jTextFieldCopyright.setBounds(new java.awt.Rectangle(160,330,320, 20)); - jTextFieldCopyright.setPreferredSize(new java.awt.Dimension(320,20)); - jTextFieldCopyright.addFocusListener(new FocusAdapter(){ + private JTextArea getJCopyrightTextArea() { + if (jCopyrightTextArea == null) { + jCopyrightTextArea = new JTextArea(); + jCopyrightTextArea.setWrapStyleWord(true); + jCopyrightTextArea.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { - ffc.setFpdHdrCopyright(jTextFieldCopyright.getText()); + if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) { + JOptionPane.showMessageDialog(frame, "Copyright must be entered."); + return; + } + if (jCopyrightTextArea.getText().equals(ffc.getFpdHdrCopyright())) { + return; + } + docConsole.setSaved(false); + ffc.setFpdHdrCopyright(jCopyrightTextArea.getText()); } }); } - return jTextFieldCopyright; + return jCopyrightTextArea; } /** @@ -373,19 +483,26 @@ public class FpdHeader extends IInternalFrame { * * @return javax.swing.JTextField */ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(160,170,320,20)); - jTextField.setPreferredSize(new Dimension(320, 20)); - jTextField.addFocusListener(new FocusAdapter(){ + private JTextField getJTextFieldUrl() { + if (jTextFieldUrl == null) { + jTextFieldUrl = new JTextField(); + jTextFieldUrl.setBounds(new java.awt.Rectangle(valueColumn,rowSix,valueWidth,oneRowHeight)); + jTextFieldUrl.setPreferredSize(new Dimension(valueWidth, oneRowHeight)); + jTextFieldUrl.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e){ + if (jTextFieldUrl.getText().length() == 0 && ffc.getFpdHdrUrl() == null) { + return; + } + if (jTextFieldUrl.getText().equals(ffc.getFpdHdrUrl())) { + return; + } ffc.setFpdHdrLicense(jTextAreaLicense.getText()); - ffc.setFpdHdrUrl(jTextField.getText()); + ffc.setFpdHdrUrl(jTextFieldUrl.getText()); + docConsole.setSaved(false); } }); } - return jTextField; + return jTextFieldUrl; } public static void main(String[] args) { @@ -414,6 +531,11 @@ public class FpdHeader extends IInternalFrame { init(ffc); } + + public FpdHeader(OpeningPlatformType opt) { + this(opt.getXmlFpd()); + docConsole = opt; + } /** This method initializes this @@ -422,7 +544,7 @@ public class FpdHeader extends IInternalFrame { private void init() { //this.setSize(500, 515); this.setContentPane(getJContentPane()); - this.setTitle("Package Surface Area Header"); + this.setTitle("Platform Surface Area Header"); initFrame(); } @@ -452,10 +574,10 @@ public class FpdHeader extends IInternalFrame { jTextFieldAbstract.setText(ffc.getFpdHdrAbs()); } if (ffc.getFpdHdrUrl() != null) { - jTextField.setText(ffc.getFpdHdrUrl()); + jTextFieldUrl.setText(ffc.getFpdHdrUrl()); } if (ffc.getFpdHdrCopyright() != null) { - jTextFieldCopyright.setText(ffc.getFpdHdrCopyright()); + jCopyrightTextArea.setText(ffc.getFpdHdrCopyright()); } if (ffc.getFpdHdrDescription() != null) { jTextAreaDescription.setText(ffc.getFpdHdrDescription()); @@ -463,7 +585,24 @@ public class FpdHeader extends IInternalFrame { if (ffc.getFpdHdrSpec() != null) { jTextFieldSpecification.setText(ffc.getFpdHdrSpec()); } - + ffc.setFpdHdrSpec(jTextFieldSpecification.getText()); + + ffc.genPlatformDefsSkuInfo("0", "DEFAULT"); + Vector v = new Vector(); + ffc.getPlatformDefsSupportedArchs(v); + if (v.size() == 0) { + v.add("IA32"); + ffc.setPlatformDefsSupportedArchs(v); + } + v.removeAllElements(); + ffc.getPlatformDefsBuildTargets(v); + if (v.size() == 0) { + v.add("DEBUG"); + ffc.setPlatformDefsBuildTargets(v); + } + if (ffc.getPlatformDefsInterDir() == null) { + ffc.setPlatformDefsInterDir("UNIFIED"); + } } /** @@ -474,38 +613,51 @@ public class FpdHeader extends IInternalFrame { **/ private JPanel getJContentPane() { if (jContentPane == null) { - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(15,170,140,20)); - jLabel.setText("URL"); - jContentPane = new JPanel(); + jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.setLocation(new java.awt.Point(0, 0)); - jContentPane.setSize(new java.awt.Dimension(500,423)); + jContentPane.setSize(new java.awt.Dimension(dialogWidth - 20 ,dialogHeight - 20)); + + jLabel = new JLabel(); + jLabel.setBounds(new java.awt.Rectangle(labelColumn,rowSix,labelWidth,oneRowHeight)); + jLabel.setText("URL"); jLabelAbstract = new JLabel(); - jLabelAbstract.setBounds(new java.awt.Rectangle(15, 195, 140, 20)); + jLabelAbstract.setBounds(new java.awt.Rectangle(labelColumn,rowSeven,labelWidth,oneRowHeight)); jLabelAbstract.setText("Abstract"); - jLabelSpecification = new JLabel(); - jLabelSpecification.setText("Specification"); - jLabelSpecification.setBounds(new java.awt.Rectangle(15, 305, 140, 20)); jLabelDescription = new JLabel(); jLabelDescription.setText("Description"); - jLabelDescription.setBounds(new java.awt.Rectangle(15, 220, 140, 20)); + jLabelDescription.setBounds(new java.awt.Rectangle(labelColumn,rowEight,labelWidth,oneRowHeight)); jLabelCopyright = new JLabel(); jLabelCopyright.setText("Copyright"); - jLabelCopyright.setBounds(new java.awt.Rectangle(15, 330, 140, 20)); + jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn,rowFour,labelWidth,oneRowHeight)); jLabelLicense = new JLabel(); jLabelLicense.setText("License"); - jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); + jLabelLicense.setBounds(new java.awt.Rectangle(labelColumn,rowFive,labelWidth,oneRowHeight)); jLabelVersion = new JLabel(); jLabelVersion.setText("Version"); - jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); + jLabelVersion.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight)); jLabelGuid = new JLabel(); - jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15)); - jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); + jLabelGuid.setPreferredSize(new java.awt.Dimension(labelWidth, oneRowHeight)); + jLabelGuid.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight)); jLabelGuid.setText("Guid"); jLabelBaseName = new JLabel(); jLabelBaseName.setText("Platform Name"); - jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); + jLabelBaseName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight)); + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(0, rowOne)); + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(0, rowTwo)); + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(0, rowThree)); + jStarLabel4 = new StarLabel(); + jStarLabel4.setLocation(new java.awt.Point(0,rowFour)); + jStarLabel5 = new StarLabel(); + jStarLabel5.setLocation(new java.awt.Point(0,rowFive)); + jStarLabel7 = new StarLabel(); + jStarLabel7.setLocation(new java.awt.Point(0,rowSeven)); + jStarLabel8 = new StarLabel(); + jStarLabel8.setLocation(new java.awt.Point(0,rowEight)); + jContentPane.add(jLabelBaseName, null); jContentPane.add(getJTextFieldBaseName(), null); jContentPane.add(jLabelGuid, null); @@ -516,7 +668,6 @@ public class FpdHeader 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); @@ -524,39 +675,18 @@ public class FpdHeader extends IInternalFrame { jContentPane.add(getJScrollPaneDescription(), null); jContentPane.add(jLabelAbstract, null); jContentPane.add(getJTextFieldAbstract(), null); - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(0, 10)); - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(0, 35)); - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(0, 60)); - jStarLabel4 = new StarLabel(); - jStarLabel4.setLocation(new java.awt.Point(0, 85)); - jStarLabel5 = new StarLabel(); - jStarLabel5.setLocation(new java.awt.Point(0, 330)); - jStarLabel6 = new StarLabel(); - jStarLabel6.setLocation(new java.awt.Point(0, 195)); - jStarLabel7 = new StarLabel(); - jStarLabel7.setLocation(new java.awt.Point(0, 305)); - jStarLabel7.setEnabled(false); - jStarLabel8 = new StarLabel(); - jStarLabel8.setLocation(new java.awt.Point(0, 220)); - jStarLabel9 = new StarLabel(); - jStarLabel9.setLocation(new java.awt.Point(0, 280)); - jStarLabel9.setVisible(false); + jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel2, null); jContentPane.add(jStarLabel3, null); jContentPane.add(jStarLabel4, null); jContentPane.add(jStarLabel5, null); - jContentPane.add(jStarLabel6, null); jContentPane.add(jStarLabel7, null); jContentPane.add(jStarLabel8, null); - jContentPane.add(jStarLabel9, null); - jContentPane.add(getJTextFieldCopyright(), null); + jContentPane.add(getCopyrightScrollPane(), null); jContentPane.add(jLabel, null); - jContentPane.add(getJTextField(), null); + jContentPane.add(getJTextFieldUrl(), null); } return jContentPane; } @@ -568,92 +698,15 @@ public class FpdHeader extends IInternalFrame { * */ public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.setEdited(true); - } - if (arg0.getSource() == jButtonCancel) { - this.setEdited(false); - } + if (arg0.getSource() == jButtonGenerateGuid) { - //ToDo: invoke GuidValueEditor + docConsole.setSaved(false); jTextFieldGuid.setText(Tools.generateUuidString()); ffc.setFpdHdrGuidValue(jTextFieldGuid.getText()); } } - /** - Data validation for all fields - - @retval true - All datas are valid - @retval false - At least one data is invalid - - **/ - public boolean check() { - // - // Check if all required fields are not empty - // - if (isEmpty(this.jTextFieldBaseName.getText())) { - Log.err("Base Name couldn't be empty"); - return false; - } - if (isEmpty(this.jTextFieldGuid.getText())) { - Log.err("Guid couldn't be empty"); - return false; - } - if (isEmpty(this.jTextFieldVersion.getText())) { - Log.err("Version couldn't be empty"); - return false; - } - if (isEmpty(this.jTextAreaLicense.getText())) { - Log.err("License couldn't be empty"); - return false; - } - if (isEmpty(this.jTextFieldCopyright.getText())) { - Log.err("Copyright couldn't be empty"); - return false; - } - if (isEmpty(this.jTextAreaDescription.getText())) { - Log.err("Description couldn't be empty"); - return false; - } - if (isEmpty(this.jTextFieldAbstract.getText())) { - Log.err("Abstract couldn't be empty"); - return false; - } - - // - // Check if all fields have correct data types - // - if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) { - Log.err("Incorrect data type for Base Name"); - return false; - } - if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) { - Log.err("Incorrect data type for Guid"); - return false; - } - if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) { - Log.err("Incorrect data type for Abstract"); - return false; - } - if (!DataValidation.isCopyright(this.jTextFieldCopyright.getText())) { - Log.err("Incorrect data type for Copyright"); - return false; - } - return true; - } - - /** - Save all components of Fpd Header - if exists FpdHeader, set the value directly - if not exists FpdHeader, new an instance first - - **/ - public void save() { - - } - + /** This method initializes Package type and Compontent type @@ -669,17 +722,21 @@ public class FpdHeader extends IInternalFrame { * Override componentResized to resize all components when frame's size is changed */ public void componentResized(ComponentEvent arg0) { - int intPreferredWidth = 500; + int intPreferredWidth = dialogWidth; + int intCurrentWidth = this.getJContentPane().getWidth(); + + // Tools.resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth); + // Tools.resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth); +// Tools.relocateComponentX(this.jButtonGenerateGuid, this.getWidth(), jButtonGenerateGuid.getWidth(), 25); + // Tools.resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth); + // Tools.resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth); + Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldUrl, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth); + Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth); + // Tools.resizeComponentWidth(this.jTextFieldSpecification, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jScrollPaneLicense, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jScrollPaneDescription, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jTextFieldSpecification, this.getWidth(), intPreferredWidth); - resizeComponentWidth(this.jTextFieldAbstract, this.getWidth(), intPreferredWidth); - relocateComponentX(this.jButtonGenerateGuid, this.getWidth(), jButtonGenerateGuid.getWidth(), 25); + } }