Delete useless file SpdPackageDefinitions.java;

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
This commit is contained in:
jlin16 2006-10-30 03:46:11 +00:00
parent b5ace64c27
commit 62df8efa93
9 changed files with 145 additions and 194 deletions

View File

@ -357,7 +357,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
if (jButtonRemove == null) {
jButtonRemove = new JButton();
jButtonRemove.setBounds(new java.awt.Rectangle(270,227,90,20));
jButtonRemove.setText("Remove");
jButtonRemove.setText("Delete");
jButtonRemove.addActionListener(this);
}
return jButtonRemove;
@ -432,6 +432,10 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
public SpdGuidDecls(OpeningPackageType opt) {
this(opt.getXmlSpd());
docConsole = opt;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");
}
initFrame();
}
/**
This method initializes this
@ -449,7 +453,6 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
});
this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
this.setVisible(true);
initFrame();
}
protected void init(SpdFileContents sfc){
@ -466,6 +469,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
model.addRow(saa[i]);
i++;
}
}
protected JScrollPane getJContentPane(){
@ -567,7 +571,16 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
protected void initFrame() {
this.setTitle("GUID Declarations");
boolean editable = true;
if (getSfc().getSpdPkgDefsRdOnly().equals("true")) {
editable = false;
}
jButtonAdd.setEnabled(editable);
jButtonRemove.setEnabled(editable);
jButtonClearAll.setEnabled(editable);
jTable.setEnabled(editable);
}
/* (non-Javadoc)
@ -722,7 +735,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
if (jButtonGen == null) {
jButtonGen = new JButton();
jButtonGen.setBounds(new java.awt.Rectangle(485,58,92,21));
jButtonGen.setText("Gen GUID");
jButtonGen.setText("Gen");
jButtonGen.setPreferredSize(new java.awt.Dimension(80,20));
jButtonGen.addActionListener(this);
}
@ -919,6 +932,13 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
protected JLabel getJLabelGuidType() {
return jLabelGuidType;
}
/**
* @return Returns the sfc.
*/
protected SpdFileContents getSfc() {
return sfc;
}
}

View File

