X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdBuildOptions.java;h=7f06730fe40939ddd5e8e5867927574a52b98e6f;hp=b94e695ecc315165973596b07d4e25f7cf395b1a;hb=a0783edc77ae576d8032461935362f43293bc467;hpb=1800d80f22f225e931a318c785646f581562d608 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 b94e695ecc..7f06730fe4 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 @@ -26,6 +26,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.DefaultCellEditor; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JButton; import javax.swing.JScrollPane; @@ -39,154 +42,313 @@ 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.tianocore.PlatformSurfaceAreaDocument; +import org.tianocore.frameworkwizard.common.DataValidation; +import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; + +import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Set; import java.util.Vector; +import java.awt.Dimension; +import javax.swing.JSplitPane; public class FpdBuildOptions extends IInternalFrame { + private final int oneRowHeight = 20; + + private final int twoRowHeight = 40; + + private final int sepHeight = 6; + + private final int sepWidth = 10; + + private final int buttonWidth = 90; + + private final int rowOne = 12; + + private final int dialogWidth = 600; + + private final int rowTwo = rowOne + oneRowHeight + sepHeight; + + private final int rowThree = rowTwo + oneRowHeight + sepHeight; + + private final int rowFour = rowThree + oneRowHeight + sepHeight; + + private final int rowFive = rowFour + oneRowHeight + sepHeight; + + private final int rowSix = rowFive + oneRowHeight + sepHeight; + + private final int rowSeven = rowSix + oneRowHeight + sepHeight; + + private final int buttonRow = rowSeven + oneRowHeight + sepHeight + sepHeight; + + private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight; + + private final int lastButtonXLoc = dialogWidth - buttonWidth - sepWidth; + + private final int next2LastButtonLoc = lastButtonXLoc - buttonWidth - sepWidth; + + private final int firstButtonLoc = next2LastButtonLoc - buttonWidth - sepWidth; + + private final int labelColumn = 12; + + private final int fieldColumn = 168; + + private final int labelWidth = 155; + + private final int fieldWidth = 320; + private static final long serialVersionUID = 1L; + + static JFrame frame; + private JPanel jContentPane = null; - private JPanel jPanel = null; - private JPanel jPanel1 = null; - private JPanel jPanel2 = null; - private JPanel jPanel3 = null; + + // private JPanel jPanelContentSouth = null; + + // private JPanel jPanelContentNorth = null; + + // private JPanel jPanelContentWest = null; + + // private JPanel jPanelContentEast = null; + private JTabbedPane jTabbedPane = null; - private JPanel jPanel8 = null; - private JPanel jPanel9 = null; - private JPanel jPanel10 = null; - private JPanel jPanel11 = null; - private JTextField jTextField2 = null; - private JLabel jLabel3 = null; - private JTextField jTextField3 = null; - private JButton jButton4 = null; - private JButton jButton5 = null; - private JTextField jTextField4 = null; - private JScrollPane jScrollPane2 = null; - private JTable jTable2 = null; + + private JPanel jPanelUserDef = null; + + private JPanel jPanelUserDefNorth = null; + + private JPanel jPanelUserDefCenter = null; + + private JTextField jTextFieldAntTaskFile = null; + + private JLabel jLabelAntTaskId = null; + + private JTextField jTextFieldAntTaskId = null; + + private JButton jButtonAntTaskAdd = null; + + private JButton jButtonAntTaskDel = null; + + private JTextField jTextFieldAntCmdOpts = null; + + private JScrollPane jScrollPaneAntTasks = null; + + private JTable jTableAntTasks = null; + private DefaultTableModel ffsTableModel = null; + private DefaultTableModel sectionsTableModel = null; + private DefaultTableModel sectionTableModel = null; + private DefaultTableModel subsectionsTableModel = null; + private DefaultTableModel antTaskTableModel = null; + private DefaultTableModel ffsAttributesTableModel = null; + private DefaultTableModel optionsTableModel = null; - private JPanel jPanel13 = null; - private JPanel jPanel18 = null; - private JPanel jPanel15 = null; - private JPanel jPanel16 = null; - private JPanel jPanel17 = null; - private JLabel jLabel7 = null; - private JTextField jTextField6 = null; - private JButton jButton8 = null; - private JButton jButton9 = null; - private JScrollPane jScrollPane5 = null; - private JTable jTable4 = null; - private JPanel jPanel19 = null; - private JPanel jPanel20 = null; - private JLabel jLabel9 = null; - private JTextField jTextField7 = null; - private JLabel jLabel10 = null; - private JComboBox jComboBox2 = null; - private JLabel jLabel11 = null; - private JLabel jLabel12 = null; - private JTextField jTextField8 = null; - private JScrollPane jScrollPane6 = null; - private JTable jTable5 = null; - private JButton jButton10 = null; - private JButton jButton11 = null; - private JButton jButton17 = null; - private JButton jButton18 = null; + + private JPanel jPanelFfsTab = null; + + private JPanel jPanelFfsTabCenter = null; + + private JPanel jPanelFfsTabCenterN = null; + + private JPanel jPanelFfsTabCenterS = null; + + private JLabel jLabelFfsKey = null; + + private JTextField jTextFieldFfsKey = null; + + private JButton jButtonFfsAdd = null; + + private JButton jButtonFfsDel = null; + + private JScrollPane jScrollPaneFfsAttribs = null; + + private JTable jTableFfsAttribs = null; + + private JPanel jPanelOptionsTab = null; + + private JLabel jLabelOptionContents = null; + + private JTextField jTextFieldOptionContents = null; + + private JLabel jLabelToolChainFamily = null; + + private JLabel jLabelSupArch = null; + + private JLabel jLabelToolCmd = null; + + private JTextField jTextFieldToolCmd = null; + + private JScrollPane jScrollPaneOptions = null; + + private JTable jTableOptions = null; + + private JLabel jTitle = null; + + private JButton jButtonOptionsAdd = null; + + private JButton jButtonOptionsDel = null; + + private JButton jButtonFfsAttribNew = null; + + private JButton jButtonFfsAttribRemove = null; + private FpdFileContents ffc = null; - private JButton jButton19 = null; - private JCheckBox jCheckBox9 = null; - private JCheckBox jCheckBox10 = null; - private JCheckBox jCheckBox11 = null; - private JCheckBox jCheckBox12 = null; - private JCheckBox jCheckBox13 = null; - private JCheckBox jCheckBox14 = null; - private JLabel jLabel14 = null; - private JTextField jTextField12 = null; - private JTextField jTextField13 = null; - private JLabel jLabel15 = null; + + private OpeningPlatformType docConsole = null; + + private JPanel jArchitectureSelections = null; + + private JCheckBox jCheckBoxIA32 = null; + + private JCheckBox jCheckBoxIpf = null; + + private JCheckBox jCheckBoxX64 = null; + + private JCheckBox jCheckBoxEBC = null; + + private JCheckBox jCheckBoxARM = null; + + private JCheckBox jCheckBoxPPC = null; + + private JLabel jLabelBuildTargets = null; + + private JTextField jTextFieldBuildTargets = null; + + private JTextField jTextFieldTagName = null; + + private JLabel jLabelTagName = null; + private int selectedRow = -1; - private JLabel jLabel = null; - private JLabel jLabel1 = null; - private JScrollPane jScrollPane = null; - private JTable jTable = null; - private JLabel jLabel2 = null; - private JScrollPane jScrollPane1 = null; - private JTable jTable1 = null; - private JLabel jLabel4 = null; - private JScrollPane jScrollPane3 = null; - private JTable jTable3 = null; - private JLabel jLabel5 = null; - private JTextField jTextField = null; - private JPanel jPanel4 = null; - private JLabel jLabel6 = null; - private JButton jButton = null; - private JButton jButton1 = null; - private JButton jButton2 = null; - private JButton jButton3 = null; - private JLabel jLabel8 = null; - private JButton jButton6 = null; - private JButton jButton7 = null; - private JScrollPane jScrollPane4 = null; - private JTable jTable6 = null; + + private JLabel jLabelAntTaskFile = null; + + private JLabel jLabelAntCmdOpts = null; + + private JScrollPane jScrollPaneFfs = null; + + private JTable jTableFfs = null; + + private JLabel jLabelFfsSection = null; + + private JScrollPane jScrollPaneFfsSection = null; + + private JTable jTableFfsSection = null; + + private JLabel jLabelFfsSubSections = null; + + private JScrollPane jScrollPaneFfsSubSection = null; + + private JTable jTableFfsSubSection = null; + + private JLabel jLabelEncapType = null; + + private JTextField jTextFieldEncapType = null; + + private JPanel jPanelFfsAttribButtonGroup = null; + + private JLabel jLabelFfsAttribs = null; + + private JButton jButtonFfsSectionNew = null; + + private JButton jButtonFfsSectionRemove = null; + + private JButton jButtonFfsSubSectionNew = null; + + private JButton jButtonFfsSubSectionRemove = null; + + private JLabel jLabelFfsSections = null; + + private JButton jButtonFfsSectionsNew = null; + + private JButton jButtonFfsSectionsRemove = null; + + private JScrollPane jScrollPaneFfsSections = null; + + private JTable jTableFfsSections = null; + + private JButton jButtonAntTaskFileBrowse = null; + + private JTextField jTextFieldToolChainFamily = null; + + private JSplitPane jSplitPaneFfsC = null; + + private JPanel jPanelFfsCTop = null; + + private JSplitPane jSplitPaneFfsCBottom = null; + + private JPanel jPanelFfsCBottomTop = null; + + private JPanel jPanelFfsCBottomBottom = null; + + private JPanel jPanelSectionN = null; + + private JPanel jPanelSectionsN = null; + + private JPanel jPanelSubSectionN = null; + + private JPanel jPanelOptionsContainer = null; + + private JPanel jPanelUserDefCenterN = null; + /** * This method initializes jPanel * * @return javax.swing.JPanel + private JPanel getJPanelContentSouth() { + if (jPanelContentSouth == null) { + jPanelContentSouth = new JPanel(); + } + return jPanelContentSouth; + } */ - private JPanel getJPanel() { - if (jPanel == null) { - jPanel = new JPanel(); - } - return jPanel; - } /** * This method initializes jPanel1 * * @return javax.swing.JPanel + private JPanel getJPanelContentNorth() { + if (jPanelContentNorth == null) { + jPanelContentNorth = new JPanel(); + } + return jPanelContentNorth; + } */ - private JPanel getJPanel1() { - if (jPanel1 == null) { - jPanel1 = new JPanel(); - } - return jPanel1; - } /** * This method initializes jPanel2 * * @return javax.swing.JPanel + private JPanel getJPanelContentWest() { + if (jPanelContentWest == null) { + jPanelContentWest = new JPanel(); + } + return jPanelContentWest; + } */ - private JPanel getJPanel2() { - if (jPanel2 == null) { - jPanel2 = new JPanel(); - } - return jPanel2; - } /** * This method initializes jPanel3 * * @return javax.swing.JPanel + private JPanel getJPanelContentEast() { + if (jPanelContentEast == null) { + jPanelContentEast = new JPanel(); + } + return jPanelContentEast; + } */ - private JPanel getJPanel3() { - if (jPanel3 == null) { - jPanel3 = new JPanel(); - } - return jPanel3; - } /** * This method initializes jTabbedPane @@ -196,1488 +358,1804 @@ public class FpdBuildOptions extends IInternalFrame { private JTabbedPane getJTabbedPane() { if (jTabbedPane == null) { jTabbedPane = new JTabbedPane(); - jTabbedPane.addTab("FFS", null, getJPanel13(), null); - jTabbedPane.addTab("Options", null, getJPanel20(), null); - jTabbedPane.addTab("User Defined ANT Tasks", null, getJPanel8(), null); + jTabbedPane.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null); + jTabbedPane.addTab("Tool Arguments", null, getJPanelOptionsTab(), null); + jTabbedPane.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null); } return jTabbedPane; } - /** - * This method initializes jPanel8 - * - * @return javax.swing.JPanel + * This method initializes this + * + * @return void */ - private JPanel getJPanel8() { - if (jPanel8 == null) { - jPanel8 = new JPanel(); - jPanel8.setLayout(new BorderLayout()); - jPanel8.add(getJPanel9(), java.awt.BorderLayout.NORTH); - jPanel8.add(getJPanel10(), java.awt.BorderLayout.SOUTH); - jPanel8.add(getJPanel11(), java.awt.BorderLayout.CENTER); + private void initialize() { + this.setSize(722, 577); + this.setTitle("Platform Build Options"); + this.setContentPane(getJContentPane()); + } + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(new BorderLayout()); + // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH); + // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH); + // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST); + // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST); + jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER); } - return jPanel8; + return jContentPane; } /** - * This method initializes jPanel9 - * - * @return javax.swing.JPanel + * @param args */ - private JPanel getJPanel9() { - if (jPanel9 == null) { - jLabel = new JLabel(); - jLabel.setText("ANT Task File"); - jLabel.setPreferredSize(new java.awt.Dimension(80,20)); - FlowLayout flowLayout8 = new FlowLayout(); - flowLayout8.setAlignment(java.awt.FlowLayout.LEFT); - jLabel3 = new JLabel(); - jLabel3.setText("ID"); - jPanel9 = new JPanel(); - jPanel9.setLayout(flowLayout8); - jPanel9.add(jLabel, null); - jPanel9.add(getJTextField2(), null); - jPanel9.add(jLabel3, null); - jPanel9.add(getJTextField3(), null); - } - return jPanel9; + public static void main(String[] args) { + // TODO Auto-generated method stub + new FpdBuildOptions().setVisible(true); + } + + /** + * This is the default constructor + */ + public FpdBuildOptions() { + super(); + initialize(); + this.setVisible(true); + } + + public FpdBuildOptions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) { + this(); + ffc = new FpdFileContents(fpd); + init(ffc); + } + + public FpdBuildOptions(OpeningPlatformType opt) { + this(opt.getXmlFpd()); + docConsole = opt; + } + + private void init(FpdFileContents ffc) { + initOptionTable(); + initAntTaskTable(); + initFfsTable(); + this.addInternalFrameListener(new InternalFrameAdapter() { + public void internalFrameDeactivated(InternalFrameEvent e) { + if (jTableFfs.isEditing()) { + jTableFfs.getCellEditor().stopCellEditing(); + } + if (jTableFfsSection.isEditing()) { + jTableFfsSection.getCellEditor().stopCellEditing(); + } + if (jTableAntTasks.isEditing()) { + jTableAntTasks.getCellEditor().stopCellEditing(); + } + if (jTableFfsSubSection.isEditing()) { + jTableFfsSubSection.getCellEditor().stopCellEditing(); + } + if (jTableFfsAttribs.isEditing()) { + jTableFfsAttribs.getCellEditor().stopCellEditing(); + } + if (jTableOptions.isEditing()) { + jTableOptions.getCellEditor().stopCellEditing(); + } + } + }); } /** - * This method initializes jPanel10 + * This method initializes jPanel13 * * @return javax.swing.JPanel */ - private JPanel getJPanel10() { - if (jPanel10 == null) { - jPanel10 = new JPanel(); + private JPanel getJPanelFfsTab() { + if (jPanelFfsTab == null) { + jPanelFfsTab = new JPanel(); + jPanelFfsTab.setLayout(new BorderLayout()); + jPanelFfsTab.add(getJPanelFfsTabCenter(), java.awt.BorderLayout.CENTER); + jPanelFfsTab.add(getJScrollPaneFfs(), java.awt.BorderLayout.WEST); } - return jPanel10; + return jPanelFfsTab; } /** - * This method initializes jPanel11 + * This method initializes jPanel18 * * @return javax.swing.JPanel */ - private JPanel getJPanel11() { - if (jPanel11 == null) { - jLabel1 = new JLabel(); - jLabel1.setText("ANT Command Options"); - jLabel1.setPreferredSize(new java.awt.Dimension(131,20)); - FlowLayout flowLayout3 = new FlowLayout(); - flowLayout3.setHgap(5); - flowLayout3.setAlignment(java.awt.FlowLayout.LEFT); - jPanel11 = new JPanel(); - jPanel11.setLayout(flowLayout3); - jPanel11.add(jLabel1, null); - jPanel11.add(getJTextField4(), null); - jPanel11.add(getJButton4(), null); - jPanel11.add(getJButton5(), null); - jPanel11.add(getJScrollPane2(), null); + private JPanel getJPanelFfsTabCenter() { + if (jPanelFfsTabCenter == null) { + jPanelFfsTabCenter = new JPanel(); + jPanelFfsTabCenter.setLayout(new BorderLayout()); + jPanelFfsTabCenter.add(getJPanelFfsTabCenterN(), java.awt.BorderLayout.NORTH); + jPanelFfsTabCenter.add(getJPanelFfsTabCenterS(), java.awt.BorderLayout.SOUTH); + jPanelFfsTabCenter.add(getJSplitPaneFfsC(), java.awt.BorderLayout.CENTER); } - return jPanel11; + return jPanelFfsTabCenter; } /** - * This method initializes jTextField2 + * This method initializes jPanel15 * - * @return javax.swing.JTextField + * @return javax.swing.JPanel */ - private JTextField getJTextField2() { - if (jTextField2 == null) { - jTextField2 = new JTextField(); - jTextField2.setPreferredSize(new java.awt.Dimension(200,20)); + private JPanel getJPanelFfsTabCenterN() { + if (jPanelFfsTabCenterN == null) { + jLabelEncapType = new JLabel(); + jLabelEncapType.setText("Encapsulation Type"); + FlowLayout flowLayout5 = new FlowLayout(); + flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT); + jLabelFfsKey = new JLabel(); + jLabelFfsKey.setText("FFS Key"); + jPanelFfsTabCenterN = new JPanel(); + jPanelFfsTabCenterN.setLayout(flowLayout5); + jPanelFfsTabCenterN.add(jLabelFfsKey, null); + jPanelFfsTabCenterN.add(getJTextFieldFfsKey(), null); + jPanelFfsTabCenterN.add(jLabelEncapType, null); + jPanelFfsTabCenterN.add(getJTextFieldEncapType(), null); + jPanelFfsTabCenterN.add(getJButtonFfsAdd(), null); + jPanelFfsTabCenterN.add(getJButtonFfsDel(), null); } - return jTextField2; + return jPanelFfsTabCenterN; } /** - * This method initializes jTextField3 + * This method initializes jPanel16 * - * @return javax.swing.JTextField + * @return javax.swing.JPanel */ - private JTextField getJTextField3() { - if (jTextField3 == null) { - jTextField3 = new JTextField(); - jTextField3.setPreferredSize(new java.awt.Dimension(100,20)); + private JPanel getJPanelFfsTabCenterS() { + if (jPanelFfsTabCenterS == null) { + jLabelFfsAttribs = new JLabel(); + jLabelFfsAttribs.setText("Attributes"); + FlowLayout flowLayout6 = new FlowLayout(); + flowLayout6.setHgap(5); + flowLayout6.setVgap(20); + flowLayout6.setAlignment(java.awt.FlowLayout.CENTER); + jPanelFfsTabCenterS = new JPanel(); + jPanelFfsTabCenterS.setPreferredSize(new java.awt.Dimension(491, 130)); + jPanelFfsTabCenterS.setLayout(flowLayout6); + jPanelFfsTabCenterS.add(jLabelFfsAttribs, null); + jPanelFfsTabCenterS.add(getJScrollPaneFfsAttribs(), null); + jPanelFfsTabCenterS.add(getJPanelFfsAttribButtonGroup(), null); } - return jTextField3; + return jPanelFfsTabCenterS; } /** - * This method initializes jButton4 + * This method initializes jTextField6 * - * @return javax.swing.JButton + * @return javax.swing.JTextField */ - private JButton getJButton4() { - if (jButton4 == null) { - jButton4 = new JButton(); - jButton4.setPreferredSize(new java.awt.Dimension(90,20)); - jButton4.setText("Add"); - jButton4.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Object[] o = {jTextField3.getText(), null, null}; - o[1] = jTextField2.getText(); - o[2] = jTextField4.getText(); - ffc.genBuildOptionsUserDefAntTask(o[0]+"", null, o[2]+""); - antTaskTableModel.addRow(o); - + private JTextField getJTextFieldFfsKey() { + if (jTextFieldFfsKey == null) { + jTextFieldFfsKey = new JTextField(); + jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(100, 20)); + jTextFieldFfsKey.setEditable(true); + jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusLost(java.awt.event.FocusEvent e) { + if (jTableFfs.getSelectedRow() < 0) { + return; + } + // ffc.updateBuildOptionsFfsKey(jTable.getSelectedRow(), jTextField6.getText()); } }); } - return jButton4; + return jTextFieldFfsKey; } /** - * This method initializes jButton5 + * This method initializes jButton8 * * @return javax.swing.JButton */ - private JButton getJButton5() { - if (jButton5 == null) { - jButton5 = new JButton(); - jButton5.setPreferredSize(new java.awt.Dimension(90,20)); - jButton5.setText("Delete"); - jButton5.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (selectedRow >= 0) { - antTaskTableModel.removeRow(selectedRow); - ffc.removeBuildOptionsUserDefAntTask(selectedRow); + private JButton getJButtonFfsAdd() { + if (jButtonFfsAdd == null) { + jButtonFfsAdd = new JButton(); + jButtonFfsAdd.setPreferredSize(new java.awt.Dimension(70, 20)); + jButtonFfsAdd.setText("Add"); + jButtonFfsAdd.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = -2923720717273384221L; + + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTextFieldFfsKey.getText().length() > 0) { + String[] row = { jTextFieldFfsKey.getText() }; + ffsTableModel.addRow(row); + docConsole.setSaved(false); + ffc.genBuildOptionsFfs(jTextFieldFfsKey.getText(), jTextFieldEncapType.getText()); } } }); } - return jButton5; + return jButtonFfsAdd; } /** - * This method initializes jTextField4 + * This method initializes jButton9 * - * @return javax.swing.JTextField + * @return javax.swing.JButton */ - private JTextField getJTextField4() { - if (jTextField4 == null) { - jTextField4 = new JTextField(); - jTextField4.setPreferredSize(new java.awt.Dimension(270,20)); - jTextField4.setEnabled(true); + private JButton getJButtonFfsDel() { + if (jButtonFfsDel == null) { + jButtonFfsDel = new JButton(); + jButtonFfsDel.setPreferredSize(new java.awt.Dimension(70, 20)); + jButtonFfsDel.setText("Delete"); + jButtonFfsDel.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = -4002678939178194476L; + + public void actionPerformed(ActionEvent arg0) { + if (jTableFfs.getSelectedRow() < 0) { + return; + } + docConsole.setSaved(false); + ffc.removeBuildOptionsFfs(jTableFfs.getSelectedRow()); + ffsTableModel.removeRow(jTableFfs.getSelectedRow()); + } + }); } - return jTextField4; + return jButtonFfsDel; } /** - * This method initializes jScrollPane2 + * This method initializes jScrollPane5 * * @return javax.swing.JScrollPane */ - private JScrollPane getJScrollPane2() { - if (jScrollPane2 == null) { - jScrollPane2 = new JScrollPane(); - jScrollPane2.setPreferredSize(new java.awt.Dimension(600,100)); - jScrollPane2.setViewportView(getJTable2()); + private JScrollPane getJScrollPaneFfsAttribs() { + if (jScrollPaneFfsAttribs == null) { + jScrollPaneFfsAttribs = new JScrollPane(); + jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100)); + jScrollPaneFfsAttribs.setViewportView(getJTableFfsAttribs()); } - return jScrollPane2; + return jScrollPaneFfsAttribs; } /** - * This method initializes jTable2 + * This method initializes jTable4 * * @return javax.swing.JTable */ - private JTable getJTable2() { - if (jTable2 == null) { - antTaskTableModel = new DefaultTableModel(); - jTable2 = new JTable(antTaskTableModel); - antTaskTableModel.addColumn("ID"); - antTaskTableModel.addColumn("Filename"); - antTaskTableModel.addColumn("ANT Command Options"); - - jTable2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - jTable2.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ - public void valueChanged(ListSelectionEvent e) { - selectedRow = -1; - if (e.getValueIsAdjusting()){ - return; - } - ListSelectionModel lsm = (ListSelectionModel)e.getSource(); - if (lsm.isSelectionEmpty()) { - return; - } - else{ - selectedRow = lsm.getMinSelectionIndex(); - } - } - }); - - jTable2.getModel().addTableModelListener(new TableModelListener() { - public void tableChanged(TableModelEvent arg0) { + private JTable getJTableFfsAttribs() { + if (jTableFfsAttribs == null) { + ffsAttributesTableModel = new DefaultTableModel(); + jTableFfsAttribs = new JTable(ffsAttributesTableModel); + jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80)); + jTableFfsAttribs.setRowHeight(20); + ffsAttributesTableModel.addColumn("Name"); + ffsAttributesTableModel.addColumn("Value"); + + jTableFfsAttribs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTableFfsAttribs.getModel().addTableModelListener(new TableModelListener() { + public void tableChanged(TableModelEvent arg0) { // TODO Auto-generated method stub int row = arg0.getFirstRow(); - TableModel m = (TableModel)arg0.getSource(); - if (arg0.getType() == TableModelEvent.UPDATE){ + TableModel m = (TableModel) arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE) { //ToDo Data Validition check. - String id = m.getValueAt(row, 0) + ""; - String file = m.getValueAt(row, 1) + ""; - String execOrder = m.getValueAt(row, 2) + ""; - if (id.length() == 0) { + String name = m.getValueAt(row, 0) + ""; + String value = m.getValueAt(row, 1) + ""; + + if (name.length() == 0) { return; } - if (file.length() == 0 && execOrder.length() == 0){ + if (value.length() == 0) { return; } - if (file.length() == 0) { - file = null; - } - if (execOrder.length() == 0) { - execOrder = null; - } - ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder); - + docConsole.setSaved(false); + ffc.updateBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), row, name, value); } } }); } - return jTable2; + return jTableFfsAttribs; + } + + private void initFfsTable() { + int ffsCount = ffc.getBuildOptionsFfsCount(); + if (ffsCount < 0) { + return; + } + String[][] saa = new String[ffsCount][1]; + ffc.getBuildOptionsFfsKey(saa); + for (int i = 0; i < saa.length; ++i) { + ffsTableModel.addRow(saa[i]); + } } /** - * This method initializes jPanel13 - * - * @return javax.swing.JPanel + * This method initializes jButton17 + * + * @return javax.swing.JButton */ - private JPanel getJPanel13() { - if (jPanel13 == null) { - jPanel13 = new JPanel(); - jPanel13.setLayout(new BorderLayout()); - jPanel13.add(getJPanel18(), java.awt.BorderLayout.CENTER); - jPanel13.add(getJScrollPane(), java.awt.BorderLayout.WEST); + private JButton getJButtonFfsAttribNew() { + if (jButtonFfsAttribNew == null) { + jButtonFfsAttribNew = new JButton(); + jButtonFfsAttribNew.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsAttribNew.setText("New"); + jButtonFfsAttribNew.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent arg0) { + if (jTableFfs.getSelectedRow() < 0) { + return; + } + Object[] o = { "", "" }; + ffsAttributesTableModel.addRow(o); + docConsole.setSaved(false); + ffc.genBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), "", ""); + } + }); } - return jPanel13; + return jButtonFfsAttribNew; } /** - * This method initializes jPanel18 - * - * @return javax.swing.JPanel + * This method initializes jButton18 + * + * @return javax.swing.JButton */ - private JPanel getJPanel18() { - if (jPanel18 == null) { - jPanel18 = new JPanel(); - jPanel18.setLayout(new BorderLayout()); - jPanel18.add(getJPanel15(), java.awt.BorderLayout.NORTH); - jPanel18.add(getJPanel16(), java.awt.BorderLayout.SOUTH); - jPanel18.add(getJPanel17(), java.awt.BorderLayout.EAST); - jPanel18.add(getJPanel19(), java.awt.BorderLayout.CENTER); + private JButton getJButtonFfsAttribRemove() { + if (jButtonFfsAttribRemove == null) { + jButtonFfsAttribRemove = new JButton(); + jButtonFfsAttribRemove.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsAttribRemove.setText("Remove"); + jButtonFfsAttribRemove.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent arg0) { + if (jTableFfs.getSelectedRow() < 0) { + return; + } + if (jTableFfsAttribs.getSelectedRow() >= 0) { + docConsole.setSaved(false); + ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow()); + ffc.removeBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), + jTableFfsAttribs.getSelectedRow()); + } + } + }); } - return jPanel18; + return jButtonFfsAttribRemove; } /** - * This method initializes jPanel15 - * - * @return javax.swing.JPanel + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane */ - private JPanel getJPanel15() { - if (jPanel15 == null) { - jLabel5 = new JLabel(); - jLabel5.setText("Encapsulation Type"); - FlowLayout flowLayout5 = new FlowLayout(); - flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT); - jLabel7 = new JLabel(); - jLabel7.setText("FFS Key"); - jPanel15 = new JPanel(); - jPanel15.setLayout(flowLayout5); - jPanel15.add(jLabel7, null); - jPanel15.add(getJTextField6(), null); - jPanel15.add(jLabel5, null); - jPanel15.add(getJTextField(), null); - jPanel15.add(getJButton8(), null); - jPanel15.add(getJButton9(), null); + private JScrollPane getJScrollPaneFfs() { + if (jScrollPaneFfs == null) { + jScrollPaneFfs = new JScrollPane(); + jScrollPaneFfs.setPreferredSize(new java.awt.Dimension(150, 419)); + jScrollPaneFfs.setViewportView(getJTableFfs()); } - return jPanel15; + return jScrollPaneFfs; } /** - * This method initializes jPanel16 - * - * @return javax.swing.JPanel + * This method initializes jTable + * + * @return javax.swing.JTable */ - private JPanel getJPanel16() { - if (jPanel16 == null) { - jLabel6 = new JLabel(); - jLabel6.setText("Attributes"); - FlowLayout flowLayout6 = new FlowLayout(); - flowLayout6.setHgap(5); - flowLayout6.setVgap(20); - flowLayout6.setAlignment(java.awt.FlowLayout.CENTER); - jPanel16 = new JPanel(); - jPanel16.setPreferredSize(new java.awt.Dimension(491,130)); - jPanel16.setLayout(flowLayout6); - jPanel16.add(jLabel6, null); - jPanel16.add(getJScrollPane5(), null); - jPanel16.add(getJPanel4(), null); + private JTable getJTableFfs() { + if (jTableFfs == null) { + ffsTableModel = new DefaultTableModel(); + ffsTableModel.addColumn("FFS Type"); + jTableFfs = new JTable(ffsTableModel); + jTableFfs.setShowGrid(false); + jTableFfs.setRowHeight(20); + + jTableFfs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTableFfs.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + + if (e.getValueIsAdjusting()) { + return; + } + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); + if (lsm.isSelectionEmpty()) { + return; + } else { + int row = lsm.getMinSelectionIndex(); + sectionTableModel.setRowCount(0); + sectionsTableModel.setRowCount(0); + subsectionsTableModel.setRowCount(0); + ffsAttributesTableModel.setRowCount(0); + String[] sArray = { "", "" }; + LinkedHashMap lhm = new LinkedHashMap(); + ArrayList alSections = new ArrayList(); + ArrayList alSection = new ArrayList(); + ffc.getBuildOptionsFfs(row, sArray, lhm, alSections, alSection); + jTextFieldFfsKey.setText(sArray[0]); + jTextFieldEncapType.setText(sArray[1]); + for (int i = 0; i < alSection.size(); ++i) { + String[] sectionRow = { alSection.get(i) }; + sectionTableModel.addRow(sectionRow); + } + for (int j = 0; j < alSections.size(); ++j) { + String[] sectionsRow = { alSections.get(j) }; + sectionsTableModel.addRow(sectionsRow); + } + if (lhm.size() <= 0) { + return; + } + Set keySet = lhm.keySet(); + Iterator is = keySet.iterator(); + while (is.hasNext()) { + String key = is.next(); + String[] attribRow = { key, lhm.get(key) }; + ffsAttributesTableModel.addRow(attribRow); + } + } + } + }); + + jTableFfs.getModel().addTableModelListener(new TableModelListener() { + public void tableChanged(TableModelEvent arg0) { + // TODO Auto-generated method stub + int row = arg0.getFirstRow(); + TableModel m = (TableModel) arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE) { + //ToDo Data Validition check. + String id = m.getValueAt(row, 0) + ""; + + if (id.length() == 0) { + return; + } + docConsole.setSaved(false); + ffc.updateBuildOptionsFfsKey(row, id); + } + } + }); } - return jPanel16; + return jTableFfs; } /** - * This method initializes jPanel17 - * - * @return javax.swing.JPanel + * This method initializes jScrollPane1 + * + * @return javax.swing.JScrollPane */ - private JPanel getJPanel17() { - if (jPanel17 == null) { - jPanel17 = new JPanel(); + private JScrollPane getJScrollPaneFfsSection() { + if (jScrollPaneFfsSection == null) { + jScrollPaneFfsSection = new JScrollPane(); +// jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80)); + jScrollPaneFfsSection.setViewportView(getJTableFfsSection()); } - return jPanel17; + return jScrollPaneFfsSection; } /** - * This method initializes jTextField6 - * - * @return javax.swing.JTextField + * This method initializes jTable1 + * + * @return javax.swing.JTable */ - private JTextField getJTextField6() { - if (jTextField6 == null) { - jTextField6 = new JTextField(); - jTextField6.setPreferredSize(new java.awt.Dimension(100,20)); - jTextField6.setEditable(false); - jTextField6.addFocusListener(new java.awt.event.FocusAdapter() { - public void focusLost(java.awt.event.FocusEvent e) { - if (jTable.getSelectedRow() < 0) { + private JTable getJTableFfsSection() { + if (jTableFfsSection == null) { + sectionTableModel = new DefaultTableModel(); + sectionTableModel.addColumn("SectionType"); + + jTableFfsSection = new JTable(sectionTableModel); + jTableFfsSection.setRowHeight(20); + JComboBox cb = new JComboBox(); + cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID"); + cb.addItem("EFI_SECTION_VERSION"); + cb.addItem("EFI_SECTION_USER_INTERFACE"); + cb.addItem("EFI_SECTION_DXE_DEPEX"); + cb.addItem("EFI_SECTION_PEI_DEPEX"); + cb.addItem("EFI_SECTION_PE32"); + cb.addItem("EFI_SECTION_PIC"); + cb.addItem("EFI_SECTION_TE"); + cb.addItem("EFI_SECTION_RAW"); + cb.addItem("EFI_SECTION_COMPRESSION"); + cb.addItem("EFI_SECTION_GUID_DEFINED"); + cb.addItem("EFI_SECTION_COMPATIBILITY16"); + cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE"); + jTableFfsSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb)); + + jTableFfsSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + jTableFfsSection.getModel().addTableModelListener(new TableModelListener() { + public void tableChanged(TableModelEvent arg0) { + // TODO Auto-generated method stub + if (jTableFfs.getSelectedRow() < 0) { return; } -// ffc.updateBuildOptionsFfsKey(jTable.getSelectedRow(), jTextField6.getText()); + int row = arg0.getFirstRow(); + TableModel m = (TableModel) arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE) { + //ToDo Data Validition check. + String type = m.getValueAt(row, 0) + ""; + docConsole.setSaved(false); + ffc.updateBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row, type); + } } }); } - return jTextField6; + return jTableFfsSection; } /** - * This method initializes jButton8 - * - * @return javax.swing.JButton + * This method initializes jScrollPane3 + * + * @return javax.swing.JScrollPane */ - private JButton getJButton8() { - if (jButton8 == null) { - jButton8 = new JButton(); - jButton8.setPreferredSize(new java.awt.Dimension(70,20)); - jButton8.setText("Add"); - jButton8.addActionListener(new AbstractAction() { - /** - * - */ - private static final long serialVersionUID = -2923720717273384221L; + private JScrollPane getJScrollPaneFfsSubSection() { + if (jScrollPaneFfsSubSection == null) { + jScrollPaneFfsSubSection = new JScrollPane(); +// jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90)); + jScrollPaneFfsSubSection.setViewportView(getJTableFfsSubSection()); + } + return jScrollPaneFfsSubSection; + } - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTextField6.getText().length() > 0) { - String[] row = {jTextField6.getText()}; - ffsTableModel.addRow(row); - ffc.genBuildOptionsFfs(jTextField6.getText(), jTextField.getText()); + /** + * This method initializes jTable3 + * + * @return javax.swing.JTable + */ + private JTable getJTableFfsSubSection() { + if (jTableFfsSubSection == null) { + subsectionsTableModel = new DefaultTableModel(); + subsectionsTableModel.addColumn("SectionType"); + jTableFfsSubSection = new JTable(subsectionsTableModel); + jTableFfsSubSection.setRowHeight(20); + JComboBox cb = new JComboBox(); + cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID"); + cb.addItem("EFI_SECTION_VERSION"); + cb.addItem("EFI_SECTION_USER_INTERFACE"); + cb.addItem("EFI_SECTION_DXE_DEPEX"); + cb.addItem("EFI_SECTION_PEI_DEPEX"); + cb.addItem("EFI_SECTION_PE32"); + cb.addItem("EFI_SECTION_PIC"); + cb.addItem("EFI_SECTION_TE"); + cb.addItem("EFI_SECTION_RAW"); + cb.addItem("EFI_SECTION_COMPRESSION"); + cb.addItem("EFI_SECTION_GUID_DEFINED"); + cb.addItem("EFI_SECTION_COMPATIBILITY16"); + cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE"); + jTableFfsSubSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb)); + jTableFfsSubSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + jTableFfsSubSection.getModel().addTableModelListener(new TableModelListener() { + public void tableChanged(TableModelEvent arg0) { + // TODO Auto-generated method stub + if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) { + return; + } + int row = arg0.getFirstRow(); + TableModel m = (TableModel) arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE) { + //ToDo Data Validition check. + String type = m.getValueAt(row, 0) + ""; + docConsole.setSaved(false); + ffc.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), + jTableFfsSections.getSelectedRow(), row, type); } } }); } - return jButton8; + return jTableFfsSubSection; } /** - * This method initializes jButton9 - * - * @return javax.swing.JButton + * This method initializes jTextField + * + * @return javax.swing.JTextField */ - private JButton getJButton9() { - if (jButton9 == null) { - jButton9 = new JButton(); - 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){ - if (jTable.getSelectedRow() < 0) { + private JTextField getJTextFieldEncapType() { + if (jTextFieldEncapType == null) { + jTextFieldEncapType = new JTextField(); + jTextFieldEncapType.setPreferredSize(new java.awt.Dimension(100, 20)); + jTextFieldEncapType.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusLost(java.awt.event.FocusEvent e) { + if (jTableFfs.getSelectedRow() < 0) { return; } - ffc.removeBuildOptionsFfs(jTable.getSelectedRow()); + ffc.updateBuildOptionsFfsSectionsType(jTableFfs.getSelectedRow(), jTextFieldEncapType.getText()); } }); } - return jButton9; + return jTextFieldEncapType; } /** - * This method initializes jScrollPane5 - * - * @return javax.swing.JScrollPane + * This method initializes jPanel4 + * + * @return javax.swing.JPanel */ - private JScrollPane getJScrollPane5() { - if (jScrollPane5 == null) { - jScrollPane5 = new JScrollPane(); - jScrollPane5.setPreferredSize(new java.awt.Dimension(350,100)); - jScrollPane5.setViewportView(getJTable4()); + private JPanel getJPanelFfsAttribButtonGroup() { + if (jPanelFfsAttribButtonGroup == null) { + jPanelFfsAttribButtonGroup = new JPanel(); + jPanelFfsAttribButtonGroup.setPreferredSize(new java.awt.Dimension(100, 100)); + jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribNew(), null); + jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribRemove(), null); } - return jScrollPane5; + return jPanelFfsAttribButtonGroup; } /** - * This method initializes jTable4 - * - * @return javax.swing.JTable + * This method initializes jButton + * + * @return javax.swing.JButton */ - private JTable getJTable4() { - if (jTable4 == null) { - ffsAttributesTableModel = new DefaultTableModel(); - jTable4 = new JTable(ffsAttributesTableModel); - jTable4.setPreferredSize(new java.awt.Dimension(400,80)); - ffsAttributesTableModel.addColumn("Name"); - ffsAttributesTableModel.addColumn("Value"); - - jTable4.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - jTable4.getModel().addTableModelListener(new TableModelListener() { - public void tableChanged(TableModelEvent arg0) { - // TODO Auto-generated method stub - int row = arg0.getFirstRow(); - TableModel m = (TableModel)arg0.getSource(); - if (arg0.getType() == TableModelEvent.UPDATE){ - //ToDo Data Validition check. - String name = m.getValueAt(row, 0) + ""; - String value = m.getValueAt(row, 1) + ""; - - if (name.length() == 0) { - return; - } - if (value.length() == 0){ - return; - } - ffc.updateBuildOptionsFfsAttribute(jTable.getSelectedRow(), row, name, value); + private JButton getJButtonFfsSectionNew() { + if (jButtonFfsSectionNew == null) { + jButtonFfsSectionNew = new JButton(); + jButtonFfsSectionNew.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsSectionNew.setText("New"); + jButtonFfsSectionNew.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTableFfs.getSelectedRow() < 0) { + return; } + docConsole.setSaved(false); + String[] row = { "EFI_SECTION_RAW" }; + sectionTableModel.addRow(row); + ffc.genBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row[0]); } }); } - return jTable4; + return jButtonFfsSectionNew; } /** - * This method initializes jPanel19 - * - * @return javax.swing.JPanel + * This method initializes jButton1 + * + * @return javax.swing.JButton */ - private JPanel getJPanel19() { - if (jPanel19 == null) { - jLabel8 = new JLabel(); - jLabel8.setText("Sections"); - jLabel4 = new JLabel(); - jLabel4.setText("Sub-Sections"); - jLabel2 = new JLabel(); - jLabel2.setText("Section"); - jPanel19 = new JPanel(); - jPanel19.setLayout(new FlowLayout()); - jPanel19.add(jLabel2, null); - jPanel19.add(getJButton(), null); - jPanel19.add(getJButton1(), null); - jPanel19.add(getJScrollPane1(), null); - jPanel19.add(jLabel8, null); - jPanel19.add(getJButton6(), null); - jPanel19.add(getJButton7(), null); - jPanel19.add(getJScrollPane4(), null); - jPanel19.add(jLabel4, null); - jPanel19.add(getJButton2(), null); - jPanel19.add(getJButton3(), null); - jPanel19.add(getJScrollPane3(), null); - } - return jPanel19; - } - - /** - * This method initializes jPanel20 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel20() { - if (jPanel20 == null) { - jLabel15 = new JLabel(); - jLabel15.setText("Tag Name"); - FlowLayout flowLayout9 = new FlowLayout(); - flowLayout9.setAlignment(java.awt.FlowLayout.LEFT); - jLabel14 = new JLabel(); - jLabel14.setText("Build Targets"); - jLabel12 = new JLabel(); - jLabel12.setText("Tool Command"); - jLabel11 = new JLabel(); - jLabel11.setText("Supported Arch"); - jLabel10 = new JLabel(); - jLabel10.setText("Tool Chain Family"); - jLabel9 = new JLabel(); - jLabel9.setText("Option Contents"); - jPanel20 = new JPanel(); - jPanel20.setLayout(flowLayout9); - jPanel20.add(jLabel14, null); - jPanel20.add(getJTextField12(), null); - jPanel20.add(jLabel10, null); - jPanel20.add(getJComboBox2(), null); - jPanel20.add(jLabel12, null); - jPanel20.add(getJTextField8(), null); - jPanel20.add(jLabel11, null); - jPanel20.add(getJCheckBox9(), null); - jPanel20.add(getJCheckBox10(), null); - jPanel20.add(getJCheckBox11(), null); - jPanel20.add(getJCheckBox12(), null); - jPanel20.add(getJCheckBox13(), null); - jPanel20.add(getJCheckBox14(), null); - jPanel20.add(jLabel15, null); - jPanel20.add(getJTextField13(), null); - jPanel20.add(jLabel9, null); - jPanel20.add(getJTextField7(), null); - jPanel20.add(getJButton10(), null); - jPanel20.add(getJButton11(), null); - jPanel20.add(getJButton19(), null); - jPanel20.add(getJScrollPane6(), null); - } - return jPanel20; - } - - /** - * This method initializes jTextField7 - * - * @return javax.swing.JTextField + private JButton getJButtonFfsSectionRemove() { + if (jButtonFfsSectionRemove == null) { + jButtonFfsSectionRemove = new JButton(); + jButtonFfsSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsSectionRemove.setText("Remove"); + + jButtonFfsSectionRemove.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) { + return; + } + docConsole.setSaved(false); + sectionTableModel.removeRow(jTableFfsSection.getSelectedRow()); + ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), + jTableFfsSection.getSelectedRow()); + } + }); + } + return jButtonFfsSectionRemove; + } + + /** + * This method initializes jButton2 + * + * @return javax.swing.JButton */ - private JTextField getJTextField7() { - if (jTextField7 == null) { - jTextField7 = new JTextField(); - jTextField7.setPreferredSize(new java.awt.Dimension(300,20)); + private JButton getJButtonFfsSubSectionNew() { + if (jButtonFfsSubSectionNew == null) { + jButtonFfsSubSectionNew = new JButton(); + jButtonFfsSubSectionNew.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsSubSectionNew.setText("New"); + jButtonFfsSubSectionNew.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) { + return; + } + docConsole.setSaved(false); + String[] row = { "EFI_SECTION_RAW" }; + subsectionsTableModel.addRow(row); + ffc.genBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), + jTableFfsSections.getSelectedRow(), row[0]); + + } + }); } - return jTextField7; + return jButtonFfsSubSectionNew; } /** - * This method initializes jComboBox2 - * - * @return javax.swing.JComboBox + * This method initializes jButton3 + * + * @return javax.swing.JButton */ - private JComboBox getJComboBox2() { - if (jComboBox2 == null) { - jComboBox2 = new JComboBox(); - jComboBox2.setPreferredSize(new java.awt.Dimension(80,20)); - jComboBox2.addItem("MSFT"); - jComboBox2.addItem("GCC"); - jComboBox2.addItem("CYGWIN"); - jComboBox2.addItem("INTEL"); - jComboBox2.setSelectedIndex(0); + private JButton getJButtonFfsSubSectionRemove() { + if (jButtonFfsSubSectionRemove == null) { + jButtonFfsSubSectionRemove = new JButton(); + jButtonFfsSubSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsSubSectionRemove.setText("Remove"); + jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0 + || jTableFfsSubSection.getSelectedRow() < 0) { + return; + } + docConsole.setSaved(false); + subsectionsTableModel.removeRow(jTableFfsSubSection.getSelectedRow()); + ffc.removeBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), + jTableFfsSections.getSelectedRow(), + jTableFfsSubSection.getSelectedRow()); + } + }); } - return jComboBox2; + return jButtonFfsSubSectionRemove; } /** - * This method initializes jTextField8 - * - * @return javax.swing.JTextField + * This method initializes jButton6 + * + * @return javax.swing.JButton */ - private JTextField getJTextField8() { - if (jTextField8 == null) { - jTextField8 = new JTextField(); - jTextField8.setPreferredSize(new java.awt.Dimension(110,20)); + private JButton getJButtonFfsSectionsNew() { + if (jButtonFfsSectionsNew == null) { + jButtonFfsSectionsNew = new JButton(); + jButtonFfsSectionsNew.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsSectionsNew.setText("New"); + jButtonFfsSectionsNew.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTableFfs.getSelectedRow() < 0) { + return; + } + docConsole.setSaved(false); + String[] row = { "" }; + sectionsTableModel.addRow(row); + ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), ""); + } + }); } - return jTextField8; + return jButtonFfsSectionsNew; } /** - * This method initializes jScrollPane6 - * - * @return javax.swing.JScrollPane + * This method initializes jButton7 + * + * @return javax.swing.JButton */ - private JScrollPane getJScrollPane6() { - if (jScrollPane6 == null) { - jScrollPane6 = new JScrollPane(); - jScrollPane6.setPreferredSize(new java.awt.Dimension(630,200)); - jScrollPane6.setViewportView(getJTable5()); + private JButton getJButtonFfsSectionsRemove() { + if (jButtonFfsSectionsRemove == null) { + jButtonFfsSectionsRemove = new JButton(); + jButtonFfsSectionsRemove.setPreferredSize(new java.awt.Dimension(80, 20)); + jButtonFfsSectionsRemove.setText("Remove"); + jButtonFfsSectionsRemove.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) { + return; + } + docConsole.setSaved(false); + sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow()); + ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), + jTableFfsSections.getSelectedRow()); + } + }); + } + return jButtonFfsSectionsRemove; + } + + private JScrollPane getJScrollPaneFfsSections() { + if (jScrollPaneFfsSections == null) { + jScrollPaneFfsSections = new JScrollPane(); +// jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80)); + jScrollPaneFfsSections.setViewportView(getJTableFfsSections()); } - return jScrollPane6; + return jScrollPaneFfsSections; } /** - * This method initializes jTable5 - * - * @return javax.swing.JTable + * This method initializes jTable6 + * + * @return javax.swing.JTable */ - private JTable getJTable5() { - if (jTable5 == null) { - optionsTableModel = new DefaultTableModel(); - jTable5 = new JTable(optionsTableModel); - optionsTableModel.addColumn("BuildTargets"); - optionsTableModel.addColumn("ToolChainFamily"); - optionsTableModel.addColumn("SupportedArch"); - optionsTableModel.addColumn("ToolCommand"); - optionsTableModel.addColumn("TagName"); - optionsTableModel.addColumn("Contents"); - - TableColumn toolFamilyCol = jTable5.getColumnModel().getColumn(1); - JComboBox cb = new JComboBox(); - cb.addItem("MSFT"); - cb.addItem("GCC"); - cb.addItem("CYGWIN"); - cb.addItem("INTEL"); - toolFamilyCol.setCellEditor(new DefaultCellEditor(cb)); - - jTable5.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - jTable5.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ + private JTable getJTableFfsSections() { + if (jTableFfsSections == null) { + sectionsTableModel = new DefaultTableModel(); + sectionsTableModel.addColumn("EncapsulationType"); + jTableFfsSections = new JTable(sectionsTableModel); + jTableFfsSections.setRowHeight(20); + jTableFfsSections.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTableFfsSections.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { - selectedRow = -1; - if (e.getValueIsAdjusting()){ + if (e.getValueIsAdjusting()) { return; } - ListSelectionModel lsm = (ListSelectionModel)e.getSource(); + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { return; - } - else{ - selectedRow = lsm.getMinSelectionIndex(); + } else { + int sectionsRow = lsm.getMinSelectionIndex(); + if (jTableFfs.getSelectedRow() < 0) { + return; + } + subsectionsTableModel.setRowCount(0); + ArrayList al = new ArrayList(); + ffc.getBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), sectionsRow, al); + for (int i = 0; i < al.size(); ++i) { + String[] subsectionRow = { al.get(i) }; + subsectionsTableModel.addRow(subsectionRow); + } } } }); - - jTable5.getModel().addTableModelListener(new TableModelListener() { + + jTableFfsSections.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent arg0) { // TODO Auto-generated method stub int row = arg0.getFirstRow(); - TableModel m = (TableModel)arg0.getSource(); - if (arg0.getType() == TableModelEvent.UPDATE){ + TableModel m = (TableModel) arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE) { //ToDo Data Validition check. - String targets = m.getValueAt(row, 0) + ""; - Vector targetName = new Vector(); - String[] sArray = targets.split("( )+"); - for (int i = 0; i < sArray.length; ++i) { - targetName.add(sArray[i]); - } - String toolChain = m.getValueAt(row, 1) + ""; - String archs = m.getValueAt(row, 2) + ""; - Vector supArch = new Vector(); - String[] sArray1 = archs.split("( )+"); - for (int i = 0; i < sArray1.length; ++i) { - supArch.add(sArray1[i]); - } - if (supArch.size() == 0) { - supArch.add("IA32"); - } - String toolCmd = m.getValueAt(row, 3) + ""; - String tagName = m.getValueAt(row, 4) + ""; - String contents = m.getValueAt(row, 5) + ""; - ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents); - } - } - }); - } - return jTable5; - } - - /** - * This method initializes jButton10 - * - * @return javax.swing.JButton - */ - private JButton getJButton10() { - if (jButton10 == null) { - jButton10 = new JButton(); - 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()}; - String s = boolToList(boolArray); - Object[] o = {jTextField12.getText(), jComboBox2.getSelectedItem(), s, - jTextField8.getText(), jTextField13.getText(), jTextField7.getText()}; - optionsTableModel.addRow(o); - - ffc.genBuildOptionsOpt(stringToVector(jTextField12.getText()), jComboBox2.getSelectedItem()+"", jTextField13.getText(), jTextField8.getText(), stringToVector(s), jTextField7.getText()); + String encapType = m.getValueAt(row, 0) + ""; + docConsole.setSaved(false); + ffc.updateBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), row, encapType); + } } }); } - return jButton10; + return jTableFfsSections; } - - private Vector stringToVector(String s) { - String[] sArray = s.split(" "); - Vector v = new Vector(); - for (int i = 0; i < sArray.length; ++i) { - v.add(sArray[i]); + + /** + * This method initializes jSplitPaneFfsC + * + * @return javax.swing.JSplitPane + */ + private JSplitPane getJSplitPaneFfsC() { + if (jSplitPaneFfsC == null) { + jSplitPaneFfsC = new JSplitPane(); + jSplitPaneFfsC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); + jSplitPaneFfsC.setDividerLocation(130); + jSplitPaneFfsC.setTopComponent(getJPanelFfsCTop()); + jSplitPaneFfsC.setBottomComponent(getJSplitPaneFfsCBottom()); + jSplitPaneFfsC.setDividerSize(5); } - return v; + return jSplitPaneFfsC; } - - private String boolToList (boolean[] bool) { - String s = " "; - if (bool[0]) { - s += "IA32 "; + + /** + * This method initializes jPanelFfsCTop + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelFfsCTop() { + if (jPanelFfsCTop == null) { + jPanelFfsCTop = new JPanel(); + jPanelFfsCTop.setLayout(new BorderLayout()); + jPanelFfsCTop.add(getJPanelSectionN(), java.awt.BorderLayout.NORTH); + jPanelFfsCTop.add(getJScrollPaneFfsSection(), java.awt.BorderLayout.CENTER); } - if (bool[1]) { - s += "IPF "; + return jPanelFfsCTop; + } + + /** + * This method initializes jSplitPaneFfsCBottom + * + * @return javax.swing.JSplitPane + */ + private JSplitPane getJSplitPaneFfsCBottom() { + if (jSplitPaneFfsCBottom == null) { + jSplitPaneFfsCBottom = new JSplitPane(); + jSplitPaneFfsCBottom.setDividerSize(5); + jSplitPaneFfsCBottom.setDividerLocation(130); + jSplitPaneFfsCBottom.setTopComponent(getJPanelFfsCBottomTop()); + jSplitPaneFfsCBottom.setBottomComponent(getJPanelFfsCBottomBottom()); + jSplitPaneFfsCBottom.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); } - if (bool[2]) { - s += "X64 "; + return jSplitPaneFfsCBottom; + } + + /** + * This method initializes jPanelFfsCBottomTop + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelFfsCBottomTop() { + if (jPanelFfsCBottomTop == null) { + jPanelFfsCBottomTop = new JPanel(); + jPanelFfsCBottomTop.setLayout(new BorderLayout()); + jPanelFfsCBottomTop.add(getJPanelSectionsN(), java.awt.BorderLayout.NORTH); + jPanelFfsCBottomTop.add(getJScrollPaneFfsSections(), java.awt.BorderLayout.CENTER); } - if (bool[3]) { - s += "EBC "; + return jPanelFfsCBottomTop; + } + + /** + * This method initializes jPanelFfsCBottomBottom + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelFfsCBottomBottom() { + if (jPanelFfsCBottomBottom == null) { + jPanelFfsCBottomBottom = new JPanel(); + jPanelFfsCBottomBottom.setLayout(new BorderLayout()); + jPanelFfsCBottomBottom.add(getJPanelSubSectionN(), java.awt.BorderLayout.NORTH); + jPanelFfsCBottomBottom.add(getJScrollPaneFfsSubSection(), java.awt.BorderLayout.CENTER); } - if (bool[4]) { - s += "ARM "; + return jPanelFfsCBottomBottom; + } + + /** + * This method initializes jPanelSectionN + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelSectionN() { + if (jPanelSectionN == null) { + jPanelSectionN = new JPanel(); + jLabelFfsSection = new JLabel(); + jLabelFfsSection.setText("Section"); + jPanelSectionN.add(jLabelFfsSection, null); + jPanelSectionN.add(getJButtonFfsSectionNew(), null); + jPanelSectionN.add(getJButtonFfsSectionRemove(), null); } - if (bool[5]) { - s += "PPC "; + return jPanelSectionN; + } + + /** + * This method initializes jPanelSectionsN + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelSectionsN() { + if (jPanelSectionsN == null) { + jPanelSectionsN = new JPanel(); + jLabelFfsSections = new JLabel(); + jLabelFfsSections.setText("Sections"); + jPanelSectionsN.add(jLabelFfsSections, null); + jPanelSectionsN.add(getJButtonFfsSectionsNew(), null); + jPanelSectionsN.add(getJButtonFfsSectionsRemove(), null); } - if (s == " ") { - s += "IA32"; + return jPanelSectionsN; + } + + /** + * This method initializes jPanelSubSectionN + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelSubSectionN() { + if (jPanelSubSectionN == null) { + jPanelSubSectionN = new JPanel(); + jLabelFfsSubSections = new JLabel(); + jLabelFfsSubSections.setText("Sub-Sections"); + jPanelSubSectionN.add(jLabelFfsSubSections, null); + jPanelSubSectionN.add(getJButtonFfsSubSectionNew(), null); + jPanelSubSectionN.add(getJButtonFfsSubSectionRemove(), null); } - return s.trim(); + return jPanelSubSectionN; } /** - * This method initializes jButton11 - * - * @return javax.swing.JButton + * The following section contains all Build Options content */ - private JButton getJButton11() { - if (jButton11 == null) { - jButton11 = new JButton(); - 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); - ffc.removeBuildOptionsOpt(selectedRow); - } - } - }); + /** + * This method initializes jPanelOptionsTab + * + * This is the main Options screen + * + * @return javax.swing.JPanel jPanelOptionsTab + */ + private JPanel getJPanelOptionsTab() { + if (jPanelOptionsTab == null) { + // This container holds the Options Tab content + + // FlowLayout flowLayout9 = new FlowLayout(); + // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT); + + jPanelOptionsTab = new JPanel(); + jPanelOptionsTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3)); + jPanelOptionsTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10)); + jPanelOptionsTab.setAutoscrolls(true); + jPanelOptionsTab.setLocation(0, 0); + jPanelOptionsTab.setLayout(null); + jPanelOptionsTab.add(getJPanelOptionsContainer(), null); + jPanelOptionsTab.add(getJScrollPaneOptions(), null); + + } + return jPanelOptionsTab; + } + + /** + * This method initializes jPanelOptionsContainer + * + * @return javax.swing.JPanel + */ + private JPanel getJPanelOptionsContainer() { + if (jPanelOptionsContainer == null) { + jLabelTagName = new JLabel(); + jLabelTagName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight)); + jLabelTagName.setLocation(new java.awt.Point(labelColumn, rowOne)); + jLabelTagName.setText("Tag Name"); + jLabelBuildTargets = new JLabel(); + jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight)); + jLabelBuildTargets.setLocation(new java.awt.Point(labelColumn, rowTwo)); + jLabelBuildTargets.setText("Build Targets"); + jLabelToolCmd = new JLabel(); + jLabelToolCmd.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight)); + jLabelToolCmd.setLocation(new java.awt.Point(labelColumn, rowThree)); + jLabelToolCmd.setText("Tool Command"); + jLabelSupArch = new JLabel(); + jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight)); + jLabelSupArch.setLocation(new java.awt.Point(labelColumn, rowFour)); + jLabelSupArch.setText("Supported Architectures"); + jLabelToolChainFamily = new JLabel(); + jLabelToolChainFamily.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight)); + jLabelToolChainFamily.setLocation(new java.awt.Point(labelColumn, rowFive)); + jLabelToolChainFamily.setText("Tool Chain Family"); + + jLabelOptionContents = new JLabel(); + jLabelOptionContents.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight)); + jLabelOptionContents.setLocation(new java.awt.Point(labelColumn, rowSix)); + jLabelOptionContents.setText("Option Contents"); + + jPanelOptionsContainer = new JPanel(); + + jPanelOptionsContainer.setLayout(null); + + jPanelOptionsContainer.setLocation(new java.awt.Point(2, 2)); + jPanelOptionsContainer.setBounds(new java.awt.Rectangle(2, 2, dialogWidth * 2, dialogHeight)); + jPanelOptionsContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight)); + /* + jPanelOptionsContainer + .setBorder(javax.swing.BorderFactory + .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); +*/ + jPanelOptionsContainer.add(jLabelTagName, null); + jPanelOptionsContainer.add(getJTextFieldTagName(), null); + + jPanelOptionsContainer.add(jLabelBuildTargets, null); + jPanelOptionsContainer.add(getJTextFieldBuildTargets(), null); + + jPanelOptionsContainer.add(jLabelToolChainFamily, null); + jPanelOptionsContainer.add(getJTextFieldToolChainFamily(), null); + + jPanelOptionsContainer.add(jLabelToolCmd, null); + jPanelOptionsContainer.add(getJTextFieldToolCmd(), null); + + jPanelOptionsContainer.add(jLabelSupArch, null); + jPanelOptionsContainer.add(getArchitectureSelections(), null); + + jPanelOptionsContainer.add(jLabelOptionContents, null); + jPanelOptionsContainer.add(getJTextFieldOptionContents(), null); + + jPanelOptionsContainer.add(getJButtonOptionsAdd(), null); + jPanelOptionsContainer.add(getJButtonOptionsDel(), null); } - return jButton11; + return jPanelOptionsContainer; } /** - * This method initializes jButton17 - * - * @return javax.swing.JButton + * This method initializes jTextFieldOptionTagName Row 1 + * + * @return javax.swing.JTextField */ - private JButton getJButton17() { - if (jButton17 == null) { - jButton17 = new JButton(); - jButton17.setPreferredSize(new java.awt.Dimension(80,20)); - jButton17.setText("New"); - jButton17.addActionListener(new AbstractAction() { - /** - * - */ - private static final long serialVersionUID = 1L; + private JTextField getJTextFieldTagName() { + if (jTextFieldTagName == null) { + jTextFieldTagName = new JTextField(); + jTextFieldTagName.setBounds(new java.awt.Rectangle(fieldColumn, rowOne, fieldWidth, oneRowHeight)); + jTextFieldTagName.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight)); + jTextFieldTagName.setLocation(new java.awt.Point(fieldColumn, rowOne)); + } + return jTextFieldTagName; + } - public void actionPerformed(ActionEvent arg0){ - if (jTable.getSelectedRow() < 0) { - return; - } - Object[] o = {"", ""}; - ffsAttributesTableModel.addRow(o); - ffc.genBuildOptionsFfsAttribute(jTable.getSelectedRow(), "", ""); - } - }); + /** + * This method initializes jTextFieldBuildTargets Row 2 + * + * @return javax.swing.JTextField jTextFieldBuildTargets + */ + private JTextField getJTextFieldBuildTargets() { + if (jTextFieldBuildTargets == null) { + jTextFieldBuildTargets = new JTextField(); + jTextFieldBuildTargets.setBounds(new java.awt.Rectangle(fieldColumn, rowTwo, fieldWidth, oneRowHeight)); + jTextFieldBuildTargets.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight)); + jTextFieldBuildTargets.setLocation(new java.awt.Point(fieldColumn, rowTwo)); } - return jButton17; + return jTextFieldBuildTargets; } /** - * This method initializes jButton18 - * - * @return javax.swing.JButton + * This method initializes jTextFieldToolCmd Row 3 + * + * This should be a dropdown box of command codes from tools_def.txt + * + * @return javax.swing.JTextField jTextFieldToolCmd */ - private JButton getJButton18() { - if (jButton18 == null) { - jButton18 = new JButton(); - jButton18.setPreferredSize(new java.awt.Dimension(80,20)); - jButton18.setText("Remove"); - jButton18.addActionListener(new AbstractAction(){ - /** - * - */ - private static final long serialVersionUID = 1L; + private JTextField getJTextFieldToolCmd() { + if (jTextFieldToolCmd == null) { + jTextFieldToolCmd = new JTextField(); + jTextFieldToolCmd.setBounds(new java.awt.Rectangle(fieldColumn, rowThree, fieldWidth, oneRowHeight)); + jTextFieldToolCmd.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight)); + jTextFieldToolCmd.setLocation(new java.awt.Point(fieldColumn, rowThree)); + } + return jTextFieldToolCmd; + } - public void actionPerformed(ActionEvent arg0){ - if (jTable.getSelectedRow() < 0) { - return; - } - if (jTable4.getSelectedRow() >= 0){ - ffsAttributesTableModel.removeRow(jTable4.getSelectedRow()); - ffc.removeBuildOptionsFfsAttribute(jTable.getSelectedRow(), jTable4.getSelectedRow()); - } - } - }); + /** + * This method initializes jArchitectureSelections Row 4 + * + * @return jArchitectureSelections + */ + private JPanel getArchitectureSelections() { + if (jArchitectureSelections == null) { + jArchitectureSelections = new JPanel(); + jArchitectureSelections.setLayout(null); + jArchitectureSelections.add(getJCheckBoxIA32(), null); + jArchitectureSelections.add(getJCheckBoxX64(), null); + jArchitectureSelections.add(getJCheckBoxIpf(), null); + jArchitectureSelections.add(getJCheckBoxEBC(), null); + jArchitectureSelections.add(getJCheckBoxARM(), null); + jArchitectureSelections.add(getJCheckBoxPPC(), null); + jArchitectureSelections.setBounds(new java.awt.Rectangle(fieldColumn, rowFour, fieldWidth, oneRowHeight)); + jArchitectureSelections.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight)); + jArchitectureSelections.setLocation(new java.awt.Point(fieldColumn, rowFour)); } - return jButton18; + return jArchitectureSelections; } /** - * This method initializes jButton19 - * - * @return javax.swing.JButton + * This method initializes jCheckBoxIA32 + * + * @return javax.swing.JCheckBox jCheckBoxIA32 */ - private JButton getJButton19() { - if (jButton19 == null) { - jButton19 = new JButton(); - jButton19.setPreferredSize(new java.awt.Dimension(75,20)); - jButton19.setEnabled(false); - jButton19.setText("Update"); + private JCheckBox getJCheckBoxIA32() { + if (jCheckBoxIA32 == null) { + jCheckBoxIA32 = new JCheckBox(); + jCheckBoxIA32.setBounds(new java.awt.Rectangle(0, 0, 55, 20)); + jCheckBoxIA32.setText("IA32"); } - return jButton19; + return jCheckBoxIA32; } /** - * This method initializes jCheckBox9 - * - * @return javax.swing.JCheckBox + * This method initializes jCheckBoxX64 + * + * @return javax.swing.JCheckBox jCheckBoxX64 */ - private JCheckBox getJCheckBox9() { - if (jCheckBox9 == null) { - jCheckBox9 = new JCheckBox(); - jCheckBox9.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox9.setText("IA32"); + private JCheckBox getJCheckBoxX64() { + if (jCheckBoxX64 == null) { + jCheckBoxX64 = new JCheckBox(); + jCheckBoxX64.setText("X64"); + jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20)); } - return jCheckBox9; + return jCheckBoxX64; } /** - * This method initializes jCheckBox10 - * - * @return javax.swing.JCheckBox + * This method initializes jCheckBoxIpf + * + * @return javax.swing.JCheckBox jCheckBoxIpf */ - private JCheckBox getJCheckBox10() { - if (jCheckBox10 == null) { - jCheckBox10 = new JCheckBox(); - jCheckBox10.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox10.setText("IPF"); + private JCheckBox getJCheckBoxIpf() { + if (jCheckBoxIpf == null) { + jCheckBoxIpf = new JCheckBox(); + jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20)); + jCheckBoxIpf.setText("IPF"); } - return jCheckBox10; + return jCheckBoxIpf; } + /** - * This method initializes jCheckBox11 - * - * @return javax.swing.JCheckBox + * This method initializes jCheckBoxEBC + * + * @return javax.swing.JCheckBox jCheckBoxEBC */ - private JCheckBox getJCheckBox11() { - if (jCheckBox11 == null) { - jCheckBox11 = new JCheckBox(); - jCheckBox11.setText("X64"); - jCheckBox11.setPreferredSize(new java.awt.Dimension(47,20)); + private JCheckBox getJCheckBoxEBC() { + if (jCheckBoxEBC == null) { + jCheckBoxEBC = new JCheckBox(); + jCheckBoxEBC.setBounds(new java.awt.Rectangle(160, 0, 53, 20)); + jCheckBoxEBC.setText("EBC"); } - return jCheckBox11; + return jCheckBoxEBC; } /** - * This method initializes jCheckBox12 - * - * @return javax.swing.JCheckBox + * This method initializes jCheckBoxARM + * + * @return javax.swing.JCheckBox jCheckBoxARM */ - private JCheckBox getJCheckBox12() { - if (jCheckBox12 == null) { - jCheckBox12 = new JCheckBox(); - jCheckBox12.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox12.setText("EBC"); + private JCheckBox getJCheckBoxARM() { + if (jCheckBoxARM == null) { + jCheckBoxARM = new JCheckBox(); + jCheckBoxARM.setBounds(new java.awt.Rectangle(213, 0, 54, 20)); + jCheckBoxARM.setText("ARM"); } - return jCheckBox12; + return jCheckBoxARM; } /** - * This method initializes jCheckBox13 - * - * @return javax.swing.JCheckBox + * This method initializes jCheckBoxPPC + * + * @return javax.swing.JCheckBox jCheckBoxPPC */ - private JCheckBox getJCheckBox13() { - if (jCheckBox13 == null) { - jCheckBox13 = new JCheckBox(); - jCheckBox13.setPreferredSize(new java.awt.Dimension(55,20)); - jCheckBox13.setText("ARM"); + private JCheckBox getJCheckBoxPPC() { + if (jCheckBoxPPC == null) { + jCheckBoxPPC = new JCheckBox(); + jCheckBoxPPC.setBounds(new java.awt.Rectangle(267, 0, 53, 20)); + jCheckBoxPPC.setText("PPC"); } - return jCheckBox13; + return jCheckBoxPPC; } /** - * This method initializes jCheckBox14 - * - * @return javax.swing.JCheckBox + * This method initializes jTextFieldToolChainFamily Row 5 + * + * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED + * + * @return javax.swing.JTextField */ - private JCheckBox getJCheckBox14() { - if (jCheckBox14 == null) { - jCheckBox14 = new JCheckBox(); - jCheckBox14.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox14.setText("PPC"); + private JTextField getJTextFieldToolChainFamily() { + if (jTextFieldToolChainFamily == null) { + jTextFieldToolChainFamily = new JTextField(); + jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(fieldColumn, rowFive, fieldWidth, oneRowHeight)); + jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight)); + jTextFieldToolChainFamily.setLocation(new java.awt.Point(fieldColumn, rowFive)); } - return jCheckBox14; + return jTextFieldToolChainFamily; } /** - * This method initializes jTextField12 - * + * This method initializes jTextFieldOptionContents Row 6 + * + * This is where we should put the checkbox & entry data for the command arguments + * * @return javax.swing.JTextField */ - private JTextField getJTextField12() { - if (jTextField12 == null) { - jTextField12 = new JTextField(); - jTextField12.setPreferredSize(new java.awt.Dimension(150,20)); + private JTextField getJTextFieldOptionContents() { + if (jTextFieldOptionContents == null) { + jTextFieldOptionContents = new JTextField(); + jTextFieldOptionContents.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight)); + jTextFieldOptionContents.setBounds(fieldColumn, rowSix, fieldWidth, oneRowHeight); + jTextFieldOptionContents.setLocation(new java.awt.Point(fieldColumn, rowSix)); } - return jTextField12; + return jTextFieldOptionContents; } /** - * This method initializes jTextField13 - * - * @return javax.swing.JTextField + * This method initializes jButtonOptionsAdd + * + * Add entry from the top screen to the table + * + * @return javax.swing.JButton jButtonOptionsAdd */ - private JTextField getJTextField13() { - if (jTextField13 == null) { - jTextField13 = new JTextField(); - jTextField13.setPreferredSize(new java.awt.Dimension(140,20)); + private JButton getJButtonOptionsAdd() { + if (jButtonOptionsAdd == null) { + jButtonOptionsAdd = new JButton(); + jButtonOptionsAdd.setText("Add"); + + jButtonOptionsAdd.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight)); + jButtonOptionsAdd.setBounds(new java.awt.Rectangle(firstButtonLoc, buttonRow, buttonWidth, oneRowHeight)); + jButtonOptionsAdd.setLocation(new java.awt.Point(firstButtonLoc, buttonRow)); + jButtonOptionsAdd.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed(java.awt.event.ActionEvent e) { + boolean[] boolArray = { jCheckBoxIA32.isSelected(), jCheckBoxIpf.isSelected(), + jCheckBoxX64.isSelected(), jCheckBoxEBC.isSelected(), + jCheckBoxARM.isSelected(), jCheckBoxPPC.isSelected() }; + String s = boolToList(boolArray); + Object[] o = { jTextFieldBuildTargets.getText(), jTextFieldToolChainFamily.getText(), s, + jTextFieldToolCmd.getText(), jTextFieldTagName.getText(), + jTextFieldOptionContents.getText() }; + optionsTableModel.addRow(o); + docConsole.setSaved(false); + ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText()), + jTextFieldToolChainFamily.getText(), jTextFieldTagName.getText(), + jTextFieldToolCmd.getText(), stringToVector(s), + jTextFieldOptionContents.getText()); + } + }); } - return jTextField13; + return jButtonOptionsAdd; } /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane + * This method initializes jButtonOptionsDel + * + * Remove a line from the table below + * + * @return javax.swing.JButton jButtonOptionsDel + */ + private JButton getJButtonOptionsDel() { + if (jButtonOptionsDel == null) { + jButtonOptionsDel = new JButton(); + jButtonOptionsDel.setText("Delete"); + jButtonOptionsDel.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight)); + jButtonOptionsDel.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight)); + jButtonOptionsDel.setLocation(new java.awt.Point(next2LastButtonLoc, buttonRow)); + jButtonOptionsDel.addActionListener(new AbstractAction() { + /** + * + */ + private static final long serialVersionUID = 1L; + + public void actionPerformed(java.awt.event.ActionEvent e) { + if (selectedRow >= 0) { + optionsTableModel.removeRow(selectedRow); + docConsole.setSaved(false); + ffc.removeBuildOptionsOpt(selectedRow); + } + } + }); + } + return jButtonOptionsDel; + } + + /** + * This method initializes jScrollPaneOptions + * Contains the Table and is located below the data entry section + * @return javax.swing.JScrollPane jScrollPaneOptoins */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setPreferredSize(new java.awt.Dimension(150,419)); - jScrollPane.setViewportView(getJTable()); + private JScrollPane getJScrollPaneOptions() { + if (jScrollPaneOptions == null) { + jScrollPaneOptions = new JScrollPane(); + jScrollPaneOptions.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight * 2)); + jScrollPaneOptions.setBounds(new java.awt.Rectangle(2, (dialogHeight * 2) + 2, dialogWidth * 2, dialogHeight * 2)); + jScrollPaneOptions.setLocation(new java.awt.Point(2, dialogHeight + 2)); + + jScrollPaneOptions.setViewportView(getJTableOptions()); } - return jScrollPane; + return jScrollPaneOptions; } /** - * This method initializes jTable + * This method initializes jTableOptions * - * @return javax.swing.JTable + * @return javax.swing.JTable jTableOptions */ - private JTable getJTable() { - if (jTable == null) { - ffsTableModel = new DefaultTableModel(); - ffsTableModel.addColumn("FFS Type"); - jTable = new JTable(ffsTableModel); - jTable.setShowGrid(false); - jTable.setRowHeight(20); + private JTable getJTableOptions() { + if (jTableOptions == null) { + jTitle = new JLabel(); + jTitle.setText("Current Option Configuration Lines"); + jTitle.setBounds(2, 2, labelWidth, oneRowHeight); + + optionsTableModel = new DefaultTableModel(); + jTableOptions = new JTable(optionsTableModel); + jTableOptions.setRowHeight(20); + optionsTableModel.addColumn("Build Targets"); + optionsTableModel.addColumn("Tool Chain Family"); + optionsTableModel.addColumn("Supported Architectures"); + optionsTableModel.addColumn("Tool Command Code"); + optionsTableModel.addColumn("TagName"); + optionsTableModel.addColumn("Contents"); + + javax.swing.table.TableColumn toolFamilyCol = jTableOptions.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 vArch = new Vector(); + vArch.add("IA32"); + vArch.add("X64"); + vArch.add("IPF"); + vArch.add("EBC"); + vArch.add("ARM"); + vArch.add("PPC"); + jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch)); + + jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor()); - jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ + jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); + jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { - - if (e.getValueIsAdjusting()){ + selectedRow = -1; + if (e.getValueIsAdjusting()) { return; } - ListSelectionModel lsm = (ListSelectionModel)e.getSource(); + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { return; - } - else{ - int row = lsm.getMinSelectionIndex(); - sectionTableModel.setRowCount(0); - sectionsTableModel.setRowCount(0); - subsectionsTableModel.setRowCount(0); - ffsAttributesTableModel.setRowCount(0); - String[] sArray = {"", ""}; - LinkedHashMap lhm = new LinkedHashMap(); - ArrayList alSections = new ArrayList(); - ArrayList alSection = new ArrayList(); - ffc.getBuildOptionsFfs(row, sArray, lhm, alSections, alSection); - jTextField6.setText(sArray[0]); - jTextField.setText(sArray[1]); - for (int i = 0; i < alSection.size(); ++i) { - String[] sectionRow = {alSection.get(i)}; - sectionTableModel.addRow(sectionRow); - } - for (int j = 0; j < alSections.size(); ++j) { - String[] sectionsRow = {alSections.get(j)}; - sectionsTableModel.addRow(sectionsRow); - } - if (lhm.size() <= 0 ) { - return; - } - Set keySet = lhm.keySet(); - Iterator is = keySet.iterator(); - while(is.hasNext()) { - String key = is.next(); - String[] attribRow = {key, lhm.get(key)}; - ffsAttributesTableModel.addRow(attribRow); - } + } else { + selectedRow = lsm.getMinSelectionIndex(); } } }); - - jTable.getModel().addTableModelListener(new TableModelListener() { + + jTableOptions.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent arg0) { // TODO Auto-generated method stub int row = arg0.getFirstRow(); - TableModel m = (TableModel)arg0.getSource(); - if (arg0.getType() == TableModelEvent.UPDATE){ + TableModel m = (TableModel) arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE) { //ToDo Data Validition check. - String id = m.getValueAt(row, 0) + ""; - - if (id.length() == 0) { - return; + String targets = m.getValueAt(row, 0) + ""; + Vector targetName = new Vector(); + String[] sArray = targets.split("( )+"); + for (int i = 0; i < sArray.length; ++i) { + targetName.add(sArray[i]); } - - ffc.updateBuildOptionsFfsKey(row, id); + String toolChain = m.getValueAt(row, 1) + ""; + String archs = m.getValueAt(row, 2) + ""; + Vector supArch = null; + if (archs.length() > 0) { + supArch = new Vector(); + String[] sArray1 = archs.split("( )+"); + for (int i = 0; i < sArray1.length; ++i) { + supArch.add(sArray1[i]); + } + } + + String toolCmd = m.getValueAt(row, 3) + ""; + String tagName = m.getValueAt(row, 4) + ""; + String contents = m.getValueAt(row, 5) + ""; + docConsole.setSaved(false); + ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents); } } }); } - return jTable; + return jTableOptions; + } + + private Vector stringToVector(String s) { + String[] sArray = s.split(" "); + Vector v = null; + if (s.length() > 0) { + v = new Vector(); + for (int i = 0; i < sArray.length; ++i) { + v.add(sArray[i]); + } + } + return v; + } + + private String boolToList(boolean[] bool) { + String s = " "; + if (bool[0]) { + s += "IA32 "; + } + if (bool[1]) { + s += "IPF "; + } + if (bool[2]) { + s += "X64 "; + } + if (bool[3]) { + s += "EBC "; + } + if (bool[4]) { + s += "ARM "; + } + if (bool[5]) { + s += "PPC "; + } + if (s == " ") { + s += "IA32"; + } + return s.trim(); + } + + private void initOptionTable() { + if (ffc.getBuildOptionsOptCount() == 0) { + //ToDo get default options from *.txt file + return; + } + String[][] saa = new String[ffc.getBuildOptionsOptCount()][6]; + ffc.getBuildOptionsOpts(saa); + for (int i = 0; i < saa.length; ++i) { + optionsTableModel.addRow(saa[i]); + } } + /** - * This method initializes jScrollPane1 - * - * @return javax.swing.JScrollPane + * Everything below should pertain to the ANT Task Tab */ - private JScrollPane getJScrollPane1() { - if (jScrollPane1 == null) { - jScrollPane1 = new JScrollPane(); - jScrollPane1.setPreferredSize(new java.awt.Dimension(500,80)); - jScrollPane1.setViewportView(getJTable1()); - } - return jScrollPane1; - } /** - * This method initializes jTable1 - * - * @return javax.swing.JTable + * This method initializes jButton12 + * + * @return javax.swing.JButton */ - private JTable getJTable1() { - if (jTable1 == null) { - sectionTableModel = new DefaultTableModel(); - sectionTableModel.addColumn("SectionType"); - - jTable1 = new JTable(sectionTableModel); - JComboBox cb = new JComboBox(); - cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID"); - cb.addItem("EFI_SECTION_VERSION"); - cb.addItem("EFI_SECTION_USER_INTERFACE"); - cb.addItem("EFI_SECTION_DXE_DEPEX"); - cb.addItem("EFI_SECTION_PEI_DEPEX"); - cb.addItem("EFI_SECTION_PE32"); - cb.addItem("EFI_SECTION_PIC"); - cb.addItem("EFI_SECTION_TE"); - cb.addItem("EFI_SECTION_RAW"); - cb.addItem("EFI_SECTION_COMPRESSION"); - cb.addItem("EFI_SECTION_GUID_DEFINED"); - cb.addItem("EFI_SECTION_COMPATIBILITY16"); - cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE"); - jTable1.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb)); - - jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - jTable1.getModel().addTableModelListener(new TableModelListener() { - public void tableChanged(TableModelEvent arg0) { - // TODO Auto-generated method stub - if (jTable.getSelectedRow() < 0) { + private JButton getJButtonAntTaskFileBrowse() { + if (jButtonAntTaskFileBrowse == null) { + jButtonAntTaskFileBrowse = new JButton(); + jButtonAntTaskFileBrowse.setPreferredSize(new Dimension(buttonWidth, oneRowHeight)); + jButtonAntTaskFileBrowse.setText("Browse"); + jButtonAntTaskFileBrowse.addActionListener(new AbstractAction() { + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent arg0) { + // + // Select files from current workspace + // + String dirPrefix = System.getenv("WORKSPACE"); + JFileChooser chooser = new JFileChooser(dirPrefix); + File theFile = null; + String headerDest = null; + + chooser.setMultiSelectionEnabled(false); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + int retval = chooser.showOpenDialog(frame); + if (retval == JFileChooser.APPROVE_OPTION) { + + theFile = chooser.getSelectedFile(); + String file = theFile.getPath(); + if (!file.startsWith(dirPrefix)) { + JOptionPane.showMessageDialog(frame, "You can only select files in current package!"); + return; + } + } else { return; } - int row = arg0.getFirstRow(); - TableModel m = (TableModel)arg0.getSource(); - if (arg0.getType() == TableModelEvent.UPDATE){ - //ToDo Data Validition check. - String type = m.getValueAt(row, 0) + ""; - - ffc.updateBuildOptionsFfsSectionsSection(jTable.getSelectedRow(), row, type); - } + + headerDest = theFile.getPath(); + jTextFieldAntTaskFile.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/')); + } + }); } - return jTable1; + return jButtonAntTaskFileBrowse; } /** - * This method initializes jScrollPane3 + * This method initializes jPanelUserDefCenterN * - * @return javax.swing.JScrollPane + * @return javax.swing.JPanel */ - private JScrollPane getJScrollPane3() { - if (jScrollPane3 == null) { - jScrollPane3 = new JScrollPane(); - jScrollPane3.setPreferredSize(new java.awt.Dimension(500,90)); - jScrollPane3.setViewportView(getJTable3()); + private JPanel getJPanelUserDefCenterN() { + if (jPanelUserDefCenterN == null) { + jPanelUserDefCenterN = new JPanel(); + jPanelUserDefCenterN.add(jLabelAntCmdOpts, null); + jPanelUserDefCenterN.add(getJTextFieldAntCmdOpts(), null); + jPanelUserDefCenterN.add(getJButtonAntTaskAdd(), null); + jPanelUserDefCenterN.add(getJButtonAntTaskDel(), null); } - return jScrollPane3; + return jPanelUserDefCenterN; } /** - * This method initializes jTable3 - * - * @return javax.swing.JTable + * This method initializes jPanel8 + * + * @return javax.swing.JPanel */ - private JTable getJTable3() { - if (jTable3 == null) { - subsectionsTableModel = new DefaultTableModel(); - subsectionsTableModel.addColumn("SectionType"); - jTable3 = new JTable(subsectionsTableModel); - JComboBox cb = new JComboBox(); - cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID"); - cb.addItem("EFI_SECTION_VERSION"); - cb.addItem("EFI_SECTION_USER_INTERFACE"); - cb.addItem("EFI_SECTION_DXE_DEPEX"); - cb.addItem("EFI_SECTION_PEI_DEPEX"); - cb.addItem("EFI_SECTION_PE32"); - cb.addItem("EFI_SECTION_PIC"); - cb.addItem("EFI_SECTION_TE"); - cb.addItem("EFI_SECTION_RAW"); - cb.addItem("EFI_SECTION_COMPRESSION"); - cb.addItem("EFI_SECTION_GUID_DEFINED"); - cb.addItem("EFI_SECTION_COMPATIBILITY16"); - cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE"); - jTable3.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb)); - jTable3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - jTable3.getModel().addTableModelListener(new TableModelListener() { - public void tableChanged(TableModelEvent arg0) { - // TODO Auto-generated method stub - if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0) { - return; - } - int row = arg0.getFirstRow(); - TableModel m = (TableModel)arg0.getSource(); - if (arg0.getType() == TableModelEvent.UPDATE){ - //ToDo Data Validition check. - String type = m.getValueAt(row, 0) + ""; - ffc.updateBuildOptionsFfsSectionsSectionsSection(jTable.getSelectedRow(), jTable6.getSelectedRow(), row, type); - } - } - }); - } - return jTable3; - } + private JPanel getJPanelUserDef() { + if (jPanelUserDef == null) { + jPanelUserDef = new JPanel(); + jPanelUserDef.setLayout(new BorderLayout()); + jPanelUserDef.add(getJPanelUserDefNorth(), java.awt.BorderLayout.NORTH); + jPanelUserDef.add(getJPanelUserDefCenter(), java.awt.BorderLayout.CENTER); - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setPreferredSize(new java.awt.Dimension(100,20)); - jTextField.addFocusListener(new java.awt.event.FocusAdapter() { - public void focusLost(java.awt.event.FocusEvent e) { - if (jTable.getSelectedRow() < 0) { - return; - } - ffc.updateBuildOptionsFfsSectionsType(jTable.getSelectedRow(), jTextField.getText()); - } - }); } - return jTextField; + return jPanelUserDef; } /** - * This method initializes jPanel4 - * - * @return javax.swing.JPanel + * This method initializes jPanel9 + * + * @return javax.swing.JPanel */ - private JPanel getJPanel4() { - if (jPanel4 == null) { - jPanel4 = new JPanel(); - jPanel4.setPreferredSize(new java.awt.Dimension(100,100)); - jPanel4.add(getJButton17(), null); - jPanel4.add(getJButton18(), null); + private JPanel getJPanelUserDefNorth() { + if (jPanelUserDefNorth == null) { + jLabelAntTaskFile = new JLabel(); + jLabelAntTaskFile.setText("ANT Task File"); + jLabelAntTaskFile.setPreferredSize(new java.awt.Dimension(80, 20)); + FlowLayout flowLayout8 = new FlowLayout(); + flowLayout8.setAlignment(java.awt.FlowLayout.CENTER); + jLabelAntTaskId = new JLabel(); + jLabelAntTaskId.setText("ID"); + jPanelUserDefNorth = new JPanel(); + jPanelUserDefNorth.setLayout(flowLayout8); + jPanelUserDefNorth.add(jLabelAntTaskFile, null); + jPanelUserDefNorth.add(getJTextFieldAntTaskFile(), null); + jPanelUserDefNorth.add(getJButtonAntTaskFileBrowse(), null); + jPanelUserDefNorth.add(jLabelAntTaskId, null); + jPanelUserDefNorth.add(getJTextFieldAntTaskId(), null); } - return jPanel4; + return jPanelUserDefNorth; } /** - * This method initializes jButton - * - * @return javax.swing.JButton + * This method initializes jPanel11 + * + * @return javax.swing.JPanel */ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setPreferredSize(new java.awt.Dimension(80,20)); - jButton.setText("New"); - jButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTable.getSelectedRow() < 0) { - return; - } - String[] row = {"EFI_SECTION_RAW"}; - sectionTableModel.addRow(row); - ffc.genBuildOptionsFfsSectionsSection(jTable.getSelectedRow(), row[0]); - } - }); + private JPanel getJPanelUserDefCenter() { + if (jPanelUserDefCenter == null) { + jLabelAntCmdOpts = new JLabel(); + jLabelAntCmdOpts.setText("ANT Command Options"); + jLabelAntCmdOpts.setPreferredSize(new java.awt.Dimension(131, 20)); + jPanelUserDefCenter = new JPanel(); + jPanelUserDefCenter.setLayout(new BorderLayout()); + + jPanelUserDefCenter.add(getJPanelUserDefCenterN(), java.awt.BorderLayout.NORTH); + jPanelUserDefCenter.add(getJScrollPaneAntTasks(), java.awt.BorderLayout.CENTER); } - return jButton; + return jPanelUserDefCenter; } /** - * This method initializes jButton1 - * - * @return javax.swing.JButton + * This method initializes jTextField2 + * + * @return javax.swing.JTextField */ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setPreferredSize(new java.awt.Dimension(80,20)); - jButton1.setText("Remove"); - - jButton1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTable.getSelectedRow() < 0 || jTable1.getSelectedRow() < 0) { - return; - } - sectionTableModel.removeRow(jTable1.getSelectedRow()); - ffc.removeBuildOptionsFfsSectionsSection(jTable.getSelectedRow(), jTable1.getSelectedRow()); - } - }); + private JTextField getJTextFieldAntTaskFile() { + if (jTextFieldAntTaskFile == null) { + jTextFieldAntTaskFile = new JTextField(); + jTextFieldAntTaskFile.setPreferredSize(new java.awt.Dimension(200, 20)); } - return jButton1; + return jTextFieldAntTaskFile; } /** - * This method initializes jButton2 - * - * @return javax.swing.JButton + * This method initializes jTextField3 + * + * @return javax.swing.JTextField */ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setPreferredSize(new java.awt.Dimension(80,20)); - jButton2.setText("New"); - jButton2.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0) { - return; - } - String[] row = {"EFI_SECTION_RAW"}; - subsectionsTableModel.addRow(row); - ffc.genBuildOptionsFfsSectionsSectionsSection(jTable.getSelectedRow(), jTable6.getSelectedRow(), row[0]); - - } - }); + private JTextField getJTextFieldAntTaskId() { + if (jTextFieldAntTaskId == null) { + jTextFieldAntTaskId = new JTextField(); + jTextFieldAntTaskId.setPreferredSize(new java.awt.Dimension(100, 20)); } - return jButton2; + return jTextFieldAntTaskId; } /** - * This method initializes jButton3 - * - * @return javax.swing.JButton + * This method initializes jButton4 + * + * @return javax.swing.JButton */ - private JButton getJButton3() { - if (jButton3 == null) { - jButton3 = new JButton(); - jButton3.setPreferredSize(new java.awt.Dimension(80,20)); - jButton3.setText("Remove"); - jButton3.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0 || jTable3.getSelectedRow() < 0) { + private JButton getJButtonAntTaskAdd() { + if (jButtonAntTaskAdd == null) { + jButtonAntTaskAdd = new JButton(); + jButtonAntTaskAdd.setPreferredSize(new java.awt.Dimension(90, 20)); + jButtonAntTaskAdd.setText("Add"); + jButtonAntTaskAdd.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (!DataValidation.isInt(jTextFieldAntTaskId.getText()) + || jTextFieldAntTaskId.getText().length() != 8) { + JOptionPane.showMessageDialog(frame, "ID must be an 8-digit integer."); return; } - subsectionsTableModel.removeRow(jTable3.getSelectedRow()); - ffc.removeBuildOptionsFfsSectionsSectionsSection(jTable.getSelectedRow(), jTable6.getSelectedRow(), jTable3.getSelectedRow()); + Object[] o = { jTextFieldAntTaskId.getText(), null, null }; + o[1] = jTextFieldAntTaskFile.getText(); + o[2] = jTextFieldAntCmdOpts.getText(); + ffc.genBuildOptionsUserDefAntTask(o[0] + "", o[1] + "", o[2] + ""); + antTaskTableModel.addRow(o); + docConsole.setSaved(false); } }); } - return jButton3; + return jButtonAntTaskAdd; } /** - * This method initializes jButton6 - * - * @return javax.swing.JButton + * This method initializes jButton5 + * + * @return javax.swing.JButton */ - private JButton getJButton6() { - if (jButton6 == null) { - jButton6 = new JButton(); - jButton6.setPreferredSize(new java.awt.Dimension(80,20)); - jButton6.setText("New"); - jButton6.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTable.getSelectedRow() < 0) { - return; + private JButton getJButtonAntTaskDel() { + if (jButtonAntTaskDel == null) { + jButtonAntTaskDel = new JButton(); + jButtonAntTaskDel.setPreferredSize(new java.awt.Dimension(90, 20)); + jButtonAntTaskDel.setText("Delete"); + jButtonAntTaskDel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (selectedRow >= 0) { + docConsole.setSaved(false); + antTaskTableModel.removeRow(selectedRow); + ffc.removeBuildOptionsUserDefAntTask(selectedRow); } - String[] row = {""}; - sectionsTableModel.addRow(row); - ffc.genBuildOptionsFfsSectionsSections(jTable.getSelectedRow(), ""); } }); } - return jButton6; + return jButtonAntTaskDel; } /** - * This method initializes jButton7 - * - * @return javax.swing.JButton + * This method initializes jTextField4 + * + * @return javax.swing.JTextField */ - private JButton getJButton7() { - if (jButton7 == null) { - jButton7 = new JButton(); - jButton7.setPreferredSize(new java.awt.Dimension(80,20)); - jButton7.setText("Remove"); - jButton7.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTable.getSelectedRow() < 0 || jTable6.getSelectedRow() < 0) { - return; - } - sectionsTableModel.removeRow(jTable6.getSelectedRow()); - ffc.removeBuildOptionsFfsSectionsSections(jTable.getSelectedRow(), jTable6.getSelectedRow()); - } - }); + private JTextField getJTextFieldAntCmdOpts() { + if (jTextFieldAntCmdOpts == null) { + jTextFieldAntCmdOpts = new JTextField(); + jTextFieldAntCmdOpts.setPreferredSize(new java.awt.Dimension(270, 20)); + jTextFieldAntCmdOpts.setEnabled(true); } - return jButton7; + return jTextFieldAntCmdOpts; } /** - * This method initializes jScrollPane4 - * - * @return javax.swing.JScrollPane + * This method initializes jScrollPane2 + * + * @return javax.swing.JScrollPane */ - private JScrollPane getJScrollPane4() { - if (jScrollPane4 == null) { - jScrollPane4 = new JScrollPane(); - jScrollPane4.setPreferredSize(new java.awt.Dimension(500,80)); - jScrollPane4.setViewportView(getJTable6()); + private JScrollPane getJScrollPaneAntTasks() { + if (jScrollPaneAntTasks == null) { + jScrollPaneAntTasks = new JScrollPane(); + jScrollPaneAntTasks.setPreferredSize(new java.awt.Dimension(600, 400)); + jScrollPaneAntTasks.setViewportView(getJTableAntTasks()); } - return jScrollPane4; + return jScrollPaneAntTasks; } /** - * This method initializes jTable6 - * - * @return javax.swing.JTable + * This method initializes jTable2 + * + * @return javax.swing.JTable */ - private JTable getJTable6() { - if (jTable6 == null) { - sectionsTableModel = new DefaultTableModel(); - sectionsTableModel.addColumn("EncapsulationType"); - jTable6 = new JTable(sectionsTableModel); - - jTable6.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - jTable6.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ + private JTable getJTableAntTasks() { + if (jTableAntTasks == null) { + antTaskTableModel = new DefaultTableModel(); + jTableAntTasks = new JTable(antTaskTableModel); + jTableAntTasks.setRowHeight(20); + antTaskTableModel.addColumn("ID"); + antTaskTableModel.addColumn("Filename"); + antTaskTableModel.addColumn("ANT Command Options"); + + jTableAntTasks.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTableAntTasks.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { - if (e.getValueIsAdjusting()){ + selectedRow = -1; + if (e.getValueIsAdjusting()) { return; } - ListSelectionModel lsm = (ListSelectionModel)e.getSource(); + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { return; - } - else{ - int sectionsRow = lsm.getMinSelectionIndex(); - if (jTable.getSelectedRow() < 0) { - return; - } - subsectionsTableModel.setRowCount(0); - ArrayList al = new ArrayList(); - ffc.getBuildOptionsFfsSectionsSectionsSection(jTable.getSelectedRow(), sectionsRow, al); - for (int i = 0; i < al.size(); ++i) { - String[] subsectionRow = {al.get(i)}; - subsectionsTableModel.addRow(subsectionRow); - } + } else { + selectedRow = lsm.getMinSelectionIndex(); } } }); - - jTable6.getModel().addTableModelListener(new TableModelListener() { + + jTableAntTasks.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent arg0) { // TODO Auto-generated method stub int row = arg0.getFirstRow(); - TableModel m = (TableModel)arg0.getSource(); - if (arg0.getType() == TableModelEvent.UPDATE){ + TableModel m = (TableModel) arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE) { //ToDo Data Validition check. - String encapType = m.getValueAt(row, 0) + ""; - ffc.updateBuildOptionsFfsSectionsSections(jTable.getSelectedRow(), row, encapType); + String id = m.getValueAt(row, 0) + ""; + String file = m.getValueAt(row, 1) + ""; + String execOrder = m.getValueAt(row, 2) + ""; + if (id.length() == 0) { + return; + } + if (file.length() == 0 && execOrder.length() == 0) { + return; + } + if (file.length() == 0) { + file = null; + } + if (execOrder.length() == 0) { + execOrder = null; + } + ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder); + } } }); } - return jTable6; - } - - /** - * @param args - */ - public static void main(String[] args) { - // TODO Auto-generated method stub - new FpdBuildOptions().setVisible(true); - } - - /** - * This is the default constructor - */ - public FpdBuildOptions() { - super(); - initialize(); - this.setVisible(true); - } - - public FpdBuildOptions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) { - this(); - ffc = new FpdFileContents(fpd); - init(ffc); + return jTableAntTasks; } - private void init(FpdFileContents ffc) { - initOptionTable(); - initAntTaskTable(); - initFfsTable(); - 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() { - if (ffc.getBuildOptionsOptCount() == 0) { - //ToDo get default options from *.txt file - return; - } - String[][] saa = new String[ffc.getBuildOptionsOptCount()][6]; - ffc.getBuildOptionsOpts(saa); - for (int i = 0; i < saa.length; ++i) { - optionsTableModel.addRow(saa[i]); - } - } - private void initAntTaskTable() { if (ffc.getBuildOptionsUserDefAntTaskCount() == 0) { return; @@ -1688,45 +2166,5 @@ public class FpdBuildOptions extends IInternalFrame { antTaskTableModel.addRow(saa[i]); } } - - private void initFfsTable(){ - int ffsCount = ffc.getBuildOptionsFfsCount(); - if (ffsCount < 0) { - return; - } - String[][] saa = new String[ffsCount][1]; - ffc.getBuildOptionsFfsKey(saa); - for (int i = 0; i < saa.length; ++i) { - ffsTableModel.addRow(saa[i]); - } - } - /** - * This method initializes this - * - * @return void - */ - private void initialize() { - this.setSize(722, 577); - this.setTitle("FPD Build Options"); - this.setContentPane(getJContentPane()); - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(new BorderLayout()); - jContentPane.add(getJPanel(), java.awt.BorderLayout.SOUTH); - jContentPane.add(getJPanel1(), java.awt.BorderLayout.NORTH); - jContentPane.add(getJPanel2(), java.awt.BorderLayout.WEST); - jContentPane.add(getJPanel3(), java.awt.BorderLayout.EAST); - jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER); - } - return jContentPane; - } -} // @jve:decl-index=0:visual-constraint="10,10" +} // @jve:decl-index=0:visual-constraint="10,10"