3 The file is used to create, update BuildOptions of Fpd file
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.platform
.ui
;
17 import java
.awt
.BorderLayout
;
19 import javax
.swing
.JPanel
;
20 import javax
.swing
.JTabbedPane
;
21 import javax
.swing
.JCheckBox
;
22 import javax
.swing
.JLabel
;
23 import java
.awt
.FlowLayout
;
24 import javax
.swing
.AbstractAction
;
25 import java
.awt
.event
.ActionEvent
;
26 import java
.awt
.event
.ActionListener
;
27 import java
.awt
.event
.ComponentEvent
;
29 import javax
.swing
.DefaultCellEditor
;
30 import javax
.swing
.JFileChooser
;
31 import javax
.swing
.JFrame
;
32 import javax
.swing
.JOptionPane
;
33 import javax
.swing
.JTextField
;
34 import javax
.swing
.JButton
;
35 import javax
.swing
.JScrollPane
;
36 import javax
.swing
.JTable
;
37 import javax
.swing
.JComboBox
;
38 import javax
.swing
.ListSelectionModel
;
39 import javax
.swing
.event
.DocumentEvent
;
40 import javax
.swing
.event
.DocumentListener
;
41 import javax
.swing
.event
.InternalFrameAdapter
;
42 import javax
.swing
.event
.InternalFrameEvent
;
43 import javax
.swing
.event
.ListSelectionEvent
;
44 import javax
.swing
.event
.ListSelectionListener
;
45 import javax
.swing
.event
.TableModelEvent
;
46 import javax
.swing
.event
.TableModelListener
;
47 import javax
.swing
.table
.DefaultTableModel
;
48 import javax
.swing
.table
.TableModel
;
50 import org
.tianocore
.PlatformSurfaceAreaDocument
;
51 import org
.tianocore
.frameworkwizard
.common
.DataValidation
;
52 import org
.tianocore
.frameworkwizard
.common
.Tools
;
53 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPlatformType
;
54 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
55 import org
.tianocore
.frameworkwizard
.workspace
.Workspace
;
58 import java
.util
.ArrayList
;
59 import java
.util
.Iterator
;
60 import java
.util
.LinkedHashMap
;
62 import java
.util
.Vector
;
63 import java
.awt
.Dimension
;
64 import javax
.swing
.JSplitPane
;
65 import java
.awt
.GridLayout
;
67 public class FpdBuildOptions
extends IInternalFrame
{
69 private final int oneRowHeight
= 20;
71 private final int twoRowHeight
= 40;
73 private final int sepHeight
= 6;
75 private final int sepWidth
= 10;
77 private final int buttonWidth
= 90;
79 private final int rowOne
= 12;
81 private final int dialogWidth
= 600;
83 private final int rowTwo
= rowOne
+ oneRowHeight
+ sepHeight
;
85 private final int rowThree
= rowTwo
+ oneRowHeight
+ sepHeight
;
87 private final int rowFour
= rowThree
+ oneRowHeight
+ sepHeight
;
89 private final int rowFive
= rowFour
+ oneRowHeight
+ sepHeight
;
91 private final int rowSix
= rowFive
+ oneRowHeight
+ sepHeight
;
93 private final int rowSeven
= rowSix
+ oneRowHeight
+ sepHeight
;
95 private final int buttonRow
= rowSeven
+ oneRowHeight
+ sepHeight
+ sepHeight
;
97 private final int dialogHeight
= buttonRow
+ twoRowHeight
+ twoRowHeight
;
99 private final int lastButtonXLoc
= dialogWidth
- buttonWidth
- sepWidth
;
101 private final int next2LastButtonLoc
= lastButtonXLoc
- buttonWidth
- sepWidth
;
103 private final int firstButtonLoc
= next2LastButtonLoc
- buttonWidth
- sepWidth
;
105 private final int labelColumn
= 12;
107 private final int fieldColumn
= 168;
109 private final int labelWidth
= 155;
111 private final int fieldWidth
= 320;
113 private static final long serialVersionUID
= 1L;
117 private JPanel jContentPane
= null;
119 // private JPanel jPanelContentSouth = null;
121 // private JPanel jPanelContentNorth = null;
123 // private JPanel jPanelContentWest = null;
125 // private JPanel jPanelContentEast = null;
127 private JTabbedPane jTabbedPane
= null;
129 private JPanel jPanelUserDef
= null;
131 private JPanel jPanelUserDefNorth
= null;
133 private JPanel jPanelUserDefCenter
= null;
135 private JTextField jTextFieldAntTaskFile
= null;
137 private JLabel jLabelAntTaskId
= null;
139 private JTextField jTextFieldAntTaskId
= null;
141 private JButton jButtonAntTaskAdd
= null;
143 private JButton jButtonAntTaskDel
= null;
145 private JTextField jTextFieldAntCmdOpts
= null;
147 private JScrollPane jScrollPaneAntTasks
= null;
149 private JTable jTableAntTasks
= null;
151 private DefaultTableModel ffsTableModel
= null;
153 private DefaultTableModel sectionsTableModel
= null;
155 private DefaultTableModel sectionTableModel
= null;
157 private DefaultTableModel subsectionsTableModel
= null;
159 private DefaultTableModel antTaskTableModel
= null;
161 private DefaultTableModel ffsAttributesTableModel
= null;
163 private DefaultTableModel optionsTableModel
= null;
165 private JPanel jPanelFfsTab
= null;
167 private JPanel jPanelFfsTabCenter
= null;
169 private JPanel jPanelFfsTabCenterN
= null;
171 private JPanel jPanelFfsTabCenterS
= null;
173 private JButton jButtonFfsAdd
= null;
175 private JButton jButtonFfsDel
= null;
177 private JScrollPane jScrollPaneFfsAttribs
= null;
179 private JTable jTableFfsAttribs
= null;
181 private JPanel jPanelOptionsTab
= null;
183 private JLabel jLabelOptionContents
= null;
185 private JTextField jTextFieldOptionContents
= null;
187 private JLabel jLabelToolChainFamily
= null;
189 private JLabel jLabelSupArch
= null;
191 private JLabel jLabelToolCmd
= null;
193 private JTextField jTextFieldToolCmd
= null;
195 private JScrollPane jScrollPaneOptions
= null;
197 private JTable jTableOptions
= null;
199 private JButton jButtonOptionsAdd
= null;
201 private JButton jButtonOptionsDel
= null;
203 private JButton jButtonFfsAttribNew
= null;
205 private JButton jButtonFfsAttribRemove
= null;
207 private FpdFileContents ffc
= null;
209 private OpeningPlatformType docConsole
= null;
211 private JPanel jArchitectureSelections
= null;
213 private JCheckBox jCheckBoxIA32
= null;
215 private JCheckBox jCheckBoxIpf
= null;
217 private JCheckBox jCheckBoxX64
= null;
219 private JCheckBox jCheckBoxEBC
= null;
221 private JCheckBox jCheckBoxARM
= null;
223 private JCheckBox jCheckBoxPPC
= null;
225 private JLabel jLabelBuildTargets
= null;
227 private JTextField jTextFieldBuildTargets
= null;
229 private JTextField jTextFieldTagName
= null;
231 private JLabel jLabelTagName
= null;
233 private int selectedRow
= -1;
235 private JLabel jLabelAntTaskFile
= null;
237 private JLabel jLabelAntCmdOpts
= null;
239 private JScrollPane jScrollPaneFfs
= null;
241 private JTable jTableFfs
= null;
243 private JLabel jLabelFfsSection
= null;
245 private JScrollPane jScrollPaneFfsSection
= null;
247 private JTable jTableFfsSection
= null;
249 private JLabel jLabelFfsSubSections
= null;
251 private JScrollPane jScrollPaneFfsSubSection
= null;
253 private JTable jTableFfsSubSection
= null;
255 private JLabel jLabelEncapType
= null;
257 private JTextField jTextFieldEncapType
= null;
259 private JPanel jPanelFfsAttribButtonGroup
= null;
261 private JLabel jLabelFfsAttribs
= null;
263 private JButton jButtonFfsSectionNew
= null;
265 private JButton jButtonFfsSectionRemove
= null;
267 private JButton jButtonFfsSubSectionNew
= null;
269 private JButton jButtonFfsSubSectionRemove
= null;
271 private JLabel jLabelFfsSections
= null;
273 private JButton jButtonFfsSectionsNew
= null;
275 private JButton jButtonFfsSectionsRemove
= null;
277 private JScrollPane jScrollPaneFfsSections
= null;
279 private JTable jTableFfsSections
= null;
281 private JButton jButtonAntTaskFileBrowse
= null;
283 private JTextField jTextFieldToolChainFamily
= null;
285 private JSplitPane jSplitPaneFfsC
= null;
287 private JPanel jPanelFfsCTop
= null;
289 private JSplitPane jSplitPaneFfsCBottom
= null;
291 private JPanel jPanelFfsCBottomTop
= null;
293 private JPanel jPanelFfsCBottomBottom
= null;
295 private JPanel jPanelSectionN
= null;
297 private JPanel jPanelSectionsN
= null;
299 private JPanel jPanelSubSectionN
= null;
301 private JPanel jPanelOptionsContainer
= null;
303 private JPanel jPanelUserDefCenterN
= null;
305 private JPanel jPanelTableOptionsContainer
= null;
307 private JLabel jLabelTableOptionsTitle
= null;
309 private final int buildTargetWidth
= 150;
310 private final int toolChainFamilyWidth
= 150;
311 private final int supportArchWidth
= 150;
312 private final int toolCmdCodeWidth
= 200;
313 private final int tagNameWidth
= 150;
314 private final int argWidth
= 400;
316 private boolean ffsSelection
= false;
317 private int selectedFfsTableRow
= -1;
320 * This method initializes jPanel
322 * @return javax.swing.JPanel
323 private JPanel getJPanelContentSouth() {
324 if (jPanelContentSouth == null) {
325 jPanelContentSouth = new JPanel();
327 return jPanelContentSouth;
332 * This method initializes jPanel1
334 * @return javax.swing.JPanel
335 private JPanel getJPanelContentNorth() {
336 if (jPanelContentNorth == null) {
337 jPanelContentNorth = new JPanel();
339 return jPanelContentNorth;
344 * This method initializes jPanel2
346 * @return javax.swing.JPanel
347 private JPanel getJPanelContentWest() {
348 if (jPanelContentWest == null) {
349 jPanelContentWest = new JPanel();
351 return jPanelContentWest;
356 * This method initializes jPanel3
358 * @return javax.swing.JPanel
359 private JPanel getJPanelContentEast() {
360 if (jPanelContentEast == null) {
361 jPanelContentEast = new JPanel();
363 return jPanelContentEast;
368 * This method initializes jTabbedPane
370 * @return javax.swing.JTabbedPane
372 private JTabbedPane
getJTabbedPane() {
373 if (jTabbedPane
== null) {
374 jTabbedPane
= new JTabbedPane();
375 jTabbedPane
.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null);
376 jTabbedPane
.addTab("Customize Tool Chain Configurations", null, getJPanelOptionsTab(), null);
377 jTabbedPane
.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null);
383 * This method initializes this
387 private void initialize() {
388 this.setSize(722, 577);
389 this.setTitle("Platform Build Options");
390 this.setContentPane(getJContentPane());
394 * This method initializes jContentPane
396 * @return javax.swing.JPanel
398 private JPanel
getJContentPane() {
399 if (jContentPane
== null) {
400 jContentPane
= new JPanel();
401 jContentPane
.setLayout(new BorderLayout());
402 // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
403 // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
404 // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
405 // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
406 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
412 * This method initializes jPanelTableOptionsContainer
414 * @return javax.swing.JPanel
416 private JPanel
getJPanelTableOptionsContainer() {
417 if (jPanelTableOptionsContainer
== null) {
418 jLabelTableOptionsTitle
= new JLabel();
419 jLabelTableOptionsTitle
.setText(" Current Argument Lines");
420 jPanelTableOptionsContainer
= new JPanel();
421 jPanelTableOptionsContainer
.setLayout(new BorderLayout());
422 jPanelTableOptionsContainer
.add(jLabelTableOptionsTitle
, java
.awt
.BorderLayout
.NORTH
);
423 jPanelTableOptionsContainer
.add(getJScrollPaneOptions(), java
.awt
.BorderLayout
.CENTER
);
425 return jPanelTableOptionsContainer
;
431 public static void main(String
[] args
) {
432 // TODO Auto-generated method stub
433 new FpdBuildOptions().setVisible(true);
437 * This is the default constructor
439 public FpdBuildOptions() {
442 this.setVisible(true);
445 public FpdBuildOptions(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
447 ffc
= new FpdFileContents(fpd
);
451 public FpdBuildOptions(OpeningPlatformType opt
) {
452 this(opt
.getXmlFpd());
456 private void init(FpdFileContents ffc
) {
460 this.addInternalFrameListener(new InternalFrameAdapter() {
461 public void internalFrameDeactivated(InternalFrameEvent e
) {
462 if (jTableAntTasks
.isEditing()) {
463 jTableAntTasks
.getCellEditor().stopCellEditing();
465 if (jTableOptions
.isEditing()) {
466 jTableOptions
.getCellEditor().stopCellEditing();
468 stopEditingInTables ();
473 private void stopEditingInTables () {
474 if (jTableFfs
.isEditing()) {
475 jTableFfs
.getCellEditor().stopCellEditing();
477 if (jTableFfsSection
.isEditing()) {
478 jTableFfsSection
.getCellEditor().stopCellEditing();
480 if (jTableFfsSections
.isEditing()) {
481 jTableFfsSections
.getCellEditor().stopCellEditing();
483 if (jTableFfsSubSection
.isEditing()) {
484 jTableFfsSubSection
.getCellEditor().stopCellEditing();
486 if (jTableFfsAttribs
.isEditing()) {
487 jTableFfsAttribs
.getCellEditor().stopCellEditing();
492 * This method initializes jPanel13
494 * @return javax.swing.JPanel
496 private JPanel
getJPanelFfsTab() {
497 if (jPanelFfsTab
== null) {
498 jPanelFfsTab
= new JPanel();
499 jPanelFfsTab
.setLayout(new BorderLayout());
500 jPanelFfsTab
.add(getJPanelFfsTabCenter(), java
.awt
.BorderLayout
.CENTER
);
501 jPanelFfsTab
.add(getJScrollPaneFfs(), java
.awt
.BorderLayout
.WEST
);
507 * This method initializes jPanel18
509 * @return javax.swing.JPanel
511 private JPanel
getJPanelFfsTabCenter() {
512 if (jPanelFfsTabCenter
== null) {
513 jPanelFfsTabCenter
= new JPanel();
514 jPanelFfsTabCenter
.setLayout(new BorderLayout());
515 jPanelFfsTabCenter
.add(getJPanelFfsTabCenterN(), java
.awt
.BorderLayout
.NORTH
);
516 jPanelFfsTabCenter
.add(getJPanelFfsTabCenterS(), java
.awt
.BorderLayout
.SOUTH
);
517 jPanelFfsTabCenter
.add(getJSplitPaneFfsC(), java
.awt
.BorderLayout
.CENTER
);
519 return jPanelFfsTabCenter
;
523 * This method initializes jPanel15
525 * @return javax.swing.JPanel
527 private JPanel
getJPanelFfsTabCenterN() {
528 if (jPanelFfsTabCenterN
== null) {
529 jLabelEncapType
= new JLabel();
530 jLabelEncapType
.setText("Encapsulation Type");
531 FlowLayout flowLayout5
= new FlowLayout();
532 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
534 jPanelFfsTabCenterN
= new JPanel();
535 jPanelFfsTabCenterN
.setLayout(flowLayout5
);
538 jPanelFfsTabCenterN
.add(jLabelEncapType
, null);
539 jPanelFfsTabCenterN
.add(getJTextFieldEncapType(), null);
540 jPanelFfsTabCenterN
.add(getJButtonFfsAdd(), null);
541 jPanelFfsTabCenterN
.add(getJButtonFfsDel(), null);
543 return jPanelFfsTabCenterN
;
547 * This method initializes jPanel16
549 * @return javax.swing.JPanel
551 private JPanel
getJPanelFfsTabCenterS() {
552 if (jPanelFfsTabCenterS
== null) {
553 jLabelFfsAttribs
= new JLabel();
554 jLabelFfsAttribs
.setText("Attributes");
555 jPanelFfsTabCenterS
= new JPanel();
556 jPanelFfsTabCenterS
.setPreferredSize(new java
.awt
.Dimension(491, 130));
557 jPanelFfsTabCenterS
.setLayout(new BorderLayout());
558 jPanelFfsTabCenterS
.add(jLabelFfsAttribs
, java
.awt
.BorderLayout
.WEST
);
559 jPanelFfsTabCenterS
.add(getJScrollPaneFfsAttribs(), java
.awt
.BorderLayout
.CENTER
);
560 jPanelFfsTabCenterS
.add(getJPanelFfsAttribButtonGroup(), java
.awt
.BorderLayout
.EAST
);
562 return jPanelFfsTabCenterS
;
566 * This method initializes jTextField6
568 * @return javax.swing.JTextField
573 * This method initializes jButton8
575 * @return javax.swing.JButton
577 private JButton
getJButtonFfsAdd() {
578 if (jButtonFfsAdd
== null) {
579 jButtonFfsAdd
= new JButton();
580 jButtonFfsAdd
.setPreferredSize(new java
.awt
.Dimension(70, 20));
581 jButtonFfsAdd
.setText("New");
582 jButtonFfsAdd
.addActionListener(new AbstractAction() {
586 private static final long serialVersionUID
= -2923720717273384221L;
588 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
590 String
[] row
= { "" };
591 ffsTableModel
.addRow(row
);
592 docConsole
.setSaved(false);
593 ffc
.genBuildOptionsFfs("", "");
594 jTableFfs
.changeSelection(ffsTableModel
.getRowCount()-1, 0, false, false);
599 return jButtonFfsAdd
;
603 * This method initializes jButton9
605 * @return javax.swing.JButton
607 private JButton
getJButtonFfsDel() {
608 if (jButtonFfsDel
== null) {
609 jButtonFfsDel
= new JButton();
610 jButtonFfsDel
.setPreferredSize(new java
.awt
.Dimension(70, 20));
611 jButtonFfsDel
.setText("Delete");
612 jButtonFfsDel
.addActionListener(new AbstractAction() {
616 private static final long serialVersionUID
= -4002678939178194476L;
618 public void actionPerformed(ActionEvent arg0
) {
619 if (jTableFfs
.getSelectedRow() < 0) {
622 stopEditingInTables();
623 docConsole
.setSaved(false);
624 ffc
.removeBuildOptionsFfs(jTableFfs
.getSelectedRow());
625 ffsTableModel
.removeRow(jTableFfs
.getSelectedRow());
626 sectionTableModel
.setRowCount(0);
627 sectionsTableModel
.setRowCount(0);
628 subsectionsTableModel
.setRowCount(0);
629 ffsAttributesTableModel
.setRowCount(0);
633 return jButtonFfsDel
;
637 * This method initializes jScrollPane5
639 * @return javax.swing.JScrollPane
641 private JScrollPane
getJScrollPaneFfsAttribs() {
642 if (jScrollPaneFfsAttribs
== null) {
643 jScrollPaneFfsAttribs
= new JScrollPane();
644 // jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
645 jScrollPaneFfsAttribs
.setViewportView(getJTableFfsAttribs());
648 return jScrollPaneFfsAttribs
;
652 * This method initializes jTable4
654 * @return javax.swing.JTable
656 private JTable
getJTableFfsAttribs() {
657 if (jTableFfsAttribs
== null) {
658 ffsAttributesTableModel
= new DefaultTableModel();
659 jTableFfsAttribs
= new JTable(ffsAttributesTableModel
);
660 // jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
661 jTableFfsAttribs
.setRowHeight(20);
662 ffsAttributesTableModel
.addColumn("Name");
663 ffsAttributesTableModel
.addColumn("Value");
665 jTableFfsAttribs
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
666 jTableFfsAttribs
.getModel().addTableModelListener(new TableModelListener() {
667 public void tableChanged(TableModelEvent arg0
) {
668 // TODO Auto-generated method stub
669 int row
= arg0
.getFirstRow();
670 TableModel m
= (TableModel
) arg0
.getSource();
671 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
672 //ToDo Data Validition check.
673 String name
= m
.getValueAt(row
, 0) + "";
674 String value
= m
.getValueAt(row
, 1) + "";
676 if (name
.length() == 0) {
679 if (value
.length() == 0) {
682 docConsole
.setSaved(false);
683 ffc
.updateBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(), row
, name
, value
);
688 return jTableFfsAttribs
;
691 private void initFfsTable() {
692 int ffsCount
= ffc
.getBuildOptionsFfsCount();
696 String
[][] saa
= new String
[ffsCount
][1];
697 ffc
.getBuildOptionsFfsKey(saa
);
698 for (int i
= 0; i
< saa
.length
; ++i
) {
699 ffsTableModel
.addRow(saa
[i
]);
701 jTableFfs
.changeSelection(0, 0, false, false);
705 * This method initializes jButton17
707 * @return javax.swing.JButton
709 private JButton
getJButtonFfsAttribNew() {
710 if (jButtonFfsAttribNew
== null) {
711 jButtonFfsAttribNew
= new JButton();
712 jButtonFfsAttribNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
713 jButtonFfsAttribNew
.setText("New");
714 jButtonFfsAttribNew
.addActionListener(new AbstractAction() {
718 private static final long serialVersionUID
= 1L;
720 public void actionPerformed(ActionEvent arg0
) {
721 if (jTableFfs
.getSelectedRow() < 0) {
724 Object
[] o
= { "", "" };
725 ffsAttributesTableModel
.addRow(o
);
726 docConsole
.setSaved(false);
727 ffc
.genBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(), "", "");
731 return jButtonFfsAttribNew
;
735 * This method initializes jButton18
737 * @return javax.swing.JButton
739 private JButton
getJButtonFfsAttribRemove() {
740 if (jButtonFfsAttribRemove
== null) {
741 jButtonFfsAttribRemove
= new JButton();
742 jButtonFfsAttribRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
743 jButtonFfsAttribRemove
.setText("Remove");
744 jButtonFfsAttribRemove
.addActionListener(new AbstractAction() {
748 private static final long serialVersionUID
= 1L;
750 public void actionPerformed(ActionEvent arg0
) {
751 if (jTableFfs
.getSelectedRow() < 0) {
754 stopEditingInTables();
755 if (jTableFfsAttribs
.getSelectedRow() >= 0) {
756 docConsole
.setSaved(false);
757 ffsAttributesTableModel
.removeRow(jTableFfsAttribs
.getSelectedRow());
758 ffc
.removeBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(),
759 jTableFfsAttribs
.getSelectedRow());
764 return jButtonFfsAttribRemove
;
768 * This method initializes jScrollPane
770 * @return javax.swing.JScrollPane
772 private JScrollPane
getJScrollPaneFfs() {
773 if (jScrollPaneFfs
== null) {
774 jScrollPaneFfs
= new JScrollPane();
775 jScrollPaneFfs
.setPreferredSize(new java
.awt
.Dimension(200,419));
776 jScrollPaneFfs
.setViewportView(getJTableFfs());
778 return jScrollPaneFfs
;
782 * This method initializes jTable
784 * @return javax.swing.JTable
786 private JTable
getJTableFfs() {
787 if (jTableFfs
== null) {
788 ffsTableModel
= new DefaultTableModel();
789 ffsTableModel
.addColumn("FFS Type");
790 jTableFfs
= new JTable(ffsTableModel
);
791 jTableFfs
.setShowGrid(false);
792 jTableFfs
.setRowHeight(20);
794 jTableFfs
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
795 jTableFfs
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
796 public void valueChanged(ListSelectionEvent e
) {
798 if (e
.getValueIsAdjusting()) {
801 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
802 if (lsm
.isSelectionEmpty()) {
805 int row
= lsm
.getMinSelectionIndex();
806 sectionTableModel
.setRowCount(0);
807 sectionsTableModel
.setRowCount(0);
808 subsectionsTableModel
.setRowCount(0);
809 ffsAttributesTableModel
.setRowCount(0);
810 String
[] sArray
= { "", "" };
811 LinkedHashMap
<String
, String
> lhm
= new LinkedHashMap
<String
, String
>();
812 ArrayList
<String
> alSections
= new ArrayList
<String
>();
813 ArrayList
<String
> alSection
= new ArrayList
<String
>();
814 ffc
.getBuildOptionsFfs(row
, sArray
, lhm
, alSections
, alSection
);
816 jTextFieldEncapType
.setText(sArray
[1]);
817 ffsSelection
= false;
818 for (int i
= 0; i
< alSection
.size(); ++i
) {
819 String
[] sectionRow
= { alSection
.get(i
) };
820 sectionTableModel
.addRow(sectionRow
);
822 for (int j
= 0; j
< alSections
.size(); ++j
) {
823 String
[] sectionsRow
= { alSections
.get(j
) };
824 sectionsTableModel
.addRow(sectionsRow
);
826 if (lhm
.size() <= 0) {
829 Set
<String
> keySet
= lhm
.keySet();
830 Iterator
<String
> is
= keySet
.iterator();
831 while (is
.hasNext()) {
832 String key
= is
.next();
833 String
[] attribRow
= { key
, lhm
.get(key
) };
834 ffsAttributesTableModel
.addRow(attribRow
);
836 selectedFfsTableRow
= row
;
841 jTableFfs
.getModel().addTableModelListener(new TableModelListener() {
842 public void tableChanged(TableModelEvent arg0
) {
843 // TODO Auto-generated method stub
844 int row
= arg0
.getFirstRow();
845 TableModel m
= (TableModel
) arg0
.getSource();
846 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
847 //ToDo Data Validition check.
848 String id
= m
.getValueAt(row
, 0) + "";
850 if (id
.length() == 0) {
853 docConsole
.setSaved(false);
854 ffc
.updateBuildOptionsFfsKey(row
, id
);
863 * This method initializes jScrollPane1
865 * @return javax.swing.JScrollPane
867 private JScrollPane
getJScrollPaneFfsSection() {
868 if (jScrollPaneFfsSection
== null) {
869 jScrollPaneFfsSection
= new JScrollPane();
870 // jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
871 jScrollPaneFfsSection
.setViewportView(getJTableFfsSection());
873 return jScrollPaneFfsSection
;
877 * This method initializes jTable1
879 * @return javax.swing.JTable
881 private JTable
getJTableFfsSection() {
882 if (jTableFfsSection
== null) {
883 sectionTableModel
= new DefaultTableModel();
884 sectionTableModel
.addColumn("SectionType");
886 jTableFfsSection
= new JTable(sectionTableModel
);
887 jTableFfsSection
.setRowHeight(20);
888 JComboBox cb
= new JComboBox();
889 cb
.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
890 cb
.addItem("EFI_SECTION_VERSION");
891 cb
.addItem("EFI_SECTION_USER_INTERFACE");
892 cb
.addItem("EFI_SECTION_DXE_DEPEX");
893 cb
.addItem("EFI_SECTION_PEI_DEPEX");
894 cb
.addItem("EFI_SECTION_PE32");
895 cb
.addItem("EFI_SECTION_PIC");
896 cb
.addItem("EFI_SECTION_TE");
897 cb
.addItem("EFI_SECTION_RAW");
898 cb
.addItem("EFI_SECTION_COMPRESSION");
899 cb
.addItem("EFI_SECTION_GUID_DEFINED");
900 cb
.addItem("EFI_SECTION_COMPATIBILITY16");
901 cb
.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
902 jTableFfsSection
.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb
));
904 jTableFfsSection
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
906 jTableFfsSection
.getModel().addTableModelListener(new TableModelListener() {
907 public void tableChanged(TableModelEvent arg0
) {
908 // TODO Auto-generated method stub
909 if (jTableFfs
.getSelectedRow() < 0) {
912 int row
= arg0
.getFirstRow();
913 TableModel m
= (TableModel
) arg0
.getSource();
914 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
915 //ToDo Data Validition check.
916 String type
= m
.getValueAt(row
, 0) + "";
917 docConsole
.setSaved(false);
918 ffc
.updateBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(), row
, type
);
923 return jTableFfsSection
;
927 * This method initializes jScrollPane3
929 * @return javax.swing.JScrollPane
931 private JScrollPane
getJScrollPaneFfsSubSection() {
932 if (jScrollPaneFfsSubSection
== null) {
933 jScrollPaneFfsSubSection
= new JScrollPane();
934 // jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
935 jScrollPaneFfsSubSection
.setViewportView(getJTableFfsSubSection());
937 return jScrollPaneFfsSubSection
;
941 * This method initializes jTable3
943 * @return javax.swing.JTable
945 private JTable
getJTableFfsSubSection() {
946 if (jTableFfsSubSection
== null) {
947 subsectionsTableModel
= new DefaultTableModel();
948 subsectionsTableModel
.addColumn("SectionType");
949 jTableFfsSubSection
= new JTable(subsectionsTableModel
);
950 jTableFfsSubSection
.setRowHeight(20);
951 JComboBox cb
= new JComboBox();
952 cb
.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
953 cb
.addItem("EFI_SECTION_VERSION");
954 cb
.addItem("EFI_SECTION_USER_INTERFACE");
955 cb
.addItem("EFI_SECTION_DXE_DEPEX");
956 cb
.addItem("EFI_SECTION_PEI_DEPEX");
957 cb
.addItem("EFI_SECTION_PE32");
958 cb
.addItem("EFI_SECTION_PIC");
959 cb
.addItem("EFI_SECTION_TE");
960 cb
.addItem("EFI_SECTION_RAW");
961 cb
.addItem("EFI_SECTION_COMPRESSION");
962 cb
.addItem("EFI_SECTION_GUID_DEFINED");
963 cb
.addItem("EFI_SECTION_COMPATIBILITY16");
964 cb
.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
965 jTableFfsSubSection
.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb
));
966 jTableFfsSubSection
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
968 jTableFfsSubSection
.getModel().addTableModelListener(new TableModelListener() {
969 public void tableChanged(TableModelEvent arg0
) {
970 // TODO Auto-generated method stub
971 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
974 int row
= arg0
.getFirstRow();
975 TableModel m
= (TableModel
) arg0
.getSource();
976 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
977 //ToDo Data Validition check.
978 String type
= m
.getValueAt(row
, 0) + "";
979 docConsole
.setSaved(false);
980 ffc
.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(),
981 jTableFfsSections
.getSelectedRow(), row
, type
);
986 return jTableFfsSubSection
;
990 * This method initializes jTextField
992 * @return javax.swing.JTextField
994 private JTextField
getJTextFieldEncapType() {
995 if (jTextFieldEncapType
== null) {
996 jTextFieldEncapType
= new JTextField();
997 jTextFieldEncapType
.setPreferredSize(new java
.awt
.Dimension(200,20));
998 jTextFieldEncapType
.getDocument().addDocumentListener(new DocumentListener() {
1000 public void insertUpdate(DocumentEvent arg0
) {
1002 // ffsSelection = false;
1005 if (docConsole
!= null) {
1006 docConsole
.setSaved(false);
1010 public void removeUpdate(DocumentEvent arg0
) {
1012 // ffsSelection = false;
1015 if (docConsole
!= null) {
1016 docConsole
.setSaved(false);
1020 public void changedUpdate(DocumentEvent arg0
) {
1021 // TODO Auto-generated method stub
1026 jTextFieldEncapType
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1027 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1028 if (selectedFfsTableRow
< 0) {
1031 ffc
.updateBuildOptionsFfsSectionsType(selectedFfsTableRow
, jTextFieldEncapType
.getText());
1036 return jTextFieldEncapType
;
1040 * This method initializes jPanel4
1042 * @return javax.swing.JPanel
1044 private JPanel
getJPanelFfsAttribButtonGroup() {
1045 if (jPanelFfsAttribButtonGroup
== null) {
1046 jPanelFfsAttribButtonGroup
= new JPanel();
1047 jPanelFfsAttribButtonGroup
.setPreferredSize(new java
.awt
.Dimension(100, 100));
1048 jPanelFfsAttribButtonGroup
.add(getJButtonFfsAttribNew(), null);
1049 jPanelFfsAttribButtonGroup
.add(getJButtonFfsAttribRemove(), null);
1051 return jPanelFfsAttribButtonGroup
;
1055 * This method initializes jButton
1057 * @return javax.swing.JButton
1059 private JButton
getJButtonFfsSectionNew() {
1060 if (jButtonFfsSectionNew
== null) {
1061 jButtonFfsSectionNew
= new JButton();
1062 jButtonFfsSectionNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1063 jButtonFfsSectionNew
.setText("New");
1064 jButtonFfsSectionNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1065 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1066 if (jTableFfs
.getSelectedRow() < 0) {
1069 docConsole
.setSaved(false);
1070 String
[] row
= { "EFI_SECTION_RAW" };
1071 sectionTableModel
.addRow(row
);
1072 ffc
.genBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(), row
[0]);
1076 return jButtonFfsSectionNew
;
1080 * This method initializes jButton1
1082 * @return javax.swing.JButton
1084 private JButton
getJButtonFfsSectionRemove() {
1085 if (jButtonFfsSectionRemove
== null) {
1086 jButtonFfsSectionRemove
= new JButton();
1087 jButtonFfsSectionRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1088 jButtonFfsSectionRemove
.setText("Remove");
1090 jButtonFfsSectionRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1091 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1092 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSection
.getSelectedRow() < 0) {
1095 stopEditingInTables();
1096 docConsole
.setSaved(false);
1097 sectionTableModel
.removeRow(jTableFfsSection
.getSelectedRow());
1098 ffc
.removeBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(),
1099 jTableFfsSection
.getSelectedRow());
1103 return jButtonFfsSectionRemove
;
1107 * This method initializes jButton2
1109 * @return javax.swing.JButton
1111 private JButton
getJButtonFfsSubSectionNew() {
1112 if (jButtonFfsSubSectionNew
== null) {
1113 jButtonFfsSubSectionNew
= new JButton();
1114 jButtonFfsSubSectionNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1115 jButtonFfsSubSectionNew
.setText("New");
1116 jButtonFfsSubSectionNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1117 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1118 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
1121 docConsole
.setSaved(false);
1122 String
[] row
= { "EFI_SECTION_RAW" };
1123 subsectionsTableModel
.addRow(row
);
1124 ffc
.genBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(),
1125 jTableFfsSections
.getSelectedRow(), row
[0]);
1130 return jButtonFfsSubSectionNew
;
1134 * This method initializes jButton3
1136 * @return javax.swing.JButton
1138 private JButton
getJButtonFfsSubSectionRemove() {
1139 if (jButtonFfsSubSectionRemove
== null) {
1140 jButtonFfsSubSectionRemove
= new JButton();
1141 jButtonFfsSubSectionRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1142 jButtonFfsSubSectionRemove
.setText("Remove");
1143 jButtonFfsSubSectionRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1144 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1145 int selectedFfsRow
= jTableFfs
.getSelectedRow();
1146 int selectedSectionsRow
= jTableFfsSections
.getSelectedRow();
1147 int selectedSubSectionRow
= jTableFfsSubSection
.getSelectedRow();
1148 if (selectedFfsRow
< 0 || selectedSectionsRow
< 0
1149 || selectedSubSectionRow
< 0) {
1152 stopEditingInTables();
1153 docConsole
.setSaved(false);
1154 subsectionsTableModel
.removeRow(selectedSubSectionRow
);
1155 ffc
.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow
,
1156 selectedSectionsRow
,
1157 selectedSubSectionRow
);
1158 if (subsectionsTableModel
.getRowCount() == 0) {
1159 sectionsTableModel
.removeRow(selectedSectionsRow
);
1164 return jButtonFfsSubSectionRemove
;
1168 * This method initializes jButton6
1170 * @return javax.swing.JButton
1172 private JButton
getJButtonFfsSectionsNew() {
1173 if (jButtonFfsSectionsNew
== null) {
1174 jButtonFfsSectionsNew
= new JButton();
1175 jButtonFfsSectionsNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1176 jButtonFfsSectionsNew
.setText("New");
1177 jButtonFfsSectionsNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1178 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1179 if (jTableFfs
.getSelectedRow() < 0) {
1182 docConsole
.setSaved(false);
1183 String
[] row
= { "Compress" };
1184 sectionsTableModel
.addRow(row
);
1185 ffc
.genBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(), "");
1186 JOptionPane
.showMessageDialog(frame
, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry.");
1187 jTableFfsSections
.changeSelection(sectionsTableModel
.getRowCount()-1, 0, false, false);
1191 return jButtonFfsSectionsNew
;
1195 * This method initializes jButton7
1197 * @return javax.swing.JButton
1199 private JButton
getJButtonFfsSectionsRemove() {
1200 if (jButtonFfsSectionsRemove
== null) {
1201 jButtonFfsSectionsRemove
= new JButton();
1202 jButtonFfsSectionsRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1203 jButtonFfsSectionsRemove
.setText("Remove");
1204 jButtonFfsSectionsRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1205 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1206 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
1209 stopEditingInTables();
1210 docConsole
.setSaved(false);
1211 sectionsTableModel
.removeRow(jTableFfsSections
.getSelectedRow());
1212 ffc
.removeBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(),
1213 jTableFfsSections
.getSelectedRow());
1214 subsectionsTableModel
.setRowCount(0);
1218 return jButtonFfsSectionsRemove
;
1221 private JScrollPane
getJScrollPaneFfsSections() {
1222 if (jScrollPaneFfsSections
== null) {
1223 jScrollPaneFfsSections
= new JScrollPane();
1224 // jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
1225 jScrollPaneFfsSections
.setViewportView(getJTableFfsSections());
1227 return jScrollPaneFfsSections
;
1231 * This method initializes jTable6
1233 * @return javax.swing.JTable
1235 private JTable
getJTableFfsSections() {
1236 if (jTableFfsSections
== null) {
1237 sectionsTableModel
= new DefaultTableModel();
1238 sectionsTableModel
.addColumn("EncapsulationType");
1239 jTableFfsSections
= new JTable(sectionsTableModel
);
1240 jTableFfsSections
.setRowHeight(20);
1241 jTableFfsSections
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1242 jTableFfsSections
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1243 public void valueChanged(ListSelectionEvent e
) {
1244 if (e
.getValueIsAdjusting()) {
1247 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
1248 if (lsm
.isSelectionEmpty()) {
1251 int sectionsRow
= lsm
.getMinSelectionIndex();
1252 if (jTableFfs
.getSelectedRow() < 0) {
1255 subsectionsTableModel
.setRowCount(0);
1256 ArrayList
<String
> al
= new ArrayList
<String
>();
1257 ffc
.getBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(), sectionsRow
, al
);
1258 for (int i
= 0; i
< al
.size(); ++i
) {
1259 String
[] subsectionRow
= { al
.get(i
) };
1260 subsectionsTableModel
.addRow(subsectionRow
);
1266 jTableFfsSections
.getModel().addTableModelListener(new TableModelListener() {
1267 public void tableChanged(TableModelEvent arg0
) {
1268 // TODO Auto-generated method stub
1269 int row
= arg0
.getFirstRow();
1270 TableModel m
= (TableModel
) arg0
.getSource();
1271 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
1272 //ToDo Data Validition check.
1273 String encapType
= m
.getValueAt(row
, 0) + "";
1274 docConsole
.setSaved(false);
1275 ffc
.updateBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(), row
, encapType
);
1280 return jTableFfsSections
;
1284 * This method initializes jSplitPaneFfsC
1286 * @return javax.swing.JSplitPane
1288 private JSplitPane
getJSplitPaneFfsC() {
1289 if (jSplitPaneFfsC
== null) {
1290 jSplitPaneFfsC
= new JSplitPane();
1291 jSplitPaneFfsC
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
1292 jSplitPaneFfsC
.setDividerLocation(130);
1293 jSplitPaneFfsC
.setTopComponent(getJPanelFfsCTop());
1294 jSplitPaneFfsC
.setBottomComponent(getJSplitPaneFfsCBottom());
1295 jSplitPaneFfsC
.setDividerSize(5);
1297 return jSplitPaneFfsC
;
1301 * This method initializes jPanelFfsCTop
1303 * @return javax.swing.JPanel
1305 private JPanel
getJPanelFfsCTop() {
1306 if (jPanelFfsCTop
== null) {
1307 jPanelFfsCTop
= new JPanel();
1308 jPanelFfsCTop
.setLayout(new BorderLayout());
1309 jPanelFfsCTop
.add(getJPanelSectionN(), java
.awt
.BorderLayout
.NORTH
);
1310 jPanelFfsCTop
.add(getJScrollPaneFfsSection(), java
.awt
.BorderLayout
.CENTER
);
1312 return jPanelFfsCTop
;
1316 * This method initializes jSplitPaneFfsCBottom
1318 * @return javax.swing.JSplitPane
1320 private JSplitPane
getJSplitPaneFfsCBottom() {
1321 if (jSplitPaneFfsCBottom
== null) {
1322 jSplitPaneFfsCBottom
= new JSplitPane();
1323 jSplitPaneFfsCBottom
.setDividerSize(5);
1324 jSplitPaneFfsCBottom
.setDividerLocation(130);
1325 jSplitPaneFfsCBottom
.setTopComponent(getJPanelFfsCBottomTop());
1326 jSplitPaneFfsCBottom
.setBottomComponent(getJPanelFfsCBottomBottom());
1327 jSplitPaneFfsCBottom
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
1329 return jSplitPaneFfsCBottom
;
1333 * This method initializes jPanelFfsCBottomTop
1335 * @return javax.swing.JPanel
1337 private JPanel
getJPanelFfsCBottomTop() {
1338 if (jPanelFfsCBottomTop
== null) {
1339 jPanelFfsCBottomTop
= new JPanel();
1340 jPanelFfsCBottomTop
.setLayout(new BorderLayout());
1341 jPanelFfsCBottomTop
.add(getJPanelSectionsN(), java
.awt
.BorderLayout
.NORTH
);
1342 jPanelFfsCBottomTop
.add(getJScrollPaneFfsSections(), java
.awt
.BorderLayout
.CENTER
);
1344 return jPanelFfsCBottomTop
;
1348 * This method initializes jPanelFfsCBottomBottom
1350 * @return javax.swing.JPanel
1352 private JPanel
getJPanelFfsCBottomBottom() {
1353 if (jPanelFfsCBottomBottom
== null) {
1354 jPanelFfsCBottomBottom
= new JPanel();
1355 jPanelFfsCBottomBottom
.setLayout(new BorderLayout());
1356 jPanelFfsCBottomBottom
.add(getJPanelSubSectionN(), java
.awt
.BorderLayout
.NORTH
);
1357 jPanelFfsCBottomBottom
.add(getJScrollPaneFfsSubSection(), java
.awt
.BorderLayout
.CENTER
);
1359 return jPanelFfsCBottomBottom
;
1363 * This method initializes jPanelSectionN
1365 * @return javax.swing.JPanel
1367 private JPanel
getJPanelSectionN() {
1368 if (jPanelSectionN
== null) {
1369 jPanelSectionN
= new JPanel();
1370 jLabelFfsSection
= new JLabel();
1371 jLabelFfsSection
.setText("Section");
1372 jPanelSectionN
.add(jLabelFfsSection
, null);
1373 jPanelSectionN
.add(getJButtonFfsSectionNew(), null);
1374 jPanelSectionN
.add(getJButtonFfsSectionRemove(), null);
1376 return jPanelSectionN
;
1380 * This method initializes jPanelSectionsN
1382 * @return javax.swing.JPanel
1384 private JPanel
getJPanelSectionsN() {
1385 if (jPanelSectionsN
== null) {
1386 jPanelSectionsN
= new JPanel();
1387 jLabelFfsSections
= new JLabel();
1388 jLabelFfsSections
.setText("Sections");
1389 jPanelSectionsN
.add(jLabelFfsSections
, null);
1390 jPanelSectionsN
.add(getJButtonFfsSectionsNew(), null);
1391 jPanelSectionsN
.add(getJButtonFfsSectionsRemove(), null);
1393 return jPanelSectionsN
;
1397 * This method initializes jPanelSubSectionN
1399 * @return javax.swing.JPanel
1401 private JPanel
getJPanelSubSectionN() {
1402 if (jPanelSubSectionN
== null) {
1403 jPanelSubSectionN
= new JPanel();
1404 jLabelFfsSubSections
= new JLabel();
1405 jLabelFfsSubSections
.setText("Sub-Sections");
1406 jPanelSubSectionN
.add(jLabelFfsSubSections
, null);
1407 jPanelSubSectionN
.add(getJButtonFfsSubSectionNew(), null);
1408 jPanelSubSectionN
.add(getJButtonFfsSubSectionRemove(), null);
1410 return jPanelSubSectionN
;
1414 * The following section contains all Build Options content
1418 * This method initializes jPanelOptionsTab
1420 * This is the main Options screen
1422 * @return javax.swing.JPanel jPanelOptionsTab
1424 private JPanel
getJPanelOptionsTab() {
1425 if (jPanelOptionsTab
== null) {
1426 // This container holds the Options Tab content
1428 // FlowLayout flowLayout9 = new FlowLayout();
1429 // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
1431 GridLayout gridLayout
= new GridLayout();
1432 gridLayout
.setRows(2);
1433 jPanelOptionsTab
= new JPanel();
1434 jPanelOptionsTab
.setLayout(gridLayout
);
1435 jPanelOptionsTab
.setBounds(new java
.awt
.Rectangle(0, 0, dialogWidth
* 2, dialogHeight
* 3));
1436 jPanelOptionsTab
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
+ 10, (dialogHeight
* 3) + 10));
1437 jPanelOptionsTab
.setAutoscrolls(true);
1438 jPanelOptionsTab
.setLocation(0, 0);
1439 jPanelOptionsTab
.add(getJPanelOptionsContainer(), null);
1440 // jPanelOptionsTab.add(getJScrollPaneOptions(), null);
1441 jPanelOptionsTab
.add(getJPanelTableOptionsContainer(), null);
1443 return jPanelOptionsTab
;
1447 * This method initializes jPanelOptionsContainer
1449 * @return javax.swing.JPanel
1451 private JPanel
getJPanelOptionsContainer() {
1452 if (jPanelOptionsContainer
== null) {
1453 jLabelTagName
= new JLabel();
1454 jLabelTagName
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowOne
, labelWidth
, oneRowHeight
));
1455 jLabelTagName
.setLocation(new java
.awt
.Point(labelColumn
, rowOne
));
1456 jLabelTagName
.setText("Tag Name");
1457 jLabelBuildTargets
= new JLabel();
1458 jLabelBuildTargets
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowTwo
, labelWidth
, oneRowHeight
));
1459 jLabelBuildTargets
.setLocation(new java
.awt
.Point(labelColumn
, rowTwo
));
1460 jLabelBuildTargets
.setText("Build Targets");
1461 jLabelToolCmd
= new JLabel();
1462 jLabelToolCmd
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowThree
, labelWidth
, oneRowHeight
));
1463 jLabelToolCmd
.setLocation(new java
.awt
.Point(labelColumn
, rowThree
));
1464 jLabelToolCmd
.setText("Tool Command");
1465 jLabelSupArch
= new JLabel();
1466 jLabelSupArch
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFour
, labelWidth
, oneRowHeight
));
1467 jLabelSupArch
.setLocation(new java
.awt
.Point(labelColumn
, rowFour
));
1468 jLabelSupArch
.setText("Supported Architectures");
1469 jLabelToolChainFamily
= new JLabel();
1470 jLabelToolChainFamily
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFive
, labelWidth
, oneRowHeight
));
1471 jLabelToolChainFamily
.setLocation(new java
.awt
.Point(labelColumn
, rowFive
));
1472 jLabelToolChainFamily
.setText("Tool Chain Family");
1474 jLabelOptionContents
= new JLabel();
1475 jLabelOptionContents
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowSix
, labelWidth
, oneRowHeight
));
1476 jLabelOptionContents
.setLocation(new java
.awt
.Point(labelColumn
, rowSix
));
1477 jLabelOptionContents
.setText("Argument Strings");
1479 jPanelOptionsContainer
= new JPanel();
1481 jPanelOptionsContainer
.setLayout(null);
1483 jPanelOptionsContainer
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
, dialogHeight
));
1485 jPanelOptionsContainer
1486 .setBorder(javax.swing.BorderFactory
1487 .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
1489 jPanelOptionsContainer
.add(jLabelTagName
, null);
1490 jPanelOptionsContainer
.add(getJTextFieldTagName(), null);
1492 jPanelOptionsContainer
.add(jLabelBuildTargets
, null);
1493 jPanelOptionsContainer
.add(getJTextFieldBuildTargets(), null);
1495 jPanelOptionsContainer
.add(jLabelToolChainFamily
, null);
1496 jPanelOptionsContainer
.add(getJTextFieldToolChainFamily(), null);
1498 jPanelOptionsContainer
.add(jLabelToolCmd
, null);
1499 jPanelOptionsContainer
.add(getJTextFieldToolCmd(), null);
1501 jPanelOptionsContainer
.add(jLabelSupArch
, null);
1502 jPanelOptionsContainer
.add(getArchitectureSelections(), null);
1504 jPanelOptionsContainer
.add(jLabelOptionContents
, null);
1505 jPanelOptionsContainer
.add(getJTextFieldOptionContents(), null);
1507 jPanelOptionsContainer
.add(getJButtonOptionsAdd(), null);
1508 jPanelOptionsContainer
.add(getJButtonOptionsDel(), null);
1510 return jPanelOptionsContainer
;
1514 * This method initializes jTextFieldOptionTagName Row 1
1516 * @return javax.swing.JTextField
1518 private JTextField
getJTextFieldTagName() {
1519 if (jTextFieldTagName
== null) {
1520 jTextFieldTagName
= new JTextField();
1521 jTextFieldTagName
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowOne
, fieldWidth
, oneRowHeight
));
1522 jTextFieldTagName
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1523 jTextFieldTagName
.setLocation(new java
.awt
.Point(fieldColumn
, rowOne
));
1525 return jTextFieldTagName
;
1529 * This method initializes jTextFieldBuildTargets Row 2
1531 * @return javax.swing.JTextField jTextFieldBuildTargets
1533 private JTextField
getJTextFieldBuildTargets() {
1534 if (jTextFieldBuildTargets
== null) {
1535 jTextFieldBuildTargets
= new JTextField();
1536 jTextFieldBuildTargets
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowTwo
, fieldWidth
, oneRowHeight
));
1537 jTextFieldBuildTargets
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1538 jTextFieldBuildTargets
.setLocation(new java
.awt
.Point(fieldColumn
, rowTwo
));
1540 return jTextFieldBuildTargets
;
1544 * This method initializes jTextFieldToolCmd Row 3
1546 * This should be a dropdown box of command codes from tools_def.txt
1548 * @return javax.swing.JTextField jTextFieldToolCmd
1550 private JTextField
getJTextFieldToolCmd() {
1551 if (jTextFieldToolCmd
== null) {
1552 jTextFieldToolCmd
= new JTextField();
1553 jTextFieldToolCmd
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowThree
, fieldWidth
, oneRowHeight
));
1554 jTextFieldToolCmd
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1555 jTextFieldToolCmd
.setLocation(new java
.awt
.Point(fieldColumn
, rowThree
));
1557 return jTextFieldToolCmd
;
1561 * This method initializes jArchitectureSelections Row 4
1563 * @return jArchitectureSelections
1565 private JPanel
getArchitectureSelections() {
1566 if (jArchitectureSelections
== null) {
1567 jArchitectureSelections
= new JPanel();
1568 jArchitectureSelections
.setLayout(null);
1569 jArchitectureSelections
.add(getJCheckBoxIA32(), null);
1570 jArchitectureSelections
.add(getJCheckBoxX64(), null);
1571 jArchitectureSelections
.add(getJCheckBoxIpf(), null);
1572 jArchitectureSelections
.add(getJCheckBoxEBC(), null);
1573 jArchitectureSelections
.add(getJCheckBoxARM(), null);
1574 jArchitectureSelections
.add(getJCheckBoxPPC(), null);
1575 jArchitectureSelections
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowFour
, fieldWidth
, oneRowHeight
));
1576 jArchitectureSelections
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1577 jArchitectureSelections
.setLocation(new java
.awt
.Point(fieldColumn
, rowFour
));
1579 return jArchitectureSelections
;
1583 * This method initializes jCheckBoxIA32
1585 * @return javax.swing.JCheckBox jCheckBoxIA32
1587 private JCheckBox
getJCheckBoxIA32() {
1588 if (jCheckBoxIA32
== null) {
1589 jCheckBoxIA32
= new JCheckBox();
1590 jCheckBoxIA32
.setBounds(new java
.awt
.Rectangle(0, 0, 55, 20));
1591 jCheckBoxIA32
.setText("IA32");
1593 return jCheckBoxIA32
;
1597 * This method initializes jCheckBoxX64
1599 * @return javax.swing.JCheckBox jCheckBoxX64
1601 private JCheckBox
getJCheckBoxX64() {
1602 if (jCheckBoxX64
== null) {
1603 jCheckBoxX64
= new JCheckBox();
1604 jCheckBoxX64
.setText("X64");
1605 jCheckBoxX64
.setBounds(new java
.awt
.Rectangle(55, 0, 53, 20));
1607 return jCheckBoxX64
;
1611 * This method initializes jCheckBoxIpf
1613 * @return javax.swing.JCheckBox jCheckBoxIpf
1615 private JCheckBox
getJCheckBoxIpf() {
1616 if (jCheckBoxIpf
== null) {
1617 jCheckBoxIpf
= new JCheckBox();
1618 jCheckBoxIpf
.setBounds(new java
.awt
.Rectangle(108, 0, 52, 20));
1619 jCheckBoxIpf
.setText("IPF");
1621 return jCheckBoxIpf
;
1626 * This method initializes jCheckBoxEBC
1628 * @return javax.swing.JCheckBox jCheckBoxEBC
1630 private JCheckBox
getJCheckBoxEBC() {
1631 if (jCheckBoxEBC
== null) {
1632 jCheckBoxEBC
= new JCheckBox();
1633 jCheckBoxEBC
.setBounds(new java
.awt
.Rectangle(160, 0, 53, 20));
1634 jCheckBoxEBC
.setText("EBC");
1636 return jCheckBoxEBC
;
1640 * This method initializes jCheckBoxARM
1642 * @return javax.swing.JCheckBox jCheckBoxARM
1644 private JCheckBox
getJCheckBoxARM() {
1645 if (jCheckBoxARM
== null) {
1646 jCheckBoxARM
= new JCheckBox();
1647 jCheckBoxARM
.setBounds(new java
.awt
.Rectangle(213, 0, 54, 20));
1648 jCheckBoxARM
.setText("ARM");
1650 return jCheckBoxARM
;
1654 * This method initializes jCheckBoxPPC
1656 * @return javax.swing.JCheckBox jCheckBoxPPC
1658 private JCheckBox
getJCheckBoxPPC() {
1659 if (jCheckBoxPPC
== null) {
1660 jCheckBoxPPC
= new JCheckBox();
1661 jCheckBoxPPC
.setBounds(new java
.awt
.Rectangle(267, 0, 53, 20));
1662 jCheckBoxPPC
.setText("PPC");
1664 return jCheckBoxPPC
;
1668 * This method initializes jTextFieldToolChainFamily Row 5
1670 * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
1672 * @return javax.swing.JTextField
1674 private JTextField
getJTextFieldToolChainFamily() {
1675 if (jTextFieldToolChainFamily
== null) {
1676 jTextFieldToolChainFamily
= new JTextField();
1677 jTextFieldToolChainFamily
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowFive
, fieldWidth
, oneRowHeight
));
1678 jTextFieldToolChainFamily
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1679 jTextFieldToolChainFamily
.setLocation(new java
.awt
.Point(fieldColumn
, rowFive
));
1681 return jTextFieldToolChainFamily
;
1685 * This method initializes jTextFieldOptionContents Row 6
1687 * This is where we should put the checkbox & entry data for the command arguments
1689 * @return javax.swing.JTextField
1691 private JTextField
getJTextFieldOptionContents() {
1692 if (jTextFieldOptionContents
== null) {
1693 jTextFieldOptionContents
= new JTextField();
1694 jTextFieldOptionContents
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1695 jTextFieldOptionContents
.setBounds(fieldColumn
, rowSix
, fieldWidth
, oneRowHeight
);
1696 jTextFieldOptionContents
.setLocation(new java
.awt
.Point(fieldColumn
, rowSix
));
1698 return jTextFieldOptionContents
;
1702 * This method initializes jButtonOptionsAdd
1704 * Add entry from the top screen to the table
1706 * @return javax.swing.JButton jButtonOptionsAdd
1708 private JButton
getJButtonOptionsAdd() {
1709 if (jButtonOptionsAdd
== null) {
1710 jButtonOptionsAdd
= new JButton();
1711 jButtonOptionsAdd
.setText("Add");
1713 jButtonOptionsAdd
.setPreferredSize(new java
.awt
.Dimension(buttonWidth
, oneRowHeight
));
1714 jButtonOptionsAdd
.setBounds(new java
.awt
.Rectangle(firstButtonLoc
, buttonRow
, buttonWidth
, oneRowHeight
));
1715 jButtonOptionsAdd
.setLocation(new java
.awt
.Point(firstButtonLoc
, buttonRow
));
1716 jButtonOptionsAdd
.addActionListener(new AbstractAction() {
1720 private static final long serialVersionUID
= 1L;
1722 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1723 boolean[] boolArray
= { jCheckBoxIA32
.isSelected(), jCheckBoxIpf
.isSelected(),
1724 jCheckBoxX64
.isSelected(), jCheckBoxEBC
.isSelected(),
1725 jCheckBoxARM
.isSelected(), jCheckBoxPPC
.isSelected() };
1726 String s
= boolToList(boolArray
);
1727 Object
[] o
= { jTextFieldBuildTargets
.getText(), jTextFieldToolChainFamily
.getText(), s
,
1728 jTextFieldToolCmd
.getText(), jTextFieldTagName
.getText(),
1729 jTextFieldOptionContents
.getText() };
1730 optionsTableModel
.addRow(o
);
1731 docConsole
.setSaved(false);
1732 ffc
.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets
.getText().trim()),
1733 jTextFieldToolChainFamily
.getText(), jTextFieldTagName
.getText(),
1734 jTextFieldToolCmd
.getText(), stringToVector(s
.trim()),
1735 jTextFieldOptionContents
.getText());
1739 return jButtonOptionsAdd
;
1743 * This method initializes jButtonOptionsDel
1745 * Remove a line from the table below
1747 * @return javax.swing.JButton jButtonOptionsDel
1749 private JButton
getJButtonOptionsDel() {
1750 if (jButtonOptionsDel
== null) {
1751 jButtonOptionsDel
= new JButton();
1752 jButtonOptionsDel
.setText("Delete");
1753 jButtonOptionsDel
.setPreferredSize(new java
.awt
.Dimension(buttonWidth
, oneRowHeight
));
1754 jButtonOptionsDel
.setBounds(new java
.awt
.Rectangle(next2LastButtonLoc
, buttonRow
, buttonWidth
, oneRowHeight
));
1755 jButtonOptionsDel
.setLocation(new java
.awt
.Point(next2LastButtonLoc
, buttonRow
));
1756 jButtonOptionsDel
.addActionListener(new AbstractAction() {
1760 private static final long serialVersionUID
= 1L;
1762 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1763 if (selectedRow
>= 0) {
1764 optionsTableModel
.removeRow(selectedRow
);
1765 docConsole
.setSaved(false);
1766 ffc
.removeBuildOptionsOpt(selectedRow
);
1771 return jButtonOptionsDel
;
1774 public void componentResized(ComponentEvent arg0
) {
1775 int intPreferredWidth
= 500;
1777 Tools
.resizeComponentWidth(this.jScrollPaneOptions
, this.getWidth(), intPreferredWidth
);
1781 * This method initializes jScrollPaneOptions
1782 * Contains the Table and is located below the data entry section
1783 * @return javax.swing.JScrollPane jScrollPaneOptoins
1785 private JScrollPane
getJScrollPaneOptions() {
1786 if (jScrollPaneOptions
== null) {
1787 jScrollPaneOptions
= new JScrollPane();
1788 jScrollPaneOptions
.setViewportView(getJTableOptions());
1790 return jScrollPaneOptions
;
1794 * This method initializes jTableOptions
1796 * @return javax.swing.JTable jTableOptions
1798 private JTable
getJTableOptions() {
1799 if (jTableOptions
== null) {
1801 optionsTableModel
= new DefaultTableModel();
1802 jTableOptions
= new JTable(optionsTableModel
);
1803 jTableOptions
.setRowHeight(20);
1804 optionsTableModel
.addColumn("Build Targets");
1805 optionsTableModel
.addColumn("Tool Chain Family");
1806 optionsTableModel
.addColumn("Supported Architectures");
1807 optionsTableModel
.addColumn("Tool Command Code");
1808 optionsTableModel
.addColumn("TagName");
1809 optionsTableModel
.addColumn("Arguments");
1811 jTableOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1812 jTableOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1813 jTableOptions
.getColumnModel().getColumn(2).setMinWidth(supportArchWidth
);
1814 jTableOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1815 jTableOptions
.getColumnModel().getColumn(4).setMinWidth(tagNameWidth
);
1816 jTableOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1818 // javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
1819 // JComboBox cb = new JComboBox();
1820 // cb.addItem("MSFT");
1821 // cb.addItem("GCC");
1822 // cb.addItem("CYGWIN");
1823 // cb.addItem("INTEL");
1824 // cb.addItem("USER_DEFINED");
1825 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1826 Vector
<String
> vArch
= new Vector
<String
>();
1833 jTableOptions
.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch
));
1835 jTableOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
1837 jTableOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1838 jTableOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1839 jTableOptions
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1840 public void valueChanged(ListSelectionEvent e
) {
1842 if (e
.getValueIsAdjusting()) {
1845 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
1846 if (lsm
.isSelectionEmpty()) {
1849 selectedRow
= lsm
.getMinSelectionIndex();
1854 jTableOptions
.getModel().addTableModelListener(new TableModelListener() {
1855 public void tableChanged(TableModelEvent arg0
) {
1856 // TODO Auto-generated method stub
1857 int row
= arg0
.getFirstRow();
1858 TableModel m
= (TableModel
) arg0
.getSource();
1859 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
1860 //ToDo Data Validition check.
1861 String targets
= m
.getValueAt(row
, 0) + "";
1862 Vector
<Object
> targetName
= new Vector
<Object
>();
1863 String
[] sArray
= targets
.split("( )+");
1864 for (int i
= 0; i
< sArray
.length
; ++i
) {
1865 targetName
.add(sArray
[i
]);
1867 String toolChain
= m
.getValueAt(row
, 1) + "";
1868 String archs
= m
.getValueAt(row
, 2) + "";
1869 Vector
<Object
> supArch
= null;
1870 if (archs
.length() > 0) {
1871 supArch
= new Vector
<Object
>();
1872 String
[] sArray1
= archs
.split("( )+");
1873 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1874 supArch
.add(sArray1
[i
]);
1878 String toolCmd
= m
.getValueAt(row
, 3) + "";
1879 String tagName
= m
.getValueAt(row
, 4) + "";
1880 String contents
= m
.getValueAt(row
, 5) + "";
1881 docConsole
.setSaved(false);
1882 ffc
.updateBuildOptionsOpt(row
, targetName
, toolChain
, tagName
, toolCmd
, supArch
, contents
);
1887 return jTableOptions
;
1890 private Vector
<Object
> stringToVector(String s
) {
1891 String
[] sArray
= s
.split(" ");
1892 Vector
<Object
> v
= null;
1893 if (s
.length() > 0 && !s
.trim().equalsIgnoreCase("")) {
1894 v
= new Vector
<Object
>();
1895 for (int i
= 0; i
< sArray
.length
; ++i
) {
1902 private String
boolToList(boolean[] bool
) {
1926 private void initOptionTable() {
1927 if (ffc
.getBuildOptionsOptCount() == 0) {
1928 //ToDo get default options from *.txt file
1931 String
[][] saa
= new String
[ffc
.getBuildOptionsOptCount()][6];
1932 ffc
.getBuildOptionsOpts(saa
);
1933 for (int i
= 0; i
< saa
.length
; ++i
) {
1934 optionsTableModel
.addRow(saa
[i
]);
1940 * Everything below should pertain to the ANT Task Tab
1944 * This method initializes jButton12
1946 * @return javax.swing.JButton
1948 private JButton
getJButtonAntTaskFileBrowse() {
1949 if (jButtonAntTaskFileBrowse
== null) {
1950 jButtonAntTaskFileBrowse
= new JButton();
1951 jButtonAntTaskFileBrowse
.setPreferredSize(new Dimension(buttonWidth
, oneRowHeight
));
1952 jButtonAntTaskFileBrowse
.setText("Browse");
1953 jButtonAntTaskFileBrowse
.addActionListener(new AbstractAction() {
1954 private static final long serialVersionUID
= 1L;
1956 public void actionPerformed(ActionEvent arg0
) {
1958 // Select files from current workspace
1960 String dirPrefix
= Workspace
.getCurrentWorkspace();
1961 JFileChooser chooser
= new JFileChooser(dirPrefix
);
1962 File theFile
= null;
1963 String headerDest
= null;
1965 chooser
.setMultiSelectionEnabled(false);
1966 chooser
.setFileSelectionMode(JFileChooser
.FILES_ONLY
);
1967 int retval
= chooser
.showOpenDialog(frame
);
1968 if (retval
== JFileChooser
.APPROVE_OPTION
) {
1970 theFile
= chooser
.getSelectedFile();
1971 String file
= theFile
.getPath();
1972 if (!file
.startsWith(dirPrefix
)) {
1973 JOptionPane
.showMessageDialog(frame
, "You can only select files in current package!");
1980 headerDest
= theFile
.getPath();
1981 jTextFieldAntTaskFile
.setText(headerDest
.substring(dirPrefix
.length()).replace('\\', '/'));
1987 return jButtonAntTaskFileBrowse
;
1991 * This method initializes jPanelUserDefCenterN
1993 * @return javax.swing.JPanel
1995 private JPanel
getJPanelUserDefCenterN() {
1996 if (jPanelUserDefCenterN
== null) {
1997 jPanelUserDefCenterN
= new JPanel();
1998 jPanelUserDefCenterN
.add(jLabelAntCmdOpts
, null);
1999 jPanelUserDefCenterN
.add(getJTextFieldAntCmdOpts(), null);
2000 jPanelUserDefCenterN
.add(getJButtonAntTaskAdd(), null);
2001 jPanelUserDefCenterN
.add(getJButtonAntTaskDel(), null);
2003 return jPanelUserDefCenterN
;
2007 * This method initializes jPanel8
2009 * @return javax.swing.JPanel
2011 private JPanel
getJPanelUserDef() {
2012 if (jPanelUserDef
== null) {
2013 jPanelUserDef
= new JPanel();
2014 jPanelUserDef
.setLayout(new BorderLayout());
2015 jPanelUserDef
.add(getJPanelUserDefNorth(), java
.awt
.BorderLayout
.NORTH
);
2016 jPanelUserDef
.add(getJPanelUserDefCenter(), java
.awt
.BorderLayout
.CENTER
);
2019 return jPanelUserDef
;
2023 * This method initializes jPanel9
2025 * @return javax.swing.JPanel
2027 private JPanel
getJPanelUserDefNorth() {
2028 if (jPanelUserDefNorth
== null) {
2029 jLabelAntTaskFile
= new JLabel();
2030 jLabelAntTaskFile
.setText("ANT Task File");
2031 jLabelAntTaskFile
.setPreferredSize(new java
.awt
.Dimension(80, 20));
2032 FlowLayout flowLayout8
= new FlowLayout();
2033 flowLayout8
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
2034 jLabelAntTaskId
= new JLabel();
2035 jLabelAntTaskId
.setText("ID");
2036 jPanelUserDefNorth
= new JPanel();
2037 jPanelUserDefNorth
.setLayout(flowLayout8
);
2038 jPanelUserDefNorth
.add(jLabelAntTaskFile
, null);
2039 jPanelUserDefNorth
.add(getJTextFieldAntTaskFile(), null);
2040 jPanelUserDefNorth
.add(getJButtonAntTaskFileBrowse(), null);
2041 jPanelUserDefNorth
.add(jLabelAntTaskId
, null);
2042 jPanelUserDefNorth
.add(getJTextFieldAntTaskId(), null);
2044 return jPanelUserDefNorth
;
2048 * This method initializes jPanel11
2050 * @return javax.swing.JPanel
2052 private JPanel
getJPanelUserDefCenter() {
2053 if (jPanelUserDefCenter
== null) {
2054 jLabelAntCmdOpts
= new JLabel();
2055 jLabelAntCmdOpts
.setText("ANT Command Options");
2056 jLabelAntCmdOpts
.setPreferredSize(new java
.awt
.Dimension(131, 20));
2057 jPanelUserDefCenter
= new JPanel();
2058 jPanelUserDefCenter
.setLayout(new BorderLayout());
2060 jPanelUserDefCenter
.add(getJPanelUserDefCenterN(), java
.awt
.BorderLayout
.NORTH
);
2061 jPanelUserDefCenter
.add(getJScrollPaneAntTasks(), java
.awt
.BorderLayout
.CENTER
);
2063 return jPanelUserDefCenter
;
2067 * This method initializes jTextField2
2069 * @return javax.swing.JTextField
2071 private JTextField
getJTextFieldAntTaskFile() {
2072 if (jTextFieldAntTaskFile
== null) {
2073 jTextFieldAntTaskFile
= new JTextField();
2074 jTextFieldAntTaskFile
.setPreferredSize(new java
.awt
.Dimension(200, 20));
2076 return jTextFieldAntTaskFile
;
2080 * This method initializes jTextField3
2082 * @return javax.swing.JTextField
2084 private JTextField
getJTextFieldAntTaskId() {
2085 if (jTextFieldAntTaskId
== null) {
2086 jTextFieldAntTaskId
= new JTextField();
2087 jTextFieldAntTaskId
.setPreferredSize(new java
.awt
.Dimension(100, 20));
2089 return jTextFieldAntTaskId
;
2093 * This method initializes jButton4
2095 * @return javax.swing.JButton
2097 private JButton
getJButtonAntTaskAdd() {
2098 if (jButtonAntTaskAdd
== null) {
2099 jButtonAntTaskAdd
= new JButton();
2100 jButtonAntTaskAdd
.setPreferredSize(new java
.awt
.Dimension(90, 20));
2101 jButtonAntTaskAdd
.setText("Add");
2102 jButtonAntTaskAdd
.addActionListener(new ActionListener() {
2103 public void actionPerformed(ActionEvent e
) {
2104 if (!DataValidation
.isInt(jTextFieldAntTaskId
.getText())
2105 || jTextFieldAntTaskId
.getText().length() != 8) {
2106 JOptionPane
.showMessageDialog(frame
, "ID must be an 8-digit integer.");
2109 Object
[] o
= { jTextFieldAntTaskId
.getText(), null, null };
2110 o
[1] = jTextFieldAntTaskFile
.getText();
2111 o
[2] = jTextFieldAntCmdOpts
.getText();
2112 ffc
.genBuildOptionsUserDefAntTask(o
[0] + "", o
[1] + "", o
[2] + "");
2113 antTaskTableModel
.addRow(o
);
2114 docConsole
.setSaved(false);
2118 return jButtonAntTaskAdd
;
2122 * This method initializes jButton5
2124 * @return javax.swing.JButton
2126 private JButton
getJButtonAntTaskDel() {
2127 if (jButtonAntTaskDel
== null) {
2128 jButtonAntTaskDel
= new JButton();
2129 jButtonAntTaskDel
.setPreferredSize(new java
.awt
.Dimension(90, 20));
2130 jButtonAntTaskDel
.setText("Delete");
2131 jButtonAntTaskDel
.addActionListener(new ActionListener() {
2132 public void actionPerformed(ActionEvent e
) {
2133 if (selectedRow
>= 0) {
2134 docConsole
.setSaved(false);
2135 antTaskTableModel
.removeRow(selectedRow
);
2136 ffc
.removeBuildOptionsUserDefAntTask(selectedRow
);
2141 return jButtonAntTaskDel
;
2145 * This method initializes jTextField4
2147 * @return javax.swing.JTextField
2149 private JTextField
getJTextFieldAntCmdOpts() {
2150 if (jTextFieldAntCmdOpts
== null) {
2151 jTextFieldAntCmdOpts
= new JTextField();
2152 jTextFieldAntCmdOpts
.setPreferredSize(new java
.awt
.Dimension(270, 20));
2153 jTextFieldAntCmdOpts
.setEnabled(true);
2155 return jTextFieldAntCmdOpts
;
2159 * This method initializes jScrollPane2
2161 * @return javax.swing.JScrollPane
2163 private JScrollPane
getJScrollPaneAntTasks() {
2164 if (jScrollPaneAntTasks
== null) {
2165 jScrollPaneAntTasks
= new JScrollPane();
2166 jScrollPaneAntTasks
.setPreferredSize(new java
.awt
.Dimension(600, 400));
2167 jScrollPaneAntTasks
.setViewportView(getJTableAntTasks());
2169 return jScrollPaneAntTasks
;
2173 * This method initializes jTable2
2175 * @return javax.swing.JTable
2177 private JTable
getJTableAntTasks() {
2178 if (jTableAntTasks
== null) {
2179 antTaskTableModel
= new DefaultTableModel();
2180 jTableAntTasks
= new JTable(antTaskTableModel
);
2181 jTableAntTasks
.setRowHeight(20);
2182 antTaskTableModel
.addColumn("ID");
2183 antTaskTableModel
.addColumn("Filename");
2184 antTaskTableModel
.addColumn("ANT Command Options");
2186 jTableAntTasks
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
2187 jTableAntTasks
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
2188 public void valueChanged(ListSelectionEvent e
) {
2190 if (e
.getValueIsAdjusting()) {
2193 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
2194 if (lsm
.isSelectionEmpty()) {
2197 selectedRow
= lsm
.getMinSelectionIndex();
2202 jTableAntTasks
.getModel().addTableModelListener(new TableModelListener() {
2203 public void tableChanged(TableModelEvent arg0
) {
2204 // TODO Auto-generated method stub
2205 int row
= arg0
.getFirstRow();
2206 TableModel m
= (TableModel
) arg0
.getSource();
2207 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
2208 //ToDo Data Validition check.
2209 String id
= m
.getValueAt(row
, 0) + "";
2210 String file
= m
.getValueAt(row
, 1) + "";
2211 String execOrder
= m
.getValueAt(row
, 2) + "";
2212 if (id
.length() == 0) {
2215 if (file
.length() == 0 && execOrder
.length() == 0) {
2218 if (file
.length() == 0) {
2221 if (execOrder
.length() == 0) {
2224 ffc
.updateBuildOptionsUserDefAntTask(row
, id
, file
, execOrder
);
2230 return jTableAntTasks
;
2233 private void initAntTaskTable() {
2234 if (ffc
.getBuildOptionsUserDefAntTaskCount() == 0) {
2237 String
[][] saa
= new String
[ffc
.getBuildOptionsUserDefAntTaskCount()][3];
2238 ffc
.getBuildOptionsUserDefAntTasks(saa
);
2239 for (int i
= 0; i
< saa
.length
; ++i
) {
2240 antTaskTableModel
.addRow(saa
[i
]);
2244 } // @jve:decl-index=0:visual-constraint="10,10"