@ -493,13 +493,13 @@ public class SpdHeader extends IInternalFrame {
jCheckBoxRdOnly.setText("Read Only");
jCheckBoxRdOnly.setLocation(new java.awt.Point(labelColumn, rowNine));
jCheckBoxRdOnly.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
// jCheckBoxRdOnly.setPreferredSize(new java.awt.Dimension(150, oneRowHeight));
jCheckBoxRdOnly.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected() + "");
sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected()+"");
initFrame();
}
});
}
@ -522,7 +522,7 @@ public class SpdHeader extends IInternalFrame {
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected() + "");
sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected()+"");
}
});
}
@ -558,6 +558,7 @@ public class SpdHeader extends IInternalFrame {
public SpdHeader(OpeningPackageType opt) {
this(opt.getXmlSpd());
docConsole = opt;
initFrame();
}
/**
@ -567,7 +568,6 @@ public class SpdHeader extends IInternalFrame {
private void init() {
this.setContentPane(getTopScrollPane());
this.setTitle("Package Surface Area Header");
initFrame();
}
/**
@ -646,9 +646,11 @@ public class SpdHeader extends IInternalFrame {
jStarLabel7.setLocation(new java.awt.Point(2, rowEight));
jStarLabel8 = new StarLabel();
jStarLabel8.setLocation(new java.awt.Point(2, rowNine));
jStarLabel8.setVisible(false);
jStarLabel9 = new StarLabel();
jStarLabel9.setLocation(new java.awt.Point(2, rowTen));
jStarLabel9.setVisible(false);
jPackageNameLabel = new JLabel();
jPackageNameLabel.setText("Package Name");
jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
@ -739,7 +741,20 @@ public class SpdHeader extends IInternalFrame {
**/
private void initFrame() {
boolean editable = true;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
editable = false;
}
jPackageNameTextField.setEditable(editable);
jGuidTextField.setEditable(editable);
jGenerateGuidButton.setEnabled(editable);
jVersionTextField.setEditable(editable);
jCopyrightTextArea.setEditable(editable);
jLicenseTextArea.setEditable(editable);
jUrlTextField.setEditable(editable);
jAbstractTextField.setEditable(editable);
jDescriptionTextArea.setEditable(editable);
jCheckBoxRePkg.setEnabled(editable);
}
/* (non-Javadoc)

View File

@ -407,7 +407,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
private JButton getJButtonRemove() {
if (jButtonRemove == null) {
jButtonRemove = new JButton();
jButtonRemove.setText("Remove");
jButtonRemove.setText("Delete");
jButtonRemove.setSize(new java.awt.Dimension(buttonWidth,20));
jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowSeven,buttonWidth,20));
jButtonRemove.addActionListener(this);
@ -423,7 +423,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
private JButton getJButtonRemoveAll() {
if (jButtonRemoveAll == null) {
jButtonRemoveAll = new JButton();
jButtonRemoveAll.setText("Remove All");
jButtonRemoveAll.setText("Clear All");
jButtonRemoveAll.setLocation(removeAllButtonCol,rowSeven);
FontMetrics fm = jButtonRemoveAll.getFontMetrics(jButtonRemoveAll.getFont());
jButtonRemoveAll.setSize(fm.stringWidth(jButtonRemoveAll.getText()) + 50, 20);
@ -473,6 +473,12 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
}
private void init(SpdFileContents sfc) {
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");
}
initFrame();
if (sfc.getSpdLibClassDeclarationCount() == 0) {
return ;
}
@ -491,7 +497,21 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
model.addRow(saa[i]);
i++;
}
}
private void initFrame() {
boolean editable = true;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
editable = false;
}
jButtonAdd.setEnabled(editable);
jButtonRemove.setEnabled(editable);
jButtonRemoveAll.setEnabled(editable);
jTable.setEnabled(editable);
}
private JScrollPane getJContentPane(){
if (topScrollPane == null){
topScrollPane = new JScrollPane();

View File

@ -170,7 +170,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
if (jButtonRemove == null) {
jButtonRemove = new JButton();
jButtonRemove.setBounds(new java.awt.Rectangle(266,148,90,20));
jButtonRemove.setText("Remove");
jButtonRemove.setText("Delete");
jButtonRemove.addActionListener(this);
}
return jButtonRemove;
@ -264,10 +264,15 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
}
});
this.setVisible(true);
initFrame();
}
private void init(SpdFileContents sfc){
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");
}
initFrame();
if (sfc.getSpdMsaFileCount() == 0) {
return ;
}
@ -281,6 +286,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
model.addRow(saa[i]);
i++;
}
}
private JScrollPane getJScrollPane(){
@ -325,7 +331,15 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
fill ComboBoxes with pre-defined contents
**/
private void initFrame() {
boolean editable = true;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
editable = false;
}
jButtonAdd.setEnabled(editable);
jButtonRemove.setEnabled(editable);
jButtonClearAll.setEnabled(editable);
jTable.setEnabled(editable);
}
/* (non-Javadoc)

View File

@ -1,172 +0,0 @@
/** @file
The file is used to create, update Package Definitions of Spd file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.frameworkwizard.packaging.ui;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import java.awt.Dimension;
import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
import org.tianocore.frameworkwizard.common.ui.StarLabel;
public class SpdPackageDefinitions extends IInternalFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabelRdOnly = null;
private JComboBox jComboBoxReadOnly = null;
private JLabel jLabelRePkg = null;
private JComboBox jComboBoxRePackage = null;
private StarLabel starLabel = null;
private StarLabel starLabel1 = null;
private SpdFileContents sfc = null;
private OpeningPackageType docConsole = null;
/**
* This is the default constructor
*/
public SpdPackageDefinitions() {
super();
initialize();
}
public SpdPackageDefinitions(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){
this();
sfc = new SpdFileContents(inPsa);
init(sfc);
}
public SpdPackageDefinitions(OpeningPackageType opt) {
this(opt.getXmlSpd());
docConsole = opt;
}
private void init(SpdFileContents sfc) {
if (sfc.getSpdPkgDefsRdOnly() != null) {
jComboBoxReadOnly.setSelectedItem(sfc.getSpdPkgDefsRdOnly());
}
if (sfc.getSpdPkgDefsRePkg() != null) {
jComboBoxRePackage.setSelectedItem(sfc.getSpdPkgDefsRePkg());
}
this.setVisible(true);
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 200);
this.setTitle("Package Definitions");
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
starLabel1 = new StarLabel();
starLabel1.setBounds(new java.awt.Rectangle(4,62,10,20));
starLabel1.setVisible(true);
starLabel = new StarLabel();
starLabel.setBounds(new java.awt.Rectangle(4,22,10,20));
jLabelRePkg = new JLabel();
jLabelRePkg.setPreferredSize(new java.awt.Dimension(65,20));
jLabelRePkg.setLocation(new java.awt.Point(22,62));
jLabelRePkg.setSize(new java.awt.Dimension(65,20));
jLabelRePkg.setText("RePackage");
jLabelRdOnly = new JLabel();
jLabelRdOnly.setPreferredSize(new java.awt.Dimension(57,20));
jLabelRdOnly.setLocation(new java.awt.Point(22,22));
jLabelRdOnly.setSize(new java.awt.Dimension(57,20));
jLabelRdOnly.setText("Read Only");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabelRdOnly, null);
jContentPane.add(getJComboBox(), null);
jContentPane.add(jLabelRePkg, null);
jContentPane.add(getJComboBox1(), null);
jContentPane.add(starLabel, null);
jContentPane.add(starLabel1, null);
}
return jContentPane;
}
/**
* This method initializes jComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBox() {
if (jComboBoxReadOnly == null) {
jComboBoxReadOnly = new JComboBox();
jComboBoxReadOnly.setBounds(new java.awt.Rectangle(95,22,117,20));
jComboBoxReadOnly.setPreferredSize(new Dimension(80, 20));
jComboBoxReadOnly.addItem("true");
jComboBoxReadOnly.addItem("false");
jComboBoxReadOnly.setSelectedIndex(1);
jComboBoxReadOnly.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
if (jComboBoxReadOnly.getSelectedItem().equals(sfc.getSpdPkgDefsRdOnly())) {
return;
}
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.setSpdPkgDefsRdOnly(jComboBoxReadOnly.getSelectedItem()+"");
}
});
}
return jComboBoxReadOnly;
}
/**
* This method initializes jComboBox1
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBox1() {
if (jComboBoxRePackage == null) {
jComboBoxRePackage = new JComboBox();
jComboBoxRePackage.setBounds(new java.awt.Rectangle(95,62,116,20));
jComboBoxRePackage.setPreferredSize(new Dimension(80, 20));
jComboBoxRePackage.addItem("false");
jComboBoxRePackage.addItem("true");
jComboBoxRePackage.setSelectedIndex(0);
jComboBoxRePackage.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
if (jComboBoxRePackage.getSelectedItem().equals(sfc.getSpdPkgDefsRePkg())) {
return;
}
if (docConsole != null) {
docConsole.setSaved(false);
}
sfc.setSpdPkgDefsRePkg(jComboBoxRePackage.getSelectedItem()+"");
}
});
}
return jComboBoxRePackage;
}
}

View File

@ -189,7 +189,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
if (jButtonRemove == null) {
jButtonRemove = new JButton();
jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowFour,buttonWidth,20));
jButtonRemove.setText("Remove");
jButtonRemove.setText("Delete");
jButtonRemove.addActionListener(this);
}
return jButtonRemove;
@ -248,10 +248,15 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
}
}
});
initFrame();
}
private void init(SpdFileContents sfc){
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");
}
initFrame();
if (sfc.getSpdPackageHeaderCount() == 0) {
return ;
}
@ -262,6 +267,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
model.addRow(saa[i]);
i++;
}
}
private JScrollPane getJScrollPane(){
@ -323,6 +329,16 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
jComboBoxSelect.addItem("UEFI_APPLICATION");
jComboBoxSelect.addItem("USER_DEFINED");
jComboBoxSelect.setSelectedIndex(0);
boolean editable = true;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
editable = false;
}
jButtonAdd.setEnabled(editable);
jButtonRemove.setEnabled(editable);
jButtonClearAll.setEnabled(editable);
jTable.setEnabled(editable);
}
/* (non-Javadoc)

View File

@ -296,7 +296,12 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
}
private void init(SpdFileContents sfc){
initFrame(sfc);
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");
}
initFrame();
if (sfc.getSpdPcdDefinitionCount() == 0) {
return ;
}
@ -346,8 +351,6 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
i++;
}
}
private JScrollPane getJContentPane(){
@ -459,7 +462,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
jContentPane.add(jLabelTokenSpace, null);
**/
private void initFrame(SpdFileContents sfc) {
private void initFrame() {
jComboBoxDataType.addItem("UINT8");
jComboBoxDataType.addItem("UINT16");
@ -474,6 +477,16 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
for (int i = 0; i < vGuidCName.size(); ++i) {
jComboBoxTsGuid.addItem(vGuidCName.get(i));
}
boolean editable = true;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
editable = false;
}
jButtonAdd.setEnabled(editable);
jButtonRemove.setEnabled(editable);
jButtonClearAll.setEnabled(editable);
jTable.setEnabled(editable);
}
public void actionPerformed(ActionEvent arg0) {

View File

@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.frameworkwizard.packaging.ui;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
@ -47,10 +48,14 @@ public class SpdPpiDecls extends SpdGuidDecls {
public SpdPpiDecls(OpeningPackageType opt) {
this(opt.getXmlSpd());
docConsole = opt;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");
}
initFrame();
}
protected void initFrame() {
super.initFrame();
this.setTitle("PPI Declarations");
starLabel.setVisible(false);
((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
@ -71,6 +76,7 @@ public class SpdPpiDecls extends SpdGuidDecls {
model.addRow(saa[i]);
i++;
}
}
protected void updateRow(int row, int column, TableModel m){
@ -130,4 +136,11 @@ public class SpdPpiDecls extends SpdGuidDecls {
sfc.removeSpdPpiDeclaration();
docConsole.setSaved(false);
}
/**
* @return Returns the sfc.
*/
protected SpdFileContents getSfc() {
return sfc;
}
}

View File

@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.frameworkwizard.packaging.ui;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
@ -47,10 +48,14 @@ public class SpdProtocolDecls extends SpdGuidDecls {
public SpdProtocolDecls(OpeningPackageType opt) {
this(opt.getXmlSpd());
docConsole = opt;
if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table.");
}
initFrame();
}
protected void initFrame() {
super.initFrame();
this.setTitle("Protocol Declarations");
starLabel.setVisible(false);
((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
@ -130,4 +135,11 @@ public class SpdProtocolDecls extends SpdGuidDecls {
sfc.removeSpdProtocolDeclaration();
docConsole.setSaved(false);
}
/**
* @return Returns the sfc.
*/
protected SpdFileContents getSfc() {
return sfc;
}
}