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=60780744d10b9056d3d41a10826a5dfd15cc6da6;hb=a0783edc77ae576d8032461935362f43293bc467;hpb=a13899c5acad2f5e125abdae972b4c3d1e522f69 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 60780744d1..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 @@ -15,10 +15,8 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; -import java.awt.Dimension; import javax.swing.JPanel; -import javax.swing.JDialog; import javax.swing.JTabbedPane; import javax.swing.JCheckBox; import javax.swing.JLabel; @@ -26,174 +24,331 @@ import java.awt.FlowLayout; import javax.swing.AbstractAction; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import javax.swing.ButtonGroup; import javax.swing.DefaultCellEditor; -import javax.swing.DefaultListModel; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JButton; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JComboBox; -import javax.swing.JRadioButton; import javax.swing.ListSelectionModel; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableColumn; import javax.swing.table.TableModel; -import javax.swing.JList; import org.tianocore.PlatformSurfaceAreaDocument; +import org.tianocore.frameworkwizard.common.DataValidation; +import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; -import java.awt.CardLayout; -import javax.swing.JTree; + +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 JRadioButton jRadioButton = null; - private JTextField jTextField2 = null; - private JLabel jLabel3 = null; - private JTextField jTextField3 = null; - private JButton jButton4 = null; - private JButton jButton5 = null; - private JRadioButton jRadioButton1 = null; - private JLabel jLabel4 = null; - private JTextField jTextField4 = null; - private JScrollPane jScrollPane2 = null; - private JTable jTable2 = null; - private DefaultTableModel fileNameTableModel = null; - private DefaultTableModel imageEntryPointTableModel = null; - private DefaultTableModel outputDirectoryTableModel = 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 jPanel14 = null; - private JPanel jPanel18 = null; - private JScrollPane jScrollPane4 = null; - private JLabel jLabel6 = null; - private JList jList = null; - private JPanel jPanel15 = null; - private JPanel jPanel16 = null; - private JPanel jPanel17 = null; - private JLabel jLabel7 = null; - private JTextField jTextField6 = null; - private JButton jButton8 = null; - private JButton jButton9 = null; - private JCheckBox jCheckBox5 = 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 JPanel jPanel21 = null; - private JButton jButton12 = null; - private JButton jButton13 = null; - private JLabel jLabel8 = null; - private JTextField jTextField9 = null; - private JLabel jLabel13 = null; - private JTextField jTextField10 = null; - private JPanel jPanel22 = null; - private JCheckBox jCheckBox6 = null; - private JComboBox jComboBox4 = null; - private JCheckBox jCheckBox7 = null; - private JComboBox jComboBox5 = null; - private JCheckBox jCheckBox8 = null; - private JTextField jTextField11 = null; - private JButton jButton14 = null; - private JButton jButton15 = null; - private JButton jButton16 = null; - private DefaultListModel listModel = new DefaultListModel(); - private JScrollPane jScrollPane7 = null; - private JTree jTree = null; - private JButton jButton17 = null; - private JButton jButton18 = null; + + private 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 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 @@ -203,1270 +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); - ButtonGroup bg = new ButtonGroup(); - bg.add(jRadioButton); - bg.add(jRadioButton1); - } - return jPanel8; + private void initialize() { + this.setSize(722, 577); + this.setTitle("Platform Build Options"); + this.setContentPane(getJContentPane()); } /** - * This method initializes jPanel9 - * - * @return javax.swing.JPanel + * This method initializes jContentPane + * + * @return javax.swing.JPanel */ - private JPanel getJPanel9() { - if (jPanel9 == null) { - FlowLayout flowLayout8 = new FlowLayout(); - flowLayout8.setAlignment(java.awt.FlowLayout.LEFT); - jLabel3 = new JLabel(); - jLabel3.setText("ID"); - jPanel9 = new JPanel(); - jPanel9.setLayout(flowLayout8); - jPanel9.add(getJRadioButton(), null); - jPanel9.add(getJTextField2(), null); - jPanel9.add(jLabel3, null); - jPanel9.add(getJTextField3(), null); - jPanel9.add(getJButton4(), null); - jPanel9.add(getJButton5(), null); + 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 jPanel9; + return jContentPane; } /** - * This method initializes jPanel10 - * - * @return javax.swing.JPanel + * @param args */ - private JPanel getJPanel10() { - if (jPanel10 == null) { - jPanel10 = new JPanel(); - } - return jPanel10; + public static void main(String[] args) { + // TODO Auto-generated method stub + new FpdBuildOptions().setVisible(true); } /** - * This method initializes jPanel11 + * 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 jPanel13 * * @return javax.swing.JPanel */ - private JPanel getJPanel11() { - if (jPanel11 == null) { - FlowLayout flowLayout3 = new FlowLayout(); - flowLayout3.setHgap(5); - flowLayout3.setAlignment(java.awt.FlowLayout.LEFT); - jLabel4 = new JLabel(); - jLabel4.setText("Execution Order"); - jLabel4.setEnabled(false); - jLabel4.setPreferredSize(new java.awt.Dimension(100,16)); - jPanel11 = new JPanel(); - jPanel11.setLayout(flowLayout3); - jPanel11.add(getJRadioButton1(), null); - jPanel11.add(jLabel4, null); - jPanel11.add(getJTextField4(), null); - jPanel11.add(getJScrollPane2(), null); + 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 jPanel11; + return jPanelFfsTab; } /** - * This method initializes jRadioButton + * This method initializes jPanel18 * - * @return javax.swing.JRadioButton - */ - private JRadioButton getJRadioButton() { - if (jRadioButton == null) { - jRadioButton = new JRadioButton(); - jRadioButton.setText("ANT tasks File"); - jRadioButton.setSelected(true); - jRadioButton.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent arg0) { - boolean selected = jRadioButton.isSelected(); - jTextField2.setEnabled(selected); - } - }); + * @return javax.swing.JPanel + */ + 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 jRadioButton; + 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(70,20)); - jButton4.setText("Add"); - jButton4.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - Object[] o = {jTextField3.getText(), null, null}; - if (jRadioButton.isSelected()) { - o[1] = jTextField2.getText(); - ffc.genBuildOptionsUserDefAntTask(o[0]+"", o[1]+"", null); - } - if (jRadioButton1.isSelected()) { - o[2] = jTextField4.getText(); - ffc.genBuildOptionsUserDefAntTask(o[0]+"", null, o[2]+""); + 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; } - antTaskTableModel.addRow(o); - + // 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(70,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 jRadioButton1 + * This method initializes jButton9 * - * @return javax.swing.JRadioButton - */ - private JRadioButton getJRadioButton1() { - if (jRadioButton1 == null) { - jRadioButton1 = new JRadioButton(); - jRadioButton1.setText("ANT Command"); - jRadioButton1.setPreferredSize(new java.awt.Dimension(180,24)); - jRadioButton1.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent arg0) { - boolean selected = jRadioButton1.isSelected(); - jLabel4.setEnabled(selected); - jTextField4.setEnabled(selected); + * @return javax.swing.JButton + */ + 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 jRadioButton1; - } - - /** - * This method initializes jTextField4 - * - * @return javax.swing.JTextField - */ - private JTextField getJTextField4() { - if (jTextField4 == null) { - jTextField4 = new JTextField(); - jTextField4.setPreferredSize(new java.awt.Dimension(100,20)); - jTextField4.setEnabled(false); - } - 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("ExecutionOrder"); - - 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() { + 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; } - /** - * This method initializes jPanel13 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel13() { - if (jPanel13 == null) { - jPanel13 = new JPanel(); - jPanel13.setLayout(new BorderLayout()); - jPanel13.add(getJPanel14(), java.awt.BorderLayout.WEST); - jPanel13.add(getJPanel18(), java.awt.BorderLayout.CENTER); + private void initFfsTable() { + int ffsCount = ffc.getBuildOptionsFfsCount(); + if (ffsCount < 0) { + return; } - return jPanel13; - } - - /** - * This method initializes jPanel14 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel14() { - if (jPanel14 == null) { - jLabel6 = new JLabel(); - jLabel6.setText("FFS Types"); - jPanel14 = new JPanel(); - jPanel14.setPreferredSize(new java.awt.Dimension(120,300)); - jPanel14.add(jLabel6, null); - jPanel14.add(getJScrollPane4(), null); + String[][] saa = new String[ffsCount][1]; + ffc.getBuildOptionsFfsKey(saa); + for (int i = 0; i < saa.length; ++i) { + ffsTableModel.addRow(saa[i]); } - return jPanel14; } /** - * This method initializes jPanel18 - * - * @return javax.swing.JPanel + * This method initializes jButton17 + * + * @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 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 jPanel18; + return jButtonFfsAttribNew; } /** - * This method initializes jScrollPane4 - * - * @return javax.swing.JScrollPane + * This method initializes jButton18 + * + * @return javax.swing.JButton */ - private JScrollPane getJScrollPane4() { - if (jScrollPane4 == null) { - jScrollPane4 = new JScrollPane(); - jScrollPane4.setPreferredSize(new java.awt.Dimension(120,330)); - jScrollPane4.setViewportView(getJList()); + 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 jScrollPane4; + return jButtonFfsAttribRemove; } /** - * This method initializes jList - * - * @return javax.swing.JList + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane */ - private JList getJList() { - if (jList == null) { - jList = new JList(listModel); + private JScrollPane getJScrollPaneFfs() { + if (jScrollPaneFfs == null) { + jScrollPaneFfs = new JScrollPane(); + jScrollPaneFfs.setPreferredSize(new java.awt.Dimension(150, 419)); + jScrollPaneFfs.setViewportView(getJTableFfs()); } - return jList; + return jScrollPaneFfs; } /** - * This method initializes jPanel15 - * - * @return javax.swing.JPanel + * This method initializes jTable + * + * @return javax.swing.JTable */ - private JPanel getJPanel15() { - if (jPanel15 == null) { - FlowLayout flowLayout5 = new FlowLayout(); - flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT); - jLabel7 = new JLabel(); - jLabel7.setText("Type"); - jPanel15 = new JPanel(); - jPanel15.setLayout(flowLayout5); - jPanel15.add(jLabel7, null); - jPanel15.add(getJTextField6(), null); - jPanel15.add(getJButton8(), null); - jPanel15.add(getJButton9(), 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 jPanel15; + return jTableFfs; } /** - * This method initializes jPanel16 - * - * @return javax.swing.JPanel + * This method initializes jScrollPane1 + * + * @return javax.swing.JScrollPane */ - private JPanel getJPanel16() { - if (jPanel16 == null) { - FlowLayout flowLayout6 = new FlowLayout(); - flowLayout6.setHgap(5); - flowLayout6.setAlignment(java.awt.FlowLayout.LEFT); - jPanel16 = new JPanel(); - jPanel16.setPreferredSize(new java.awt.Dimension(491,130)); - jPanel16.setLayout(flowLayout6); - jPanel16.add(getJCheckBox5(), null); - jPanel16.add(getJButton17(), null); - jPanel16.add(getJButton18(), null); - jPanel16.add(getJScrollPane5(), null); + private JScrollPane getJScrollPaneFfsSection() { + if (jScrollPaneFfsSection == null) { + jScrollPaneFfsSection = new JScrollPane(); +// jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80)); + jScrollPaneFfsSection.setViewportView(getJTableFfsSection()); } - return jPanel16; + return jScrollPaneFfsSection; } /** - * This method initializes jPanel17 - * - * @return javax.swing.JPanel + * This method initializes jTable1 + * + * @return javax.swing.JTable */ - private JPanel getJPanel17() { - if (jPanel17 == null) { - jPanel17 = new JPanel(); - jPanel17.add(getJScrollPane7(), null); + 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; + } + 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 jPanel17; + return jTableFfsSection; } /** - * This method initializes jTextField6 - * - * @return javax.swing.JTextField + * This method initializes jScrollPane3 + * + * @return javax.swing.JScrollPane */ - private JTextField getJTextField6() { - if (jTextField6 == null) { - jTextField6 = new JTextField(); - jTextField6.setPreferredSize(new java.awt.Dimension(150,20)); + private JScrollPane getJScrollPaneFfsSubSection() { + if (jScrollPaneFfsSubSection == null) { + jScrollPaneFfsSubSection = new JScrollPane(); +// jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90)); + jScrollPaneFfsSubSection.setViewportView(getJTableFfsSubSection()); } - return jTextField6; + return jScrollPaneFfsSubSection; } /** - * This method initializes jButton8 - * - * @return javax.swing.JButton + * This method initializes jTable3 + * + * @return javax.swing.JTable */ - private JButton getJButton8() { - if (jButton8 == null) { - jButton8 = new JButton(); - jButton8.setPreferredSize(new java.awt.Dimension(70,20)); - jButton8.setText("Add"); - jButton8.addActionListener(new AbstractAction() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (jTextField6.getText().length() > 0) { - listModel.addElement(jTextField6.getText()); + 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() { - public void actionPerformed(ActionEvent arg0){ - listModel.remove(jList.getSelectedIndex()); + 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.updateBuildOptionsFfsSectionsType(jTableFfs.getSelectedRow(), jTextFieldEncapType.getText()); } }); } - return jButton9; + return jTextFieldEncapType; } /** - * This method initializes jCheckBox5 - * - * @return javax.swing.JCheckBox + * This method initializes jPanel4 + * + * @return javax.swing.JPanel */ - private JCheckBox getJCheckBox5() { - if (jCheckBox5 == null) { - jCheckBox5 = new JCheckBox(); - jCheckBox5.setText("Attributes"); - jCheckBox5.setPreferredSize(new java.awt.Dimension(81,20)); + 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 jCheckBox5; + return jPanelFfsAttribButtonGroup; } /** - * This method initializes jScrollPane5 - * - * @return javax.swing.JScrollPane + * This method initializes jButton + * + * @return javax.swing.JButton */ - private JScrollPane getJScrollPane5() { - if (jScrollPane5 == null) { - jScrollPane5 = new JScrollPane(); - jScrollPane5.setPreferredSize(new java.awt.Dimension(350,100)); - jScrollPane5.setViewportView(getJTable4()); + 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 jScrollPane5; + return jButtonFfsSectionNew; } /** - * This method initializes jTable4 - * - * @return javax.swing.JTable + * This method initializes jButton1 + * + * @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"); + 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 jTable4; + return jButtonFfsSectionRemove; } /** - * This method initializes jPanel19 - * - * @return javax.swing.JPanel + * This method initializes jButton2 + * + * @return javax.swing.JButton */ - private JPanel getJPanel19() { - if (jPanel19 == null) { - jPanel19 = new JPanel(); - jPanel19.setLayout(new CardLayout()); - jPanel19.add(getJPanel21(), getJPanel21().getName()); - jPanel19.add(getJPanel22(), getJPanel22().getName()); + 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 jPanel19; + return jButtonFfsSubSectionNew; } /** - * This method initializes jPanel20 - * - * @return javax.swing.JPanel + * This method initializes jButton3 + * + * @return javax.swing.JButton */ - 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 JTextField getJTextField7() { - if (jTextField7 == null) { - jTextField7 = new JTextField(); - jTextField7.setPreferredSize(new java.awt.Dimension(300,20)); + 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 jTextField7; + return jButtonFfsSubSectionRemove; } /** - * This method initializes jComboBox2 - * - * @return javax.swing.JComboBox + * This method initializes jButton6 + * + * @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 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 jComboBox2; + return jButtonFfsSectionsNew; } /** - * This method initializes jTextField8 - * - * @return javax.swing.JTextField + * This method initializes jButton7 + * + * @return javax.swing.JButton */ - private JTextField getJTextField8() { - if (jTextField8 == null) { - jTextField8 = new JTextField(); - jTextField8.setPreferredSize(new java.awt.Dimension(110,20)); + 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 jTextField8; + return jButtonFfsSectionsRemove; } - /** - * This method initializes jScrollPane6 - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane6() { - if (jScrollPane6 == null) { - jScrollPane6 = new JScrollPane(); - jScrollPane6.setPreferredSize(new java.awt.Dimension(630,200)); - jScrollPane6.setViewportView(getJTable5()); + 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 targetName = m.getValueAt(row, 0) + ""; - String toolChain = m.getValueAt(row, 1) + ""; - String supArch = m.getValueAt(row, 2) + ""; - 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); + String encapType = m.getValueAt(row, 0) + ""; + docConsole.setSaved(false); + ffc.updateBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), row, encapType); } } }); } - return jTable5; + return jTableFfsSections; } /** - * This method initializes jButton10 - * - * @return javax.swing.JButton + * This method initializes jSplitPaneFfsC + * + * @return javax.swing.JSplitPane */ - private JButton getJButton10() { - if (jButton10 == null) { - jButton10 = new JButton(); - jButton10.setText("Add"); - jButton10.setPreferredSize(new java.awt.Dimension(70,20)); - jButton10.addActionListener(new AbstractAction() { - 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(jTextField12.getText(), jComboBox2.getSelectedItem()+"", jTextField13.getText(), jTextField8.getText(), s, jTextField7.getText()); - } - }); - } - return jButton10; - } - - 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 "; + 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); } - if (bool[5]) { - s += "PPC "; - } - - return s.trim(); + return jSplitPaneFfsC; } /** - * This method initializes jButton11 - * - * @return javax.swing.JButton + * This method initializes jPanelFfsCTop + * + * @return javax.swing.JPanel */ - private JButton getJButton11() { - if (jButton11 == null) { - jButton11 = new JButton(); - jButton11.setText("Delete"); - jButton11.setPreferredSize(new java.awt.Dimension(70,20)); - jButton11.addActionListener(new AbstractAction() { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (selectedRow >= 0) { - optionsTableModel.removeRow(selectedRow); - ffc.removeBuildOptionsOpt(selectedRow); - } - } - }); + 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); } - return jButton11; + return jPanelFfsCTop; } /** - * This method initializes jPanel21 - * - * @return javax.swing.JPanel + * This method initializes jSplitPaneFfsCBottom + * + * @return javax.swing.JSplitPane */ - private JPanel getJPanel21() { - if (jPanel21 == null) { - jLabel13 = new JLabel(); - jLabel13.setText("EncapsulationTag"); - jLabel8 = new JLabel(); - jLabel8.setText("EncapsulationType"); - jPanel21 = new JPanel(); - jPanel21.setName("jPanel21"); - jPanel21.add(jLabel8, null); - jPanel21.add(getJTextField9(), null); - jPanel21.add(jLabel13, null); - jPanel21.add(getJTextField10(), null); - jPanel21.add(getJButton12(), null); - jPanel21.add(getJButton13(), null); - jPanel21.add(getJButton16(), null); + 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); } - return jPanel21; + return jSplitPaneFfsCBottom; } /** - * This method initializes jButton12 - * - * @return javax.swing.JButton + * This method initializes jPanelFfsCBottomTop + * + * @return javax.swing.JPanel */ - private JButton getJButton12() { - if (jButton12 == null) { - jButton12 = new JButton(); - jButton12.setText("Add Sections"); - jButton12.setPreferredSize(new java.awt.Dimension(109,20)); - jButton12.addActionListener(new AbstractAction(){ - public void actionPerformed(ActionEvent arg0){ - } - }); + 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); } - return jButton12; + return jPanelFfsCBottomTop; } /** - * This method initializes jButton13 - * - * @return javax.swing.JButton + * This method initializes jPanelFfsCBottomBottom + * + * @return javax.swing.JPanel */ - private JButton getJButton13() { - if (jButton13 == null) { - jButton13 = new JButton(); - jButton13.setText("Add Section"); - jButton13.setPreferredSize(new java.awt.Dimension(102,20)); - jButton13.addActionListener(new AbstractAction(){ - public void actionPerformed(ActionEvent arg0){ - CardLayout cl = (CardLayout)jPanel19.getLayout(); - cl.last(jPanel19); - } - }); + 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); } - return jButton13; + return jPanelFfsCBottomBottom; } /** - * This method initializes jTextField9 - * - * @return javax.swing.JTextField + * This method initializes jPanelSectionN + * + * @return javax.swing.JPanel */ - private JTextField getJTextField9() { - if (jTextField9 == null) { - jTextField9 = new JTextField(); - jTextField9.setPreferredSize(new java.awt.Dimension(250,20)); + 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); } - return jTextField9; + return jPanelSectionN; } /** - * This method initializes jTextField10 - * - * @return javax.swing.JTextField + * This method initializes jPanelSectionsN + * + * @return javax.swing.JPanel */ - private JTextField getJTextField10() { - if (jTextField10 == null) { - jTextField10 = new JTextField(); - jTextField10.setPreferredSize(new java.awt.Dimension(250,20)); + 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); } - return jTextField10; + return jPanelSectionsN; } /** - * This method initializes jPanel22 - * - * @return javax.swing.JPanel + * This method initializes jPanelSubSectionN + * + * @return javax.swing.JPanel */ - private JPanel getJPanel22() { - if (jPanel22 == null) { - FlowLayout flowLayout7 = new FlowLayout(); - flowLayout7.setAlignment(java.awt.FlowLayout.LEFT); - jPanel22 = new JPanel(); - jPanel22.setLayout(flowLayout7); - jPanel22.setName("jPanel22"); - jPanel22.add(getJCheckBox6(), null); - jPanel22.add(getJComboBox4(), null); - jPanel22.add(getJCheckBox7(), null); - jPanel22.add(getJComboBox5(), null); - jPanel22.add(getJCheckBox8(), null); - jPanel22.add(getJTextField11(), null); - jPanel22.add(getJButton14(), null); - jPanel22.add(getJButton15(), null); + 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 jPanel22; + return jPanelSubSectionN; } /** - * This method initializes jCheckBox6 - * - * @return javax.swing.JCheckBox + * The following section contains all Build Options content */ - private JCheckBox getJCheckBox6() { - if (jCheckBox6 == null) { - jCheckBox6 = new JCheckBox(); - jCheckBox6.setText("Section Type"); - jCheckBox6.setPreferredSize(new java.awt.Dimension(98,20)); - } - return jCheckBox6; - } /** - * This method initializes jComboBox4 + * This method initializes jPanelOptionsTab * - * @return javax.swing.JComboBox - */ - private JComboBox getJComboBox4() { - if (jComboBox4 == null) { - jComboBox4 = new JComboBox(); - jComboBox4.setPreferredSize(new java.awt.Dimension(260,20)); + * 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); - jComboBox4.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID"); - jComboBox4.addItem("EFI_SECTION_VERSION"); - jComboBox4.addItem("EFI_SECTION_USER_INTERFACE"); - jComboBox4.addItem("EFI_SECTION_DXE_DEPEX"); - jComboBox4.addItem("EFI_SECTION_PEI_DEPEX"); - jComboBox4.addItem("EFI_SECTION_PE32"); - jComboBox4.addItem("EFI_SECTION_PIC"); - jComboBox4.addItem("EFI_SECTION_TE"); - jComboBox4.addItem("EFI_SECTION_RAW"); - jComboBox4.addItem("EFI_SECTION_COMPRESSION"); - jComboBox4.addItem("EFI_SECTION_GUID_DEFINED"); - jComboBox4.addItem("EFI_SECTION_COMPATIBILITY16"); - jComboBox4.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE"); - jComboBox4.setSelectedIndex(0); - } - return jComboBox4; - } - - /** - * This method initializes jCheckBox7 - * - * @return javax.swing.JCheckBox - */ - private JCheckBox getJCheckBox7() { - if (jCheckBox7 == null) { - jCheckBox7 = new JCheckBox(); - jCheckBox7.setPreferredSize(new java.awt.Dimension(120,20)); - jCheckBox7.setText("Compressible"); - } - return jCheckBox7; - } + 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); - /** - * This method initializes jComboBox5 - * - * @return javax.swing.JComboBox + 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 jPanelOptionsContainer; + } + + /** + * This method initializes jTextFieldOptionTagName Row 1 + * + * @return javax.swing.JTextField */ - private JComboBox getJComboBox5() { - if (jComboBox5 == null) { - jComboBox5 = new JComboBox(); - jComboBox5.setPreferredSize(new java.awt.Dimension(80,20)); - - jComboBox5.addItem("false"); - jComboBox5.addItem("true"); - jComboBox5.setSelectedIndex(0); + 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 jComboBox5; + return jTextFieldTagName; } /** - * This method initializes jCheckBox8 - * - * @return javax.swing.JCheckBox + * This method initializes jTextFieldBuildTargets Row 2 + * + * @return javax.swing.JTextField jTextFieldBuildTargets */ - private JCheckBox getJCheckBox8() { - if (jCheckBox8 == null) { - jCheckBox8 = new JCheckBox(); - jCheckBox8.setText("Binding Order"); - jCheckBox8.setPreferredSize(new java.awt.Dimension(103,20)); + 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 jCheckBox8; + return jTextFieldBuildTargets; } /** - * This method initializes jTextField11 - * - * @return javax.swing.JTextField + * 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 JTextField getJTextField11() { - if (jTextField11 == null) { - jTextField11 = new JTextField(); - jTextField11.setPreferredSize(new java.awt.Dimension(150,20)); + 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 jTextField11; + return jTextFieldToolCmd; } /** - * This method initializes jButton14 - * - * @return javax.swing.JButton + * This method initializes jArchitectureSelections Row 4 + * + * @return jArchitectureSelections */ - private JButton getJButton14() { - if (jButton14 == null) { - jButton14 = new JButton(); - jButton14.setText("Add"); - jButton14.setPreferredSize(new java.awt.Dimension(70,20)); - jButton14.addActionListener(new AbstractAction(){ - public void actionPerformed(ActionEvent arg0){ - } - }); + 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 jButton14; + return jArchitectureSelections; } /** - * This method initializes jButton15 - * - * @return javax.swing.JButton + * This method initializes jCheckBoxIA32 + * + * @return javax.swing.JCheckBox jCheckBoxIA32 */ - private JButton getJButton15() { - if (jButton15 == null) { - jButton15 = new JButton(); - jButton15.setPreferredSize(new java.awt.Dimension(70,20)); - jButton15.setText("Delete"); + private JCheckBox getJCheckBoxIA32() { + if (jCheckBoxIA32 == null) { + jCheckBoxIA32 = new JCheckBox(); + jCheckBoxIA32.setBounds(new java.awt.Rectangle(0, 0, 55, 20)); + jCheckBoxIA32.setText("IA32"); } - return jButton15; + return jCheckBoxIA32; } /** - * This method initializes jButton16 - * - * @return javax.swing.JButton + * This method initializes jCheckBoxX64 + * + * @return javax.swing.JCheckBox jCheckBoxX64 */ - private JButton getJButton16() { - if (jButton16 == null) { - jButton16 = new JButton(); - jButton16.setText("Delete"); - jButton16.setPreferredSize(new java.awt.Dimension(70,20)); + private JCheckBox getJCheckBoxX64() { + if (jCheckBoxX64 == null) { + jCheckBoxX64 = new JCheckBox(); + jCheckBoxX64.setText("X64"); + jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20)); } - return jButton16; + return jCheckBoxX64; } /** - * This method initializes jScrollPane7 - * - * @return javax.swing.JScrollPane + * This method initializes jCheckBoxIpf + * + * @return javax.swing.JCheckBox jCheckBoxIpf */ - private JScrollPane getJScrollPane7() { - if (jScrollPane7 == null) { - jScrollPane7 = new JScrollPane(); - jScrollPane7.setPreferredSize(new java.awt.Dimension(110,200)); - jScrollPane7.setViewportView(getJTree()); + private JCheckBox getJCheckBoxIpf() { + if (jCheckBoxIpf == null) { + jCheckBoxIpf = new JCheckBox(); + jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20)); + jCheckBoxIpf.setText("IPF"); } - return jScrollPane7; + return jCheckBoxIpf; } + /** - * This method initializes jTree - * - * @return javax.swing.JTree + * This method initializes jCheckBoxEBC + * + * @return javax.swing.JCheckBox jCheckBoxEBC */ - private JTree getJTree() { - if (jTree == null) { - jTree = new JTree(); + private JCheckBox getJCheckBoxEBC() { + if (jCheckBoxEBC == null) { + jCheckBoxEBC = new JCheckBox(); + jCheckBoxEBC.setBounds(new java.awt.Rectangle(160, 0, 53, 20)); + jCheckBoxEBC.setText("EBC"); } - return jTree; + return jCheckBoxEBC; } /** - * This method initializes jButton17 - * - * @return javax.swing.JButton + * This method initializes jCheckBoxARM + * + * @return javax.swing.JCheckBox jCheckBoxARM */ - private JButton getJButton17() { - if (jButton17 == null) { - jButton17 = new JButton(); - jButton17.setPreferredSize(new java.awt.Dimension(70,20)); - jButton17.setText("Add"); - jButton17.addActionListener(new AbstractAction() { - public void actionPerformed(ActionEvent arg0){ - Object[] o = {"", ""}; - ffsAttributesTableModel.addRow(o); + private JCheckBox getJCheckBoxARM() { + if (jCheckBoxARM == null) { + jCheckBoxARM = new JCheckBox(); + jCheckBoxARM.setBounds(new java.awt.Rectangle(213, 0, 54, 20)); + jCheckBoxARM.setText("ARM"); + } + return jCheckBoxARM; + } + + /** + * This method initializes jCheckBoxPPC + * + * @return javax.swing.JCheckBox jCheckBoxPPC + */ + private JCheckBox getJCheckBoxPPC() { + if (jCheckBoxPPC == null) { + jCheckBoxPPC = new JCheckBox(); + jCheckBoxPPC.setBounds(new java.awt.Rectangle(267, 0, 53, 20)); + jCheckBoxPPC.setText("PPC"); + } + return jCheckBoxPPC; + } + + /** + * This method initializes jTextFieldToolChainFamily Row 5 + * + * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED + * + * @return javax.swing.JTextField + */ + 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 jTextFieldToolChainFamily; + } + + /** + * 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 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 jTextFieldOptionContents; + } + + /** + * This method initializes jButtonOptionsAdd + * + * Add entry from the top screen to the table + * + * @return javax.swing.JButton jButtonOptionsAdd + */ + 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 jButton17; + return jButtonOptionsAdd; } /** - * This method initializes jButton18 - * - * @return javax.swing.JButton - */ - private JButton getJButton18() { - if (jButton18 == null) { - jButton18 = new JButton(); - jButton18.setPreferredSize(new java.awt.Dimension(70,20)); - jButton18.setText("Delete"); - jButton18.addActionListener(new AbstractAction(){ - public void actionPerformed(ActionEvent arg0){ - if (jTable4.getSelectedRow() >= 0){ - ffsAttributesTableModel.removeRow(jTable4.getSelectedRow()); + * 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 jButton18; + return jButtonOptionsDel; } /** - * This method initializes jButton19 - * - * @return javax.swing.JButton + * This method initializes jScrollPaneOptions + * Contains the Table and is located below the data entry section + * @return javax.swing.JScrollPane jScrollPaneOptoins */ - private JButton getJButton19() { - if (jButton19 == null) { - jButton19 = new JButton(); - jButton19.setPreferredSize(new java.awt.Dimension(75,20)); - jButton19.setEnabled(false); - jButton19.setText("Update"); + 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 jButton19; + return jScrollPaneOptions; } /** - * This method initializes jCheckBox9 + * This method initializes jTableOptions * - * @return javax.swing.JCheckBox + * @return javax.swing.JTable jTableOptions */ - private JCheckBox getJCheckBox9() { - if (jCheckBox9 == null) { - jCheckBox9 = new JCheckBox(); - jCheckBox9.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox9.setText("IA32"); + 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()); + + jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); + jTableOptions.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(); + } + } + }); + + 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) { + //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 = 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 jCheckBox9; + 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 jCheckBox10 - * - * @return javax.swing.JCheckBox + * Everything below should pertain to the ANT Task Tab */ - private JCheckBox getJCheckBox10() { - if (jCheckBox10 == null) { - jCheckBox10 = new JCheckBox(); - jCheckBox10.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox10.setText("IPF"); + + /** + * This method initializes jButton12 + * + * @return javax.swing.JButton + */ + 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; + } + + headerDest = theFile.getPath(); + jTextFieldAntTaskFile.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/')); + + } + + }); } - return jCheckBox10; + return jButtonAntTaskFileBrowse; } /** - * This method initializes jCheckBox11 + * This method initializes jPanelUserDefCenterN * - * @return javax.swing.JCheckBox + * @return javax.swing.JPanel */ - private JCheckBox getJCheckBox11() { - if (jCheckBox11 == null) { - jCheckBox11 = new JCheckBox(); - jCheckBox11.setText("X64"); - jCheckBox11.setPreferredSize(new java.awt.Dimension(47,20)); + 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 jCheckBox11; + return jPanelUserDefCenterN; } /** - * This method initializes jCheckBox12 - * - * @return javax.swing.JCheckBox + * This method initializes jPanel8 + * + * @return javax.swing.JPanel */ - private JCheckBox getJCheckBox12() { - if (jCheckBox12 == null) { - jCheckBox12 = new JCheckBox(); - jCheckBox12.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox12.setText("EBC"); + 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); + } - return jCheckBox12; + return jPanelUserDef; } /** - * This method initializes jCheckBox13 - * - * @return javax.swing.JCheckBox + * This method initializes jPanel9 + * + * @return javax.swing.JPanel */ - private JCheckBox getJCheckBox13() { - if (jCheckBox13 == null) { - jCheckBox13 = new JCheckBox(); - jCheckBox13.setPreferredSize(new java.awt.Dimension(55,20)); - jCheckBox13.setText("ARM"); + 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 jCheckBox13; + return jPanelUserDefNorth; } /** - * This method initializes jCheckBox14 - * - * @return javax.swing.JCheckBox + * This method initializes jPanel11 + * + * @return javax.swing.JPanel */ - private JCheckBox getJCheckBox14() { - if (jCheckBox14 == null) { - jCheckBox14 = new JCheckBox(); - jCheckBox14.setPreferredSize(new java.awt.Dimension(50,20)); - jCheckBox14.setText("PPC"); + 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 jCheckBox14; + return jPanelUserDefCenter; } /** - * This method initializes jTextField12 - * - * @return javax.swing.JTextField + * This method initializes jTextField2 + * + * @return javax.swing.JTextField */ - private JTextField getJTextField12() { - if (jTextField12 == null) { - jTextField12 = new JTextField(); - jTextField12.setPreferredSize(new java.awt.Dimension(150,20)); + private JTextField getJTextFieldAntTaskFile() { + if (jTextFieldAntTaskFile == null) { + jTextFieldAntTaskFile = new JTextField(); + jTextFieldAntTaskFile.setPreferredSize(new java.awt.Dimension(200, 20)); } - return jTextField12; + return jTextFieldAntTaskFile; } /** - * This method initializes jTextField13 - * - * @return javax.swing.JTextField + * This method initializes jTextField3 + * + * @return javax.swing.JTextField */ - private JTextField getJTextField13() { - if (jTextField13 == null) { - jTextField13 = new JTextField(); - jTextField13.setPreferredSize(new java.awt.Dimension(140,20)); + private JTextField getJTextFieldAntTaskId() { + if (jTextFieldAntTaskId == null) { + jTextFieldAntTaskId = new JTextField(); + jTextFieldAntTaskId.setPreferredSize(new java.awt.Dimension(100, 20)); } - return jTextField13; + return jTextFieldAntTaskId; } /** - * @param args + * This method initializes jButton4 + * + * @return javax.swing.JButton */ - public static void main(String[] args) { - // TODO Auto-generated method stub - new FpdBuildOptions().setVisible(true); + 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; + } + 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 jButtonAntTaskAdd; } /** - * This is the default constructor + * This method initializes jButton5 + * + * @return javax.swing.JButton */ - public FpdBuildOptions() { - super(); - initialize(); - this.setVisible(true); - } - - public FpdBuildOptions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) { - this(); - ffc = new FpdFileContents(fpd); - init(ffc); + 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); + } + } + }); + } + return jButtonAntTaskDel; } - private void init(FpdFileContents ffc) { - initOptionTable(); - initAntTaskTable(); + /** + * This method initializes jTextField4 + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldAntCmdOpts() { + if (jTextFieldAntCmdOpts == null) { + jTextFieldAntCmdOpts = new JTextField(); + jTextFieldAntCmdOpts.setPreferredSize(new java.awt.Dimension(270, 20)); + jTextFieldAntCmdOpts.setEnabled(true); + } + return jTextFieldAntCmdOpts; } - - private void initOptionTable() { - if (ffc.getBuildOptionsOptCount() == 0) { - //ToDo get default options from *.txt file - return; + + /** + * This method initializes jScrollPane2 + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPaneAntTasks() { + if (jScrollPaneAntTasks == null) { + jScrollPaneAntTasks = new JScrollPane(); + jScrollPaneAntTasks.setPreferredSize(new java.awt.Dimension(600, 400)); + jScrollPaneAntTasks.setViewportView(getJTableAntTasks()); } - String[][] saa = new String[ffc.getBuildOptionsOptCount()][6]; - ffc.getBuildOptionsOpts(saa); - for (int i = 0; i < saa.length; ++i) { - optionsTableModel.addRow(saa[i]); + return jScrollPaneAntTasks; + } + + /** + * This method initializes jTable2 + * + * @return javax.swing.JTable + */ + 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) { + selectedRow = -1; + if (e.getValueIsAdjusting()) { + return; + } + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); + if (lsm.isSelectionEmpty()) { + return; + } else { + selectedRow = lsm.getMinSelectionIndex(); + } + } + }); + + 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) { + //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) { + 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 jTableAntTasks; } - + private void initAntTaskTable() { if (ffc.getBuildOptionsUserDefAntTaskCount() == 0) { return; @@ -1477,33 +2166,5 @@ public class FpdBuildOptions extends IInternalFrame { antTaskTableModel.addRow(saa[i]); } } - /** - * This method initializes this - * - * @return void - */ - private void initialize() { - this.setSize(722, 439); - 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"