a. Enhanced toolchain setting UI for ModuleSa build options and global build options.

b. Fpd editor, Flash part UI FV operations.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1440 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-09-04 09:32:37 +00:00
parent 6f55be9f0b
commit 98c207975e
4 changed files with 373 additions and 40 deletions

View File

@ -1802,7 +1802,11 @@ public class FpdBuildOptions extends IInternalFrame {
vArch.add("ARM"); vArch.add("ARM");
vArch.add("PPC"); vArch.add("PPC");
jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch)); jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch));
jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() { jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) { public void valueChanged(ListSelectionEvent e) {
selectedRow = -1; selectedRow = -1;

View File

@ -988,7 +988,9 @@ public class FpdFileContents {
if (opt.getSupArchList() != null){ if (opt.getSupArchList() != null){
saa[i][4] = listToString(opt.getSupArchList()); saa[i][4] = listToString(opt.getSupArchList());
}
else {
saa[i][4] = "";
} }
saa[i][5] = opt.getStringValue(); saa[i][5] = opt.getStringValue();
@ -2589,7 +2591,19 @@ public class FpdFileContents {
} }
public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) { public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {
FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
if (fis == null || fis.getFvImageList() == null) {
return;
}
ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
while (li.hasNext()) {
FvImagesDocument.FvImages.FvImage fi = li.next();
if (fi.getType().toString().equals("ImageName")) {
vImageNames.addAll(fi.getFvImageNamesList());
return;
}
}
} }
public void AddFvImageFvImageNames (String[] fvNames) { public void AddFvImageFvImageNames (String[] fvNames) {
@ -2672,6 +2686,10 @@ public class FpdFileContents {
cursor.dispose(); cursor.dispose();
} }
/**
* @param oldFvName
* @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
*/
public void updateFvImageNameAll (String oldFvName, String newFvName) { public void updateFvImageNameAll (String oldFvName, String newFvName) {
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) { if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
return; return;
@ -2683,6 +2701,11 @@ public class FpdFileContents {
} }
} }
/**
* @param fi
* @param oldFvName The FV Name to be replaced.
* @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
*/
public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) { public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {
QName qFvImageNames = new QName(xmlNs, "FvImageNames"); QName qFvImageNames = new QName(xmlNs, "FvImageNames");
XmlCursor cursor = fi.newCursor(); XmlCursor cursor = fi.newCursor();
@ -2690,8 +2713,19 @@ public class FpdFileContents {
if (cursor.toChild(qFvImageNames)) { if (cursor.toChild(qFvImageNames)) {
do { do {
if (cursor.getTextValue().equals(oldFvName)){ if (cursor.getTextValue().equals(oldFvName)){
if (newFvName != null) {
cursor.setTextValue(newFvName); cursor.setTextValue(newFvName);
} }
else {
if (fi.getFvImageNamesList().size() == 1) {
removeElement(fi);
break;
}
else {
cursor.removeXml();
}
}
}
}while (cursor.toNextSibling(qFvImageNames)); }while (cursor.toNextSibling(qFvImageNames));
} }
@ -2738,18 +2772,50 @@ public class FpdFileContents {
cursor.dispose(); cursor.dispose();
} }
public int getFvImagesFvImageCount() { public int getFvImagesFvImageCount(String type) {
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) { if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
return 0; return 0;
} }
return getfpdFlash().getFvImages().getFvImageList().size(); List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
ListIterator li = l.listIterator();
int i = 0;
while(li.hasNext()) {
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
continue;
} }
/**Only Get Fv image setting - name and type. ++i;
}
return i;
}
public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {
Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
return vFvImage;
}
List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
ListIterator li = l.listIterator();
while(li.hasNext()) {
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
continue;
}
if (fi.getFvImageNamesList().contains(fvName)) {
vFvImage.add(fi);
}
}
return vFvImage;
}
/**
* @param saa * @param saa
* @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.
*/ */
public void getFvImagesFvImages(String[][] saa) { public void getFvImagesFvImages(String[][] saa, String type) {
if (getfpdFlash().getFvImages() == null) { if (getfpdFlash().getFvImages() == null) {
return; return;
@ -2762,6 +2828,9 @@ public class FpdFileContents {
int i = 0; int i = 0;
while(li.hasNext()) { while(li.hasNext()) {
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next(); FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
continue;
}
// //
// get FvImageNames array, space separated // get FvImageNames array, space separated
// //
@ -2780,6 +2849,108 @@ public class FpdFileContents {
} }
} }
/**Add name-value pair to FvImage element with type.
* @param fvName FV name to add name-value pair.
* @param type FvImage attribute.
* @param name
* @param value
*/
public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value) {
if (getfpdFlash().getFvImages() == null) {
return;
}
List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
if (l == null) {
return;
}
ListIterator li = l.listIterator();
while(li.hasNext()) {
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
continue;
}
if (!fi.getFvImageNamesList().contains(fvName)) {
continue;
}
setFvImagesFvImageNameValue (fi, name, value, null);
}
}
/**Add to all FvImage elements with type, the name-value pair.
* @param type
* @param name
* @param value
*/
public void setTypedFvImageNameValue (String type, String name, String value) {
if (getfpdFlash().getFvImages() == null) {
return;
}
List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
if (l == null) {
return;
}
ListIterator li = l.listIterator();
while(li.hasNext()) {
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
continue;
}
setFvImagesFvImageNameValue (fi, name, value, null);
}
}
/**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.
* @param fi
* @param name
* @param value
* @param newName
*/
public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {
if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
return;
}
XmlCursor cursor = fi.getFvImageOptions().newCursor();
if (cursor.toFirstChild()) {
do {
FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();
if (nv.getName().equals(name)) {
nv.setValue(value);
if (newName != null) {
nv.setName(newName);
}
cursor.dispose();
return;
}
}while (cursor.toNextSibling());
}
FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();
nv.setName(name);
nv.setValue(value);
if (newName != null) {
nv.setName(newName);
}
cursor.dispose();
}
public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {
Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");
for (int i = 0; i < vFvImage.size(); ++i) {
FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
continue;
}
ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()
.getNameValueList()
.listIterator();
while (li.hasNext()) {
FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
m.put(nv.getName(), nv.getValue());
}
}
}
/**Get FvImage Options for FvImage i /**Get FvImage Options for FvImage i
* @param i the ith FvImage * @param i the ith FvImage
*/ */

