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
.JOptionPane
;
32 import javax
.swing
.JTextField
;
33 import javax
.swing
.JButton
;
34 import javax
.swing
.JScrollPane
;
35 import javax
.swing
.JTable
;
36 import javax
.swing
.JComboBox
;
37 import javax
.swing
.ListSelectionModel
;
38 import javax
.swing
.event
.DocumentEvent
;
39 import javax
.swing
.event
.DocumentListener
;
40 import javax
.swing
.event
.InternalFrameAdapter
;
41 import javax
.swing
.event
.InternalFrameEvent
;
42 import javax
.swing
.event
.ListSelectionEvent
;
43 import javax
.swing
.event
.ListSelectionListener
;
44 import javax
.swing
.event
.TableModelEvent
;
45 import javax
.swing
.event
.TableModelListener
;
46 import javax
.swing
.table
.DefaultTableModel
;
47 import javax
.swing
.table
.TableModel
;
49 import org
.tianocore
.PlatformSurfaceAreaDocument
;
50 import org
.tianocore
.frameworkwizard
.FrameworkWizardUI
;
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;
115 private JPanel jContentPane
= null;
117 // private JPanel jPanelContentSouth = null;
119 // private JPanel jPanelContentNorth = null;
121 // private JPanel jPanelContentWest = null;
123 // private JPanel jPanelContentEast = null;
125 private JTabbedPane jTabbedPane
= null;
127 private JPanel jPanelUserDef
= null;
129 private JPanel jPanelUserDefNorth
= null;
131 private JPanel jPanelUserDefCenter
= null;
133 private JTextField jTextFieldAntTaskFile
= null;
135 private JLabel jLabelAntTaskId
= null;
137 private JTextField jTextFieldAntTaskId
= null;
139 private JButton jButtonAntTaskAdd
= null;
141 private JButton jButtonAntTaskDel
= null;
143 private JTextField jTextFieldAntCmdOpts
= null;
145 private JScrollPane jScrollPaneAntTasks
= null;
147 private JTable jTableAntTasks
= null;
149 private DefaultTableModel ffsTableModel
= null;
151 private DefaultTableModel sectionsTableModel
= null;
153 private DefaultTableModel sectionTableModel
= null;
155 private DefaultTableModel subsectionsTableModel
= null;
157 private DefaultTableModel antTaskTableModel
= null;
159 private DefaultTableModel ffsAttributesTableModel
= null;
161 private DefaultTableModel optionsTableModel
= null;
163 private JPanel jPanelFfsTab
= null;
165 private JPanel jPanelFfsTabCenter
= null;
167 private JPanel jPanelFfsTabCenterN
= null;
169 private JPanel jPanelFfsTabCenterS
= null;
171 private JButton jButtonFfsAdd
= null;
173 private JButton jButtonFfsDel
= null;
175 private JScrollPane jScrollPaneFfsAttribs
= null;
177 private JTable jTableFfsAttribs
= null;
179 private JPanel jPanelOptionsTab
= null;
181 private JLabel jLabelOptionContents
= null;
183 private JTextField jTextFieldOptionContents
= null;
185 private JLabel jLabelToolChainFamily
= null;
187 private JLabel jLabelSupArch
= null;
189 private JLabel jLabelToolCmd
= null;
191 private JTextField jTextFieldToolCmd
= null;
193 private JScrollPane jScrollPaneOptions
= null;
195 private JTable jTableOptions
= null;
197 private JButton jButtonOptionsAdd
= null;
199 private JButton jButtonOptionsDel
= null;
201 private JButton jButtonFfsAttribNew
= null;
203 private JButton jButtonFfsAttribRemove
= null;
205 private FpdFileContents ffc
= null;
207 private OpeningPlatformType docConsole
= null;
209 private JPanel jArchitectureSelections
= null;
211 private JCheckBox jCheckBoxIA32
= null;
213 private JCheckBox jCheckBoxIpf
= null;
215 private JCheckBox jCheckBoxX64
= null;
217 private JCheckBox jCheckBoxEBC
= null;
219 private JCheckBox jCheckBoxARM
= null;
221 private JCheckBox jCheckBoxPPC
= null;
223 private JLabel jLabelBuildTargets
= null;
225 private JTextField jTextFieldBuildTargets
= null;
227 private JTextField jTextFieldTagName
= null;
229 private JLabel jLabelTagName
= null;
231 private int selectedRow
= -1;
233 private JLabel jLabelAntTaskFile
= null;
235 private JLabel jLabelAntCmdOpts
= null;
237 private JScrollPane jScrollPaneFfs
= null;
239 private JTable jTableFfs
= null;
241 private JLabel jLabelFfsSection
= null;
243 private JScrollPane jScrollPaneFfsSection
= null;
245 private JTable jTableFfsSection
= null;
247 private JLabel jLabelFfsSubSections
= null;
249 private JScrollPane jScrollPaneFfsSubSection
= null;
251 private JTable jTableFfsSubSection
= null;
253 private JLabel jLabelEncapType
= null;
255 private JTextField jTextFieldEncapType
= null;
257 private JPanel jPanelFfsAttribButtonGroup
= null;
259 private JLabel jLabelFfsAttribs
= null;
261 private JButton jButtonFfsSectionNew
= null;
263 private JButton jButtonFfsSectionRemove
= null;
265 private JButton jButtonFfsSubSectionNew
= null;
267 private JButton jButtonFfsSubSectionRemove
= null;
269 private JLabel jLabelFfsSections
= null;
271 private JButton jButtonFfsSectionsNew
= null;
273 private JButton jButtonFfsSectionsRemove
= null;
275 private JScrollPane jScrollPaneFfsSections
= null;
277 private JTable jTableFfsSections
= null;
279 private JButton jButtonAntTaskFileBrowse
= null;
281 private JTextField jTextFieldToolChainFamily
= null;
283 private JSplitPane jSplitPaneFfsC
= null;
285 private JPanel jPanelFfsCTop
= null;
287 private JSplitPane jSplitPaneFfsCBottom
= null;
289 private JPanel jPanelFfsCBottomTop
= null;
291 private JPanel jPanelFfsCBottomBottom
= null;
293 private JPanel jPanelSectionN
= null;
295 private JPanel jPanelSectionsN
= null;
297 private JPanel jPanelSubSectionN
= null;
299 private JPanel jPanelOptionsContainer
= null;
301 private JPanel jPanelUserDefCenterN
= null;
303 private JPanel jPanelTableOptionsContainer
= null;
305 private JLabel jLabelTableOptionsTitle
= null;
307 private final int buildTargetWidth
= 150;
308 private final int toolChainFamilyWidth
= 150;
309 private final int supportArchWidth
= 150;
310 private final int toolCmdCodeWidth
= 200;
311 private final int tagNameWidth
= 150;
312 private final int argWidth
= 400;
314 private boolean ffsSelection
= false;
315 private int selectedFfsTableRow
= -1;
318 * This method initializes jPanel
320 * @return javax.swing.JPanel
321 private JPanel getJPanelContentSouth() {
322 if (jPanelContentSouth == null) {
323 jPanelContentSouth = new JPanel();
325 return jPanelContentSouth;
330 * This method initializes jPanel1
332 * @return javax.swing.JPanel
333 private JPanel getJPanelContentNorth() {
334 if (jPanelContentNorth == null) {
335 jPanelContentNorth = new JPanel();
337 return jPanelContentNorth;
342 * This method initializes jPanel2
344 * @return javax.swing.JPanel
345 private JPanel getJPanelContentWest() {
346 if (jPanelContentWest == null) {
347 jPanelContentWest = new JPanel();
349 return jPanelContentWest;
354 * This method initializes jPanel3
356 * @return javax.swing.JPanel
357 private JPanel getJPanelContentEast() {
358 if (jPanelContentEast == null) {
359 jPanelContentEast = new JPanel();
361 return jPanelContentEast;
366 * This method initializes jTabbedPane
368 * @return javax.swing.JTabbedPane
370 private JTabbedPane
getJTabbedPane() {
371 if (jTabbedPane
== null) {
372 jTabbedPane
= new JTabbedPane();
373 jTabbedPane
.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null);
374 jTabbedPane
.addTab("Customize Tool Chain Configurations", null, getJPanelOptionsTab(), null);
375 jTabbedPane
.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null);
381 * This method initializes this
385 private void initialize() {
386 this.setSize(722, 577);
387 this.setTitle("Platform Build Options");
388 this.setContentPane(getJContentPane());
392 * This method initializes jContentPane
394 * @return javax.swing.JPanel
396 private JPanel
getJContentPane() {
397 if (jContentPane
== null) {
398 jContentPane
= new JPanel();
399 jContentPane
.setLayout(new BorderLayout());
400 // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
401 // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
402 // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
403 // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
404 jContentPane
.add(getJTabbedPane(), java
.awt
.BorderLayout
.CENTER
);
410 * This method initializes jPanelTableOptionsContainer
412 * @return javax.swing.JPanel
414 private JPanel
getJPanelTableOptionsContainer() {
415 if (jPanelTableOptionsContainer
== null) {
416 jLabelTableOptionsTitle
= new JLabel();
417 jLabelTableOptionsTitle
.setText(" Current Argument Lines");
418 jPanelTableOptionsContainer
= new JPanel();
419 jPanelTableOptionsContainer
.setLayout(new BorderLayout());
420 jPanelTableOptionsContainer
.add(jLabelTableOptionsTitle
, java
.awt
.BorderLayout
.NORTH
);
421 jPanelTableOptionsContainer
.add(getJScrollPaneOptions(), java
.awt
.BorderLayout
.CENTER
);
423 return jPanelTableOptionsContainer
;
429 public static void main(String
[] args
) {
430 // TODO Auto-generated method stub
431 new FpdBuildOptions().setVisible(true);
435 * This is the default constructor
437 public FpdBuildOptions() {
440 this.setVisible(true);
443 public FpdBuildOptions(PlatformSurfaceAreaDocument
.PlatformSurfaceArea fpd
) {
445 ffc
= new FpdFileContents(fpd
);
449 public FpdBuildOptions(OpeningPlatformType opt
) {
450 this(opt
.getXmlFpd());
454 private void init(FpdFileContents ffc
) {
458 this.addInternalFrameListener(new InternalFrameAdapter() {
459 public void internalFrameDeactivated(InternalFrameEvent e
) {
460 if (jTableAntTasks
.isEditing()) {
461 jTableAntTasks
.getCellEditor().stopCellEditing();
463 if (jTableOptions
.isEditing()) {
464 jTableOptions
.getCellEditor().stopCellEditing();
466 stopEditingInTables ();
471 private void stopEditingInTables () {
472 if (jTableFfs
.isEditing()) {
473 jTableFfs
.getCellEditor().stopCellEditing();
475 if (jTableFfsSection
.isEditing()) {
476 jTableFfsSection
.getCellEditor().stopCellEditing();
478 if (jTableFfsSections
.isEditing()) {
479 jTableFfsSections
.getCellEditor().stopCellEditing();
481 if (jTableFfsSubSection
.isEditing()) {
482 jTableFfsSubSection
.getCellEditor().stopCellEditing();
484 if (jTableFfsAttribs
.isEditing()) {
485 jTableFfsAttribs
.getCellEditor().stopCellEditing();
490 * This method initializes jPanel13
492 * @return javax.swing.JPanel
494 private JPanel
getJPanelFfsTab() {
495 if (jPanelFfsTab
== null) {
496 jPanelFfsTab
= new JPanel();
497 jPanelFfsTab
.setLayout(new BorderLayout());
498 jPanelFfsTab
.add(getJPanelFfsTabCenter(), java
.awt
.BorderLayout
.CENTER
);
499 jPanelFfsTab
.add(getJScrollPaneFfs(), java
.awt
.BorderLayout
.WEST
);
505 * This method initializes jPanel18
507 * @return javax.swing.JPanel
509 private JPanel
getJPanelFfsTabCenter() {
510 if (jPanelFfsTabCenter
== null) {
511 jPanelFfsTabCenter
= new JPanel();
512 jPanelFfsTabCenter
.setLayout(new BorderLayout());
513 jPanelFfsTabCenter
.add(getJPanelFfsTabCenterN(), java
.awt
.BorderLayout
.NORTH
);
514 jPanelFfsTabCenter
.add(getJPanelFfsTabCenterS(), java
.awt
.BorderLayout
.SOUTH
);
515 jPanelFfsTabCenter
.add(getJSplitPaneFfsC(), java
.awt
.BorderLayout
.CENTER
);
517 return jPanelFfsTabCenter
;
521 * This method initializes jPanel15
523 * @return javax.swing.JPanel
525 private JPanel
getJPanelFfsTabCenterN() {
526 if (jPanelFfsTabCenterN
== null) {
527 jLabelEncapType
= new JLabel();
528 jLabelEncapType
.setText("Encapsulation Type");
529 FlowLayout flowLayout5
= new FlowLayout();
530 flowLayout5
.setAlignment(java
.awt
.FlowLayout
.RIGHT
);
532 jPanelFfsTabCenterN
= new JPanel();
533 jPanelFfsTabCenterN
.setLayout(flowLayout5
);
536 jPanelFfsTabCenterN
.add(jLabelEncapType
, null);
537 jPanelFfsTabCenterN
.add(getJTextFieldEncapType(), null);
538 jPanelFfsTabCenterN
.add(getJButtonFfsAdd(), null);
539 jPanelFfsTabCenterN
.add(getJButtonFfsDel(), null);
541 return jPanelFfsTabCenterN
;
545 * This method initializes jPanel16
547 * @return javax.swing.JPanel
549 private JPanel
getJPanelFfsTabCenterS() {
550 if (jPanelFfsTabCenterS
== null) {
551 jLabelFfsAttribs
= new JLabel();
552 jLabelFfsAttribs
.setText("Attributes");
553 jPanelFfsTabCenterS
= new JPanel();
554 jPanelFfsTabCenterS
.setPreferredSize(new java
.awt
.Dimension(491, 130));
555 jPanelFfsTabCenterS
.setLayout(new BorderLayout());
556 jPanelFfsTabCenterS
.add(jLabelFfsAttribs
, java
.awt
.BorderLayout
.WEST
);
557 jPanelFfsTabCenterS
.add(getJScrollPaneFfsAttribs(), java
.awt
.BorderLayout
.CENTER
);
558 jPanelFfsTabCenterS
.add(getJPanelFfsAttribButtonGroup(), java
.awt
.BorderLayout
.EAST
);
560 return jPanelFfsTabCenterS
;
564 * This method initializes jTextField6
566 * @return javax.swing.JTextField
571 * This method initializes jButton8
573 * @return javax.swing.JButton
575 private JButton
getJButtonFfsAdd() {
576 if (jButtonFfsAdd
== null) {
577 jButtonFfsAdd
= new JButton();
578 jButtonFfsAdd
.setPreferredSize(new java
.awt
.Dimension(70, 20));
579 jButtonFfsAdd
.setText("New");
580 jButtonFfsAdd
.addActionListener(new AbstractAction() {
584 private static final long serialVersionUID
= -2923720717273384221L;
586 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
588 String
[] row
= { "" };
589 ffsTableModel
.addRow(row
);
590 docConsole
.setSaved(false);
591 ffc
.genBuildOptionsFfs("", "");
592 jTableFfs
.changeSelection(ffsTableModel
.getRowCount()-1, 0, false, false);
597 return jButtonFfsAdd
;
601 * This method initializes jButton9
603 * @return javax.swing.JButton
605 private JButton
getJButtonFfsDel() {
606 if (jButtonFfsDel
== null) {
607 jButtonFfsDel
= new JButton();
608 jButtonFfsDel
.setPreferredSize(new java
.awt
.Dimension(70, 20));
609 jButtonFfsDel
.setText("Delete");
610 jButtonFfsDel
.addActionListener(new AbstractAction() {
614 private static final long serialVersionUID
= -4002678939178194476L;
616 public void actionPerformed(ActionEvent arg0
) {
617 if (jTableFfs
.getSelectedRow() < 0) {
620 stopEditingInTables();
621 docConsole
.setSaved(false);
622 ffc
.removeBuildOptionsFfs(jTableFfs
.getSelectedRow());
623 ffsTableModel
.removeRow(jTableFfs
.getSelectedRow());
624 sectionTableModel
.setRowCount(0);
625 sectionsTableModel
.setRowCount(0);
626 subsectionsTableModel
.setRowCount(0);
627 ffsAttributesTableModel
.setRowCount(0);
631 return jButtonFfsDel
;
635 * This method initializes jScrollPane5
637 * @return javax.swing.JScrollPane
639 private JScrollPane
getJScrollPaneFfsAttribs() {
640 if (jScrollPaneFfsAttribs
== null) {
641 jScrollPaneFfsAttribs
= new JScrollPane();
642 // jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
643 jScrollPaneFfsAttribs
.setViewportView(getJTableFfsAttribs());
646 return jScrollPaneFfsAttribs
;
650 * This method initializes jTable4
652 * @return javax.swing.JTable
654 private JTable
getJTableFfsAttribs() {
655 if (jTableFfsAttribs
== null) {
656 ffsAttributesTableModel
= new DefaultTableModel();
657 jTableFfsAttribs
= new JTable(ffsAttributesTableModel
);
658 // jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
659 jTableFfsAttribs
.setRowHeight(20);
660 ffsAttributesTableModel
.addColumn("Name");
661 ffsAttributesTableModel
.addColumn("Value");
663 jTableFfsAttribs
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
664 jTableFfsAttribs
.getModel().addTableModelListener(new TableModelListener() {
665 public void tableChanged(TableModelEvent arg0
) {
666 // TODO Auto-generated method stub
667 int row
= arg0
.getFirstRow();
668 TableModel m
= (TableModel
) arg0
.getSource();
669 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
670 //ToDo Data Validition check.
671 String name
= m
.getValueAt(row
, 0) + "";
672 String value
= m
.getValueAt(row
, 1) + "";
674 if (name
.length() == 0) {
677 if (value
.length() == 0) {
680 docConsole
.setSaved(false);
681 ffc
.updateBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(), row
, name
, value
);
686 return jTableFfsAttribs
;
689 private void initFfsTable() {
690 int ffsCount
= ffc
.getBuildOptionsFfsCount();
694 String
[][] saa
= new String
[ffsCount
][1];
695 ffc
.getBuildOptionsFfsKey(saa
);
696 for (int i
= 0; i
< saa
.length
; ++i
) {
697 ffsTableModel
.addRow(saa
[i
]);
699 jTableFfs
.changeSelection(0, 0, false, false);
703 * This method initializes jButton17
705 * @return javax.swing.JButton
707 private JButton
getJButtonFfsAttribNew() {
708 if (jButtonFfsAttribNew
== null) {
709 jButtonFfsAttribNew
= new JButton();
710 jButtonFfsAttribNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
711 jButtonFfsAttribNew
.setText("New");
712 jButtonFfsAttribNew
.addActionListener(new AbstractAction() {
716 private static final long serialVersionUID
= 1L;
718 public void actionPerformed(ActionEvent arg0
) {
719 if (jTableFfs
.getSelectedRow() < 0) {
722 Object
[] o
= { "", "" };
723 ffsAttributesTableModel
.addRow(o
);
724 docConsole
.setSaved(false);
725 ffc
.genBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(), "", "");
729 return jButtonFfsAttribNew
;
733 * This method initializes jButton18
735 * @return javax.swing.JButton
737 private JButton
getJButtonFfsAttribRemove() {
738 if (jButtonFfsAttribRemove
== null) {
739 jButtonFfsAttribRemove
= new JButton();
740 jButtonFfsAttribRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
741 jButtonFfsAttribRemove
.setText("Remove");
742 jButtonFfsAttribRemove
.addActionListener(new AbstractAction() {
746 private static final long serialVersionUID
= 1L;
748 public void actionPerformed(ActionEvent arg0
) {
749 if (jTableFfs
.getSelectedRow() < 0) {
752 stopEditingInTables();
753 if (jTableFfsAttribs
.getSelectedRow() >= 0) {
754 docConsole
.setSaved(false);
755 ffsAttributesTableModel
.removeRow(jTableFfsAttribs
.getSelectedRow());
756 ffc
.removeBuildOptionsFfsAttribute(jTableFfs
.getSelectedRow(),
757 jTableFfsAttribs
.getSelectedRow());
762 return jButtonFfsAttribRemove
;
766 * This method initializes jScrollPane
768 * @return javax.swing.JScrollPane
770 private JScrollPane
getJScrollPaneFfs() {
771 if (jScrollPaneFfs
== null) {
772 jScrollPaneFfs
= new JScrollPane();
773 jScrollPaneFfs
.setPreferredSize(new java
.awt
.Dimension(200,419));
774 jScrollPaneFfs
.setViewportView(getJTableFfs());
776 return jScrollPaneFfs
;
780 * This method initializes jTable
782 * @return javax.swing.JTable
784 private JTable
getJTableFfs() {
785 if (jTableFfs
== null) {
786 ffsTableModel
= new DefaultTableModel();
787 ffsTableModel
.addColumn("FFS Type");
788 jTableFfs
= new JTable(ffsTableModel
);
789 jTableFfs
.setShowGrid(false);
790 jTableFfs
.setRowHeight(20);
792 jTableFfs
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
793 jTableFfs
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
794 public void valueChanged(ListSelectionEvent e
) {
796 if (e
.getValueIsAdjusting()) {
799 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
800 if (lsm
.isSelectionEmpty()) {
803 int row
= lsm
.getMinSelectionIndex();
804 sectionTableModel
.setRowCount(0);
805 sectionsTableModel
.setRowCount(0);
806 subsectionsTableModel
.setRowCount(0);
807 ffsAttributesTableModel
.setRowCount(0);
808 String
[] sArray
= { "", "" };
809 LinkedHashMap
<String
, String
> lhm
= new LinkedHashMap
<String
, String
>();
810 ArrayList
<String
> alSections
= new ArrayList
<String
>();
811 ArrayList
<String
> alSection
= new ArrayList
<String
>();
812 ffc
.getBuildOptionsFfs(row
, sArray
, lhm
, alSections
, alSection
);
814 jTextFieldEncapType
.setText(sArray
[1]);
815 ffsSelection
= false;
816 for (int i
= 0; i
< alSection
.size(); ++i
) {
817 String
[] sectionRow
= { alSection
.get(i
) };
818 sectionTableModel
.addRow(sectionRow
);
820 for (int j
= 0; j
< alSections
.size(); ++j
) {
821 String
[] sectionsRow
= { alSections
.get(j
) };
822 sectionsTableModel
.addRow(sectionsRow
);
824 if (lhm
.size() <= 0) {
827 Set
<String
> keySet
= lhm
.keySet();
828 Iterator
<String
> is
= keySet
.iterator();
829 while (is
.hasNext()) {
830 String key
= is
.next();
831 String
[] attribRow
= { key
, lhm
.get(key
) };
832 ffsAttributesTableModel
.addRow(attribRow
);
834 selectedFfsTableRow
= row
;
839 jTableFfs
.getModel().addTableModelListener(new TableModelListener() {
840 public void tableChanged(TableModelEvent arg0
) {
841 // TODO Auto-generated method stub
842 int row
= arg0
.getFirstRow();
843 TableModel m
= (TableModel
) arg0
.getSource();
844 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
845 //ToDo Data Validition check.
846 String id
= m
.getValueAt(row
, 0) + "";
848 if (id
.length() == 0) {
851 docConsole
.setSaved(false);
852 ffc
.updateBuildOptionsFfsKey(row
, id
);
861 * This method initializes jScrollPane1
863 * @return javax.swing.JScrollPane
865 private JScrollPane
getJScrollPaneFfsSection() {
866 if (jScrollPaneFfsSection
== null) {
867 jScrollPaneFfsSection
= new JScrollPane();
868 // jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
869 jScrollPaneFfsSection
.setViewportView(getJTableFfsSection());
871 return jScrollPaneFfsSection
;
875 * This method initializes jTable1
877 * @return javax.swing.JTable
879 private JTable
getJTableFfsSection() {
880 if (jTableFfsSection
== null) {
881 sectionTableModel
= new DefaultTableModel();
882 sectionTableModel
.addColumn("SectionType");
884 jTableFfsSection
= new JTable(sectionTableModel
);
885 jTableFfsSection
.setRowHeight(20);
886 JComboBox cb
= new JComboBox();
887 cb
.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
888 cb
.addItem("EFI_SECTION_VERSION");
889 cb
.addItem("EFI_SECTION_USER_INTERFACE");
890 cb
.addItem("EFI_SECTION_DXE_DEPEX");
891 cb
.addItem("EFI_SECTION_PEI_DEPEX");
892 cb
.addItem("EFI_SECTION_PE32");
893 cb
.addItem("EFI_SECTION_PIC");
894 cb
.addItem("EFI_SECTION_TE");
895 cb
.addItem("EFI_SECTION_RAW");
896 cb
.addItem("EFI_SECTION_COMPRESSION");
897 cb
.addItem("EFI_SECTION_GUID_DEFINED");
898 cb
.addItem("EFI_SECTION_COMPATIBILITY16");
899 cb
.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
900 jTableFfsSection
.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb
));
902 jTableFfsSection
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
904 jTableFfsSection
.getModel().addTableModelListener(new TableModelListener() {
905 public void tableChanged(TableModelEvent arg0
) {
906 // TODO Auto-generated method stub
907 if (jTableFfs
.getSelectedRow() < 0) {
910 int row
= arg0
.getFirstRow();
911 TableModel m
= (TableModel
) arg0
.getSource();
912 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
913 //ToDo Data Validition check.
914 String type
= m
.getValueAt(row
, 0) + "";
915 docConsole
.setSaved(false);
916 ffc
.updateBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(), row
, type
);
921 return jTableFfsSection
;
925 * This method initializes jScrollPane3
927 * @return javax.swing.JScrollPane
929 private JScrollPane
getJScrollPaneFfsSubSection() {
930 if (jScrollPaneFfsSubSection
== null) {
931 jScrollPaneFfsSubSection
= new JScrollPane();
932 // jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
933 jScrollPaneFfsSubSection
.setViewportView(getJTableFfsSubSection());
935 return jScrollPaneFfsSubSection
;
939 * This method initializes jTable3
941 * @return javax.swing.JTable
943 private JTable
getJTableFfsSubSection() {
944 if (jTableFfsSubSection
== null) {
945 subsectionsTableModel
= new DefaultTableModel();
946 subsectionsTableModel
.addColumn("SectionType");
947 jTableFfsSubSection
= new JTable(subsectionsTableModel
);
948 jTableFfsSubSection
.setRowHeight(20);
949 JComboBox cb
= new JComboBox();
950 cb
.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
951 cb
.addItem("EFI_SECTION_VERSION");
952 cb
.addItem("EFI_SECTION_USER_INTERFACE");
953 cb
.addItem("EFI_SECTION_DXE_DEPEX");
954 cb
.addItem("EFI_SECTION_PEI_DEPEX");
955 cb
.addItem("EFI_SECTION_PE32");
956 cb
.addItem("EFI_SECTION_PIC");
957 cb
.addItem("EFI_SECTION_TE");
958 cb
.addItem("EFI_SECTION_RAW");
959 cb
.addItem("EFI_SECTION_COMPRESSION");
960 cb
.addItem("EFI_SECTION_GUID_DEFINED");
961 cb
.addItem("EFI_SECTION_COMPATIBILITY16");
962 cb
.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
963 jTableFfsSubSection
.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb
));
964 jTableFfsSubSection
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
966 jTableFfsSubSection
.getModel().addTableModelListener(new TableModelListener() {
967 public void tableChanged(TableModelEvent arg0
) {
968 // TODO Auto-generated method stub
969 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
972 int row
= arg0
.getFirstRow();
973 TableModel m
= (TableModel
) arg0
.getSource();
974 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
975 //ToDo Data Validition check.
976 String type
= m
.getValueAt(row
, 0) + "";
977 docConsole
.setSaved(false);
978 ffc
.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(),
979 jTableFfsSections
.getSelectedRow(), row
, type
);
984 return jTableFfsSubSection
;
988 * This method initializes jTextField
990 * @return javax.swing.JTextField
992 private JTextField
getJTextFieldEncapType() {
993 if (jTextFieldEncapType
== null) {
994 jTextFieldEncapType
= new JTextField();
995 jTextFieldEncapType
.setPreferredSize(new java
.awt
.Dimension(200,20));
996 jTextFieldEncapType
.getDocument().addDocumentListener(new DocumentListener() {
998 public void insertUpdate(DocumentEvent arg0
) {
1000 // ffsSelection = false;
1003 if (docConsole
!= null) {
1004 docConsole
.setSaved(false);
1008 public void removeUpdate(DocumentEvent arg0
) {
1010 // ffsSelection = false;
1013 if (docConsole
!= null) {
1014 docConsole
.setSaved(false);
1018 public void changedUpdate(DocumentEvent arg0
) {
1019 // TODO Auto-generated method stub
1024 jTextFieldEncapType
.addFocusListener(new java
.awt
.event
.FocusAdapter() {
1025 public void focusLost(java
.awt
.event
.FocusEvent e
) {
1026 if (selectedFfsTableRow
< 0) {
1029 ffc
.updateBuildOptionsFfsSectionsType(selectedFfsTableRow
, jTextFieldEncapType
.getText());
1034 return jTextFieldEncapType
;
1038 * This method initializes jPanel4
1040 * @return javax.swing.JPanel
1042 private JPanel
getJPanelFfsAttribButtonGroup() {
1043 if (jPanelFfsAttribButtonGroup
== null) {
1044 jPanelFfsAttribButtonGroup
= new JPanel();
1045 jPanelFfsAttribButtonGroup
.setPreferredSize(new java
.awt
.Dimension(100, 100));
1046 jPanelFfsAttribButtonGroup
.add(getJButtonFfsAttribNew(), null);
1047 jPanelFfsAttribButtonGroup
.add(getJButtonFfsAttribRemove(), null);
1049 return jPanelFfsAttribButtonGroup
;
1053 * This method initializes jButton
1055 * @return javax.swing.JButton
1057 private JButton
getJButtonFfsSectionNew() {
1058 if (jButtonFfsSectionNew
== null) {
1059 jButtonFfsSectionNew
= new JButton();
1060 jButtonFfsSectionNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1061 jButtonFfsSectionNew
.setText("New");
1062 jButtonFfsSectionNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1063 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1064 if (jTableFfs
.getSelectedRow() < 0) {
1067 docConsole
.setSaved(false);
1068 String
[] row
= { "EFI_SECTION_RAW" };
1069 sectionTableModel
.addRow(row
);
1070 ffc
.genBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(), row
[0]);
1074 return jButtonFfsSectionNew
;
1078 * This method initializes jButton1
1080 * @return javax.swing.JButton
1082 private JButton
getJButtonFfsSectionRemove() {
1083 if (jButtonFfsSectionRemove
== null) {
1084 jButtonFfsSectionRemove
= new JButton();
1085 jButtonFfsSectionRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1086 jButtonFfsSectionRemove
.setText("Remove");
1088 jButtonFfsSectionRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1089 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1090 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSection
.getSelectedRow() < 0) {
1093 stopEditingInTables();
1094 docConsole
.setSaved(false);
1095 sectionTableModel
.removeRow(jTableFfsSection
.getSelectedRow());
1096 ffc
.removeBuildOptionsFfsSectionsSection(jTableFfs
.getSelectedRow(),
1097 jTableFfsSection
.getSelectedRow());
1101 return jButtonFfsSectionRemove
;
1105 * This method initializes jButton2
1107 * @return javax.swing.JButton
1109 private JButton
getJButtonFfsSubSectionNew() {
1110 if (jButtonFfsSubSectionNew
== null) {
1111 jButtonFfsSubSectionNew
= new JButton();
1112 jButtonFfsSubSectionNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1113 jButtonFfsSubSectionNew
.setText("New");
1114 jButtonFfsSubSectionNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1115 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1116 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
1119 docConsole
.setSaved(false);
1120 String
[] row
= { "EFI_SECTION_RAW" };
1121 subsectionsTableModel
.addRow(row
);
1122 ffc
.genBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(),
1123 jTableFfsSections
.getSelectedRow(), row
[0]);
1128 return jButtonFfsSubSectionNew
;
1132 * This method initializes jButton3
1134 * @return javax.swing.JButton
1136 private JButton
getJButtonFfsSubSectionRemove() {
1137 if (jButtonFfsSubSectionRemove
== null) {
1138 jButtonFfsSubSectionRemove
= new JButton();
1139 jButtonFfsSubSectionRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1140 jButtonFfsSubSectionRemove
.setText("Remove");
1141 jButtonFfsSubSectionRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1142 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1143 int selectedFfsRow
= jTableFfs
.getSelectedRow();
1144 int selectedSectionsRow
= jTableFfsSections
.getSelectedRow();
1145 int selectedSubSectionRow
= jTableFfsSubSection
.getSelectedRow();
1146 if (selectedFfsRow
< 0 || selectedSectionsRow
< 0
1147 || selectedSubSectionRow
< 0) {
1150 stopEditingInTables();
1151 docConsole
.setSaved(false);
1152 subsectionsTableModel
.removeRow(selectedSubSectionRow
);
1153 ffc
.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow
,
1154 selectedSectionsRow
,
1155 selectedSubSectionRow
);
1156 if (subsectionsTableModel
.getRowCount() == 0) {
1157 sectionsTableModel
.removeRow(selectedSectionsRow
);
1162 return jButtonFfsSubSectionRemove
;
1166 * This method initializes jButton6
1168 * @return javax.swing.JButton
1170 private JButton
getJButtonFfsSectionsNew() {
1171 if (jButtonFfsSectionsNew
== null) {
1172 jButtonFfsSectionsNew
= new JButton();
1173 jButtonFfsSectionsNew
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1174 jButtonFfsSectionsNew
.setText("New");
1175 jButtonFfsSectionsNew
.addActionListener(new java
.awt
.event
.ActionListener() {
1176 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1177 if (jTableFfs
.getSelectedRow() < 0) {
1180 docConsole
.setSaved(false);
1181 String
[] row
= { "Compress" };
1182 sectionsTableModel
.addRow(row
);
1183 ffc
.genBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(), "");
1184 JOptionPane
.showMessageDialog(FpdBuildOptions
.this, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry.");
1185 jTableFfsSections
.changeSelection(sectionsTableModel
.getRowCount()-1, 0, false, false);
1189 return jButtonFfsSectionsNew
;
1193 * This method initializes jButton7
1195 * @return javax.swing.JButton
1197 private JButton
getJButtonFfsSectionsRemove() {
1198 if (jButtonFfsSectionsRemove
== null) {
1199 jButtonFfsSectionsRemove
= new JButton();
1200 jButtonFfsSectionsRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
1201 jButtonFfsSectionsRemove
.setText("Remove");
1202 jButtonFfsSectionsRemove
.addActionListener(new java
.awt
.event
.ActionListener() {
1203 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1204 if (jTableFfs
.getSelectedRow() < 0 || jTableFfsSections
.getSelectedRow() < 0) {
1207 stopEditingInTables();
1208 docConsole
.setSaved(false);
1209 sectionsTableModel
.removeRow(jTableFfsSections
.getSelectedRow());
1210 ffc
.removeBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(),
1211 jTableFfsSections
.getSelectedRow());
1212 subsectionsTableModel
.setRowCount(0);
1216 return jButtonFfsSectionsRemove
;
1219 private JScrollPane
getJScrollPaneFfsSections() {
1220 if (jScrollPaneFfsSections
== null) {
1221 jScrollPaneFfsSections
= new JScrollPane();
1222 // jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
1223 jScrollPaneFfsSections
.setViewportView(getJTableFfsSections());
1225 return jScrollPaneFfsSections
;
1229 * This method initializes jTable6
1231 * @return javax.swing.JTable
1233 private JTable
getJTableFfsSections() {
1234 if (jTableFfsSections
== null) {
1235 sectionsTableModel
= new DefaultTableModel();
1236 sectionsTableModel
.addColumn("EncapsulationType");
1237 jTableFfsSections
= new JTable(sectionsTableModel
);
1238 jTableFfsSections
.setRowHeight(20);
1239 jTableFfsSections
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1240 jTableFfsSections
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1241 public void valueChanged(ListSelectionEvent e
) {
1242 if (e
.getValueIsAdjusting()) {
1245 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
1246 if (lsm
.isSelectionEmpty()) {
1249 int sectionsRow
= lsm
.getMinSelectionIndex();
1250 if (jTableFfs
.getSelectedRow() < 0) {
1253 subsectionsTableModel
.setRowCount(0);
1254 ArrayList
<String
> al
= new ArrayList
<String
>();
1255 ffc
.getBuildOptionsFfsSectionsSectionsSection(jTableFfs
.getSelectedRow(), sectionsRow
, al
);
1256 for (int i
= 0; i
< al
.size(); ++i
) {
1257 String
[] subsectionRow
= { al
.get(i
) };
1258 subsectionsTableModel
.addRow(subsectionRow
);
1264 jTableFfsSections
.getModel().addTableModelListener(new TableModelListener() {
1265 public void tableChanged(TableModelEvent arg0
) {
1266 // TODO Auto-generated method stub
1267 int row
= arg0
.getFirstRow();
1268 TableModel m
= (TableModel
) arg0
.getSource();
1269 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
1270 //ToDo Data Validition check.
1271 String encapType
= m
.getValueAt(row
, 0) + "";
1272 docConsole
.setSaved(false);
1273 ffc
.updateBuildOptionsFfsSectionsSections(jTableFfs
.getSelectedRow(), row
, encapType
);
1278 return jTableFfsSections
;
1282 * This method initializes jSplitPaneFfsC
1284 * @return javax.swing.JSplitPane
1286 private JSplitPane
getJSplitPaneFfsC() {
1287 if (jSplitPaneFfsC
== null) {
1288 jSplitPaneFfsC
= new JSplitPane();
1289 jSplitPaneFfsC
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
1290 jSplitPaneFfsC
.setDividerLocation(130);
1291 jSplitPaneFfsC
.setTopComponent(getJPanelFfsCTop());
1292 jSplitPaneFfsC
.setBottomComponent(getJSplitPaneFfsCBottom());
1293 jSplitPaneFfsC
.setDividerSize(5);
1295 return jSplitPaneFfsC
;
1299 * This method initializes jPanelFfsCTop
1301 * @return javax.swing.JPanel
1303 private JPanel
getJPanelFfsCTop() {
1304 if (jPanelFfsCTop
== null) {
1305 jPanelFfsCTop
= new JPanel();
1306 jPanelFfsCTop
.setLayout(new BorderLayout());
1307 jPanelFfsCTop
.add(getJPanelSectionN(), java
.awt
.BorderLayout
.NORTH
);
1308 jPanelFfsCTop
.add(getJScrollPaneFfsSection(), java
.awt
.BorderLayout
.CENTER
);
1310 return jPanelFfsCTop
;
1314 * This method initializes jSplitPaneFfsCBottom
1316 * @return javax.swing.JSplitPane
1318 private JSplitPane
getJSplitPaneFfsCBottom() {
1319 if (jSplitPaneFfsCBottom
== null) {
1320 jSplitPaneFfsCBottom
= new JSplitPane();
1321 jSplitPaneFfsCBottom
.setDividerSize(5);
1322 jSplitPaneFfsCBottom
.setDividerLocation(130);
1323 jSplitPaneFfsCBottom
.setTopComponent(getJPanelFfsCBottomTop());
1324 jSplitPaneFfsCBottom
.setBottomComponent(getJPanelFfsCBottomBottom());
1325 jSplitPaneFfsCBottom
.setOrientation(javax
.swing
.JSplitPane
.VERTICAL_SPLIT
);
1327 return jSplitPaneFfsCBottom
;
1331 * This method initializes jPanelFfsCBottomTop
1333 * @return javax.swing.JPanel
1335 private JPanel
getJPanelFfsCBottomTop() {
1336 if (jPanelFfsCBottomTop
== null) {
1337 jPanelFfsCBottomTop
= new JPanel();
1338 jPanelFfsCBottomTop
.setLayout(new BorderLayout());
1339 jPanelFfsCBottomTop
.add(getJPanelSectionsN(), java
.awt
.BorderLayout
.NORTH
);
1340 jPanelFfsCBottomTop
.add(getJScrollPaneFfsSections(), java
.awt
.BorderLayout
.CENTER
);
1342 return jPanelFfsCBottomTop
;
1346 * This method initializes jPanelFfsCBottomBottom
1348 * @return javax.swing.JPanel
1350 private JPanel
getJPanelFfsCBottomBottom() {
1351 if (jPanelFfsCBottomBottom
== null) {
1352 jPanelFfsCBottomBottom
= new JPanel();
1353 jPanelFfsCBottomBottom
.setLayout(new BorderLayout());
1354 jPanelFfsCBottomBottom
.add(getJPanelSubSectionN(), java
.awt
.BorderLayout
.NORTH
);
1355 jPanelFfsCBottomBottom
.add(getJScrollPaneFfsSubSection(), java
.awt
.BorderLayout
.CENTER
);
1357 return jPanelFfsCBottomBottom
;
1361 * This method initializes jPanelSectionN
1363 * @return javax.swing.JPanel
1365 private JPanel
getJPanelSectionN() {
1366 if (jPanelSectionN
== null) {
1367 jPanelSectionN
= new JPanel();
1368 jLabelFfsSection
= new JLabel();
1369 jLabelFfsSection
.setText("Section");
1370 jPanelSectionN
.add(jLabelFfsSection
, null);
1371 jPanelSectionN
.add(getJButtonFfsSectionNew(), null);
1372 jPanelSectionN
.add(getJButtonFfsSectionRemove(), null);
1374 return jPanelSectionN
;
1378 * This method initializes jPanelSectionsN
1380 * @return javax.swing.JPanel
1382 private JPanel
getJPanelSectionsN() {
1383 if (jPanelSectionsN
== null) {
1384 jPanelSectionsN
= new JPanel();
1385 jLabelFfsSections
= new JLabel();
1386 jLabelFfsSections
.setText("Sections");
1387 jPanelSectionsN
.add(jLabelFfsSections
, null);
1388 jPanelSectionsN
.add(getJButtonFfsSectionsNew(), null);
1389 jPanelSectionsN
.add(getJButtonFfsSectionsRemove(), null);
1391 return jPanelSectionsN
;
1395 * This method initializes jPanelSubSectionN
1397 * @return javax.swing.JPanel
1399 private JPanel
getJPanelSubSectionN() {
1400 if (jPanelSubSectionN
== null) {
1401 jPanelSubSectionN
= new JPanel();
1402 jLabelFfsSubSections
= new JLabel();
1403 jLabelFfsSubSections
.setText("Sub-Sections");
1404 jPanelSubSectionN
.add(jLabelFfsSubSections
, null);
1405 jPanelSubSectionN
.add(getJButtonFfsSubSectionNew(), null);
1406 jPanelSubSectionN
.add(getJButtonFfsSubSectionRemove(), null);
1408 return jPanelSubSectionN
;
1412 * The following section contains all Build Options content
1416 * This method initializes jPanelOptionsTab
1418 * This is the main Options screen
1420 * @return javax.swing.JPanel jPanelOptionsTab
1422 private JPanel
getJPanelOptionsTab() {
1423 if (jPanelOptionsTab
== null) {
1424 // This container holds the Options Tab content
1426 // FlowLayout flowLayout9 = new FlowLayout();
1427 // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
1429 GridLayout gridLayout
= new GridLayout();
1430 gridLayout
.setRows(2);
1431 jPanelOptionsTab
= new JPanel();
1432 jPanelOptionsTab
.setLayout(gridLayout
);
1433 jPanelOptionsTab
.setBounds(new java
.awt
.Rectangle(0, 0, dialogWidth
* 2, dialogHeight
* 3));
1434 jPanelOptionsTab
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
+ 10, (dialogHeight
* 3) + 10));
1435 jPanelOptionsTab
.setAutoscrolls(true);
1436 jPanelOptionsTab
.setLocation(0, 0);
1437 jPanelOptionsTab
.add(getJPanelOptionsContainer(), null);
1438 // jPanelOptionsTab.add(getJScrollPaneOptions(), null);
1439 jPanelOptionsTab
.add(getJPanelTableOptionsContainer(), null);
1441 return jPanelOptionsTab
;
1445 * This method initializes jPanelOptionsContainer
1447 * @return javax.swing.JPanel
1449 private JPanel
getJPanelOptionsContainer() {
1450 if (jPanelOptionsContainer
== null) {
1451 jLabelTagName
= new JLabel();
1452 jLabelTagName
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowOne
, labelWidth
, oneRowHeight
));
1453 jLabelTagName
.setLocation(new java
.awt
.Point(labelColumn
, rowOne
));
1454 jLabelTagName
.setText("Tag Name");
1455 jLabelBuildTargets
= new JLabel();
1456 jLabelBuildTargets
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowTwo
, labelWidth
, oneRowHeight
));
1457 jLabelBuildTargets
.setLocation(new java
.awt
.Point(labelColumn
, rowTwo
));
1458 jLabelBuildTargets
.setText("Build Targets");
1459 jLabelToolCmd
= new JLabel();
1460 jLabelToolCmd
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowThree
, labelWidth
, oneRowHeight
));
1461 jLabelToolCmd
.setLocation(new java
.awt
.Point(labelColumn
, rowThree
));
1462 jLabelToolCmd
.setText("Tool Command");
1463 jLabelSupArch
= new JLabel();
1464 jLabelSupArch
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFour
, labelWidth
, oneRowHeight
));
1465 jLabelSupArch
.setLocation(new java
.awt
.Point(labelColumn
, rowFour
));
1466 jLabelSupArch
.setText("Supported Architectures");
1467 jLabelToolChainFamily
= new JLabel();
1468 jLabelToolChainFamily
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowFive
, labelWidth
, oneRowHeight
));
1469 jLabelToolChainFamily
.setLocation(new java
.awt
.Point(labelColumn
, rowFive
));
1470 jLabelToolChainFamily
.setText("Tool Chain Family");
1472 jLabelOptionContents
= new JLabel();
1473 jLabelOptionContents
.setBounds(new java
.awt
.Rectangle(labelColumn
, rowSix
, labelWidth
, oneRowHeight
));
1474 jLabelOptionContents
.setLocation(new java
.awt
.Point(labelColumn
, rowSix
));
1475 jLabelOptionContents
.setText("Argument Strings");
1477 jPanelOptionsContainer
= new JPanel();
1479 jPanelOptionsContainer
.setLayout(null);
1481 jPanelOptionsContainer
.setPreferredSize(new java
.awt
.Dimension(dialogWidth
, dialogHeight
));
1483 jPanelOptionsContainer
1484 .setBorder(javax.swing.BorderFactory
1485 .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
1487 jPanelOptionsContainer
.add(jLabelTagName
, null);
1488 jPanelOptionsContainer
.add(getJTextFieldTagName(), null);
1490 jPanelOptionsContainer
.add(jLabelBuildTargets
, null);
1491 jPanelOptionsContainer
.add(getJTextFieldBuildTargets(), null);
1493 jPanelOptionsContainer
.add(jLabelToolChainFamily
, null);
1494 jPanelOptionsContainer
.add(getJTextFieldToolChainFamily(), null);
1496 jPanelOptionsContainer
.add(jLabelToolCmd
, null);
1497 jPanelOptionsContainer
.add(getJTextFieldToolCmd(), null);
1499 jPanelOptionsContainer
.add(jLabelSupArch
, null);
1500 jPanelOptionsContainer
.add(getArchitectureSelections(), null);
1502 jPanelOptionsContainer
.add(jLabelOptionContents
, null);
1503 jPanelOptionsContainer
.add(getJTextFieldOptionContents(), null);
1505 jPanelOptionsContainer
.add(getJButtonOptionsAdd(), null);
1506 jPanelOptionsContainer
.add(getJButtonOptionsDel(), null);
1508 return jPanelOptionsContainer
;
1512 * This method initializes jTextFieldOptionTagName Row 1
1514 * @return javax.swing.JTextField
1516 private JTextField
getJTextFieldTagName() {
1517 if (jTextFieldTagName
== null) {
1518 jTextFieldTagName
= new JTextField();
1519 jTextFieldTagName
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowOne
, fieldWidth
, oneRowHeight
));
1520 jTextFieldTagName
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1521 jTextFieldTagName
.setLocation(new java
.awt
.Point(fieldColumn
, rowOne
));
1523 return jTextFieldTagName
;
1527 * This method initializes jTextFieldBuildTargets Row 2
1529 * @return javax.swing.JTextField jTextFieldBuildTargets
1531 private JTextField
getJTextFieldBuildTargets() {
1532 if (jTextFieldBuildTargets
== null) {
1533 jTextFieldBuildTargets
= new JTextField();
1534 jTextFieldBuildTargets
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowTwo
, fieldWidth
, oneRowHeight
));
1535 jTextFieldBuildTargets
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1536 jTextFieldBuildTargets
.setLocation(new java
.awt
.Point(fieldColumn
, rowTwo
));
1538 return jTextFieldBuildTargets
;
1542 * This method initializes jTextFieldToolCmd Row 3
1544 * This should be a dropdown box of command codes from tools_def.txt
1546 * @return javax.swing.JTextField jTextFieldToolCmd
1548 private JTextField
getJTextFieldToolCmd() {
1549 if (jTextFieldToolCmd
== null) {
1550 jTextFieldToolCmd
= new JTextField();
1551 jTextFieldToolCmd
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowThree
, fieldWidth
, oneRowHeight
));
1552 jTextFieldToolCmd
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1553 jTextFieldToolCmd
.setLocation(new java
.awt
.Point(fieldColumn
, rowThree
));
1555 return jTextFieldToolCmd
;
1559 * This method initializes jArchitectureSelections Row 4
1561 * @return jArchitectureSelections
1563 private JPanel
getArchitectureSelections() {
1564 if (jArchitectureSelections
== null) {
1565 jArchitectureSelections
= new JPanel();
1566 jArchitectureSelections
.setLayout(null);
1567 jArchitectureSelections
.add(getJCheckBoxIA32(), null);
1568 jArchitectureSelections
.add(getJCheckBoxX64(), null);
1569 jArchitectureSelections
.add(getJCheckBoxIpf(), null);
1570 jArchitectureSelections
.add(getJCheckBoxEBC(), null);
1571 jArchitectureSelections
.add(getJCheckBoxARM(), null);
1572 jArchitectureSelections
.add(getJCheckBoxPPC(), null);
1573 jArchitectureSelections
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowFour
, fieldWidth
, oneRowHeight
));
1574 jArchitectureSelections
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1575 jArchitectureSelections
.setLocation(new java
.awt
.Point(fieldColumn
, rowFour
));
1577 return jArchitectureSelections
;
1581 * This method initializes jCheckBoxIA32
1583 * @return javax.swing.JCheckBox jCheckBoxIA32
1585 private JCheckBox
getJCheckBoxIA32() {
1586 if (jCheckBoxIA32
== null) {
1587 jCheckBoxIA32
= new JCheckBox();
1588 jCheckBoxIA32
.setBounds(new java
.awt
.Rectangle(0, 0, 55, 20));
1589 jCheckBoxIA32
.setText("IA32");
1591 return jCheckBoxIA32
;
1595 * This method initializes jCheckBoxX64
1597 * @return javax.swing.JCheckBox jCheckBoxX64
1599 private JCheckBox
getJCheckBoxX64() {
1600 if (jCheckBoxX64
== null) {
1601 jCheckBoxX64
= new JCheckBox();
1602 jCheckBoxX64
.setText("X64");
1603 jCheckBoxX64
.setBounds(new java
.awt
.Rectangle(55, 0, 53, 20));
1605 return jCheckBoxX64
;
1609 * This method initializes jCheckBoxIpf
1611 * @return javax.swing.JCheckBox jCheckBoxIpf
1613 private JCheckBox
getJCheckBoxIpf() {
1614 if (jCheckBoxIpf
== null) {
1615 jCheckBoxIpf
= new JCheckBox();
1616 jCheckBoxIpf
.setBounds(new java
.awt
.Rectangle(108, 0, 52, 20));
1617 jCheckBoxIpf
.setText("IPF");
1619 return jCheckBoxIpf
;
1624 * This method initializes jCheckBoxEBC
1626 * @return javax.swing.JCheckBox jCheckBoxEBC
1628 private JCheckBox
getJCheckBoxEBC() {
1629 if (jCheckBoxEBC
== null) {
1630 jCheckBoxEBC
= new JCheckBox();
1631 jCheckBoxEBC
.setBounds(new java
.awt
.Rectangle(160, 0, 53, 20));
1632 jCheckBoxEBC
.setText("EBC");
1634 return jCheckBoxEBC
;
1638 * This method initializes jCheckBoxARM
1640 * @return javax.swing.JCheckBox jCheckBoxARM
1642 private JCheckBox
getJCheckBoxARM() {
1643 if (jCheckBoxARM
== null) {
1644 jCheckBoxARM
= new JCheckBox();
1645 jCheckBoxARM
.setBounds(new java
.awt
.Rectangle(213, 0, 54, 20));
1646 jCheckBoxARM
.setText("ARM");
1648 return jCheckBoxARM
;
1652 * This method initializes jCheckBoxPPC
1654 * @return javax.swing.JCheckBox jCheckBoxPPC
1656 private JCheckBox
getJCheckBoxPPC() {
1657 if (jCheckBoxPPC
== null) {
1658 jCheckBoxPPC
= new JCheckBox();
1659 jCheckBoxPPC
.setBounds(new java
.awt
.Rectangle(267, 0, 53, 20));
1660 jCheckBoxPPC
.setText("PPC");
1662 return jCheckBoxPPC
;
1666 * This method initializes jTextFieldToolChainFamily Row 5
1668 * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
1670 * @return javax.swing.JTextField
1672 private JTextField
getJTextFieldToolChainFamily() {
1673 if (jTextFieldToolChainFamily
== null) {
1674 jTextFieldToolChainFamily
= new JTextField();
1675 jTextFieldToolChainFamily
.setBounds(new java
.awt
.Rectangle(fieldColumn
, rowFive
, fieldWidth
, oneRowHeight
));
1676 jTextFieldToolChainFamily
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1677 jTextFieldToolChainFamily
.setLocation(new java
.awt
.Point(fieldColumn
, rowFive
));
1679 return jTextFieldToolChainFamily
;
1683 * This method initializes jTextFieldOptionContents Row 6
1685 * This is where we should put the checkbox & entry data for the command arguments
1687 * @return javax.swing.JTextField
1689 private JTextField
getJTextFieldOptionContents() {
1690 if (jTextFieldOptionContents
== null) {
1691 jTextFieldOptionContents
= new JTextField();
1692 jTextFieldOptionContents
.setPreferredSize(new java
.awt
.Dimension(fieldWidth
, oneRowHeight
));
1693 jTextFieldOptionContents
.setBounds(fieldColumn
, rowSix
, fieldWidth
, oneRowHeight
);
1694 jTextFieldOptionContents
.setLocation(new java
.awt
.Point(fieldColumn
, rowSix
));
1696 return jTextFieldOptionContents
;
1700 * This method initializes jButtonOptionsAdd
1702 * Add entry from the top screen to the table
1704 * @return javax.swing.JButton jButtonOptionsAdd
1706 private JButton
getJButtonOptionsAdd() {
1707 if (jButtonOptionsAdd
== null) {
1708 jButtonOptionsAdd
= new JButton();
1709 jButtonOptionsAdd
.setText("Add");
1711 jButtonOptionsAdd
.setPreferredSize(new java
.awt
.Dimension(buttonWidth
, oneRowHeight
));
1712 jButtonOptionsAdd
.setBounds(new java
.awt
.Rectangle(firstButtonLoc
, buttonRow
, buttonWidth
, oneRowHeight
));
1713 jButtonOptionsAdd
.setLocation(new java
.awt
.Point(firstButtonLoc
, buttonRow
));
1714 jButtonOptionsAdd
.addActionListener(new AbstractAction() {
1718 private static final long serialVersionUID
= 1L;
1720 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1721 boolean[] boolArray
= { jCheckBoxIA32
.isSelected(), jCheckBoxIpf
.isSelected(),
1722 jCheckBoxX64
.isSelected(), jCheckBoxEBC
.isSelected(),
1723 jCheckBoxARM
.isSelected(), jCheckBoxPPC
.isSelected() };
1724 String s
= boolToList(boolArray
);
1725 Object
[] o
= { jTextFieldBuildTargets
.getText(), jTextFieldToolChainFamily
.getText(), s
,
1726 jTextFieldToolCmd
.getText(), jTextFieldTagName
.getText(),
1727 jTextFieldOptionContents
.getText() };
1728 optionsTableModel
.addRow(o
);
1729 docConsole
.setSaved(false);
1730 ffc
.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets
.getText().trim()),
1731 jTextFieldToolChainFamily
.getText(), jTextFieldTagName
.getText(),
1732 jTextFieldToolCmd
.getText(), stringToVector(s
.trim()),
1733 jTextFieldOptionContents
.getText());
1737 return jButtonOptionsAdd
;
1741 * This method initializes jButtonOptionsDel
1743 * Remove a line from the table below
1745 * @return javax.swing.JButton jButtonOptionsDel
1747 private JButton
getJButtonOptionsDel() {
1748 if (jButtonOptionsDel
== null) {
1749 jButtonOptionsDel
= new JButton();
1750 jButtonOptionsDel
.setText("Delete");
1751 jButtonOptionsDel
.setPreferredSize(new java
.awt
.Dimension(buttonWidth
, oneRowHeight
));
1752 jButtonOptionsDel
.setBounds(new java
.awt
.Rectangle(next2LastButtonLoc
, buttonRow
, buttonWidth
, oneRowHeight
));
1753 jButtonOptionsDel
.setLocation(new java
.awt
.Point(next2LastButtonLoc
, buttonRow
));
1754 jButtonOptionsDel
.addActionListener(new AbstractAction() {
1758 private static final long serialVersionUID
= 1L;
1760 public void actionPerformed(java
.awt
.event
.ActionEvent e
) {
1761 if (selectedRow
>= 0) {
1762 optionsTableModel
.removeRow(selectedRow
);
1763 docConsole
.setSaved(false);
1764 ffc
.removeBuildOptionsOpt(selectedRow
);
1769 return jButtonOptionsDel
;
1772 public void componentResized(ComponentEvent arg0
) {
1773 int intPreferredWidth
= 500;
1775 Tools
.resizeComponentWidth(this.jScrollPaneOptions
, this.getWidth(), intPreferredWidth
);
1779 * This method initializes jScrollPaneOptions
1780 * Contains the Table and is located below the data entry section
1781 * @return javax.swing.JScrollPane jScrollPaneOptoins
1783 private JScrollPane
getJScrollPaneOptions() {
1784 if (jScrollPaneOptions
== null) {
1785 jScrollPaneOptions
= new JScrollPane();
1786 jScrollPaneOptions
.setViewportView(getJTableOptions());
1788 return jScrollPaneOptions
;
1792 * This method initializes jTableOptions
1794 * @return javax.swing.JTable jTableOptions
1796 private JTable
getJTableOptions() {
1797 if (jTableOptions
== null) {
1799 optionsTableModel
= new DefaultTableModel();
1800 jTableOptions
= new JTable(optionsTableModel
);
1801 jTableOptions
.setRowHeight(20);
1802 optionsTableModel
.addColumn("Build Targets");
1803 optionsTableModel
.addColumn("Tool Chain Family");
1804 optionsTableModel
.addColumn("Supported Architectures");
1805 optionsTableModel
.addColumn("Tool Command Code");
1806 optionsTableModel
.addColumn("TagName");
1807 optionsTableModel
.addColumn("Arguments");
1809 jTableOptions
.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth
);
1810 jTableOptions
.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth
);
1811 jTableOptions
.getColumnModel().getColumn(2).setMinWidth(supportArchWidth
);
1812 jTableOptions
.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth
);
1813 jTableOptions
.getColumnModel().getColumn(4).setMinWidth(tagNameWidth
);
1814 jTableOptions
.getColumnModel().getColumn(5).setMinWidth(argWidth
);
1816 // javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
1817 // JComboBox cb = new JComboBox();
1818 // cb.addItem("MSFT");
1819 // cb.addItem("GCC");
1820 // cb.addItem("CYGWIN");
1821 // cb.addItem("INTEL");
1822 // cb.addItem("USER_DEFINED");
1823 // toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1824 Vector
<String
> vArch
= new Vector
<String
>();
1831 jTableOptions
.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch
, FrameworkWizardUI
.getInstance()));
1833 jTableOptions
.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI
.getInstance()));
1835 jTableOptions
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
1836 jTableOptions
.setAutoResizeMode(javax
.swing
.JTable
.AUTO_RESIZE_OFF
);
1837 jTableOptions
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1838 public void valueChanged(ListSelectionEvent e
) {
1840 if (e
.getValueIsAdjusting()) {
1843 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
1844 if (lsm
.isSelectionEmpty()) {
1847 selectedRow
= lsm
.getMinSelectionIndex();
1852 jTableOptions
.getModel().addTableModelListener(new TableModelListener() {
1853 public void tableChanged(TableModelEvent arg0
) {
1854 // TODO Auto-generated method stub
1855 int row
= arg0
.getFirstRow();
1856 TableModel m
= (TableModel
) arg0
.getSource();
1857 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
1858 //ToDo Data Validition check.
1859 String targets
= m
.getValueAt(row
, 0) + "";
1860 Vector
<Object
> targetName
= new Vector
<Object
>();
1861 String
[] sArray
= targets
.split("( )+");
1862 for (int i
= 0; i
< sArray
.length
; ++i
) {
1863 targetName
.add(sArray
[i
]);
1865 String toolChain
= m
.getValueAt(row
, 1) + "";
1866 String archs
= m
.getValueAt(row
, 2) + "";
1867 Vector
<Object
> supArch
= null;
1868 if (archs
.length() > 0) {
1869 supArch
= new Vector
<Object
>();
1870 String
[] sArray1
= archs
.split("( )+");
1871 for (int i
= 0; i
< sArray1
.length
; ++i
) {
1872 supArch
.add(sArray1
[i
]);
1876 String toolCmd
= m
.getValueAt(row
, 3) + "";
1877 String tagName
= m
.getValueAt(row
, 4) + "";
1878 String contents
= m
.getValueAt(row
, 5) + "";
1879 docConsole
.setSaved(false);
1880 ffc
.updateBuildOptionsOpt(row
, targetName
, toolChain
, tagName
, toolCmd
, supArch
, contents
);
1885 return jTableOptions
;
1888 private Vector
<Object
> stringToVector(String s
) {
1889 String
[] sArray
= s
.split(" ");
1890 Vector
<Object
> v
= null;
1891 if (s
.length() > 0 && !s
.trim().equalsIgnoreCase("")) {
1892 v
= new Vector
<Object
>();
1893 for (int i
= 0; i
< sArray
.length
; ++i
) {
1900 private String
boolToList(boolean[] bool
) {
1924 private void initOptionTable() {
1925 if (ffc
.getBuildOptionsOptCount() == 0) {
1926 //ToDo get default options from *.txt file
1929 String
[][] saa
= new String
[ffc
.getBuildOptionsOptCount()][6];
1930 ffc
.getBuildOptionsOpts(saa
);
1931 for (int i
= 0; i
< saa
.length
; ++i
) {
1932 optionsTableModel
.addRow(saa
[i
]);
1938 * Everything below should pertain to the ANT Task Tab
1942 * This method initializes jButton12
1944 * @return javax.swing.JButton
1946 private JButton
getJButtonAntTaskFileBrowse() {
1947 if (jButtonAntTaskFileBrowse
== null) {
1948 jButtonAntTaskFileBrowse
= new JButton();
1949 jButtonAntTaskFileBrowse
.setPreferredSize(new Dimension(buttonWidth
, oneRowHeight
));
1950 jButtonAntTaskFileBrowse
.setText("Browse");
1951 jButtonAntTaskFileBrowse
.addActionListener(new AbstractAction() {
1952 private static final long serialVersionUID
= 1L;
1954 public void actionPerformed(ActionEvent arg0
) {
1956 // Select files from current workspace
1958 String dirPrefix
= Workspace
.getCurrentWorkspace();
1959 JFileChooser chooser
= new JFileChooser(dirPrefix
);
1960 File theFile
= null;
1961 String headerDest
= null;
1963 chooser
.setMultiSelectionEnabled(false);
1964 chooser
.setFileSelectionMode(JFileChooser
.FILES_ONLY
);
1965 int retval
= chooser
.showOpenDialog(FpdBuildOptions
.this);
1966 if (retval
== JFileChooser
.APPROVE_OPTION
) {
1968 theFile
= chooser
.getSelectedFile();
1969 String file
= theFile
.getPath();
1970 if (!file
.startsWith(dirPrefix
)) {
1971 JOptionPane
.showMessageDialog(FpdBuildOptions
.this, "You can only select files in current package!");
1978 headerDest
= theFile
.getPath();
1979 jTextFieldAntTaskFile
.setText(headerDest
.substring(dirPrefix
.length()).replace('\\', '/'));
1985 return jButtonAntTaskFileBrowse
;
1989 * This method initializes jPanelUserDefCenterN
1991 * @return javax.swing.JPanel
1993 private JPanel
getJPanelUserDefCenterN() {
1994 if (jPanelUserDefCenterN
== null) {
1995 jPanelUserDefCenterN
= new JPanel();
1996 jPanelUserDefCenterN
.add(jLabelAntCmdOpts
, null);
1997 jPanelUserDefCenterN
.add(getJTextFieldAntCmdOpts(), null);
1998 jPanelUserDefCenterN
.add(getJButtonAntTaskAdd(), null);
1999 jPanelUserDefCenterN
.add(getJButtonAntTaskDel(), null);
2001 return jPanelUserDefCenterN
;
2005 * This method initializes jPanel8
2007 * @return javax.swing.JPanel
2009 private JPanel
getJPanelUserDef() {
2010 if (jPanelUserDef
== null) {
2011 jPanelUserDef
= new JPanel();
2012 jPanelUserDef
.setLayout(new BorderLayout());
2013 jPanelUserDef
.add(getJPanelUserDefNorth(), java
.awt
.BorderLayout
.NORTH
);
2014 jPanelUserDef
.add(getJPanelUserDefCenter(), java
.awt
.BorderLayout
.CENTER
);
2017 return jPanelUserDef
;
2021 * This method initializes jPanel9
2023 * @return javax.swing.JPanel
2025 private JPanel
getJPanelUserDefNorth() {
2026 if (jPanelUserDefNorth
== null) {
2027 jLabelAntTaskFile
= new JLabel();
2028 jLabelAntTaskFile
.setText("ANT Task File");
2029 jLabelAntTaskFile
.setPreferredSize(new java
.awt
.Dimension(80, 20));
2030 FlowLayout flowLayout8
= new FlowLayout();
2031 flowLayout8
.setAlignment(java
.awt
.FlowLayout
.CENTER
);
2032 jLabelAntTaskId
= new JLabel();
2033 jLabelAntTaskId
.setText("ID");
2034 jPanelUserDefNorth
= new JPanel();
2035 jPanelUserDefNorth
.setLayout(flowLayout8
);
2036 jPanelUserDefNorth
.add(jLabelAntTaskFile
, null);
2037 jPanelUserDefNorth
.add(getJTextFieldAntTaskFile(), null);
2038 jPanelUserDefNorth
.add(getJButtonAntTaskFileBrowse(), null);
2039 jPanelUserDefNorth
.add(jLabelAntTaskId
, null);
2040 jPanelUserDefNorth
.add(getJTextFieldAntTaskId(), null);
2042 return jPanelUserDefNorth
;
2046 * This method initializes jPanel11
2048 * @return javax.swing.JPanel
2050 private JPanel
getJPanelUserDefCenter() {
2051 if (jPanelUserDefCenter
== null) {
2052 jLabelAntCmdOpts
= new JLabel();
2053 jLabelAntCmdOpts
.setText("ANT Command Options");
2054 jLabelAntCmdOpts
.setPreferredSize(new java
.awt
.Dimension(131, 20));
2055 jPanelUserDefCenter
= new JPanel();
2056 jPanelUserDefCenter
.setLayout(new BorderLayout());
2058 jPanelUserDefCenter
.add(getJPanelUserDefCenterN(), java
.awt
.BorderLayout
.NORTH
);
2059 jPanelUserDefCenter
.add(getJScrollPaneAntTasks(), java
.awt
.BorderLayout
.CENTER
);
2061 return jPanelUserDefCenter
;
2065 * This method initializes jTextField2
2067 * @return javax.swing.JTextField
2069 private JTextField
getJTextFieldAntTaskFile() {
2070 if (jTextFieldAntTaskFile
== null) {
2071 jTextFieldAntTaskFile
= new JTextField();
2072 jTextFieldAntTaskFile
.setPreferredSize(new java
.awt
.Dimension(200, 20));
2074 return jTextFieldAntTaskFile
;
2078 * This method initializes jTextField3
2080 * @return javax.swing.JTextField
2082 private JTextField
getJTextFieldAntTaskId() {
2083 if (jTextFieldAntTaskId
== null) {
2084 jTextFieldAntTaskId
= new JTextField();
2085 jTextFieldAntTaskId
.setPreferredSize(new java
.awt
.Dimension(100, 20));
2087 return jTextFieldAntTaskId
;
2091 * This method initializes jButton4
2093 * @return javax.swing.JButton
2095 private JButton
getJButtonAntTaskAdd() {
2096 if (jButtonAntTaskAdd
== null) {
2097 jButtonAntTaskAdd
= new JButton();
2098 jButtonAntTaskAdd
.setPreferredSize(new java
.awt
.Dimension(90, 20));
2099 jButtonAntTaskAdd
.setText("Add");
2100 jButtonAntTaskAdd
.addActionListener(new ActionListener() {
2101 public void actionPerformed(ActionEvent e
) {
2102 if (!DataValidation
.isInt(jTextFieldAntTaskId
.getText())
2103 || jTextFieldAntTaskId
.getText().length() != 8) {
2104 JOptionPane
.showMessageDialog(FpdBuildOptions
.this, "ID must be an 8-digit integer.");
2107 Object
[] o
= { jTextFieldAntTaskId
.getText(), null, null };
2108 o
[1] = jTextFieldAntTaskFile
.getText();
2109 o
[2] = jTextFieldAntCmdOpts
.getText();
2110 ffc
.genBuildOptionsUserDefAntTask(o
[0] + "", o
[1] + "", o
[2] + "");
2111 antTaskTableModel
.addRow(o
);
2112 docConsole
.setSaved(false);
2116 return jButtonAntTaskAdd
;
2120 * This method initializes jButton5
2122 * @return javax.swing.JButton
2124 private JButton
getJButtonAntTaskDel() {
2125 if (jButtonAntTaskDel
== null) {
2126 jButtonAntTaskDel
= new JButton();
2127 jButtonAntTaskDel
.setPreferredSize(new java
.awt
.Dimension(90, 20));
2128 jButtonAntTaskDel
.setText("Delete");
2129 jButtonAntTaskDel
.addActionListener(new ActionListener() {
2130 public void actionPerformed(ActionEvent e
) {
2131 if (selectedRow
>= 0) {
2132 docConsole
.setSaved(false);
2133 antTaskTableModel
.removeRow(selectedRow
);
2134 ffc
.removeBuildOptionsUserDefAntTask(selectedRow
);
2139 return jButtonAntTaskDel
;
2143 * This method initializes jTextField4
2145 * @return javax.swing.JTextField
2147 private JTextField
getJTextFieldAntCmdOpts() {
2148 if (jTextFieldAntCmdOpts
== null) {
2149 jTextFieldAntCmdOpts
= new JTextField();
2150 jTextFieldAntCmdOpts
.setPreferredSize(new java
.awt
.Dimension(270, 20));
2151 jTextFieldAntCmdOpts
.setEnabled(true);
2153 return jTextFieldAntCmdOpts
;
2157 * This method initializes jScrollPane2
2159 * @return javax.swing.JScrollPane
2161 private JScrollPane
getJScrollPaneAntTasks() {
2162 if (jScrollPaneAntTasks
== null) {
2163 jScrollPaneAntTasks
= new JScrollPane();
2164 jScrollPaneAntTasks
.setPreferredSize(new java
.awt
.Dimension(600, 400));
2165 jScrollPaneAntTasks
.setViewportView(getJTableAntTasks());
2167 return jScrollPaneAntTasks
;
2171 * This method initializes jTable2
2173 * @return javax.swing.JTable
2175 private JTable
getJTableAntTasks() {
2176 if (jTableAntTasks
== null) {
2177 antTaskTableModel
= new DefaultTableModel();
2178 jTableAntTasks
= new JTable(antTaskTableModel
);
2179 jTableAntTasks
.setRowHeight(20);
2180 antTaskTableModel
.addColumn("ID");
2181 antTaskTableModel
.addColumn("Filename");
2182 antTaskTableModel
.addColumn("ANT Command Options");
2184 jTableAntTasks
.setSelectionMode(ListSelectionModel
.SINGLE_SELECTION
);
2185 jTableAntTasks
.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
2186 public void valueChanged(ListSelectionEvent e
) {
2188 if (e
.getValueIsAdjusting()) {
2191 ListSelectionModel lsm
= (ListSelectionModel
) e
.getSource();
2192 if (lsm
.isSelectionEmpty()) {
2195 selectedRow
= lsm
.getMinSelectionIndex();
2200 jTableAntTasks
.getModel().addTableModelListener(new TableModelListener() {
2201 public void tableChanged(TableModelEvent arg0
) {
2202 // TODO Auto-generated method stub
2203 int row
= arg0
.getFirstRow();
2204 TableModel m
= (TableModel
) arg0
.getSource();
2205 if (arg0
.getType() == TableModelEvent
.UPDATE
) {
2206 //ToDo Data Validition check.
2207 String id
= m
.getValueAt(row
, 0) + "";
2208 String file
= m
.getValueAt(row
, 1) + "";
2209 String execOrder
= m
.getValueAt(row
, 2) + "";
2210 if (id
.length() == 0) {
2213 if (file
.length() == 0 && execOrder
.length() == 0) {
2216 if (file
.length() == 0) {
2219 if (execOrder
.length() == 0) {
2222 ffc
.updateBuildOptionsUserDefAntTask(row
, id
, file
, execOrder
);
2228 return jTableAntTasks
;
2231 private void initAntTaskTable() {
2232 if (ffc
.getBuildOptionsUserDefAntTaskCount() == 0) {
2235 String
[][] saa
= new String
[ffc
.getBuildOptionsUserDefAntTaskCount()][3];
2236 ffc
.getBuildOptionsUserDefAntTasks(saa
);
2237 for (int i
= 0; i
< saa
.length
; ++i
) {
2238 antTaskTableModel
.addRow(saa
[i
]);
2242 } // @jve:decl-index=0:visual-constraint="10,10"