Delete useless file SpdPackageDefinitions.java;
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 30 Oct 2006 03:46:11 +0000 (03:46 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 30 Oct 2006 03:46:11 +0000 (03:46 +0000)
Change button texts to Add, Delete, Clear All.
Activate the Read-Only attribute checking for package editors.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1853 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java [deleted file]
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java

index 2357df2b09af997f4694deca97d22a4744ba8fb3..c0c4b2698c3536d8a55652c2097e9002f85a4c5b 100644 (file)
@@ -357,7 +357,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
         if (jButtonRemove == null) {\r
             jButtonRemove = new JButton();\r
             jButtonRemove.setBounds(new java.awt.Rectangle(270,227,90,20));\r
-            jButtonRemove.setText("Remove");\r
+            jButtonRemove.setText("Delete");\r
             jButtonRemove.addActionListener(this);\r
         }\r
         return jButtonRemove;\r
@@ -432,6 +432,10 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
     public SpdGuidDecls(OpeningPackageType opt) {\r
         this(opt.getXmlSpd());\r
         docConsole = opt;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r
+        }\r
+        initFrame();\r
     }\r
     /**\r
       This method initializes this\r
@@ -449,7 +453,6 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
         });\r
         this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r
         this.setVisible(true);\r
-        initFrame();\r
     }\r
 \r
     protected void init(SpdFileContents sfc){\r
@@ -466,6 +469,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
             model.addRow(saa[i]);\r
             i++;\r
         }\r
+        \r
     }\r
     \r
     protected JScrollPane getJContentPane(){\r
@@ -567,7 +571,16 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
     protected void initFrame() {\r
         \r
         this.setTitle("GUID Declarations");\r
-\r
+        \r
+        boolean editable = true;\r
+        if (getSfc().getSpdPkgDefsRdOnly().equals("true")) {\r
+            editable = false;\r
+        }\r
+        \r
+        jButtonAdd.setEnabled(editable);\r
+        jButtonRemove.setEnabled(editable);\r
+        jButtonClearAll.setEnabled(editable);\r
+        jTable.setEnabled(editable);\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -722,7 +735,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
         if (jButtonGen == null) {\r
             jButtonGen = new JButton();\r
             jButtonGen.setBounds(new java.awt.Rectangle(485,58,92,21));\r
-            jButtonGen.setText("Gen GUID");\r
+            jButtonGen.setText("Gen");\r
             jButtonGen.setPreferredSize(new java.awt.Dimension(80,20));\r
             jButtonGen.addActionListener(this);\r
         }\r
@@ -919,6 +932,13 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
     protected JLabel getJLabelGuidType() {\r
         return jLabelGuidType;\r
     }\r
+\r
+    /**\r
+     * @return Returns the sfc.\r
+     */\r
+    protected SpdFileContents getSfc() {\r
+        return sfc;\r
+    }\r
 }\r
 \r
 \r
index ad7783268a0b5c3fa4b8f0b9e10dc006d8876e1d..58701918c913106ebe7ac2f7f41d8e0edbc0c898 100644 (file)
@@ -493,13 +493,13 @@ public class SpdHeader extends IInternalFrame {
             jCheckBoxRdOnly.setText("Read Only");\r
             jCheckBoxRdOnly.setLocation(new java.awt.Point(labelColumn, rowNine));\r
             jCheckBoxRdOnly.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));\r
-            // jCheckBoxRdOnly.setPreferredSize(new java.awt.Dimension(150, oneRowHeight));\r
             jCheckBoxRdOnly.addItemListener(new java.awt.event.ItemListener() {\r
                 public void itemStateChanged(java.awt.event.ItemEvent e) {\r
                     if (docConsole != null) {\r
                         docConsole.setSaved(false);\r
                     }\r
-                    sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected() + "");\r
+                    sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected()+"");\r
+                    initFrame();\r
                 }\r
             });\r
         }\r
@@ -522,7 +522,7 @@ public class SpdHeader extends IInternalFrame {
                     if (docConsole != null) {\r
                         docConsole.setSaved(false);\r
                     }\r
-                    sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected() + "");\r
+                    sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected()+"");\r
                 }\r
             });\r
         }\r
