From 440537339ee813c0d52ab4e88746cd3fe42fdc33 Mon Sep 17 00:00:00 2001 From: jlin16 Date: Sat, 1 Jul 2006 11:43:16 +0000 Subject: [PATCH] git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@710 6f19259b-4bc3-4df7-8a09-765794883524 --- .../platform/ui/DynamicTree.java | 324 +++++++++--------- .../platform/ui/FpdBuildOptions.java | 184 +++++----- .../ui/FpdDynamicPcdBuildDefinitions.java | 12 +- .../platform/ui/FpdFileContents.java | 198 ++++++++++- .../frameworkwizard/platform/ui/FpdFlash.java | 297 +++++++++++++--- .../platform/ui/FpdFrameworkModules.java | 10 +- .../platform/ui/FpdHeader.java | 8 +- .../platform/ui/FpdModuleSA.java | 25 +- .../platform/ui/FpdPlatformDefs.java | 45 +-- 9 files changed, 763 insertions(+), 340 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java index bd3d4feb52..e54c7f0b6c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java @@ -1,160 +1,164 @@ -/** @file - - The file is used to create tree view sections - - 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.platform.ui; -import java.awt.GridLayout; -import java.awt.Toolkit; - -import javax.swing.ImageIcon; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.TreePath; -import javax.swing.tree.TreeSelectionModel; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; - - -public class DynamicTree extends JPanel { - protected DefaultMutableTreeNode rootNode; - protected DefaultTreeModel treeModel; - protected JTree tree; - private Toolkit toolkit = Toolkit.getDefaultToolkit(); - - public DynamicTree() { - super(new GridLayout(1,0)); - - rootNode = new DefaultMutableTreeNode("Sections"); - treeModel = new DefaultTreeModel(rootNode); - treeModel.addTreeModelListener(new MyTreeModelListener()); - - tree = new JTree(treeModel); - DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer(); - renderer.setOpenIcon(new ImageIcon("junk.gif")); - renderer.setClosedIcon(new ImageIcon("junk.gif")); - renderer.setLeafIcon(new ImageIcon("junk.gif")); - tree.setEditable(true); - tree.getSelectionModel().setSelectionMode - (TreeSelectionModel.SINGLE_TREE_SELECTION); - tree.setShowsRootHandles(true); - - JScrollPane scrollPane = new JScrollPane(tree); - add(scrollPane); - } - - /** Remove all nodes except the root node. */ - public void clear() { - rootNode.removeAllChildren(); - treeModel.reload(); - } - - public String getCurrentNodeText() { - DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); - if (currentNode != null){ - return (String)currentNode.getUserObject(); - } - return null; - } - /** Remove the currently selected node. */ - public void removeCurrentNode() { - TreePath currentSelection = tree.getSelectionPath(); - if (currentSelection != null) { - DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) - (currentSelection.getLastPathComponent()); - MutableTreeNode parent = (MutableTreeNode)(currentNode.getParent()); - if (parent != null) { - treeModel.removeNodeFromParent(currentNode); - return; - } - } - - // Either there was no selection, or the root was selected. - toolkit.beep(); - } - - /** Add child to the currently selected node. */ - public DefaultMutableTreeNode addObject(Object child) { - DefaultMutableTreeNode parentNode = null; - TreePath parentPath = tree.getSelectionPath(); - - if (parentPath == null) { - parentNode = rootNode; - } else { - parentNode = (DefaultMutableTreeNode) - (parentPath.getLastPathComponent()); - } - - return addObject(parentNode, child, true); - } - - public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, - Object child) { - return addObject(parent, child, false); - } - - public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, - Object child, - boolean shouldBeVisible) { - DefaultMutableTreeNode childNode = - new DefaultMutableTreeNode(child); - - if (parent == null) { - parent = rootNode; - } - - treeModel.insertNodeInto(childNode, parent, - parent.getChildCount()); - - //Make sure the user can see the lovely new node. - if (shouldBeVisible) { - tree.scrollPathToVisible(new TreePath(childNode.getPath())); - } - return childNode; - } - - class MyTreeModelListener implements TreeModelListener { - public void treeNodesChanged(TreeModelEvent e) { - DefaultMutableTreeNode node; - node = (DefaultMutableTreeNode) - (e.getTreePath().getLastPathComponent()); - - /* - * If the event lists children, then the changed - * node is the child of the node we've already - * gotten. Otherwise, the changed node and the - * specified node are the same. - */ - try { - int index = e.getChildIndices()[0]; - node = (DefaultMutableTreeNode) - (node.getChildAt(index)); - } catch (NullPointerException exc) {} - - System.out.println("The user has finished editing the node."); - System.out.println("New value: " + node.getUserObject()); - } - public void treeNodesInserted(TreeModelEvent e) { - } - public void treeNodesRemoved(TreeModelEvent e) { - } - public void treeStructureChanged(TreeModelEvent e) { - } - } -} - - +/** @file + + The file is used to create tree view sections + + 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.platform.ui; +import java.awt.GridLayout; +import java.awt.Toolkit; + +import javax.swing.ImageIcon; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.MutableTreeNode; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; + + +public class DynamicTree extends JPanel { + /** + * + */ + private static final long serialVersionUID = 1L; + protected DefaultMutableTreeNode rootNode; + protected DefaultTreeModel treeModel; + protected JTree tree; + private Toolkit toolkit = Toolkit.getDefaultToolkit(); + + public DynamicTree() { + super(new GridLayout(1,0)); + + rootNode = new DefaultMutableTreeNode("Sections"); + treeModel = new DefaultTreeModel(rootNode); + treeModel.addTreeModelListener(new MyTreeModelListener()); + + tree = new JTree(treeModel); + DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer(); + renderer.setOpenIcon(new ImageIcon("junk.gif")); + renderer.setClosedIcon(new ImageIcon("junk.gif")); + renderer.setLeafIcon(new ImageIcon("junk.gif")); + tree.setEditable(true); + tree.getSelectionModel().setSelectionMode + (TreeSelectionModel.SINGLE_TREE_SELECTION); + tree.setShowsRootHandles(true); + + JScrollPane scrollPane = new JScrollPane(tree); + add(scrollPane); + } + + /** Remove all nodes except the root node. */ + public void clear() { + rootNode.removeAllChildren(); + treeModel.reload(); + } + + public String getCurrentNodeText() { + DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); + if (currentNode != null){ + return (String)currentNode.getUserObject(); + } + return null; + } + /** Remove the currently selected node. */ + public void removeCurrentNode() { + TreePath currentSelection = tree.getSelectionPath(); + if (currentSelection != null) { + DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) + (currentSelection.getLastPathComponent()); + MutableTreeNode parent = (MutableTreeNode)(currentNode.getParent()); + if (parent != null) { + treeModel.removeNodeFromParent(currentNode); + return; + } + } + + // Either there was no selection, or the root was selected. + toolkit.beep(); + } + + /** Add child to the currently selected node. */ + public DefaultMutableTreeNode addObject(Object child) { + DefaultMutableTreeNode parentNode = null; + TreePath parentPath = tree.getSelectionPath(); + + if (parentPath == null) { + parentNode = rootNode; + } else { + parentNode = (DefaultMutableTreeNode) + (parentPath.getLastPathComponent()); + } + + return addObject(parentNode, child, true); + } + + public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, + Object child) { + return addObject(parent, child, false); + } + + public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, + Object child, + boolean shouldBeVisible) { + DefaultMutableTreeNode childNode = + new DefaultMutableTreeNode(child); + + if (parent == null) { + parent = rootNode; + } + + treeModel.insertNodeInto(childNode, parent, + parent.getChildCount()); + + //Make sure the user can see the lovely new node. + if (shouldBeVisible) { + tree.scrollPathToVisible(new TreePath(childNode.getPath())); + } + return childNode; + } + + class MyTreeModelListener implements TreeModelListener { + public void treeNodesChanged(TreeModelEvent e) { + DefaultMutableTreeNode node; + node = (DefaultMutableTreeNode) + (e.getTreePath().getLastPathComponent()); + + /* + * If the event lists children, then the changed + * node is the child of the node we've already + * gotten. Otherwise, the changed node and the + * specified node are the same. + */ + try { + int index = e.getChildIndices()[0]; + node = (DefaultMutableTreeNode) + (node.getChildAt(index)); + } catch (NullPointerException exc) {} + + System.out.println("The user has finished editing the node."); + System.out.println("New value: " + node.getUserObject()); + } + public void treeNodesInserted(TreeModelEvent e) { + } + public void treeNodesRemoved(TreeModelEvent e) { + } + public void treeStructureChanged(TreeModelEvent e) { + } + } +} + + diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java index 6abccfe38e..bfbf783168 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java @@ -39,6 +39,8 @@ import javax.swing.JTable; import javax.swing.JComboBox; import javax.swing.JRadioButton; import javax.swing.ListSelectionModel; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; @@ -46,12 +48,10 @@ import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableModel; -import javax.swing.JList; import org.tianocore.PlatformSurfaceAreaDocument; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; import java.awt.CardLayout; -import javax.swing.JTree; public class FpdBuildOptions extends IInternalFrame { @@ -74,18 +74,14 @@ public class FpdBuildOptions extends IInternalFrame { private JTextField jTextField4 = null; private JScrollPane jScrollPane2 = null; private JTable jTable2 = null; - private DefaultTableModel fileNameTableModel = null; + private DefaultTableModel ffsTableModel = null; private DefaultTableModel imageEntryPointTableModel = null; private DefaultTableModel outputDirectoryTableModel = null; private DefaultTableModel antTaskTableModel = null; private DefaultTableModel ffsAttributesTableModel = null; private DefaultTableModel optionsTableModel = null; private JPanel jPanel13 = null; - private JPanel jPanel14 = null; private JPanel jPanel18 = null; - private JScrollPane jScrollPane4 = null; - private JLabel jLabel6 = null; - private JList jList = null; private JPanel jPanel15 = null; private JPanel jPanel16 = null; private JPanel jPanel17 = null; @@ -127,8 +123,6 @@ public class FpdBuildOptions extends IInternalFrame { private JButton jButton15 = null; private JButton jButton16 = null; private DefaultListModel listModel = new DefaultListModel(); - private JScrollPane jScrollPane7 = null; - private JTree jTree = null; private JButton jButton17 = null; private JButton jButton18 = null; private FpdFileContents ffc = null; @@ -146,6 +140,8 @@ public class FpdBuildOptions extends IInternalFrame { private int selectedRow = -1; private JLabel jLabel = null; private JLabel jLabel1 = null; + private JScrollPane jScrollPane = null; + private JTable jTable = null; /** * This method initializes jPanel * @@ -457,29 +453,12 @@ public class FpdBuildOptions extends IInternalFrame { if (jPanel13 == null) { jPanel13 = new JPanel(); jPanel13.setLayout(new BorderLayout()); - jPanel13.add(getJPanel14(), java.awt.BorderLayout.WEST); jPanel13.add(getJPanel18(), java.awt.BorderLayout.CENTER); + jPanel13.add(getJScrollPane(), java.awt.BorderLayout.WEST); } return jPanel13; } - /** - * This method initializes jPanel14 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel14() { - if (jPanel14 == null) { - jLabel6 = new JLabel(); - jLabel6.setText("FFS Types"); - jPanel14 = new JPanel(); - jPanel14.setPreferredSize(new java.awt.Dimension(120,300)); - jPanel14.add(jLabel6, null); - jPanel14.add(getJScrollPane4(), null); - } - return jPanel14; - } - /** * This method initializes jPanel18 * @@ -497,32 +476,6 @@ public class FpdBuildOptions extends IInternalFrame { return jPanel18; } - /** - * This method initializes jScrollPane4 - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane4() { - if (jScrollPane4 == null) { - jScrollPane4 = new JScrollPane(); - jScrollPane4.setPreferredSize(new java.awt.Dimension(120,330)); - jScrollPane4.setViewportView(getJList()); - } - return jScrollPane4; - } - - /** - * This method initializes jList - * - * @return javax.swing.JList - */ - private JList getJList() { - if (jList == null) { - jList = new JList(listModel); - } - return jList; - } - /** * This method initializes jPanel15 * @@ -573,7 +526,6 @@ public class FpdBuildOptions extends IInternalFrame { private JPanel getJPanel17() { if (jPanel17 == null) { jPanel17 = new JPanel(); - jPanel17.add(getJScrollPane7(), null); } return jPanel17; } @@ -602,6 +554,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton8.setPreferredSize(new java.awt.Dimension(70,20)); jButton8.setText("Add"); jButton8.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = -2923720717273384221L; + public void actionPerformed(java.awt.event.ActionEvent e) { if (jTextField6.getText().length() > 0) { listModel.addElement(jTextField6.getText()); @@ -623,8 +580,12 @@ public class FpdBuildOptions extends IInternalFrame { jButton9.setPreferredSize(new java.awt.Dimension(70,20)); jButton9.setText("Delete"); jButton9.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = -4002678939178194476L; + public void actionPerformed(ActionEvent arg0){ - listModel.remove(jList.getSelectedIndex()); } }); } @@ -869,6 +830,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton10.setText("Add"); jButton10.setPreferredSize(new java.awt.Dimension(70,20)); jButton10.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(java.awt.event.ActionEvent e) { boolean[] boolArray = {jCheckBox9.isSelected(),jCheckBox10.isSelected(),jCheckBox11.isSelected(), jCheckBox12.isSelected(),jCheckBox13.isSelected(),jCheckBox14.isSelected()}; @@ -918,6 +884,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton11.setText("Delete"); jButton11.setPreferredSize(new java.awt.Dimension(70,20)); jButton11.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(java.awt.event.ActionEvent e) { if (selectedRow >= 0) { optionsTableModel.removeRow(selectedRow); @@ -964,6 +935,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton12.setText("Add Sections"); jButton12.setPreferredSize(new java.awt.Dimension(109,20)); jButton12.addActionListener(new AbstractAction(){ + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent arg0){ } }); @@ -982,6 +958,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton13.setText("Add Section"); jButton13.setPreferredSize(new java.awt.Dimension(102,20)); jButton13.addActionListener(new AbstractAction(){ + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent arg0){ CardLayout cl = (CardLayout)jPanel19.getLayout(); cl.last(jPanel19); @@ -1152,6 +1133,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton14.setText("Add"); jButton14.setPreferredSize(new java.awt.Dimension(70,20)); jButton14.addActionListener(new AbstractAction(){ + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent arg0){ } }); @@ -1187,32 +1173,6 @@ public class FpdBuildOptions extends IInternalFrame { return jButton16; } - /** - * This method initializes jScrollPane7 - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane7() { - if (jScrollPane7 == null) { - jScrollPane7 = new JScrollPane(); - jScrollPane7.setPreferredSize(new java.awt.Dimension(110,200)); - jScrollPane7.setViewportView(getJTree()); - } - return jScrollPane7; - } - - /** - * This method initializes jTree - * - * @return javax.swing.JTree - */ - private JTree getJTree() { - if (jTree == null) { - jTree = new JTree(); - } - return jTree; - } - /** * This method initializes jButton17 * @@ -1224,6 +1184,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton17.setPreferredSize(new java.awt.Dimension(70,20)); jButton17.setText("Add"); jButton17.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent arg0){ Object[] o = {"", ""}; ffsAttributesTableModel.addRow(o); @@ -1244,6 +1209,11 @@ public class FpdBuildOptions extends IInternalFrame { jButton18.setPreferredSize(new java.awt.Dimension(70,20)); jButton18.setText("Delete"); jButton18.addActionListener(new AbstractAction(){ + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent arg0){ if (jTable4.getSelectedRow() >= 0){ ffsAttributesTableModel.removeRow(jTable4.getSelectedRow()); @@ -1379,6 +1349,36 @@ public class FpdBuildOptions extends IInternalFrame { return jTextField13; } + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setPreferredSize(new java.awt.Dimension(150,419)); + jScrollPane.setViewportView(getJTable()); + } + return jScrollPane; + } + + /** + * This method initializes jTable + * + * @return javax.swing.JTable + */ + private JTable getJTable() { + if (jTable == null) { + ffsTableModel = new DefaultTableModel(); + ffsTableModel.addColumn("FFS Type"); + jTable = new JTable(ffsTableModel); + jTable.setShowGrid(false); + jTable.setRowHeight(20); + } + return jTable; + } + /** * @param args */ @@ -1405,6 +1405,28 @@ public class FpdBuildOptions extends IInternalFrame { private void init(FpdFileContents ffc) { initOptionTable(); initAntTaskTable(); + this.addInternalFrameListener(new InternalFrameAdapter(){ + public void internalFrameDeactivated(InternalFrameEvent e){ + if (jTable.isEditing()) { + jTable.getCellEditor().stopCellEditing(); + } +// if (jTable1.isEditing()) { +// jTable1.getCellEditor().stopCellEditing(); +// } + if (jTable2.isEditing()) { + jTable2.getCellEditor().stopCellEditing(); + } +// if (jTable3.isEditing()) { +// jTable3.getCellEditor().stopCellEditing(); +// } + if (jTable4.isEditing()) { + jTable4.getCellEditor().stopCellEditing(); + } + if (jTable5.isEditing()) { + jTable5.getCellEditor().stopCellEditing(); + } + } + }); } private void initOptionTable() { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java index 155f4f48d4..5c1393de58 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java @@ -4,7 +4,6 @@ import java.awt.BorderLayout; import javax.swing.ButtonGroup; import javax.swing.JPanel; -import javax.swing.JDialog; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; @@ -23,6 +22,10 @@ import javax.swing.JTextField; public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { + /** + * + */ + private static final long serialVersionUID = 1L; private JPanel jContentPane = null; private JPanel jPanel = null; private JPanel jPanel1 = null; @@ -465,7 +468,7 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { } else{ int selected = lsm.getMinSelectionIndex(); - + displaySkuInfoDetails(selected); } } }); @@ -662,6 +665,11 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { } // @jve:decl-index=0:visual-constraint="10,10" class DynPcdTableModel extends DefaultTableModel { + /** + * + */ + private static final long serialVersionUID = 1L; + public boolean isCellEditable(int row, int col) { return false; diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 449578006e..c9f4ccc98e 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -33,10 +33,8 @@ import org.tianocore.AntTaskDocument; import org.tianocore.BuildOptionsDocument; import org.tianocore.DynamicPcdBuildDefinitionsDocument; import org.tianocore.FlashDefinitionFileDocument; -import org.tianocore.FlashDeviceDefinitionsDocument; import org.tianocore.FlashDocument; import org.tianocore.FrameworkModulesDocument; -import org.tianocore.FvRegionNameDocument; import org.tianocore.LibrariesDocument; import org.tianocore.ModuleSADocument; import org.tianocore.ModuleSurfaceAreaDocument; @@ -1306,8 +1304,15 @@ public class FpdFileContents { Set key = options.keySet(); Iterator i = key.iterator(); while (i.hasNext()) { + FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fio.addNewNameValue(); String k = (String)i.next(); + if (k.equals("EFI_ALIGNMENT_CAP")) { + nv.setName(k); + nv.setValue("TRUE"); + setFvImageOptionsAlign((String)options.get(k), fio); + continue; + } nv.setName(k); nv.setValue((String)options.get(k)); @@ -1315,6 +1320,195 @@ public class FpdFileContents { } + private void setFvImageOptionsAlign(String alignValue, FvImagesDocument.FvImages.FvImage.FvImageOptions fio) { + int numForm = -1; + if (alignValue.endsWith("K")) { + alignValue = alignValue.substring(0, alignValue.length()-1); + numForm = new Integer(alignValue).intValue() * 1024; + } + else { + numForm = new Integer(alignValue).intValue(); + } + + FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = null; + if (numForm / (64*1024) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_64K"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_64K"); + nv.setValue("FALSE"); + } + + if (numForm / (32*1024) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_32K"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_32K"); + nv.setValue("FALSE"); + } + + if (numForm / (16*1024) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_16K"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_16K"); + nv.setValue("FALSE"); + } + + if (numForm / (8*1024) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_8K"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_8K"); + nv.setValue("FALSE"); + } + + if (numForm / (4*1024) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_4K"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_4K"); + nv.setValue("FALSE"); + } + + if (numForm / (2*1024) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_2K"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_2K"); + nv.setValue("FALSE"); + } + + if (numForm / (1*1024) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_1K"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_1K"); + nv.setValue("FALSE"); + } + + if (numForm / (512) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_512"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_512"); + nv.setValue("FALSE"); + } + + if (numForm / (256) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_256"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_256"); + nv.setValue("FALSE"); + } + + if (numForm / (128) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_128"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_128"); + nv.setValue("FALSE"); + } + + if (numForm / (64) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_64"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_64"); + nv.setValue("FALSE"); + } + + if (numForm / (32) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_32"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_32"); + nv.setValue("FALSE"); + } + + if (numForm / (16) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_16"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_16"); + nv.setValue("FALSE"); + } + + if (numForm / (8) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_8"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_8"); + nv.setValue("FALSE"); + } + + if (numForm / (4) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_4"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_4"); + nv.setValue("FALSE"); + } + + if (numForm / (2) >= 1) { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_2"); + nv.setValue("TRUE"); + } + else { + nv = fio.addNewNameValue(); + nv.setName("EFI_ALIGNMENT_2"); + nv.setValue("FALSE"); + } + + } + public void removeFvImagesFvImage(int i) { XmlObject o = getfpdFlash().getFvImages(); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java index 992f65a2f3..4e143108d5 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java @@ -16,34 +16,24 @@ import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.AbstractAction; -import javax.swing.ButtonGroup; import javax.swing.DefaultCellEditor; -import javax.swing.DefaultListModel; -import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; -import javax.swing.JInternalFrame; -import javax.swing.JOptionPane; import javax.swing.JTabbedPane; import javax.swing.JButton; import javax.swing.ListSelectionModel; import org.tianocore.PlatformSurfaceAreaDocument; -import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; import java.awt.FlowLayout; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; import java.util.Iterator; @@ -57,7 +47,8 @@ import java.awt.GridLayout; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; -import javax.swing.JList; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; @@ -67,12 +58,13 @@ import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import javax.swing.JComboBox; import java.awt.Dimension; -import javax.swing.JRadioButton; -import javax.swing.JTextArea; -import java.awt.CardLayout; public class FpdFlash extends IInternalFrame { + /** + * + */ + private static final long serialVersionUID = 1L; static JFrame frame; private JPanel jContentPane = null; private JPanel jPanel = null; @@ -84,7 +76,6 @@ public class FpdFlash extends IInternalFrame { private JButton jButtonOk = null; private JButton jButtonCancel = null; private JPanel jPanelFvImageN = null; - private JPanel jPanelFvImageW = null; private JPanel jPanelFvImageS = null; private JCheckBox jCheckBox1 = null; private JLabel jLabel = null; @@ -92,7 +83,6 @@ public class FpdFlash extends IInternalFrame { private JLabel jLabel1 = null; private JTextField jTextField1 = null; private JButton jButton = null; - private JScrollPane jScrollPane = null; private JScrollPane jScrollPane1 = null; private JTable jTable = null; private JPanel jPanel4 = null; @@ -130,19 +120,14 @@ public class FpdFlash extends IInternalFrame { private JCheckBox jCheckBox12 = null; private JCheckBox jCheckBox13 = null; private JPanel jPanel6 = null; - private DefaultTableModel fdfImageDefTableModel = null; - private DefaultTableModel fdfBlocksTableModel = null; - private DefaultTableModel fdfRegionsTableModel = null; - private DefaultTableModel fdfSubRegionsTableModel = null; - private JLabel jLabel17 = null; - private DefaultListModel listModel = new DefaultListModel(); private FpdFileContents ffc = null; private JPanel jPanel7 = null; private JCheckBox jCheckBox = null; private JTextField jTextField3 = null; private JButton jButton5 = null; - + private JLabel jLabel6 = null; + private JComboBox jComboBox2 = null; public FpdFlash() { super(); // TODO Auto-generated constructor stub @@ -309,21 +294,6 @@ public class FpdFlash extends IInternalFrame { return jPanelFvImageN; } - - /** - * This method initializes jPanelFvImageW - * - * @return javax.swing.JPanel - */ - private JPanel getJPanelFvImageW() { - if (jPanelFvImageW == null) { - jPanelFvImageW = new JPanel(); - jPanelFvImageW.setPreferredSize(new java.awt.Dimension(10,2)); - } - return jPanelFvImageW; - } - - /** * This method initializes jPanelFvImageS * @@ -334,7 +304,7 @@ public class FpdFlash extends IInternalFrame { GridLayout gridLayout2 = new GridLayout(); gridLayout2.setRows(1); jPanelFvImageS = new JPanel(); - jPanelFvImageS.setPreferredSize(new java.awt.Dimension(480,200)); + jPanelFvImageS.setPreferredSize(new java.awt.Dimension(480,190)); jPanelFvImageS.setLayout(gridLayout2); jPanelFvImageS.add(getJScrollPane3(), null); } @@ -416,6 +386,11 @@ public class FpdFlash extends IInternalFrame { jButton.setEnabled(false); jButton.setText("Add"); jButton.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent e) { if (jTextField.getText().length() > 0 && jTextField1.getText().length() > 0){ String[] row = {jTextField.getText(), jTextField1.getText()}; @@ -522,6 +497,11 @@ public class FpdFlash extends IInternalFrame { jButton1.setEnabled(false); jButton1.setText("Delete"); jButton1.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent e) { if (jTable.getSelectedRow() >= 0){ fvPropertyTableModel.removeRow(jTable.getSelectedRow()); @@ -656,6 +636,11 @@ public class FpdFlash extends IInternalFrame { jButton2.setEnabled(false); jButton2.setText("Add"); jButton2.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(java.awt.event.ActionEvent e) { if (jTextField2.getText().length() > 0){ String[] row = {jTextField2.getText()}; @@ -711,6 +696,11 @@ public class FpdFlash extends IInternalFrame { jButton3.setEnabled(false); jButton3.setText("Delete"); jButton3.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(java.awt.event.ActionEvent e) { if (jTable1.getSelectedRow() >= 0){ @@ -730,11 +720,14 @@ public class FpdFlash extends IInternalFrame { if (jPanel5 == null) { //ToDo add ButtonGroup for RadioButtons + jLabel6 = new JLabel(); + jLabel6.setText("EFI Alignment CAP"); + jLabel6.setEnabled(false); jPanel5 = new JPanel(); - jPanel5.setPreferredSize(new java.awt.Dimension(480,120)); + jPanel5.setPreferredSize(new java.awt.Dimension(480,150)); GridLayout gridLayout = new GridLayout(); - gridLayout.setRows(5); + gridLayout.setRows(6); gridLayout.setColumns(3); jPanel5.setLayout(gridLayout); jPanel5.add(getJCheckBox3(), null); @@ -754,8 +747,10 @@ public class FpdFlash extends IInternalFrame { jPanel5.add(getJCheckBox11(), null); jPanel5.add(getJCheckBox12(), null); jPanel5.add(getJCheckBox13(), null); - jPanel5.add(getJButton4(), null); jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED)); + jPanel5.add(jLabel6, null); + jPanel5.add(getJComboBox2(), null); + jPanel5.add(getJButton4(), null); jPanel5.add(getJButton6(), null); @@ -779,6 +774,11 @@ public class FpdFlash extends IInternalFrame { // jButton4.setEnabled(false); jButton4.setText("Add FV Image"); jButton4.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(java.awt.event.ActionEvent e) { if (jTable1.getRowCount()== 0){ return; @@ -795,13 +795,16 @@ public class FpdFlash extends IInternalFrame { } - LinkedHashMap m = new LinkedHashMap(); - boolean[] boolArray = {jComboBox1.getSelectedIndex()==0 ? true: false, jCheckBox6.isSelected(), jCheckBox9.isSelected(), + LinkedHashMap m = null; + if (jCheckBox3.isSelected()) { + m = new LinkedHashMap(); + boolean[] boolArray = {jComboBox1.getSelectedIndex()==0 ? true: false, jCheckBox6.isSelected(), jCheckBox9.isSelected(), jCheckBox11.isSelected(), jCheckBox12.isSelected(), jCheckBox13.isSelected(),jCheckBox4.isSelected(), jCheckBox5.isSelected(), jCheckBox7.isSelected(), jCheckBox8.isSelected(),jCheckBox10.isSelected()}; - booleanToNameValue(boolArray, m); + booleanToNameValue(boolArray, m); + } ffc.genFvImagesFvImage(imageName.split(" "), jComboBox.getSelectedItem()+"", m); Object[] o = {imageName, jComboBox.getSelectedItem(), jComboBox1.getSelectedIndex()==0 ? true: false, @@ -856,6 +859,7 @@ public class FpdFlash extends IInternalFrame { fvImageParaTableModel.addColumn("WriteDisableCap"); fvImageParaTableModel.addColumn("WriteEnableCap"); fvImageParaTableModel.addColumn("LockCap"); + fvImageParaTableModel.addColumn("Alignment"); TableColumn typeCol = jTable2.getColumnModel().getColumn(1); JComboBox cb = new JComboBox(); @@ -865,11 +869,26 @@ public class FpdFlash extends IInternalFrame { cb.addItem("Components"); typeCol.setCellEditor(new DefaultCellEditor(cb)); -// TableColumn epCol = jTable2.getColumnModel().getColumn(2); -// JComboBox cb1 = new JComboBox(); -// cb1.addItem("1"); -// cb1.addItem("0"); -// epCol.setCellEditor(new DefaultCellEditor(cb1)); + TableColumn alignCol = jTable2.getColumnModel().getColumn(13); + JComboBox cb1 = new JComboBox(); + cb1.addItem("64K"); + cb1.addItem("32K"); + cb1.addItem("16K"); + cb1.addItem("8K"); + cb1.addItem("4K"); + cb1.addItem("2K"); + cb1.addItem("1K"); + cb1.addItem("512"); + cb1.addItem("256"); + cb1.addItem("128"); + cb1.addItem("64"); + cb1.addItem("32"); + cb1.addItem("16"); + cb1.addItem("8"); + cb1.addItem("4"); + cb1.addItem("2"); + alignCol.setCellEditor(new DefaultCellEditor(cb1)); + jTable2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable2.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { @@ -901,6 +920,7 @@ public class FpdFlash extends IInternalFrame { } LinkedHashMap lhm = new LinkedHashMap(); booleanToNameValue(boolArray, lhm); + lhm.put("EFI_ALIGNMENT_CAP", m.getValueAt(row, 13)+""); ffc.updateFvImagesFvImage(row, name.split(" "), type, lhm); } @@ -923,6 +943,10 @@ public class FpdFlash extends IInternalFrame { // jButton6.setEnabled(false); jButton6.setText("Delete Row"); jButton6.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub @@ -970,6 +994,8 @@ public class FpdFlash extends IInternalFrame { jCheckBox11.setEnabled(seleted); jCheckBox12.setEnabled(seleted); jCheckBox13.setEnabled(seleted); + jLabel6.setEnabled(seleted); + jComboBox2.setEnabled(seleted); // jButton4.setEnabled(seleted); // jButton6.setEnabled(seleted); } @@ -1258,6 +1284,11 @@ public class FpdFlash extends IInternalFrame { jButton5.setText("Browse"); jButton5.setPreferredSize(new Dimension(78, 20)); jButton5.addActionListener(new AbstractAction(){ + /** + * + */ + private static final long serialVersionUID = 1L; + public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub JFileChooser chooser = new JFileChooser(); @@ -1276,6 +1307,36 @@ public class FpdFlash extends IInternalFrame { return jButton5; } + /** + * This method initializes jComboBox2 + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBox2() { + if (jComboBox2 == null) { + jComboBox2 = new JComboBox(); + jComboBox2.setEnabled(false); + jComboBox2.addItem("64K"); + jComboBox2.addItem("32K"); + jComboBox2.addItem("16K"); + jComboBox2.addItem("8K"); + jComboBox2.addItem("4K"); + jComboBox2.addItem("2K"); + jComboBox2.addItem("1K"); + jComboBox2.addItem("512"); + jComboBox2.addItem("256"); + jComboBox2.addItem("128"); + jComboBox2.addItem("64"); + jComboBox2.addItem("32"); + jComboBox2.addItem("16"); + jComboBox2.addItem("8"); + jComboBox2.addItem("4"); + jComboBox2.addItem("2"); + jComboBox2.setSelectedIndex(0); + } + return jComboBox2; + } + /** * @param args */ @@ -1294,6 +1355,19 @@ public class FpdFlash extends IInternalFrame { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); this.setContentPane(getJContentPane()); this.setTitle("FPD Flash Definitions"); + this.addInternalFrameListener(new InternalFrameAdapter(){ + public void internalFrameDeactivated(InternalFrameEvent e){ + if (jTable.isEditing()) { + jTable.getCellEditor().stopCellEditing(); + } + if (jTable1.isEditing()) { + jTable1.getCellEditor().stopCellEditing(); + } + if (jTable2.isEditing()) { + jTable2.getCellEditor().stopCellEditing(); + } + } + }); } private void init(FpdFileContents ffc) { @@ -1308,7 +1382,7 @@ public class FpdFlash extends IInternalFrame { } ffc.getFvImagesFvImages(saa, options); - Object[] rowData = new Object[13]; + Object[] rowData = new Object[14]; int i = 0; Boolean f = new Boolean("false"); while (i < saa.length) { @@ -1327,11 +1401,113 @@ public class FpdFlash extends IInternalFrame { for (k = 2; k < 13; ++k) { rowData[k] = boolArray[k-2]; } + rowData[13] = getAlign(options.get(i)); fvImageParaTableModel.addRow(rowData); ++i; } } + private String getAlign(Map m){ + String s = "64K"; + if (m.get("EFI_ALIGNMENT_64K") != null) { + if (m.get("EFI_ALIGNMENT_64K").equals("TRUE")) { + s = "64K"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_32K") != null) { + if (m.get("EFI_ALIGNMENT_32K").equals("TRUE")) { + s = "32K"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_16K") != null) { + if (m.get("EFI_ALIGNMENT_16K").equals("TRUE")) { + s = "16K"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_8K") != null) { + if (m.get("EFI_ALIGNMENT_8K").equals("TRUE")) { + s = "8K"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_4K") != null) { + if (m.get("EFI_ALIGNMENT_4K").equals("TRUE")) { + s = "4K"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_2K") != null) { + if (m.get("EFI_ALIGNMENT_2K").equals("TRUE")) { + s = "2K"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_1K") != null) { + if (m.get("EFI_ALIGNMENT_1K").equals("TRUE")) { + s = "1K"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_512") != null) { + if (m.get("EFI_ALIGNMENT_512").equals("TRUE")) { + s = "512"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_256") != null) { + if (m.get("EFI_ALIGNMENT_256").equals("TRUE")) { + s = "256"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_128") != null) { + if (m.get("EFI_ALIGNMENT_128").equals("TRUE")) { + s = "128"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_64") != null) { + if (m.get("EFI_ALIGNMENT_64").equals("TRUE")) { + s = "64"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_32") != null) { + if (m.get("EFI_ALIGNMENT_32").equals("TRUE")) { + s = "32"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_16") != null) { + if (m.get("EFI_ALIGNMENT_16").equals("TRUE")) { + s = "16"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_8") != null) { + if (m.get("EFI_ALIGNMENT_8").equals("TRUE")) { + s = "8"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_4") != null) { + if (m.get("EFI_ALIGNMENT_4").equals("TRUE")) { + s = "4"; + return s; + } + } + if (m.get("EFI_ALIGNMENT_2") != null) { + if (m.get("EFI_ALIGNMENT_2").equals("TRUE")) { + s = "2"; + return s; + } + } + return s; + } + private void namevalueToBoolean(Map m, Boolean[] boolArray){ Set key = m.keySet(); Iterator ki= key.iterator(); @@ -1464,7 +1640,22 @@ public class FpdFlash extends IInternalFrame { class ImageParaTableModel extends DefaultTableModel { - public Class getColumnClass (int c) { - return getValueAt(0, c).getClass(); + /** + * + */ + private static final long serialVersionUID = 1L; + + public Class getColumnClass (int c) { + if (getValueAt(0, c) != null) { + return getValueAt(0, c).getClass(); + } + return String.class; + } + + public boolean isCellEditable(int row, int col) { + if (getValueAt(row, 1).equals("ImageName") && col >=1) { + return false; + } + return true; } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index f9abe9d017..929e1647e0 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -5,7 +5,6 @@ import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.JDialog; import javax.swing.JSplitPane; import javax.swing.JLabel; import javax.swing.JScrollPane; @@ -30,6 +29,10 @@ import java.util.Set; public class FpdFrameworkModules extends IInternalFrame { + /** + * + */ + private static final long serialVersionUID = 1L; static JFrame frame; private JSplitPane jSplitPane = null; private JPanel jPanel = null; @@ -432,6 +435,11 @@ public class FpdFrameworkModules extends IInternalFrame { } // @jve:decl-index=0:visual-constraint="10,10" class NonEditableTableModel extends DefaultTableModel { + /** + * + */ + private static final long serialVersionUID = 1L; + public boolean isCellEditable(int row, int col) { return false; } 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 dae88584a4..d897959aea 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 @@ -16,14 +16,12 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.Dimension; -import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import javax.swing.JButton; -import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -31,12 +29,9 @@ import javax.swing.JTextArea; import javax.swing.JTextField; -import org.tianocore.LicenseDocument; import org.tianocore.PlatformSurfaceAreaDocument; -import org.tianocore.PlatformHeaderDocument; -import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Tools; @@ -453,6 +448,9 @@ public class FpdHeader extends IInternalFrame { if (ffc.getFpdHdrLicense() != null) { jTextAreaLicense.setText(ffc.getFpdHdrLicense()); } + if (ffc.getFpdHdrAbs() != null) { + jTextFieldAbstract.setText(ffc.getFpdHdrAbs()); + } if (ffc.getFpdHdrUrl() != null) { jTextField.setText(ffc.getFpdHdrUrl()); } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index 5cf0c6dbea..e5a4e88574 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -2,8 +2,6 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; -import javax.swing.DefaultCellEditor; -import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -12,7 +10,6 @@ import javax.swing.JTabbedPane; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; -import javax.swing.JTextPane; import javax.swing.JTextArea; import javax.swing.JSplitPane; import javax.swing.JButton; @@ -22,7 +19,6 @@ import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import org.apache.xmlbeans.XmlObject; @@ -43,6 +39,10 @@ import java.util.Set; public class FpdModuleSA extends JDialog implements ActionListener { + /** + * + */ + private static final long serialVersionUID = 1L; static JFrame frame; private JPanel jContentPane = null; private JTabbedPane jTabbedPane = null; @@ -83,11 +83,8 @@ public class FpdModuleSA extends JDialog implements ActionListener { private LibraryTableModel model3 = null; private FpdFileContents ffc = null; private String moduleKey = null; -// private int selectedRow = -1; - private HashMap instancePreferMap = null; private HashMap> classInstanceMap = null; private ArrayList classProduced = null; -// private ArrayList classConsumed = null; private HashMap> classConsumed = null; /** * This is the default constructor @@ -481,7 +478,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { - int selectedRow = -1; + if (e.getValueIsAdjusting()){ return; } @@ -490,7 +487,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { return; } else{ - selectedRow = lsm.getMinSelectionIndex(); +// int selectedRow = lsm.getMinSelectionIndex(); } @@ -970,6 +967,11 @@ public class FpdModuleSA extends JDialog implements ActionListener { } // @jve:decl-index=0:visual-constraint="10,10" class PartialEditableTableModel extends DefaultTableModel { + /** + * + */ + private static final long serialVersionUID = 1L; + public boolean isCellEditable(int row, int col) { switch (col){ case 2: @@ -982,6 +984,11 @@ class PartialEditableTableModel extends DefaultTableModel { } class LibraryTableModel extends DefaultTableModel { + /** + * + */ + private static final long serialVersionUID = 1L; + public boolean isCellEditable(int row, int col) { return false; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java index 526caf7da7..2133e05464 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java @@ -15,50 +15,26 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; import javax.swing.JPanel; -import javax.swing.AbstractAction; -import javax.swing.ButtonGroup; import javax.swing.DefaultCellEditor; import javax.swing.DefaultListModel; -import javax.swing.JDialog; -import javax.swing.JFileChooser; import javax.swing.JFrame; -import javax.swing.JInternalFrame; -import javax.swing.JOptionPane; import javax.swing.JTabbedPane; import javax.swing.JButton; -import javax.swing.ListSelectionModel; import org.tianocore.PlatformSurfaceAreaDocument; -import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; -import org.tianocore.frameworkwizard.common.ui.StarLabel; import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.ActionEvent; -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; + import javax.swing.JCheckBox; import javax.swing.JTextField; -import java.awt.GridLayout; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; -import javax.swing.JList; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; @@ -74,6 +50,10 @@ import java.awt.CardLayout; public class FpdPlatformDefs extends IInternalFrame { + /** + * + */ + private static final long serialVersionUID = 1L; static JFrame frame; private JPanel jContentPane = null; private JPanel jPanel = null; @@ -265,6 +245,17 @@ public class FpdPlatformDefs extends IInternalFrame { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); this.setContentPane(getJContentPane()); this.setTitle("FPD Platform Definitions"); + this.addInternalFrameListener(new InternalFrameAdapter(){ + public void internalFrameDeactivated(InternalFrameEvent e){ + if (jTable.isEditing()) { + jTable.getCellEditor().stopCellEditing(); + } + if (jTable2.isEditing()) { + jTable2.getCellEditor().stopCellEditing(); + } + + } + }); } private void init(FpdFileContents ffc) { -- 2.39.2