View File

@ -25,6 +25,7 @@ import javax.swing.JButton;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import org.tianocore.PlatformSurfaceAreaDocument; import org.tianocore.PlatformSurfaceAreaDocument;
import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.GlobalData; import org.tianocore.frameworkwizard.common.GlobalData;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
import org.tianocore.frameworkwizard.common.ui.IInternalFrame; import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
@ -152,13 +153,16 @@ public class FpdFlash extends IInternalFrame {
private JButton jButtonFvInFdfOptions = null; private JButton jButtonFvInFdfOptions = null;
private JScrollPane jScrollPaneFvAdditional = null; private JScrollPane jScrollPaneFvAdditional = null;
private JTable jTableFvAdditional = null; private JTable jTableFvAdditional = null;
private DefaultTableModel fvAddtionalTableModel = null; // @jve:decl-index=0:visual-constraint="" private DefaultTableModel fvAdditionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
private JButton jButtonAddFv = null; private JButton jButtonAddFv = null;
private JButton jButtonDelFv = null; private JButton jButtonDelFv = null;
private JButton jButtonAddFvOptions = null; private JButton jButtonAddFvOptions = null;
private int tabIndexForFv = -1; private int tabIndexForFv = -1;
private int selectedRowInFvAdditionalTable = -1; private int selectedRowInFvAdditionalTable = -1;
private String oldFvName = null; private String oldFvName = null;
private Vector<String> vBlockSize = new Vector<String>();
private String erasePolarity = null;
boolean memModified = false;
public FpdFlash() { public FpdFlash() {
@ -267,11 +271,11 @@ public class FpdFlash extends IInternalFrame {
fvImageParaTableModel.setRowCount(0); fvImageParaTableModel.setRowCount(0);
fvPropertyTableModel.setRowCount(0); fvPropertyTableModel.setRowCount(0);
if (ffc.getFvImagesFvImageCount() == 0) { if (ffc.getFvImagesFvImageCount("Attributes") == 0) {
return; return;
} }
String[][] saa = new String[ffc.getFvImagesFvImageCount()][2]; String[][] saa = new String[ffc.getFvImagesFvImageCount("Attributes")][2];
ffc.getFvImagesFvImages(saa); ffc.getFvImagesFvImages(saa, "Attributes");
int i = 0; int i = 0;
while (i < saa.length) { while (i < saa.length) {
@ -622,10 +626,10 @@ public class FpdFlash extends IInternalFrame {
private JComboBox getJComboBoxFvParaType() { private JComboBox getJComboBoxFvParaType() {
if (jComboBoxFvParaType == null) { if (jComboBoxFvParaType == null) {
jComboBoxFvParaType = new JComboBox(); jComboBoxFvParaType = new JComboBox();
jComboBoxFvParaType.addItem("ImageName"); // jComboBoxFvParaType.addItem("ImageName");
jComboBoxFvParaType.addItem("Attributes"); jComboBoxFvParaType.addItem("Attributes");
jComboBoxFvParaType.addItem("Options"); jComboBoxFvParaType.addItem("Options");
jComboBoxFvParaType.addItem("Components"); // jComboBoxFvParaType.addItem("Components");
jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20)); jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20));
jComboBoxFvParaType.setEnabled(false); jComboBoxFvParaType.setEnabled(false);
jComboBoxFvParaType.addItemListener(new ItemListener() { jComboBoxFvParaType.addItemListener(new ItemListener() {
@ -869,13 +873,13 @@ public class FpdFlash extends IInternalFrame {
fvImageParaTableModel.addColumn("Type"); fvImageParaTableModel.addColumn("Type");
TableColumn typeCol = jTableFvInfo.getColumnModel().getColumn(1); // TableColumn typeCol = jTableFvInfo.getColumnModel().getColumn(1);
JComboBox cb = new JComboBox(); // JComboBox cb = new JComboBox();
cb.addItem("ImageName"); // cb.addItem("ImageName");
cb.addItem("Attributes"); // cb.addItem("Attributes");
cb.addItem("Options"); // cb.addItem("Options");
cb.addItem("Components"); // cb.addItem("Components");
typeCol.setCellEditor(new DefaultCellEditor(cb)); // typeCol.setCellEditor(new DefaultCellEditor(cb));
jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
@ -931,7 +935,7 @@ public class FpdFlash extends IInternalFrame {
if (jButtonDelFvImage == null) { if (jButtonDelFvImage == null) {
jButtonDelFvImage = new JButton(); jButtonDelFvImage = new JButton();
jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(120,20)); jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(120,20));
// jButton6.setEnabled(false); jButtonDelFvImage.setEnabled(false);
jButtonDelFvImage.setText("Delete Row"); jButtonDelFvImage.setText("Delete Row");
jButtonDelFvImage.addActionListener(new AbstractAction() { jButtonDelFvImage.addActionListener(new AbstractAction() {
/** /**
@ -1131,23 +1135,88 @@ public class FpdFlash extends IInternalFrame {
} }
private void initFvAdditionalTable() { private void initFvAdditionalTable() {
Vector<String> vFvNames = new Vector<String>();
ffc.getFvImagesFvImageFvImageNames(vFvNames);
for (int i = 0; i < vFvNames.size(); ++i) {
String fvName = vFvNames.get(i);
if (fvNameExists(fvName)) {
continue;
}
HashMap<String, String> mFvOpts = new HashMap<String, String>();
ffc.getFvImagesFvImageOptions(fvName, mFvOpts);
String bSize = "";
String numBlks = "";
String fvSize = "";
String fvFile = "";
if (mFvOpts.get("EFI_FILE_NAME") != null) {
fvFile = mFvOpts.get("EFI_FILE_NAME");
}
if (mFvOpts.get("EFI_BLOCK_SIZE") != null && mFvOpts.get("EFI_NUM_BLOCKS") != null) {
bSize = mFvOpts.get("EFI_BLOCK_SIZE");
numBlks = mFvOpts.get("EFI_NUM_BLOCKS");
boolean blockSizeWellFormat = true;
boolean numOfBlockWellFormat = true;
if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {
blockSizeWellFormat = false;
JOptionPane.showMessageDialog(frame, fvName + " block size bad format.");
}
if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {
numOfBlockWellFormat = false;
JOptionPane.showMessageDialog(frame, fvName + " number of blocks bad format.");
}
if (blockSizeWellFormat && numOfBlockWellFormat) {
int size = Integer.decode(bSize);
int num = Integer.decode(numBlks);
fvSize = size*num + "";
}
}
fvAdditionalTableModel.addRow(new String[]{fvName, fvSize, fvFile});
addTabForFv(new FvInfoFromFdf(fvName, "", ""));
}
} }
private void initFvInFdfTable(String fdfPath){ private void initFvInFdfTable(String fdfPath){
Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>(); Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
getFvInfoFromFdf(fdfPath, vFvInfo); getFvInfoFromFdf(fdfPath, vFvInfo);
getFlashInfoFromFdf (fdfPath, vBlockSize, erasePolarity);
ffc.setTypedFvImageNameValue("Attributes", "ErasePolarity", erasePolarity);
// BugBug: assume all blocks have same size;
String blkSize = vBlockSize.get(0);
getFvInFdfTableModel().setRowCount(0); getFvInFdfTableModel().setRowCount(0);
for (int j = 0; j < vFvInfo.size(); ++j) { for (int j = 0; j < vFvInfo.size(); ++j) {
FvInfoFromFdf fvInfo = vFvInfo.get(j); FvInfoFromFdf fvInfo = vFvInfo.get(j);
String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()}; String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
getFvInFdfTableModel().addRow(row); getFvInFdfTableModel().addRow(row);
try {
int blockSize = Integer.decode(blkSize);
int fvSize = Integer.decode(row[1]);
int numBlocks = fvSize/blockSize;
// if no options for this FV before, generate a new options entry for this FV.
if (ffc.getFvImagesFvImageWithName(row[0], "Options") == null) {
HashMap<String, String> mOptions = new HashMap<String, String>();
mOptions.put("EFI_BLOCK_SIZE", blkSize);
mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");
mOptions.put("EFI_FILE_NAME", row[2]);
ffc.genFvImagesFvImage(new String[]{row[0]}, "Options", mOptions);
memModified = true;
}
else {
ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize);
ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "");
ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2]);
}
}
catch (NumberFormatException e){
JOptionPane.showMessageDialog(frame, e.getMessage());
}
} }
for (int k = 0; k < vFvInfo.size(); ++k) { for (int k = 0; k < vFvInfo.size(); ++k) {
FvInfoFromFdf fvInfo = vFvInfo.get(k); FvInfoFromFdf fvInfo = vFvInfo.get(k);
addTabForFv(fvInfo); addTabForFv(fvInfo);
} }
} }
private void addTabForFv (FvInfoFromFdf fvInfo) { private void addTabForFv (FvInfoFromFdf fvInfo) {
@ -1300,6 +1369,7 @@ public class FpdFlash extends IInternalFrame {
jButtonUpdateFvImage = new JButton(); jButtonUpdateFvImage = new JButton();
jButtonUpdateFvImage.setPreferredSize(new Dimension(120, 20)); jButtonUpdateFvImage.setPreferredSize(new Dimension(120, 20));
jButtonUpdateFvImage.setActionCommand("Update"); jButtonUpdateFvImage.setActionCommand("Update");
jButtonUpdateFvImage.setEnabled(false);
jButtonUpdateFvImage.setText("Update FV"); jButtonUpdateFvImage.setText("Update FV");
jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() { jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) { public void actionPerformed(java.awt.event.ActionEvent e) {
@ -1590,7 +1660,7 @@ public class FpdFlash extends IInternalFrame {
jTableFvAdditional = new JTable(); jTableFvAdditional = new JTable();
jTableFvAdditional.setRowHeight(20); jTableFvAdditional.setRowHeight(20);
jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jTableFvAdditional.setModel(getFvAddtionalTableModel()); jTableFvAdditional.setModel(getFvAdditionalTableModel());
jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() { jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) { public void valueChanged(ListSelectionEvent e) {
@ -1653,14 +1723,22 @@ public class FpdFlash extends IInternalFrame {
return jTableFvAdditional; return jTableFvAdditional;
} }
private boolean fvNameExists (String fvName) { private boolean fvNameExistsInFvInFdfTable (String fvName) {
for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) { for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) {
if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) { if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) {
return true; return true;
} }
} }
return false;
}
private boolean fvNameExists (String fvName) {
if (fvNameExistsInFvInFdfTable(fvName)) {
return true;
}
for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) { for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) {
if (fvAddtionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) { if (fvAdditionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {
return true; return true;
} }
} }
@ -1668,18 +1746,18 @@ public class FpdFlash extends IInternalFrame {
} }
/** /**
* This method initializes fvAddtionalTableModel * This method initializes fvAdditionalTableModel
* *
* @return javax.swing.table.DefaultTableModel * @return javax.swing.table.DefaultTableModel
*/ */
private DefaultTableModel getFvAddtionalTableModel() { private DefaultTableModel getFvAdditionalTableModel() {
if (fvAddtionalTableModel == null) { if (fvAdditionalTableModel == null) {
fvAddtionalTableModel = new DefaultTableModel(); fvAdditionalTableModel = new DefaultTableModel();
fvAddtionalTableModel.addColumn("FV Name"); fvAdditionalTableModel.addColumn("FV Name");
fvAddtionalTableModel.addColumn("Size"); fvAdditionalTableModel.addColumn("Size");
fvAddtionalTableModel.addColumn("Corresponding File Name"); fvAdditionalTableModel.addColumn("Corresponding File Name");
} }
return fvAddtionalTableModel; return fvAdditionalTableModel;
} }
/** /**
@ -1699,7 +1777,7 @@ public class FpdFlash extends IInternalFrame {
jTableFvAdditional.getCellEditor().stopCellEditing(); jTableFvAdditional.getCellEditor().stopCellEditing();
} }
String[] row = {"", "", ""}; String[] row = {"", "", ""};
fvAddtionalTableModel.addRow(row); fvAdditionalTableModel.addRow(row);
} }
}); });
} }
@ -1715,11 +1793,26 @@ public class FpdFlash extends IInternalFrame {
if (jButtonDelFv == null) { if (jButtonDelFv == null) {
jButtonDelFv = new JButton(); jButtonDelFv = new JButton();
jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20)); jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));
jButtonDelFv.setEnabled(false); jButtonDelFv.setEnabled(true);
jButtonDelFv.setText("Delete"); jButtonDelFv.setText("Delete");
jButtonDelFv.addActionListener(new java.awt.event.ActionListener() { jButtonDelFv.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) { public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() //delete row in FvAdditional table.
int selectedRow = jTableFvAdditional.getSelectedRow();
if (selectedRow < 0) {
return;
}
String fvName = fvAdditionalTableModel.getValueAt(selectedRow, 0) + "";
fvAdditionalTableModel.removeRow(selectedRow);
//
//delete tab with selected FV name.
//
jTabbedPane.removeTabAt(jTabbedPane.indexOfTab(fvName));
//delete FV Name from FvImages element.
ffc.updateFvImageNameAll(fvName, null);
//delete FvBinding from ModuleSA.
ffc.removeFvBindingAll(fvName);
docConsole.setSaved(false);
} }
}); });
} }
@ -1775,6 +1868,9 @@ public class FpdFlash extends IInternalFrame {
if (jTableFvInfo.isEditing()) { if (jTableFvInfo.isEditing()) {
jTableFvInfo.getCellEditor().stopCellEditing(); jTableFvInfo.getCellEditor().stopCellEditing();
} }
if (jTableFvAdditional.isEditing()) {
jTableFvAdditional.getCellEditor().stopCellEditing();
}
} }
}); });
} }
@ -1815,6 +1911,53 @@ public class FpdFlash extends IInternalFrame {
return jContentPane; return jContentPane;
} }
private void getFlashInfoFromFdf (String fdfPath, Vector<String> vBlockSize, String erasePolarity) {
File fdf = new File(fdfPath);
if (!fdf.exists()) {
return;
}
int lines = 0;
try {
FileReader reader = new FileReader(fdf);
BufferedReader in = new BufferedReader(reader);
String str;
while ((str = in.readLine()) != null) {
++lines;
str = str.trim();
//
// skip empty line, comment (start with //)
//
if (str.length() == 0 || str.startsWith("//")) {
continue;
}
//
// ErasePolarity
//
if (str.startsWith("ErasePolarity")) {
erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(","));
}
//
// dig into Block section.
//
if (str.startsWith("Block") && str.endsWith("}")) {
String[] blockSec = str.split(",");
String nv = blockSec[1].trim();
String[] sizeSec = nv.split("=");
vBlockSize.add(sizeSec[1].trim());
}
}
reader.close();
in.close();
}
catch (Exception e) {
}
}
private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) { private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {
File fdf = new File(fdfPath); File fdf = new File(fdfPath);
if (!fdf.exists()) { if (!fdf.exists()) {
@ -2374,11 +2517,12 @@ class ImageParaTableModel extends DefaultTableModel {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public boolean isCellEditable(int row, int col) { public boolean isCellEditable(int row, int col) {
if (getValueAt(row, 1).equals("ImageName") && col >=1) { // if (getValueAt(row, 1).equals("ImageName") && col >=1) {
// return false;
// }
// return true;
return false; return false;
} }
return true;
}
} }
class FvInfoFromFdf { class FvInfoFromFdf {

View File

@ -4,6 +4,7 @@ import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Toolkit; import java.awt.Toolkit;
import javax.swing.DefaultCellEditor;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -1241,6 +1242,16 @@ public class FpdModuleSA extends JDialog implements ActionListener {
optionsTableModel.addColumn("Contents"); optionsTableModel.addColumn("Contents");
jTableModuleSaOptions = new JTable(optionsTableModel); jTableModuleSaOptions = new JTable(optionsTableModel);
jTableModuleSaOptions.setRowHeight(20); jTableModuleSaOptions.setRowHeight(20);
javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
JComboBox cb = new JComboBox();
cb.addItem("MSFT");
cb.addItem("GCC");
cb.addItem("CYGWIN");
cb.addItem("INTEL");
cb.addItem("USER_DEFINED");
toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
Vector<String> vArch = new Vector<String>(); Vector<String> vArch = new Vector<String>();
vArch.add("IA32"); vArch.add("IA32");
vArch.add("X64"); vArch.add("X64");
@ -1249,6 +1260,9 @@ public class FpdModuleSA extends JDialog implements ActionListener {
vArch.add("ARM"); vArch.add("ARM");
vArch.add("PPC"); vArch.add("PPC");
jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch)); jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch));
jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() { jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() {