@@ -558,6 +558,7 @@ public class SpdHeader extends IInternalFrame {
     public SpdHeader(OpeningPackageType opt) {\r
         this(opt.getXmlSpd());\r
         docConsole = opt;\r
+        initFrame();\r
     }\r
 \r
     /**\r
@@ -567,7 +568,6 @@ public class SpdHeader extends IInternalFrame {
     private void init() {\r
         this.setContentPane(getTopScrollPane());\r
         this.setTitle("Package Surface Area Header");\r
-        initFrame();\r
     }\r
 \r
     /**\r
@@ -646,9 +646,11 @@ public class SpdHeader extends IInternalFrame {
             jStarLabel7.setLocation(new java.awt.Point(2, rowEight));\r
             jStarLabel8 = new StarLabel();\r
             jStarLabel8.setLocation(new java.awt.Point(2, rowNine));\r
+            jStarLabel8.setVisible(false);\r
             jStarLabel9 = new StarLabel();\r
             jStarLabel9.setLocation(new java.awt.Point(2, rowTen));\r
 \r
+            jStarLabel9.setVisible(false);\r
             jPackageNameLabel = new JLabel();\r
             jPackageNameLabel.setText("Package Name");\r
             jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));\r
@@ -739,7 +741,20 @@ public class SpdHeader extends IInternalFrame {
      \r
      **/\r
     private void initFrame() {\r
-\r
+        boolean editable = true;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            editable = false;\r
+        }\r
+        jPackageNameTextField.setEditable(editable);\r
+        jGuidTextField.setEditable(editable);\r
+        jGenerateGuidButton.setEnabled(editable);\r
+        jVersionTextField.setEditable(editable);\r
+        jCopyrightTextArea.setEditable(editable);\r
+        jLicenseTextArea.setEditable(editable);\r
+        jUrlTextField.setEditable(editable);\r
+        jAbstractTextField.setEditable(editable);\r
+        jDescriptionTextArea.setEditable(editable);\r
+        jCheckBoxRePkg.setEnabled(editable);\r
     }\r
 \r
     /* (non-Javadoc)\r
index a0882d2e772ef293a92f2ab540e925518c0a0b5b..9dac18480a16a426a2fd3f8952c5aa4fe2b48a24 100644 (file)
@@ -407,7 +407,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     private JButton getJButtonRemove() {\r
         if (jButtonRemove == null) {\r
             jButtonRemove = new JButton();\r
-            jButtonRemove.setText("Remove");\r
+            jButtonRemove.setText("Delete");\r
             jButtonRemove.setSize(new java.awt.Dimension(buttonWidth,20));\r
             jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowSeven,buttonWidth,20));\r
             jButtonRemove.addActionListener(this);\r
@@ -423,7 +423,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     private JButton getJButtonRemoveAll() {\r
         if (jButtonRemoveAll == null) {\r
             jButtonRemoveAll = new JButton();\r
-            jButtonRemoveAll.setText("Remove All");\r
+            jButtonRemoveAll.setText("Clear All");\r
             jButtonRemoveAll.setLocation(removeAllButtonCol,rowSeven);\r
             FontMetrics fm = jButtonRemoveAll.getFontMetrics(jButtonRemoveAll.getFont());\r
             jButtonRemoveAll.setSize(fm.stringWidth(jButtonRemoveAll.getText()) + 50, 20);\r
@@ -473,6 +473,12 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     }\r
 \r
     private void init(SpdFileContents sfc) {\r
+\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r
+        }\r
+        initFrame();\r
+        \r
         if (sfc.getSpdLibClassDeclarationCount() == 0) {\r
             return ;\r
         }\r
@@ -491,7 +497,21 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             model.addRow(saa[i]);\r
             i++;\r
         }\r
+        \r
     }\r
+    \r
+    private void initFrame() {\r
+        boolean editable = true;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            editable = false;\r
+        }\r
+        \r
+        jButtonAdd.setEnabled(editable);\r
+        jButtonRemove.setEnabled(editable);\r
+        jButtonRemoveAll.setEnabled(editable);\r
+        jTable.setEnabled(editable);\r
+    }\r
+\r
     private JScrollPane getJContentPane(){\r
         if (topScrollPane == null){\r
           topScrollPane = new JScrollPane();\r
index efaf0ef53fcff072776094b3a0519974a29262c4..283c8972238c735903cf8502c34cb2e604f589bc 100644 (file)
@@ -170,7 +170,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
         if (jButtonRemove == null) {\r
             jButtonRemove = new JButton();\r
             jButtonRemove.setBounds(new java.awt.Rectangle(266,148,90,20));\r
-            jButtonRemove.setText("Remove");\r
+            jButtonRemove.setText("Delete");\r
             jButtonRemove.addActionListener(this);\r
         }\r
         return jButtonRemove;\r
@@ -264,10 +264,15 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
             }\r
         });\r
         this.setVisible(true);\r
-        initFrame();\r
     }\r
 \r
     private void init(SpdFileContents sfc){\r
+\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r
+        }\r
+        initFrame();\r
+        \r
         if (sfc.getSpdMsaFileCount() == 0) {\r
             return ;\r
         }\r
@@ -281,6 +286,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
             model.addRow(saa[i]);\r
             i++;\r
         }\r
+        \r
     }\r
     \r
     private JScrollPane getJScrollPane(){\r
@@ -325,7 +331,15 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
      fill ComboBoxes with pre-defined contents\r
     **/\r
     private void initFrame() {\r
-\r
+        boolean editable = true;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            editable = false;\r
+        }\r
+        \r
+        jButtonAdd.setEnabled(editable);\r
+        jButtonRemove.setEnabled(editable);\r
+        jButtonClearAll.setEnabled(editable);\r
+        jTable.setEnabled(editable);\r
     }\r
 \r
     /* (non-Javadoc)\r
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java
deleted file mode 100644 (file)
index 3931381..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/** @file\r
\r
- The file is used to create, update Package Definitions of Spd file\r
\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution.  The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- **/\r
-package org.tianocore.frameworkwizard.packaging.ui;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JLabel;\r
-import javax.swing.JComboBox;\r
-import java.awt.Dimension;\r
-\r
-import org.tianocore.PackageSurfaceAreaDocument;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
-import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
-\r
-public class SpdPackageDefinitions extends IInternalFrame {\r
-\r
-    /**\r
-     * \r
-     */\r
-    private static final long serialVersionUID = 1L;\r
-    private JPanel jContentPane = null;\r
-    private JLabel jLabelRdOnly = null;\r
-    private JComboBox jComboBoxReadOnly = null;\r
-    private JLabel jLabelRePkg = null;\r
-    private JComboBox jComboBoxRePackage = null;\r
-    private StarLabel starLabel = null;\r
-    private StarLabel starLabel1 = null;\r
-    private SpdFileContents sfc = null;\r
-    private OpeningPackageType docConsole = null;\r
-\r
-    /**\r
-     * This is the default constructor\r
-     */\r
-    public SpdPackageDefinitions() {\r
-        super();\r
-        initialize();\r
-    }\r
-    \r
-    public SpdPackageDefinitions(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){\r
-        this();\r
-        sfc = new SpdFileContents(inPsa);\r
-        init(sfc);\r
-    }\r
-    \r
-    public SpdPackageDefinitions(OpeningPackageType opt) {\r
-        this(opt.getXmlSpd());\r
-        docConsole = opt;\r
-    }\r
-\r
-    private void init(SpdFileContents sfc) {\r
-        if (sfc.getSpdPkgDefsRdOnly() != null) {\r
-            jComboBoxReadOnly.setSelectedItem(sfc.getSpdPkgDefsRdOnly());\r
-        }\r
-        if (sfc.getSpdPkgDefsRePkg() != null) {\r
-            jComboBoxRePackage.setSelectedItem(sfc.getSpdPkgDefsRePkg());\r
-        }\r
-        this.setVisible(true);\r
-    }\r
-    /**\r
-     * This method initializes this\r
-     * \r
-     * @return void\r
-     */\r
-    private void initialize() {\r
-        this.setSize(300, 200);\r
-        this.setTitle("Package Definitions");\r
-        this.setContentPane(getJContentPane());\r
-    }\r
-\r
-    /**\r
-     * This method initializes jContentPane\r
-     * \r
-     * @return javax.swing.JPanel\r
-     */\r
-    private JPanel getJContentPane() {\r
-        if (jContentPane == null) {\r
-            starLabel1 = new StarLabel();\r
-            starLabel1.setBounds(new java.awt.Rectangle(4,62,10,20));\r
-            starLabel1.setVisible(true);\r
-            starLabel = new StarLabel();\r
-            starLabel.setBounds(new java.awt.Rectangle(4,22,10,20));\r
-            jLabelRePkg = new JLabel();\r
-            jLabelRePkg.setPreferredSize(new java.awt.Dimension(65,20));\r
-            jLabelRePkg.setLocation(new java.awt.Point(22,62));\r
-            jLabelRePkg.setSize(new java.awt.Dimension(65,20));\r
-            jLabelRePkg.setText("RePackage");\r
-            jLabelRdOnly = new JLabel();\r
-            jLabelRdOnly.setPreferredSize(new java.awt.Dimension(57,20));\r
-            jLabelRdOnly.setLocation(new java.awt.Point(22,22));\r
-            jLabelRdOnly.setSize(new java.awt.Dimension(57,20));\r
-            jLabelRdOnly.setText("Read Only");\r
-            jContentPane = new JPanel();\r
-            jContentPane.setLayout(null);\r
-            jContentPane.add(jLabelRdOnly, null);\r
-            jContentPane.add(getJComboBox(), null);\r
-            jContentPane.add(jLabelRePkg, null);\r
-            jContentPane.add(getJComboBox1(), null);\r
-            jContentPane.add(starLabel, null);\r
-            jContentPane.add(starLabel1, null);\r
-        }\r
-        return jContentPane;\r
-    }\r
-\r
-    /**\r
-     * This method initializes jComboBox       \r
-     *         \r
-     * @return javax.swing.JComboBox   \r
-     */\r
-    private JComboBox getJComboBox() {\r
-        if (jComboBoxReadOnly == null) {\r
-            jComboBoxReadOnly = new JComboBox();\r
-            jComboBoxReadOnly.setBounds(new java.awt.Rectangle(95,22,117,20));\r
-            jComboBoxReadOnly.setPreferredSize(new Dimension(80, 20));\r
-            jComboBoxReadOnly.addItem("true");\r
-            jComboBoxReadOnly.addItem("false");\r
-            jComboBoxReadOnly.setSelectedIndex(1);\r
-            jComboBoxReadOnly.addItemListener(new java.awt.event.ItemListener() {\r
-                public void itemStateChanged(java.awt.event.ItemEvent e) {\r
-                    if (jComboBoxReadOnly.getSelectedItem().equals(sfc.getSpdPkgDefsRdOnly())) {\r
-                        return;\r
-                    }\r
-                    if (docConsole != null) {\r
-                        docConsole.setSaved(false);\r
-                    }\r
-                    sfc.setSpdPkgDefsRdOnly(jComboBoxReadOnly.getSelectedItem()+"");\r
-                }\r
-            });\r
-        }\r
-        return jComboBoxReadOnly;\r
-    }\r
-\r
-    /**\r
-     * This method initializes jComboBox1      \r
-     *         \r
-     * @return javax.swing.JComboBox   \r
-     */\r
-    private JComboBox getJComboBox1() {\r
-        if (jComboBoxRePackage == null) {\r
-            jComboBoxRePackage = new JComboBox();\r
-            jComboBoxRePackage.setBounds(new java.awt.Rectangle(95,62,116,20));\r
-            jComboBoxRePackage.setPreferredSize(new Dimension(80, 20));\r
-            jComboBoxRePackage.addItem("false");\r
-            jComboBoxRePackage.addItem("true");\r
-            jComboBoxRePackage.setSelectedIndex(0);\r
-            jComboBoxRePackage.addItemListener(new java.awt.event.ItemListener() {\r
-                public void itemStateChanged(java.awt.event.ItemEvent e) {\r
-                    if (jComboBoxRePackage.getSelectedItem().equals(sfc.getSpdPkgDefsRePkg())) {\r
-                        return;\r
-                    }\r
-                    if (docConsole != null) {\r
-                        docConsole.setSaved(false);\r
-                    }\r
-                    sfc.setSpdPkgDefsRePkg(jComboBoxRePackage.getSelectedItem()+"");\r
-                }\r
-            });\r
-        }\r
-        return jComboBoxRePackage;\r
-    }\r
-\r
-}\r
index 8ee8805433a5da0d5d527fb7d8a40df8a229b741..5691e77654cea62bfbfa8fc674eec486ea49eee0 100644 (file)
@@ -189,7 +189,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
         if (jButtonRemove == null) {\r
             jButtonRemove = new JButton();\r
             jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowFour,buttonWidth,20));\r
