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
;
57 import java
.util
.ArrayList
;
58 import java
.util
.Iterator
;
59 import java
.util
.LinkedHashMap
;
61 import java
.util
.Vector
;
62 import java
.awt
.Dimension
;
63 import javax
.swing
.JSplitPane
;
64 import java
.awt
.GridLayout
;
66 public class FpdBuildOptions
extends IInternalFrame
{
68 private final int oneRowHeight
= 20;
70 private final int twoRowHeight
= 40;
72 private final int sepHeight
= 6;
74 private final int sepWidth
= 10;
76 private final int buttonWidth
= 90;
78 private final int rowOne
= 12;
80 private final int dialogWidth
= 600;
82 private final int rowTwo
= rowOne
+ oneRowHeight
+ sepHeight
;
84 private final int rowThree
= rowTwo
+ oneRowHeight
+ sepHeight
;
86 private final int rowFour
= rowThree
+ oneRowHeight
+ sepHeight
;
88 private final int rowFive
= rowFour
+ oneRowHeight
+ sepHeight
;
90 private final int rowSix
= rowFive
+ oneRowHeight
+ sepHeight
;
92 private final int rowSeven
= rowSix
+ oneRowHeight
+ sepHeight
;
94 private final int buttonRow
= rowSeven
+ oneRowHeight
+ sepHeight
+ sepHeight
;
96 private final int dialogHeight
= buttonRow
+ twoRowHeight
+ twoRowHeight
;
98 private final int lastButtonXLoc
= dialogWidth
- buttonWidth
- sepWidth
;
100 private final int next2LastButtonLoc
= lastButtonXLoc
- buttonWidth
- sepWidth
;
102 private final int firstButtonLoc
= next2LastButtonLoc
- buttonWidth
- sepWidth
;
104 private final int labelColumn
= 12;
106 private final int fieldColumn
= 168;
108 private final int labelWidth
= 155;
110 private final int fieldWidth
= 320;
112 private static final long serialVersionUID
= 1L;
116 private JPanel jContentPane
= null;
118 // private JPanel jPanelContentSouth = null;
120 // private JPanel jPanelContentNorth = null;
122 // private JPanel jPanelContentWest = null;
124 // private JPanel jPanelContentEast = null;
126 private JTabbedPane jTabbedPane
= null;
128 private JPanel jPanelUserDef
= null;
130 private JPanel jPanelUserDefNorth
= null;
132 private JPanel jPanelUserDefCenter
= null;
134 private JTextField jTextFieldAntTaskFile
= null;
136 private JLabel jLabelAntTaskId
= null;
138 private JTextField jTextFieldAntTaskId
= null;
140 private JButton jButtonAntTaskAdd
= null;
142 private JButton jButtonAntTaskDel
= null;
144 private JTextField jTextFieldAntCmdOpts
= null;
146 private JScrollPane jScrollPaneAntTasks
= null;
148 private JTable jTableAntTasks
= null;
150 private DefaultTableModel ffsTableModel
= null;
152 private DefaultTableModel sectionsTableModel
= null;
154 private DefaultTableModel sectionTableModel
= null;
156 private DefaultTableModel subsectionsTableModel
= null;
158 private DefaultTableModel antTaskTableModel
= null;
160 private DefaultTableModel ffsAttributesTableModel
= null;
162 private DefaultTableModel optionsTableModel
= null;
164 private JPanel jPanelFfsTab
= null;
166 private JPanel jPanelFfsTabCenter
= null;
168 private JPanel jPanelFfsTabCenterN
= null;
170 private JPanel jPanelFfsTabCenterS
= null;
172 private JButton jButtonFfsAdd
= null;
174 private JButton jButtonFfsDel
= null;
176 private JScrollPane jScrollPaneFfsAttribs
= null;
178 private JTable jTableFfsAttribs
= null;
180 private JPanel jPanelOptionsTab
= null;
182 private JLabel jLabelOptionContents
= null;
184 private JTextField jTextFieldOptionContents
= null;
186 private JLabel jLabelToolChainFamily
= null;
188 private JLabel jLabelSupArch
= null;
190 private JLabel jLabelToolCmd
= null;
192 private JTextField jTextFieldToolCmd
= null;
194 private JScrollPane jScrollPaneOptions
= null;
196 private JTable jTableOptions
= null;
198 private JButton jButtonOptionsAdd
= null;
200 private JButton jButtonOptionsDel
= null;
202 private JButton jButtonFfsAttribNew
= null;
204 private JButton jButtonFfsAttribRemove
= null;
206 private FpdFileContents ffc
= null;
208 private OpeningPlatformType docConsole
= null;
210 private JPanel jArchitectureSelections
= null;
212 private JCheckBox jCheckBoxIA32
= null;
214 private JCheckBox jCheckBoxIpf
= null;
216 private JCheckBox jCheckBoxX64
= null;
218 private JCheckBox jCheckBoxEBC
= null;
220 private JCheckBox jCheckBoxARM
= null;
222 private JCheckBox jCheckBoxPPC
= null;
224 private JLabel jLabelBuildTargets
= null;
226 private JTextField jTextFieldBuildTargets
= null;
228 private JTextField jTextFieldTagName
= null;
230 private JLabel jLabelTagName
= null;
232 private int selectedRow
= -1;
234 private JLabel jLabelAntTaskFile
= null;
236 private JLabel jLabelAntCmdOpts
= null;
238 private JScrollPane jScrollPaneFfs
= null;
240 private JTable jTableFfs
= null;
242 private JLabel jLabelFfsSection
= null;
244 private JScrollPane jScrollPaneFfsSection
= null;
246 private JTable jTableFfsSection
= null;
248 private JLabel jLabelFfsSubSections
= null;
250 private JScrollPane jScrollPaneFfsSubSection
= null;
252 private JTable jTableFfsSubSection
= null;
254 private JLabel jLabelEncapType
= null;
256 private JTextField jTextFieldEncapType
= null;
258 private JPanel jPanelFfsAttribButtonGroup
= null;
260 private JLabel jLabelFfsAttribs
= null;
262 private JButton jButtonFfsSectionNew
= null;
264 private JButton jButtonFfsSectionRemove
= null;
266 private JButton jButtonFfsSubSectionNew
= null;
268 private JButton jButtonFfsSubSectionRemove
= null;
270 private JLabel jLabelFfsSections
= null;
272 private JButton jButtonFfsSectionsNew
= null;
274 private JButton jButtonFfsSectionsRemove
= null;
276 private JScrollPane jScrollPaneFfsSections
= null;
278 private JTable jTableFfsSections
= null;
280 private JButton jButtonAntTaskFileBrowse
= null;
282 private JTextField jTextFieldToolChainFamily
= null;
284 private JSplitPane jSplitPaneFfsC
= null;
286 private JPanel jPanelFfsCTop
= null;
288 private JSplitPane jSplitPaneFfsCBottom
= null;
290 private JPanel jPanelFfsCBottomTop
= null;
292 private JPanel jPanelFfsCBottomBottom
= null;
294 private JPanel jPanelSectionN
= null;
296 private JPanel jPanelSectionsN
= null;
298 private JPanel jPanelSubSectionN
= null;
300 private JPanel jPanelOptionsContainer
= null;
302 private JPanel jPanelUserDefCenterN
= null;
304 private JPanel jPanelTableOptionsContainer
= null;
306 private JLabel jLabelTableOptionsTitle
= null;
308 private final int buildTargetWidth
= 150;
309 private final int toolChainFamilyWidth
= 150;
310 private final int supportArchWidth
= 150;
311 private final int toolCmdCodeWidth
= 200;
312 private final int tagNameWidth
= 150;
313 private final int argWidth
= 400;
315 private boolean ffsSelection
= false;
316 private int selectedFfsTableRow
= -1;
319 * This method initializes jPanel
321 * @return javax.swing.JPanel
322 private JPanel getJPanelContentSouth() {
323 if (jPanelContentSouth == null) {
324 jPanelContentSouth = new JPanel();
326 return jPanelContentSouth;
331 * This method initializes jPanel1
333 * @return javax.swing.JPanel
334 private JPanel getJPanelContentNorth() {
335 if (jPanelContentNorth == null) {
336 jPanelContentNorth = new JPanel();
338 return jPanelContentNorth;
343 * This method initializes jPanel2
345 * @return javax.swing.JPanel
346 private JPanel getJPanelContentWest() {
347 if (jPanelContentWest == null) {
348 jPanelContentWest = new JPanel();
350 return jPanelContentWest;
355 * This method initializes jPanel3
357 * @return javax.swing.JPanel
358 private JPanel getJPanelContentEast() {
359 if (jPanelContentEast == null) {
360 jPanelContentEast = new JPanel();
362 return jPanelContentEast;
367 * This method initializes jTabbedPane
369 * @return javax.swing.JTabbedPane
371 private JTabbedPane
getJTabbedPane() {
372 if (jTabbedPane
== null) {
373 jTabbedPane
= new JTabbedPane();
374 jTabbedPane
.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null);
375 jTabbedPane
.addTab("Customize Tool Chain Configurations", null, getJPanelOptionsTab(), null);
376 jTabbedPane
.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null);
382 * This method initializes this
386 private void initialize() {
387 this.setSize(722, 577);
388 this.setTitle("Platform Build Options");
389 this.setContentPane(getJContentPane());
393 * This method initializes jContentPane
395 * @return javax.swing.JPanel
397 private JPanel
getJContentPane() {
398 if (jContentPane
== null) {
399 jContentPane
= new JPanel();
400 jContentPane
.setLayout(new BorderLayout());
401 // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
402 // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
403 // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
404 // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
405 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
411 * This method initializes jPanelTableOptionsContainer
413 * @return javax.swing.JPanel
415 private JPanel
getJPanelTableOptionsContainer() {
416 if (jPanelTableOptionsContainer
== null) {
417 jLabelTableOptionsTitle
= new JLabel();
418 jLabelTableOptionsTitle
.setText(" Current Argument Lines");
419 jPanelTableOptionsContainer
= new JPanel();
420 jPanelTableOptionsContainer
.setLayout(new BorderLayout());
421 jPanelTableOptionsContainer
.add(jLabelTableOptionsTitle
, java
.awt
.BorderLayout
.NORTH
);
422 jPanelTableOptionsContainer
.add(getJScrollPaneOptions(), java
.awt
.BorderLayout
.CENTER
);
424 return jPanelTableOptionsContainer
;
430 public static void main(String
[] args
) {
431 // TODO Auto-generated method stub
432 new FpdBuildOptions().setVisible(true);
436 * This is the default constructor
438 public FpdBuildOptions() {
441 this.setVisible(true);
444 public FpdBuildOptions(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
446 ffc
= new FpdFileContents(fpd
);
450 public FpdBuildOptions(OpeningPlatformType opt
) {
451 this(opt
.getXmlFpd());
455 private void init(FpdFileContents ffc
) {
459 this.addInternalFrameListener(new InternalFrameAdapter() {
460 public void internalFrameDeactivated(InternalFrameEvent e
) {
461 if (jTableAntTasks
.isEditing()) {
462 jTableAntTasks
.getCellEditor().stopCellEditing();
464 if (jTableOptions
.isEditing()) {
465 jTableOptions
.getCellEditor().stopCellEditing();
467 stopEditingInTables ();
472 private void stopEditingInTables () {
473 if (jTableFfs
.isEditing()) {
474 jTableFfs
.getCellEditor().stopCellEditing();
476 if (jTableFfsSection
.isEditing()) {
477 jTableFfsSection
.getCellEditor().stopCellEditing();
479 if (jTableFfsSections
.isEditing()) {
480 jTableFfsSections
.getCellEditor().stopCellEditing();
482 if (jTableFfsSubSection
.isEditing()) {
483 jTableFfsSubSection
.getCellEditor().stopCellEditing();
485 if (jTableFfsAttribs
.isEditing()) {
486 jTableFfsAttribs
.getCellEditor().stopCellEditing();
491 * This method initializes jPanel13
493 * @return javax.swing.JPanel
495 private JPanel
getJPanelFfsTab() {
496 if (jPanelFfsTab
== null) {
497 jPanelFfsTab
= new JPanel();
498 jPanelFfsTab
.setLayout(new BorderLayout());
499 jPanelFfsTab
.add(getJPanelFfsTabCenter(), java
.awt
.BorderLayout
.CENTER
);
500 jPanelFfsTab
.add(getJScrollPaneFfs(), java
.awt
.BorderLayout
.WEST
);
506 * This method initializes jPanel18
508 * @return javax.swing.JPanel
510 private JPanel
getJPanelFfsTabCenter() {
511 if (jPanelFfsTabCenter
== null) {
512 jPanelFfsTabCenter
= new JPanel();
513 jPanelFfsTabCenter
.setLayout(new BorderLayout());
514 jPanelFfsTabCenter
.add(getJPanelFfsTabCenterN(), java
.awt
.BorderLayout
.NORTH
);
515 jPanelFfsTabCenter
.add(getJPanelFfsTabCenterS(), java
.awt
.BorderLayout
.SOUTH
);
516 jPanelFfsTabCenter
.add(getJSplitPaneFfsC(), java
.awt
.BorderLayout
.CENTER
);
518 return jPanelFfsTabCenter
;
522 * This method initializes jPanel15
524 * @return javax.swing.JPanel
526 private JPanel
getJPanelFfsTabCenterN() {
527 if (jPanelFfsTabCenterN
== null) {
528 jLabelEncapType
= new JLabel();
529 jLabelEncapType
.setText("Encapsulation Type");
530 FlowLayout flowLayout5
= new FlowLayout();
531 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
533 jPanelFfsTabCenterN
= new JPanel();
534 jPanelFfsTabCenterN
.setLayout(flowLayout5
);
537 jPanelFfsTabCenterN
.add(jLabelEncapType
, null);
538 jPanelFfsTabCenterN
.add(getJTextFieldEncapType(), null);
539 jPanelFfsTabCenterN
.add(getJButtonFfsAdd(), null);
540 jPanelFfsTabCenterN
.add(getJButtonFfsDel(), null);
542 return jPanelFfsTabCenterN
;
546 * This method initializes jPanel16
548 * @return javax.swing.JPanel
550 private JPanel
getJPanelFfsTabCenterS() {
551 if (jPanelFfsTabCenterS
== null) {
552 jLabelFfsAttribs
= new JLabel();
553 jLabelFfsAttribs
.setText("Attributes");
554 jPanelFfsTabCenterS
= new JPanel();
555 jPanelFfsTabCenterS
.setPreferredSize(new java
.awt
.Dimension(491, 130));
556 jPanelFfsTabCenterS
.setLayout(new BorderLayout());
557 jPanelFfsTabCenterS
.add(jLabelFfsAttribs
, java
.awt
.BorderLayout
.WEST
);
558 jPanelFfsTabCenterS
.add(getJScrollPaneFfsAttribs(), java
.awt
.BorderLayout
.CENTER
);
559 jPanelFfsTabCenterS
.add(getJPanelFfsAttribButtonGroup(), java
.awt
.BorderLayout
.EAST
);
561 return jPanelFfsTabCenterS
;
565 * This method initializes jTextField6
567 * @return javax.swing.JTextField
572 * This method initializes jButton8
574 * @return javax.swing.JButton
576 private JButton
getJButtonFfsAdd() {
577 if (jButtonFfsAdd
== null) {
578 jButtonFfsAdd
= new JButton();
579 jButtonFfsAdd
.setPreferredSize(new java
.awt
.Dimension(70, 20));
580 jButtonFfsAdd
.setText("New");
581 jButtonFfsAdd
.addActionListener(new AbstractAction() {
585 private static final long serialVersionUID
= -2923720717273384221L;
587 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
589 String
[] row
= { "" };
590 ffsTableModel
.addRow(row
);
591 docConsole
.setSaved(false);
592 ffc
.genBuildOptionsFfs("", "");
593 jTableFfs
.changeSelection(ffsTableModel
.getRowCount()-1, 0, false, false);
598 return jButtonFfsAdd
;
602 * This method initializes jButton9
604 * @return javax.swing.JButton
606 private JButton
getJButtonFfsDel() {
607 if (jButtonFfsDel
== null) {
608 jButtonFfsDel
= new JButton();
609 jButtonFfsDel
.setPreferredSize(new java
.awt
.Dimension(70, 20));
610 jButtonFfsDel
.setText("Delete");
611 jButtonFfsDel
.addActionListener(new AbstractAction() {
615 private static final long serialVersionUID
= -4002678939178194476L;
617 public void actionPerformed(ActionEvent arg0
) {
618 if (jTableFfs
.getSelectedRow() < 0) {
621 stopEditingInTables();
622 docConsole
.setSaved(false);
623 ffc
.removeBuildOptionsFfs(jTableFfs
.getSelectedRow());
624 ffsTableModel
.removeRow(jTableFfs
.getSelectedRow());
625 sectionTableModel
.setRowCount(0);
626 sectionsTableModel
.setRowCount(0);
627 subsectionsTableModel
.setRowCount(0);
628 ffsAttributesTableModel
.setRowCount(0);
632 return jButtonFfsDel
;
636 * This method initializes jScrollPane5
638 * @return javax.swing.JScrollPane
640 private JScrollPane
getJScrollPaneFfsAttribs() {
641 if (jScrollPaneFfsAttribs
== null) {
642 jScrollPaneFfsAttribs
= new JScrollPane();
643 // jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
644 jScrollPaneFfsAttribs
.setViewportView(getJTableFfsAttribs());
647 return jScrollPaneFfsAttribs
;
651 * This method initializes jTable4
653 * @return javax.swing.JTable
655 private JTable
getJTableFfsAttribs() {
656 if (jTableFfsAttribs
== null) {
657 ffsAttributesTableModel
= new DefaultTableModel();
658 jTableFfsAttribs
= new JTable(ffsAttributesTableModel
);
659 // jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
660 jTableFfsAttribs
.setRowHeight(20);
661 ffsAttributesTableModel
.addColumn("Name");
662 ffsAttributesTableModel
.addColumn("Value");
664 jTableFfsAttribs
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
665 jTableFfsAttribs
.getModel().addTableModelListener(new TableModelListener() {
666 public void tableChanged(TableModelEvent arg0
) {
667 // TODO Auto-generated method stub
668 int row
= arg0
.getFirstRow();
669 TableModel m
= (TableModel
) arg0
.getSource();
670 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
671 //ToDo Data Validition check.
672 String name
= m
.getValueAt(row
, 0) + "";
673 String value
= m
.getValueAt(row
, 1) + "";
675 if (name
.length() == 0) {
678 if (value
.length() == 0) {
681 docConsole
.setSaved(false);
682 ffc
.updateBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(), row
, name
, value
);
687 return jTableFfsAttribs
;
690 private void initFfsTable() {
691 int ffsCount
= ffc
.getBuildOptionsFfsCount();
695 String
[][] saa
= new String
[ffsCount
][1];
696 ffc
.getBuildOptionsFfsKey(saa
);
697 for (int i
= 0; i
< saa
.length
; ++i
) {
698 ffsTableModel
.addRow(saa
[i
]);
700 jTableFfs
.changeSelection(0, 0, false, false);
704 * This method initializes jButton17
706 * @return javax.swing.JButton
708 private JButton
getJButtonFfsAttribNew() {
709 if (jButtonFfsAttribNew
== null) {
710 jButtonFfsAttribNew
= new JButton();
711 jButtonFfsAttribNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
712 jButtonFfsAttribNew
.setText("New");
713 jButtonFfsAttribNew
.addActionListener(new AbstractAction() {
717 private static final long serialVersionUID
= 1L;
719 public void actionPerformed(ActionEvent arg0
) {
720 if (jTableFfs
.getSelectedRow() < 0) {
723 Object
[] o
= { "", "" };
724 ffsAttributesTableModel
.addRow(o
);
725 docConsole
.setSaved(false);
726 ffc
.genBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(), "", "");
730 return jButtonFfsAttribNew
;
734 * This method initializes jButton18
736 * @return javax.swing.JButton
738 private JButton
getJButtonFfsAttribRemove() {
739 if (jButtonFfsAttribRemove
== null) {
740 jButtonFfsAttribRemove
= new JButton();
741 jButtonFfsAttribRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
742 jButtonFfsAttribRemove
.setText("Remove");
743 jButtonFfsAttribRemove
.addActionListener(new AbstractAction() {
747 private static final long serialVersionUID
= 1L;
749 public void actionPerformed(ActionEvent arg0
) {
750 if (jTableFfs
.getSelectedRow() < 0) {
753 stopEditingInTables();
754 if (jTableFfsAttribs
.getSelectedRow() >= 0) {
755 docConsole
.setSaved(false);
756 ffsAttributesTableModel
.removeRow(jTableFfsAttribs
.getSelectedRow());
757 ffc
.removeBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(),
758 jTableFfsAttribs
.getSelectedRow());
763 return jButtonFfsAttribRemove
;
767 * This method initializes jScrollPane
769 * @return javax.swing.JScrollPane
771 private JScrollPane
getJScrollPaneFfs() {
772 if (jScrollPaneFfs
== null) {
773 jScrollPaneFfs
= new JScrollPane();
774 jScrollPaneFfs
.setPreferredSize(new java
.awt
.Dimension(200,419));
775 jScrollPaneFfs
.setViewportView(getJTableFfs());
777 return jScrollPaneFfs
;
781 * This method initializes jTable
783 * @return javax.swing.JTable
785 private JTable
getJTableFfs() {
786 if (jTableFfs
== null) {
787 ffsTableModel
= new DefaultTableModel();
788 ffsTableModel
.addColumn("FFS Type");
789 jTableFfs
= new JTable(ffsTableModel
);
790 jTableFfs
.setShowGrid(false);
791 jTableFfs
.setRowHeight(20);
793 jTableFfs
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
794 jTableFfs
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
795 public void valueChanged(ListSelectionEvent e
) {
797 if (e
.getValueIsAdjusting()) {
800 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
801 if (lsm
.isSelectionEmpty()) {
804 int row
= lsm
.getMinSelectionIndex();
805 sectionTableModel
.setRowCount(0);
806 sectionsTableModel
.setRowCount(0);
807 subsectionsTableModel
.setRowCount(0);
808 ffsAttributesTableModel
.setRowCount(0);
809 String
[] sArray
= { "", "" };
810 LinkedHashMap
<String
, String
> lhm
= new LinkedHashMap
<String
, String
>();
811 ArrayList
<String
> alSections
= new ArrayList
<String
>();
812 ArrayList
<String
> alSection
= new ArrayList
<String
>();
813 ffc
.getBuildOptionsFfs(row
, sArray
, lhm
, alSections
, alSection
);
815 jTextFieldEncapType
.setText(sArray
[1]);
816 ffsSelection
= false;
817 for (int i
= 0; i
< alSection
.size(); ++i
) {
818 String
[] sectionRow
= { alSection
.get(i
) };
819 sectionTableModel
.addRow(sectionRow
);
821 for (int j
= 0; j
< alSections
.size(); ++j
) {
822 String
[] sectionsRow
= { alSections
.get(j
) };
823 sectionsTableModel
.addRow(sectionsRow
);
825 if (lhm
.size() <= 0) {
828 Set
<String
> keySet
= lhm
.keySet();
829 Iterator
<String
> is
= keySet
.iterator();
830 while (is
.hasNext()) {
831 String key
= is
.next();
832 String
[] attribRow
= { key
, lhm
.get(key
) };
833 ffsAttributesTableModel
.addRow(attribRow
);
835 selectedFfsTableRow
= row
;
840 jTableFfs
.getModel().addTableModelListener(new TableModelListener() {
841 public void tableChanged(TableModelEvent arg0
) {
842 // TODO Auto-generated method stub
843 int row
= arg0
.getFirstRow();
844 TableModel m
= (TableModel
) arg0
.getSource();
845 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
846 //ToDo Data Validition check.
847 String id
= m
.getValueAt(row
, 0) + "";
849 if (id
.length() == 0) {
852 docConsole
.setSaved(false);
853 ffc
.updateBuildOptionsFfsKey(row
, id
);
862 * This method initializes jScrollPane1
864 * @return javax.swing.JScrollPane
866 private JScrollPane
getJScrollPaneFfsSection() {
867 if (jScrollPaneFfsSection
== null) {
868 jScrollPaneFfsSection
= new JScrollPane();
869 // jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
870 jScrollPaneFfsSection
.setViewportView(getJTableFfsSection());
872 return jScrollPaneFfsSection
;
876 * This method initializes jTable1
878 * @return javax.swing.JTable
880 private JTable
getJTableFfsSection() {
881 if (jTableFfsSection
== null) {
882 sectionTableModel
= new DefaultTableModel();
883 sectionTableModel
.addColumn("SectionType");
885 jTableFfsSection
= new JTable(sectionTableModel
);
886 jTableFfsSection
.setRowHeight(20);
887 JComboBox cb
= new JComboBox();
888 cb
.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
889 cb
.addItem("EFI_SECTION_VERSION");
890 cb
.addItem("EFI_SECTION_USER_INTERFACE");
891 cb
.addItem("EFI_SECTION_DXE_DEPEX");
892 cb
.addItem("EFI_SECTION_PEI_DEPEX");
893 cb
.addItem("EFI_SECTION_PE32");
894 cb
.addItem("EFI_SECTION_PIC");
895 cb
.addItem("EFI_SECTION_TE");
896 cb
.addItem("EFI_SECTION_RAW");
897 cb
.addItem("EFI_SECTION_COMPRESSION");
898 cb
.addItem("EFI_SECTION_GUID_DEFINED");
899 cb
.addItem("EFI_SECTION_COMPATIBILITY16");
900 cb
.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
901 jTableFfsSection
.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb
));
903 jTableFfsSection
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
905 jTableFfsSection
.getModel().addTableModelListener(new TableModelListener() {
906 public void tableChanged(TableModelEvent arg0
) {
907 // TODO Auto-generated method stub
908 if (jTableFfs
.getSelectedRow() < 0) {
911 int row
= arg0
.getFirstRow();
912 TableModel m
= (TableModel
) arg0
.getSource();
913 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
914 //ToDo Data Validition check.
915 String type
= m
.getValueAt(row
, 0) + "";
916 docConsole
.setSaved(false);
917 ffc
.updateBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(), row
, type
);
922 return jTableFfsSection
;
926 * This method initializes jScrollPane3
928 * @return javax.swing.JScrollPane
930 private JScrollPane
getJScrollPaneFfsSubSection() {
931 if (jScrollPaneFfsSubSection
== null) {
932 jScrollPaneFfsSubSection
= new JScrollPane();
933 // jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
934 jScrollPaneFfsSubSection
.setViewportView(getJTableFfsSubSection());
936 return jScrollPaneFfsSubSection
;
940 * This method initializes jTable3
942 * @return javax.swing.JTable
944 private JTable
getJTableFfsSubSection() {
945 if (jTableFfsSubSection
== null) {
946 subsectionsTableModel
= new DefaultTableModel();
947 subsectionsTableModel
.addColumn("SectionType");
948 jTableFfsSubSection
= new JTable(subsectionsTableModel
);
949 jTableFfsSubSection
.setRowHeight(20);
950 JComboBox cb
= new JComboBox();
951 cb
.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
952 cb
.addItem("EFI_SECTION_VERSION");
953 cb
.addItem("EFI_SECTION_USER_INTERFACE");
954 cb
.addItem("EFI_SECTION_DXE_DEPEX");
955 cb
.addItem("EFI_SECTION_PEI_DEPEX");
956 cb
.addItem("EFI_SECTION_PE32");
957 cb
.addItem("EFI_SECTION_PIC");
958 cb
.addItem("EFI_SECTION_TE");
959 cb
.addItem("EFI_SECTION_RAW");
960 cb
.addItem("EFI_SECTION_COMPRESSION");
961 cb
.addItem("EFI_SECTION_GUID_DEFINED");
962 cb
.addItem("EFI_SECTION_COMPATIBILITY16");
963 cb
.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
964 jTableFfsSubSection
.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb
));
965 jTableFfsSubSection
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
967 jTableFfsSubSection
.getModel().addTableModelListener(new TableModelListener() {
968 public void tableChanged(TableModelEvent arg0
) {
969 // TODO Auto-generated method stub
970 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
973 int row
= arg0
.getFirstRow();
974 TableModel m
= (TableModel
) arg0
.getSource();
975 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
976 //ToDo Data Validition check.
977 String type
= m
.getValueAt(row
, 0) + "";
978 docConsole
.setSaved(false);
979 ffc
.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(),
980 jTableFfsSections
.getSelectedRow(), row
, type
);
985 return jTableFfsSubSection
;
989 * This method initializes jTextField
991 * @return javax.swing.JTextField
993 private JTextField
getJTextFieldEncapType() {
994 if (jTextFieldEncapType
== null) {
995 jTextFieldEncapType
= new JTextField();
996 jTextFieldEncapType
.setPreferredSize(new java
.awt
.Dimension(200,20));
997 jTextFieldEncapType
.getDocument().addDocumentListener(new DocumentListener() {
999 public void insertUpdate(DocumentEvent arg0
) {
1001 // ffsSelection = false;
1004 if (docConsole
!= null) {
1005 docConsole
.setSaved(false);
1009 public void removeUpdate(DocumentEvent arg0
) {
1011 // ffsSelection = false;
1014 if (docConsole
!= null) {
1015 docConsole
.setSaved(false);
1019 public void changedUpdate(DocumentEvent arg0
) {
1020 // TODO Auto-generated method stub
1025 jTextFieldEncapType
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1026 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1027 if (selectedFfsTableRow
< 0) {
1030 ffc
.updateBuildOptionsFfsSectionsType(selectedFfsTableRow
, jTextFieldEncapType
.getText());
1035 return jTextFieldEncapType
;
1039 * This method initializes jPanel4
1041 * @return javax.swing.JPanel
1043 private JPanel
getJPanelFfsAttribButtonGroup() {
1044 if (jPanelFfsAttribButtonGroup
== null) {
1045 jPanelFfsAttribButtonGroup
= new JPanel();
1046 jPanelFfsAttribButtonGroup
.setPreferredSize(new java
.awt
.Dimension(100, 100));
1047 jPanelFfsAttribButtonGroup
.add(getJButtonFfsAttribNew(), null);
1048 jPanelFfsAttribButtonGroup
.add(getJButtonFfsAttribRemove(), null);
1050 return jPanelFfsAttribButtonGroup
;
1054 * This method initializes jButton
1056 * @return javax.swing.JButton
1058 private JButton
getJButtonFfsSectionNew() {
1059 if (jButtonFfsSectionNew
== null) {
1060 jButtonFfsSectionNew
= new JButton();
1061 jButtonFfsSectionNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1062 jButtonFfsSectionNew
.setText("New");
1063 jButtonFfsSectionNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1064 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1065 if (jTableFfs
.getSelectedRow() < 0) {
1068 docConsole
.setSaved(false);
1069 String
[] row
= { "EFI_SECTION_RAW" };
1070 sectionTableModel
.addRow(row
);
1071 ffc
.genBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(), row
[0]);
1075 return jButtonFfsSectionNew
;
1079 * This method initializes jButton1
1081 * @return javax.swing.JButton
1083 private JButton
getJButtonFfsSectionRemove() {
1084 if (jButtonFfsSectionRemove
== null) {
1085 jButtonFfsSectionRemove
= new JButton();
1086 jButtonFfsSectionRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1087 jButtonFfsSectionRemove
.setText("Remove");
1089 jButtonFfsSectionRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1090 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1091 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSection
.getSelectedRow() < 0) {
1094 stopEditingInTables();
1095 docConsole
.setSaved(false);
1096 sectionTableModel
.removeRow(jTableFfsSection
.getSelectedRow());
1097 ffc
.removeBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(),
1098 jTableFfsSection
.getSelectedRow());
1102 return jButtonFfsSectionRemove
;
1106 * This method initializes jButton2
1108 * @return javax.swing.JButton
1110 private JButton
getJButtonFfsSubSectionNew() {
1111 if (jButtonFfsSubSectionNew
== null) {
1112 jButtonFfsSubSectionNew
= new JButton();
1113 jButtonFfsSubSectionNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1114 jButtonFfsSubSectionNew
.setText("New");
1115 jButtonFfsSubSectionNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1116 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1117 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
1120 docConsole
.setSaved(false);
1121 String
[] row
= { "EFI_SECTION_RAW" };
1122 subsectionsTableModel
.addRow(row
);
1123 ffc
.genBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(),
1124 jTableFfsSections
.getSelectedRow(), row
[0]);
1129 return jButtonFfsSubSectionNew
;
1133 * This method initializes jButton3
1135 * @return javax.swing.JButton
1137 private JButton
getJButtonFfsSubSectionRemove() {
1138 if (jButtonFfsSubSectionRemove
== null) {
1139 jButtonFfsSubSectionRemove
= new JButton();
1140 jButtonFfsSubSectionRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1141 jButtonFfsSubSectionRemove
.setText("Remove");
1142 jButtonFfsSubSectionRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1143 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1144 int selectedFfsRow
= jTableFfs
.getSelectedRow();
1145 int selectedSectionsRow
= jTableFfsSections
.getSelectedRow();
1146 int selectedSubSectionRow
= jTableFfsSubSection
.getSelectedRow();
1147 if (selectedFfsRow
< 0 || selectedSectionsRow
< 0
1148 || selectedSubSectionRow
< 0) {
1151 stopEditingInTables();
1152 docConsole
.setSaved(false);
1153 subsectionsTableModel
.removeRow(selectedSubSectionRow
);
1154 ffc
.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow
,
1155 selectedSectionsRow
,
1156 selectedSubSectionRow
);
1157 if (subsectionsTableModel
.getRowCount() == 0) {
1158 sectionsTableModel
.removeRow(selectedSectionsRow
);
1163 return jButtonFfsSubSectionRemove
;
1167 * This method initializes jButton6
1169 * @return javax.swing.JButton
1171 private JButton
getJButtonFfsSectionsNew() {
1172 if (jButtonFfsSectionsNew
== null) {
1173 jButtonFfsSectionsNew
= new JButton();
1174 jButtonFfsSectionsNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1175 jButtonFfsSectionsNew
.setText("New");
1176 jButtonFfsSectionsNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1177 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1178 if (jTableFfs
.getSelectedRow() < 0) {
1181 docConsole
.setSaved(false);
1182 String
[] row
= { "Compress" };
1183 sectionsTableModel
.addRow(row
);
1184 ffc
.genBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(), "");
1185 JOptionPane
.showMessageDialog(frame
, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry.");
1186 jTableFfsSections
.changeSelection(sectionsTableModel
.getRowCount()-1, 0, false, false);
1190 return jButtonFfsSectionsNew
;
1194 * This method initializes jButton7
1196 * @return javax.swing.JButton
1198 private JButton
getJButtonFfsSectionsRemove() {
1199 if (jButtonFfsSectionsRemove
== null) {
1200 jButtonFfsSectionsRemove
= new JButton();
1201 jButtonFfsSectionsRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1202 jButtonFfsSectionsRemove
.setText("Remove");
1203 jButtonFfsSectionsRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1204 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1205 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
1208 stopEditingInTables();
1209 docConsole
.setSaved(false);
1210 sectionsTableModel
.removeRow(jTableFfsSections
.getSelectedRow());
1211 ffc
.removeBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(),
1212 jTableFfsSections
.getSelectedRow());
1213 subsectionsTableModel
.setRowCount(0);
1217 return jButtonFfsSectionsRemove
;
1220 private JScrollPane
getJScrollPaneFfsSections() {
1221 if (jScrollPaneFfsSections
== null) {
1222 jScrollPaneFfsSections
= new JScrollPane();
1223 // jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
1224 jScrollPaneFfsSections
.setViewportView(getJTableFfsSections());
1226 return jScrollPaneFfsSections
;
1230 * This method initializes jTable6
1232 * @return javax.swing.JTable
1234 private JTable
getJTableFfsSections() {
1235 if (jTableFfsSections
== null) {
1236 sectionsTableModel
= new DefaultTableModel();
1237 sectionsTableModel
.addColumn("EncapsulationType");
1238 jTableFfsSections
= new JTable(sectionsTableModel
);
1239 jTableFfsSections
.setRowHeight(20);
1240 jTableFfsSections
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1241 jTableFfsSections
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1242 public void valueChanged(ListSelectionEvent e
) {
1243 if (e
.getValueIsAdjusting()) {
1246 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
1247 if (lsm
.isSelectionEmpty()) {
1250 int sectionsRow
= lsm
.getMinSelectionIndex();
1251 if (jTableFfs
.getSelectedRow() < 0) {
1254 subsectionsTableModel
.setRowCount(0);
1255 ArrayList
<String
> al
= new ArrayList
<String
>();
1256 ffc
.getBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(), sectionsRow
, al
);
1257 for (int i
= 0; i
< al
.size(); ++i
) {
1258 String
[] subsectionRow
= { al
.get(i
) };
1259 subsectionsTableModel
.addRow(subsectionRow
);
1265 jTableFfsSections
.getModel().addTableModelListener(new TableModelListener() {
1266 public void tableChanged(TableModelEvent arg0
) {
1267 // TODO Auto-generated method stub
1268 int row
= arg0
.getFirstRow();
1269 TableModel m
= (TableModel
) arg0
.getSource();
1270 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
1271 //ToDo Data Validition check.
1272 String encapType
= m
.getValueAt(row
, 0) + "";
1273 docConsole
.setSaved(false);
1274 ffc
.updateBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(), row
, encapType
);
1279 return jTableFfsSections
;
1283 * This method initializes jSplitPaneFfsC
1285 * @return javax.swing.JSplitPane
1287 private JSplitPane
getJSplitPaneFfsC() {
1288 if (jSplitPaneFfsC
== null) {
1289 jSplitPaneFfsC
= new JSplitPane();
1290 jSplitPaneFfsC
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
1291 jSplitPaneFfsC
.setDividerLocation(130);
1292 jSplitPaneFfsC
.setTopComponent(getJPanelFfsCTop());
1293 jSplitPaneFfsC
.setBottomComponent(getJSplitPaneFfsCBottom());
1294 jSplitPaneFfsC
.setDividerSize(5);
1296 return jSplitPaneFfsC
;
1300 * This method initializes jPanelFfsCTop
1302 * @return javax.swing.JPanel
1304 private JPanel
getJPanelFfsCTop() {
1305 if (jPanelFfsCTop
== null) {
1306 jPanelFfsCTop
= new JPanel();
1307 jPanelFfsCTop
.setLayout(new BorderLayout());
1308 jPanelFfsCTop
.add(getJPanelSectionN(), java
.awt
.BorderLayout
.NORTH
);
1309 jPanelFfsCTop
.add(getJScrollPaneFfsSection(), java
.awt
.BorderLayout
.CENTER
);
1311 return jPanelFfsCTop
;
1315 * This method initializes jSplitPaneFfsCBottom
1317 * @return javax.swing.JSplitPane
1319 private JSplitPane
getJSplitPaneFfsCBottom() {
1320 if (jSplitPaneFfsCBottom
== null) {
1321 jSplitPaneFfsCBottom
= new JSplitPane();
1322 jSplitPaneFfsCBottom
.setDividerSize(5);
1323 jSplitPaneFfsCBottom
.setDividerLocation(130);
1324 jSplitPaneFfsCBottom
.setTopComponent(getJPanelFfsCBottomTop());
1325 jSplitPaneFfsCBottom
.setBottomComponent(getJPanelFfsCBottomBottom());
1326 jSplitPaneFfsCBottom
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
1328 return jSplitPaneFfsCBottom
;
1332 * This method initializes jPanelFfsCBottomTop
1334 * @return javax.swing.JPanel
1336 private JPanel
getJPanelFfsCBottomTop() {
1337 if (jPanelFfsCBottomTop
== null) {
1338 jPanelFfsCBottomTop
= new JPanel();
1339 jPanelFfsCBottomTop
.setLayout(new BorderLayout());
1340 jPanelFfsCBottomTop
.add(getJPanelSectionsN(), java
.awt
.BorderLayout
.NORTH
);
1341 jPanelFfsCBottomTop
.add(getJScrollPaneFfsSections(), java
.awt
.BorderLayout
.CENTER
);
1343 return jPanelFfsCBottomTop
;
1347 * This method initializes jPanelFfsCBottomBottom
1349 * @return javax.swing.JPanel
1351 private JPanel
getJPanelFfsCBottomBottom() {
1352 if (jPanelFfsCBottomBottom
== null) {
1353 jPanelFfsCBottomBottom
= new JPanel();
1354 jPanelFfsCBottomBottom
.setLayout(new BorderLayout());
1355 jPanelFfsCBottomBottom
.add(getJPanelSubSectionN(), java
.awt
.BorderLayout
.NORTH
);
1356 jPanelFfsCBottomBottom
.add(getJScrollPaneFfsSubSection(), java
.awt
.BorderLayout
.CENTER
);
1358 return jPanelFfsCBottomBottom
;
1362 * This method initializes jPanelSectionN
1364 * @return javax.swing.JPanel
1366 private JPanel
getJPanelSectionN() {
1367 if (jPanelSectionN
== null) {
1368 jPanelSectionN
= new JPanel();
1369 jLabelFfsSection
= new JLabel();
1370 jLabelFfsSection
.setText("Section");
1371 jPanelSectionN
.add(jLabelFfsSection
, null);
1372 jPanelSectionN
.add(getJButtonFfsSectionNew(), null);
1373 jPanelSectionN
.add(getJButtonFfsSectionRemove(), null);
1375 return jPanelSectionN
;
1379 * This method initializes jPanelSectionsN
1381 * @return javax.swing.JPanel
1383 private JPanel
getJPanelSectionsN() {
1384 if (jPanelSectionsN
== null) {
1385 jPanelSectionsN
= new JPanel();
1386 jLabelFfsSections
= new JLabel();
1387 jLabelFfsSections
.setText("Sections");
1388 jPanelSectionsN
.add(jLabelFfsSections
, null);
1389 jPanelSectionsN
.add(getJButtonFfsSectionsNew(), null);
1390 jPanelSectionsN
.add(getJButtonFfsSectionsRemove(), null);
1392 return jPanelSectionsN
;
1396 * This method initializes jPanelSubSectionN
1398 * @return javax.swing.JPanel
1400 private JPanel
getJPanelSubSectionN() {
1401 if (jPanelSubSectionN
== null) {
1402 jPanelSubSectionN
= new JPanel();
1403 jLabelFfsSubSections
= new JLabel();
1404 jLabelFfsSubSections
.setText("Sub-Sections");
1405 jPanelSubSectionN
.add(jLabelFfsSubSections
, null);
1406 jPanelSubSectionN
.add(getJButtonFfsSubSectionNew(), null);
1407 jPanelSubSectionN
.add(getJButtonFfsSubSectionRemove(), null);
1409 return jPanelSubSectionN
;
1413 * The following section contains all Build Options content
1417 * This method initializes jPanelOptionsTab
1419 * This is the main Options screen
1421 * @return javax.swing.JPanel jPanelOptionsTab
1423 private JPanel
getJPanelOptionsTab() {
1424 if (jPanelOptionsTab
== null) {
1425 // This container holds the Options Tab content
1427 // FlowLayout flowLayout9 = new FlowLayout();
1428 // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
1430 GridLayout gridLayout
= new GridLayout();
1431 gridLayout
.setRows(2);
1432 jPanelOptionsTab
= new JPanel();
1433 jPanelOptionsTab
.setLayout(gridLayout
);
1434 jPanelOptionsTab
.setBounds(new java
.awt
.Rectangle(0, 0, dialogWidth
* 2, dialogHeight
* 3));
1435 jPanelOptionsTab
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
+ 10, (dialogHeight
* 3) + 10));
1436 jPanelOptionsTab
.setAutoscrolls(true);
1437 jPanelOptionsTab
.setLocation(0, 0);
1438 jPanelOptionsTab
.add(getJPanelOptionsContainer(), null);
1439 // jPanelOptionsTab.add(getJScrollPaneOptions(), null);
1440 jPanelOptionsTab
.add(getJPanelTableOptionsContainer(), null);
1442 return jPanelOptionsTab
;
1446 * This method initializes jPanelOptionsContainer
1448 * @return javax.swing.JPanel
1450 private JPanel
getJPanelOptionsContainer() {
1451 if (jPanelOptionsContainer
== null) {
1452 jLabelTagName
= new JLabel();
1453 jLabelTagName
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowOne
, labelWidth
, oneRowHeight
));
1454 jLabelTagName
.setLocation(new java
.awt
.Point(labelColumn
, rowOne
));
1455 jLabelTagName
.setText("Tag Name");
1456 jLabelBuildTargets
= new JLabel();
1457 jLabelBuildTargets
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowTwo
, labelWidth
, oneRowHeight
));
1458 jLabelBuildTargets
.setLocation(new java
.awt
.Point(labelColumn
, rowTwo
));
1459 jLabelBuildTargets
.setText("Build Targets");
1460 jLabelToolCmd
= new JLabel();
1461 jLabelToolCmd
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowThree
, labelWidth
, oneRowHeight
));
1462 jLabelToolCmd
.setLocation(new java
.awt
.Point(labelColumn
, rowThree
));
1463 jLabelToolCmd
.setText("Tool Command");
1464 jLabelSupArch
= new JLabel();
1465 jLabelSupArch
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFour
, labelWidth
, oneRowHeight
));
1466 jLabelSupArch
.setLocation(new java
.awt
.Point(labelColumn
, rowFour
));
1467 jLabelSupArch
.setText("Supported Architectures");
1468 jLabelToolChainFamily
= new JLabel();
1469 jLabelToolChainFamily
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFive
, labelWidth
, oneRowHeight
));
1470 jLabelToolChainFamily
.setLocation(new java
.awt
.Point(labelColumn
, rowFive
));
1471 jLabelToolChainFamily
.setText("Tool Chain Family");
1473 jLabelOptionContents
= new JLabel();
1474 jLabelOptionContents
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowSix
, labelWidth
, oneRowHeight
));
1475 jLabelOptionContents
.setLocation(new java
.awt
.Point(labelColumn
, rowSix
));
1476 jLabelOptionContents
.setText("Argument Strings");
1478 jPanelOptionsContainer
= new JPanel();
1480 jPanelOptionsContainer
.setLayout(null);
1482 jPanelOptionsContainer
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
, dialogHeight
));
1484 jPanelOptionsContainer
1485 .setBorder(javax.swing.BorderFactory
1486 .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
1488 jPanelOptionsContainer
.add(jLabelTagName
, null);
1489 jPanelOptionsContainer
.add(getJTextFieldTagName(), null);
1491 jPanelOptionsContainer
.add(jLabelBuildTargets
, null);
1492 jPanelOptionsContainer
.add(getJTextFieldBuildTargets(), null);
1494 jPanelOptionsContainer
.add(jLabelToolChainFamily
, null);
1495 jPanelOptionsContainer
.add(getJTextFieldToolChainFamily(), null);
1497 jPanelOptionsContainer
.add(jLabelToolCmd
, null);
1498 jPanelOptionsContainer
.add(getJTextFieldToolCmd(), null);
1500 jPanelOptionsContainer
.add(jLabelSupArch
, null);
1501 jPanelOptionsContainer
.add(getArchitectureSelections(), null);
1503 jPanelOptionsContainer
.add(jLabelOptionContents
, null);
1504 jPanelOptionsContainer
.add(getJTextFieldOptionContents(), null);
1506 jPanelOptionsContainer
.add(getJButtonOptionsAdd(), null);
1507 jPanelOptionsContainer
.add(getJButtonOptionsDel(), null);
1509 return jPanelOptionsContainer
;
1513 * This method initializes jTextFieldOptionTagName Row 1
1515 * @return javax.swing.JTextField
1517 private JTextField
getJTextFieldTagName() {
1518 if (jTextFieldTagName
== null) {
1519 jTextFieldTagName
= new JTextField();
1520 jTextFieldTagName
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowOne
, fieldWidth
, oneRowHeight
));
1521 jTextFieldTagName
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1522 jTextFieldTagName
.setLocation(new java
.awt
.Point(fieldColumn
, rowOne
));
1524 return jTextFieldTagName
;
1528 * This method initializes jTextFieldBuildTargets Row 2
1530 * @return javax.swing.JTextField jTextFieldBuildTargets
1532 private JTextField
getJTextFieldBuildTargets() {
1533 if (jTextFieldBuildTargets
== null) {
1534 jTextFieldBuildTargets
= new JTextField();
1535 jTextFieldBuildTargets
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowTwo
, fieldWidth
, oneRowHeight
));
1536 jTextFieldBuildTargets
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1537 jTextFieldBuildTargets
.setLocation(new java
.awt
.Point(fieldColumn
, rowTwo
));
1539 return jTextFieldBuildTargets
;
1543 * This method initializes jTextFieldToolCmd Row 3
1545 * This should be a dropdown box of command codes from tools_def.txt
1547 * @return javax.swing.JTextField jTextFieldToolCmd
1549 private JTextField
getJTextFieldToolCmd() {
1550 if (jTextFieldToolCmd
== null) {
1551 jTextFieldToolCmd
= new JTextField();
1552 jTextFieldToolCmd
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowThree
, fieldWidth
, oneRowHeight
));
1553 jTextFieldToolCmd
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1554 jTextFieldToolCmd
.setLocation(new java
.awt
.Point(fieldColumn
, rowThree
));
1556 return jTextFieldToolCmd
;
1560 * This method initializes jArchitectureSelections Row 4
1562 * @return jArchitectureSelections
1564 private JPanel
getArchitectureSelections() {
1565 if (jArchitectureSelections
== null) {
1566 jArchitectureSelections
= new JPanel();
1567 jArchitectureSelections
.setLayout(null);
1568 jArchitectureSelections
.add(getJCheckBoxIA32(), null);
1569 jArchitectureSelections
.add(getJCheckBoxX64(), null);
1570 jArchitectureSelections
.add(getJCheckBoxIpf(), null);
1571 jArchitectureSelections
.add(getJCheckBoxEBC(), null);
1572 jArchitectureSelections
.add(getJCheckBoxARM(), null);
1573 jArchitectureSelections
.add(getJCheckBoxPPC(), null);
1574 jArchitectureSelections
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowFour
, fieldWidth
, oneRowHeight
));
1575 jArchitectureSelections
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1576 jArchitectureSelections
.setLocation(new java
.awt
.Point(fieldColumn
, rowFour
));
1578 return jArchitectureSelections
;
1582 * This method initializes jCheckBoxIA32
1584 * @return javax.swing.JCheckBox jCheckBoxIA32
1586 private JCheckBox
getJCheckBoxIA32() {
1587 if (jCheckBoxIA32
== null) {
1588 jCheckBoxIA32
= new JCheckBox();
1589 jCheckBoxIA32
.setBounds(new java
.awt
.Rectangle(0, 0, 55, 20));
1590 jCheckBoxIA32
.setText("IA32");
1592 return jCheckBoxIA32
;
1596 * This method initializes jCheckBoxX64
1598 * @return javax.swing.JCheckBox jCheckBoxX64
1600 private JCheckBox
getJCheckBoxX64() {
1601 if (jCheckBoxX64
== null) {
1602 jCheckBoxX64
= new JCheckBox();
1603 jCheckBoxX64
.setText("X64");
1604 jCheckBoxX64
.setBounds(new java
.awt
.Rectangle(55, 0, 53, 20));
1606 return jCheckBoxX64
;
1610 * This method initializes jCheckBoxIpf
1612 * @return javax.swing.JCheckBox jCheckBoxIpf
1614 private JCheckBox
getJCheckBoxIpf() {
1615 if (jCheckBoxIpf
== null) {
1616 jCheckBoxIpf
= new JCheckBox();
1617 jCheckBoxIpf
.setBounds(new java
.awt
.Rectangle(108, 0, 52, 20));
1618 jCheckBoxIpf
.setText("IPF");
1620 return jCheckBoxIpf
;
1625 * This method initializes jCheckBoxEBC
1627 * @return javax.swing.JCheckBox jCheckBoxEBC
1629 private JCheckBox
getJCheckBoxEBC() {
1630 if (jCheckBoxEBC
== null) {
1631 jCheckBoxEBC
= new JCheckBox();
1632 jCheckBoxEBC
.setBounds(new java
.awt
.Rectangle(160, 0, 53, 20));
1633 jCheckBoxEBC
.setText("EBC");
1635 return jCheckBoxEBC
;
1639 * This method initializes jCheckBoxARM
1641 * @return javax.swing.JCheckBox jCheckBoxARM
1643 private JCheckBox
getJCheckBoxARM() {
1644 if (jCheckBoxARM
== null) {
1645 jCheckBoxARM
= new JCheckBox();
1646 jCheckBoxARM
.setBounds(new java
.awt
.Rectangle(213, 0, 54, 20));
1647 jCheckBoxARM
.setText("ARM");
1649 return jCheckBoxARM
;
1653 * This method initializes jCheckBoxPPC
1655 * @return javax.swing.JCheckBox jCheckBoxPPC
1657 private JCheckBox
getJCheckBoxPPC() {
1658 if (jCheckBoxPPC
== null) {
1659 jCheckBoxPPC
= new JCheckBox();
1660 jCheckBoxPPC
.setBounds(new java
.awt
.Rectangle(267, 0, 53, 20));
1661 jCheckBoxPPC
.setText("PPC");
1663 return jCheckBoxPPC
;
1667 * This method initializes jTextFieldToolChainFamily Row 5
1669 * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
1671 * @return javax.swing.JTextField
1673 private JTextField
getJTextFieldToolChainFamily() {
1674 if (jTextFieldToolChainFamily
== null) {
1675 jTextFieldToolChainFamily
= new JTextField();
1676 jTextFieldToolChainFamily
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowFive
, fieldWidth
, oneRowHeight
));
1677 jTextFieldToolChainFamily
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1678 jTextFieldToolChainFamily
.setLocation(new java
.awt
.Point(fieldColumn
, rowFive
));
1680 return jTextFieldToolChainFamily
;
1684 * This method initializes jTextFieldOptionContents Row 6
1686 * This is where we should put the checkbox & entry data for the command arguments
1688 * @return javax.swing.JTextField
1690 private JTextField
getJTextFieldOptionContents() {
1691 if (jTextFieldOptionContents
== null) {
1692 jTextFieldOptionContents
= new JTextField();
1693 jTextFieldOptionContents
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1694 jTextFieldOptionContents
.setBounds(fieldColumn
, rowSix
, fieldWidth
, oneRowHeight
);
1695 jTextFieldOptionContents
.setLocation(new java
.awt
.Point(fieldColumn
, rowSix
));
1697 return jTextFieldOptionContents
;
1701 * This method initializes jButtonOptionsAdd
1703 * Add entry from the top screen to the table
1705 * @return javax.swing.JButton jButtonOptionsAdd
1707 private JButton
getJButtonOptionsAdd() {
1708 if (jButtonOptionsAdd
== null) {
1709 jButtonOptionsAdd
= new JButton();
1710 jButtonOptionsAdd
.setText("Add");
1712 jButtonOptionsAdd
.setPreferredSize(new java
.awt
.Dimension(buttonWidth
, oneRowHeight
));
1713 jButtonOptionsAdd
.setBounds(new java
.awt
.Rectangle(firstButtonLoc
, buttonRow
, buttonWidth
, oneRowHeight
));
1714 jButtonOptionsAdd
.setLocation(new java
.awt
.Point(firstButtonLoc
, buttonRow
));
1715 jButtonOptionsAdd
.addActionListener(new AbstractAction() {
1719 private static final long serialVersionUID
= 1L;
1721 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1722 boolean[] boolArray
= { jCheckBoxIA32
.isSelected(), jCheckBoxIpf
.isSelected(),
1723 jCheckBoxX64
.isSelected(), jCheckBoxEBC
.isSelected(),
1724 jCheckBoxARM
.isSelected(), jCheckBoxPPC
.isSelected() };
1725 String s
= boolToList(boolArray
);
1726 Object
[] o
= { jTextFieldBuildTargets
.getText(), jTextFieldToolChainFamily
.getText(), s
,
1727 jTextFieldToolCmd
.getText(), jTextFieldTagName
.getText(),
1728 jTextFieldOptionContents
.getText() };
1729 optionsTableModel
.addRow(o
);
1730 docConsole
.setSaved(false);
1731 ffc
.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets
.getText().trim()),
1732 jTextFieldToolChainFamily
.getText(), jTextFieldTagName
.getText(),
1733 jTextFieldToolCmd
.getText(), stringToVector(s
.trim()),
1734 jTextFieldOptionContents
.getText());
1738 return jButtonOptionsAdd
;
1742 * This method initializes jButtonOptionsDel
1744 * Remove a line from the table below
1746 * @return javax.swing.JButton jButtonOptionsDel
1748 private JButton
getJButtonOptionsDel() {
1749 if (jButtonOptionsDel
== null) {
1750 jButtonOptionsDel
= new JButton();
1751 jButtonOptionsDel
.setText("Delete");
1752 jButtonOptionsDel
.setPreferredSize(new java
.awt
.Dimension(buttonWidth
, oneRowHeight
));
1753 jButtonOptionsDel
.setBounds(new java
.awt
.Rectangle(next2LastButtonLoc
, buttonRow
, buttonWidth
, oneRowHeight
));
1754 jButtonOptionsDel
.setLocation(new java
.awt
.Point(next2LastButtonLoc
, buttonRow
));
1755 jButtonOptionsDel
.addActionListener(new AbstractAction() {
1759 private static final long serialVersionUID
= 1L;
1761 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1762 if (selectedRow
>= 0) {
1763 optionsTableModel
.removeRow(selectedRow
);
1764 docConsole
.setSaved(false);
1765 ffc
.removeBuildOptionsOpt(selectedRow
);
1770 return jButtonOptionsDel
;
1773 public void componentResized(ComponentEvent arg0
) {
1774 int intPreferredWidth
= 500;
1776 Tools
.resizeComponentWidth(this.jScrollPaneOptions
, this.getWidth(), intPreferredWidth
);
1780 * This method initializes jScrollPaneOptions
1781 * Contains the Table and is located below the data entry section
1782 * @return javax.swing.JScrollPane jScrollPaneOptoins
1784 private JScrollPane
getJScrollPaneOptions() {
1785 if (jScrollPaneOptions
== null) {
1786 jScrollPaneOptions
= new JScrollPane();
1787 jScrollPaneOptions
.setViewportView(getJTableOptions());
1789 return jScrollPaneOptions
;
1793 * This method initializes jTableOptions
1795 * @return javax.swing.JTable jTableOptions
1797 private JTable
getJTableOptions() {
1798 if (jTableOptions
== null) {
1800 optionsTableModel
= new DefaultTableModel();
1801 jTableOptions
= new JTable(optionsTableModel
);
1802 jTableOptions
.setRowHeight(20);
1803 optionsTableModel
.addColumn("Build Targets");
1804 optionsTableModel
.addColumn("Tool Chain Family");
1805 optionsTableModel
.addColumn("Supported Architectures");
1806 optionsTableModel
.addColumn("Tool Command Code");
1807 optionsTableModel
.addColumn("TagName");
1808 optionsTableModel
.addColumn("Arguments");
1810 jTableOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1811 jTableOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1812 jTableOptions
.getColumnModel().getColumn(2).setMinWidth(supportArchWidth
);
1813 jTableOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1814 jTableOptions
.getColumnModel().getColumn(4).setMinWidth(tagNameWidth
);
1815 jTableOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1817 // javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
1818 // JComboBox cb = new JComboBox();
1819 // cb.addItem("MSFT");
1820 // cb.addItem("GCC");
1821 // cb.addItem("CYGWIN");
1822 // cb.addItem("INTEL");
1823 // cb.addItem("USER_DEFINED");
1824 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1825 Vector
<String
> vArch
= new Vector
<String
>();
1832 jTableOptions
.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch
));
1834 jTableOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
1836 jTableOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1837 jTableOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1838 jTableOptions
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1839 public void valueChanged(ListSelectionEvent e
) {
1841 if (e
.getValueIsAdjusting()) {
1844 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
1845 if (lsm
.isSelectionEmpty()) {
1848 selectedRow
= lsm
.getMinSelectionIndex();
1853 jTableOptions
.getModel().addTableModelListener(new TableModelListener() {
1854 public void tableChanged(TableModelEvent arg0
) {
1855 // TODO Auto-generated method stub
1856 int row
= arg0
.getFirstRow();
1857 TableModel m
= (TableModel
) arg0
.getSource();
1858 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
1859 //ToDo Data Validition check.
1860 String targets
= m
.getValueAt(row
, 0) + "";
1861 Vector
<Object
> targetName
= new Vector
<Object
>();
1862 String
[] sArray
= targets
.split("( )+");
1863 for (int i
= 0; i
< sArray
.length
; ++i
) {
1864 targetName
.add(sArray
[i
]);
1866 String toolChain
= m
.getValueAt(row
, 1) + "";
1867 String archs
= m
.getValueAt(row
, 2) + "";
1868 Vector
<Object
> supArch
= null;
1869 if (archs
.length() > 0) {
1870 supArch
= new Vector
<Object
>();
1871 String
[] sArray1
= archs
.split("( )+");
1872 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1873 supArch
.add(sArray1
[i
]);
1877 String toolCmd
= m
.getValueAt(row
, 3) + "";
1878 String tagName
= m
.getValueAt(row
, 4) + "";
1879 String contents
= m
.getValueAt(row
, 5) + "";
1880 docConsole
.setSaved(false);
1881 ffc
.updateBuildOptionsOpt(row
, targetName
, toolChain
, tagName
, toolCmd
, supArch
, contents
);
1886 return jTableOptions
;
1889 private Vector
<Object
> stringToVector(String s
) {
1890 String
[] sArray
= s
.split(" ");
1891 Vector
<Object
> v
= null;
1892 if (s
.length() > 0 && !s
.trim().equalsIgnoreCase("")) {
1893 v
= new Vector
<Object
>();
1894 for (int i
= 0; i
< sArray
.length
; ++i
) {
1901 private String
boolToList(boolean[] bool
) {
1925 private void initOptionTable() {
1926 if (ffc
.getBuildOptionsOptCount() == 0) {
1927 //ToDo get default options from *.txt file
1930 String
[][] saa
= new String
[ffc
.getBuildOptionsOptCount()][6];
1931 ffc
.getBuildOptionsOpts(saa
);
1932 for (int i
= 0; i
< saa
.length
; ++i
) {
1933 optionsTableModel
.addRow(saa
[i
]);
1939 * Everything below should pertain to the ANT Task Tab
1943 * This method initializes jButton12
1945 * @return javax.swing.JButton
1947 private JButton
getJButtonAntTaskFileBrowse() {
1948 if (jButtonAntTaskFileBrowse
== null) {
1949 jButtonAntTaskFileBrowse
= new JButton();
1950 jButtonAntTaskFileBrowse
.setPreferredSize(new Dimension(buttonWidth
, oneRowHeight
));
1951 jButtonAntTaskFileBrowse
.setText("Browse");
1952 jButtonAntTaskFileBrowse
.addActionListener(new AbstractAction() {
1953 private static final long serialVersionUID
= 1L;
1955 public void actionPerformed(ActionEvent arg0
) {
1957 // Select files from current workspace
1959 String dirPrefix
= System
.getenv("WORKSPACE");
1960 JFileChooser chooser
= new JFileChooser(dirPrefix
);
1961 File theFile
= null;
1962 String headerDest
= null;
1964 chooser
.setMultiSelectionEnabled(false);
1965 chooser
.setFileSelectionMode(JFileChooser
.FILES_ONLY
);
1966 int retval
= chooser
.showOpenDialog(frame
);
1967 if (retval
== JFileChooser
.APPROVE_OPTION
) {
1969 theFile
= chooser
.getSelectedFile();
1970 String file
= theFile
.getPath();
1971 if (!file
.startsWith(dirPrefix
)) {
1972 JOptionPane
.showMessageDialog(frame
, "You can only select files in current package!");
1979 headerDest
= theFile
.getPath();
1980 jTextFieldAntTaskFile
.setText(headerDest
.substring(dirPrefix
.length()).replace('\\', '/'));
1986 return jButtonAntTaskFileBrowse
;
1990 * This method initializes jPanelUserDefCenterN
1992 * @return javax.swing.JPanel
1994 private JPanel
getJPanelUserDefCenterN() {
1995 if (jPanelUserDefCenterN
== null) {
1996 jPanelUserDefCenterN
= new JPanel();
1997 jPanelUserDefCenterN
.add(jLabelAntCmdOpts
, null);
1998 jPanelUserDefCenterN
.add(getJTextFieldAntCmdOpts(), null);
1999 jPanelUserDefCenterN
.add(getJButtonAntTaskAdd(), null);
2000 jPanelUserDefCenterN
.add(getJButtonAntTaskDel(), null);
2002 return jPanelUserDefCenterN
;
2006 * This method initializes jPanel8
2008 * @return javax.swing.JPanel
2010 private JPanel
getJPanelUserDef() {
2011 if (jPanelUserDef
== null) {
2012 jPanelUserDef
= new JPanel();
2013 jPanelUserDef
.setLayout(new BorderLayout());
2014 jPanelUserDef
.add(getJPanelUserDefNorth(), java
.awt
.BorderLayout
.NORTH
);
2015 jPanelUserDef
.add(getJPanelUserDefCenter(), java
.awt
.BorderLayout
.CENTER
);
2018 return jPanelUserDef
;
2022 * This method initializes jPanel9
2024 * @return javax.swing.JPanel
2026 private JPanel
getJPanelUserDefNorth() {
2027 if (jPanelUserDefNorth
== null) {
2028 jLabelAntTaskFile
= new JLabel();
2029 jLabelAntTaskFile
.setText("ANT Task File");
2030 jLabelAntTaskFile
.setPreferredSize(new java
.awt
.Dimension(80, 20));
2031 FlowLayout flowLayout8
= new FlowLayout();
2032 flowLayout8
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
2033 jLabelAntTaskId
= new JLabel();
2034 jLabelAntTaskId
.setText("ID");
2035 jPanelUserDefNorth
= new JPanel();
2036 jPanelUserDefNorth
.setLayout(flowLayout8
);
2037 jPanelUserDefNorth
.add(jLabelAntTaskFile
, null);
2038 jPanelUserDefNorth
.add(getJTextFieldAntTaskFile(), null);
2039 jPanelUserDefNorth
.add(getJButtonAntTaskFileBrowse(), null);
2040 jPanelUserDefNorth
.add(jLabelAntTaskId
, null);
2041 jPanelUserDefNorth
.add(getJTextFieldAntTaskId(), null);
2043 return jPanelUserDefNorth
;
2047 * This method initializes jPanel11
2049 * @return javax.swing.JPanel
2051 private JPanel
getJPanelUserDefCenter() {
2052 if (jPanelUserDefCenter
== null) {
2053 jLabelAntCmdOpts
= new JLabel();
2054 jLabelAntCmdOpts
.setText("ANT Command Options");
2055 jLabelAntCmdOpts
.setPreferredSize(new java
.awt
.Dimension(131, 20));
2056 jPanelUserDefCenter
= new JPanel();
2057 jPanelUserDefCenter
.setLayout(new BorderLayout());
2059 jPanelUserDefCenter
.add(getJPanelUserDefCenterN(), java
.awt
.BorderLayout
.NORTH
);
2060 jPanelUserDefCenter
.add(getJScrollPaneAntTasks(), java
.awt
.BorderLayout
.CENTER
);
2062 return jPanelUserDefCenter
;
2066 * This method initializes jTextField2
2068 * @return javax.swing.JTextField
2070 private JTextField
getJTextFieldAntTaskFile() {
2071 if (jTextFieldAntTaskFile
== null) {
2072 jTextFieldAntTaskFile
= new JTextField();
2073 jTextFieldAntTaskFile
.setPreferredSize(new java
.awt
.Dimension(200, 20));
2075 return jTextFieldAntTaskFile
;
2079 * This method initializes jTextField3
2081 * @return javax.swing.JTextField
2083 private JTextField
getJTextFieldAntTaskId() {
2084 if (jTextFieldAntTaskId
== null) {
2085 jTextFieldAntTaskId
= new JTextField();
2086 jTextFieldAntTaskId
.setPreferredSize(new java
.awt
.Dimension(100, 20));
2088 return jTextFieldAntTaskId
;
2092 * This method initializes jButton4
2094 * @return javax.swing.JButton
2096 private JButton
getJButtonAntTaskAdd() {
2097 if (jButtonAntTaskAdd
== null) {
2098 jButtonAntTaskAdd
= new JButton();
2099 jButtonAntTaskAdd
.setPreferredSize(new java
.awt
.Dimension(90, 20));
2100 jButtonAntTaskAdd
.setText("Add");
2101 jButtonAntTaskAdd
.addActionListener(new ActionListener() {
2102 public void actionPerformed(ActionEvent e
) {
2103 if (!DataValidation
.isInt(jTextFieldAntTaskId
.getText())
2104 || jTextFieldAntTaskId
.getText().length() != 8) {
2105 JOptionPane
.showMessageDialog(frame
, "ID must be an 8-digit integer.");
2108 Object
[] o
= { jTextFieldAntTaskId
.getText(), null, null };
2109 o
[1] = jTextFieldAntTaskFile
.getText();
2110 o
[2] = jTextFieldAntCmdOpts
.getText();
2111 ffc
.genBuildOptionsUserDefAntTask(o
[0] + "", o
[1] + "", o
[2] + "");
2112 antTaskTableModel
.addRow(o
);
2113 docConsole
.setSaved(false);
2117 return jButtonAntTaskAdd
;
2121 * This method initializes jButton5
2123 * @return javax.swing.JButton
2125 private JButton
getJButtonAntTaskDel() {
2126 if (jButtonAntTaskDel
== null) {
2127 jButtonAntTaskDel
= new JButton();
2128 jButtonAntTaskDel
.setPreferredSize(new java
.awt
.Dimension(90, 20));
2129 jButtonAntTaskDel
.setText("Delete");
2130 jButtonAntTaskDel
.addActionListener(new ActionListener() {
2131 public void actionPerformed(ActionEvent e
) {
2132 if (selectedRow
>= 0) {
2133 docConsole
.setSaved(false);
2134 antTaskTableModel
.removeRow(selectedRow
);
2135 ffc
.removeBuildOptionsUserDefAntTask(selectedRow
);
2140 return jButtonAntTaskDel
;
2144 * This method initializes jTextField4
2146 * @return javax.swing.JTextField
2148 private JTextField
getJTextFieldAntCmdOpts() {
2149 if (jTextFieldAntCmdOpts
== null) {
2150 jTextFieldAntCmdOpts
= new JTextField();
2151 jTextFieldAntCmdOpts
.setPreferredSize(new java
.awt
.Dimension(270, 20));
2152 jTextFieldAntCmdOpts
.setEnabled(true);
2154 return jTextFieldAntCmdOpts
;
2158 * This method initializes jScrollPane2
2160 * @return javax.swing.JScrollPane
2162 private JScrollPane
getJScrollPaneAntTasks() {
2163 if (jScrollPaneAntTasks
== null) {
2164 jScrollPaneAntTasks
= new JScrollPane();
2165 jScrollPaneAntTasks
.setPreferredSize(new java
.awt
.Dimension(600, 400));
2166 jScrollPaneAntTasks
.setViewportView(getJTableAntTasks());
2168 return jScrollPaneAntTasks
;
2172 * This method initializes jTable2
2174 * @return javax.swing.JTable
2176 private JTable
getJTableAntTasks() {
2177 if (jTableAntTasks
== null) {
2178 antTaskTableModel
= new DefaultTableModel();
2179 jTableAntTasks
= new JTable(antTaskTableModel
);
2180 jTableAntTasks
.setRowHeight(20);
2181 antTaskTableModel
.addColumn("ID");
2182 antTaskTableModel
.addColumn("Filename");
2183 antTaskTableModel
.addColumn("ANT Command Options");
2185 jTableAntTasks
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
2186 jTableAntTasks
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
2187 public void valueChanged(ListSelectionEvent e
) {
2189 if (e
.getValueIsAdjusting()) {
2192 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
2193 if (lsm
.isSelectionEmpty()) {
2196 selectedRow
= lsm
.getMinSelectionIndex();
2201 jTableAntTasks
.getModel().addTableModelListener(new TableModelListener() {
2202 public void tableChanged(TableModelEvent arg0
) {
2203 // TODO Auto-generated method stub
2204 int row
= arg0
.getFirstRow();
2205 TableModel m
= (TableModel
) arg0
.getSource();
2206 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
2207 //ToDo Data Validition check.
2208 String id
= m
.getValueAt(row
, 0) + "";
2209 String file
= m
.getValueAt(row
, 1) + "";
2210 String execOrder
= m
.getValueAt(row
, 2) + "";
2211 if (id
.length() == 0) {
2214 if (file
.length() == 0 && execOrder
.length() == 0) {
2217 if (file
.length() == 0) {
2220 if (execOrder
.length() == 0) {
2223 ffc
.updateBuildOptionsUserDefAntTask(row
, id
, file
, execOrder
);
2229 return jTableAntTasks
;
2232 private void initAntTaskTable() {
2233 if (ffc
.getBuildOptionsUserDefAntTaskCount() == 0) {
2236 String
[][] saa
= new String
[ffc
.getBuildOptionsUserDefAntTaskCount()][3];
2237 ffc
.getBuildOptionsUserDefAntTasks(saa
);
2238 for (int i
= 0; i
< saa
.length
; ++i
) {
2239 antTaskTableModel
.addRow(saa
[i
]);
2243 } // @jve:decl-index=0:visual-constraint="10,10"