-            jButtonRemove.setText("Remove");\r
+            jButtonRemove.setText("Delete");\r
             jButtonRemove.addActionListener(this);\r
         }\r
         return jButtonRemove;\r
@@ -248,10 +248,15 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
                 }\r
             }\r
         });\r
-        initFrame();\r
     }\r
 \r
     private void init(SpdFileContents sfc){\r
+\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r
+        }\r
+        initFrame();\r
+        \r
         if (sfc.getSpdPackageHeaderCount() == 0) {\r
             return ;\r
         }\r
@@ -262,6 +267,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
             model.addRow(saa[i]);\r
             i++;\r
         }\r
+        \r
     }\r
     \r
     private JScrollPane getJScrollPane(){\r
@@ -323,6 +329,16 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
         jComboBoxSelect.addItem("UEFI_APPLICATION");\r
         jComboBoxSelect.addItem("USER_DEFINED");\r
         jComboBoxSelect.setSelectedIndex(0);\r
+        \r
+        boolean editable = true;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            editable = false;\r
+        }\r
+        \r
+        jButtonAdd.setEnabled(editable);\r
+        jButtonRemove.setEnabled(editable);\r
+        jButtonClearAll.setEnabled(editable);\r
+        jTable.setEnabled(editable);\r
     }\r
 \r
     /* (non-Javadoc)\r
index 7abf5c0f2e65721c2a296ec1d198d1f55b9d828e..1905b483bf92ca4ae5d06c517a6dc36f61bd8097 100644 (file)
@@ -296,7 +296,12 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
     }\r
 \r
     private void init(SpdFileContents sfc){\r
-        initFrame(sfc);\r
+        \r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r
+        }\r
+        initFrame();\r
+        \r
         if (sfc.getSpdPcdDefinitionCount() == 0) {\r
             return ;\r
         }\r
@@ -346,8 +351,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
             i++;\r
         }\r
         \r
-        \r
-        \r
     }\r
     \r
     private JScrollPane getJContentPane(){\r
@@ -459,7 +462,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
                        jContentPane.add(jLabelTokenSpace, null);\r
     \r
      **/\r
-    private void initFrame(SpdFileContents sfc) {\r
+    private void initFrame() {\r
 \r
         jComboBoxDataType.addItem("UINT8");\r
         jComboBoxDataType.addItem("UINT16");\r
@@ -474,6 +477,16 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
         for (int i = 0; i < vGuidCName.size(); ++i) {\r
             jComboBoxTsGuid.addItem(vGuidCName.get(i));\r
         }\r
+        \r
+        boolean editable = true;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            editable = false;\r
+        }\r
+        \r
+        jButtonAdd.setEnabled(editable);\r
+        jButtonRemove.setEnabled(editable);\r
+        jButtonClearAll.setEnabled(editable);\r
+        jTable.setEnabled(editable);\r
     }\r
 \r
     public void actionPerformed(ActionEvent arg0) {\r
index eb912f39a554ff443526802f5627e6d0af442048..d03b2fdd3ae1d7fe321b52da4fb762db148278af 100644 (file)
@@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 package org.tianocore.frameworkwizard.packaging.ui;\r
 \r
+import javax.swing.JOptionPane;\r
 import javax.swing.table.DefaultTableModel;\r
 import javax.swing.table.TableModel;\r
 \r
@@ -47,10 +48,14 @@ public class SpdPpiDecls extends SpdGuidDecls {
     public SpdPpiDecls(OpeningPackageType opt) {\r
         this(opt.getXmlSpd());\r
         docConsole = opt;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r
+        }\r
+        initFrame();\r
     }\r
     \r
     protected void initFrame() {\r
-        \r
+        super.initFrame();\r
         this.setTitle("PPI Declarations");\r
         starLabel.setVisible(false);\r
         ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);\r
@@ -71,6 +76,7 @@ public class SpdPpiDecls extends SpdGuidDecls {
             model.addRow(saa[i]);\r
             i++;\r
         }\r
+        \r
     }\r
     \r
     protected void updateRow(int row, int column, TableModel m){\r
@@ -130,4 +136,11 @@ public class SpdPpiDecls extends SpdGuidDecls {
         sfc.removeSpdPpiDeclaration();\r
         docConsole.setSaved(false);\r
     }\r
+    \r
+    /**\r
+     * @return Returns the sfc.\r
+     */\r
+    protected SpdFileContents getSfc() {\r
+        return sfc;\r
+    }\r
 }\r
index 7bfba65b6e2f5752779ce2e6b65ce9996f57ce18..99ed418d1a66d5784e32cb2a66804388285f52e9 100644 (file)
@@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 package org.tianocore.frameworkwizard.packaging.ui;\r
 \r
+import javax.swing.JOptionPane;\r
 import javax.swing.table.DefaultTableModel;\r
 import javax.swing.table.TableModel;\r
 \r
@@ -47,10 +48,14 @@ public class SpdProtocolDecls extends SpdGuidDecls {
     public SpdProtocolDecls(OpeningPackageType opt) {\r
         this(opt.getXmlSpd());\r
         docConsole = opt;\r
+        if (sfc.getSpdPkgDefsRdOnly().equals("true")) {\r
+            JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");\r
+        }\r
+        initFrame();\r
     }\r
     \r
     protected void initFrame() {\r
-        \r
+        super.initFrame();\r
         this.setTitle("Protocol Declarations");\r
         starLabel.setVisible(false);\r
         ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);\r
@@ -130,4 +135,11 @@ public class SpdProtocolDecls extends SpdGuidDecls {
         sfc.removeSpdProtocolDeclaration();\r
         docConsole.setSaved(false);\r
     }\r
+    \r
+    /**\r
+     * @return Returns the sfc.\r
+     */\r
+    protected SpdFileContents getSfc() {\r
+        return sfc;\r
+    }\r
 }\r