57b7f2cba08ebbf3142c65004a0ca584f01a3064
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdBuildOptions.java
1 /** @file
2
3 The file is used to create, update BuildOptions of Fpd file
4
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
10
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.
13
14 **/
15 package org.tianocore.frameworkwizard.platform.ui;
16
17 import java.awt.BorderLayout;
18
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
28 import javax.swing.DefaultCellEditor;
29 import javax.swing.JFileChooser;
30 import javax.swing.JFrame;
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.InternalFrameAdapter;
39 import javax.swing.event.InternalFrameEvent;
40 import javax.swing.event.ListSelectionEvent;
41 import javax.swing.event.ListSelectionListener;
42 import javax.swing.event.TableModelEvent;
43 import javax.swing.event.TableModelListener;
44 import javax.swing.table.DefaultTableModel;
45 import javax.swing.table.TableModel;
46
47 import org.tianocore.PlatformSurfaceAreaDocument;
48 import org.tianocore.frameworkwizard.common.DataValidation;
49 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
50 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
51
52 import java.io.File;
53 import java.util.ArrayList;
54 import java.util.Iterator;
55 import java.util.LinkedHashMap;
56 import java.util.Set;
57 import java.util.Vector;
58 import java.awt.Dimension;
59 import javax.swing.JSplitPane;
60
61 public class FpdBuildOptions extends IInternalFrame {
62
63 private final int oneRowHeight = 20;
64
65 private final int twoRowHeight = 40;
66
67 private final int sepHeight = 6;
68
69 private final int sepWidth = 10;
70
71 private final int buttonWidth = 90;
72
73 private final int rowOne = 12;
74
75 private final int dialogWidth = 600;
76
77 private final int rowTwo = rowOne + oneRowHeight + sepHeight;
78
79 private final int rowThree = rowTwo + oneRowHeight + sepHeight;
80
81 private final int rowFour = rowThree + oneRowHeight + sepHeight;
82
83 private final int rowFive = rowFour + oneRowHeight + sepHeight;
84
85 private final int rowSix = rowFive + oneRowHeight + sepHeight;
86
87 private final int rowSeven = rowSix + oneRowHeight + sepHeight;
88
89 private final int buttonRow = rowSeven + oneRowHeight + sepHeight + sepHeight;
90
91 private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight;
92
93 private final int lastButtonXLoc = dialogWidth - buttonWidth - sepWidth;
94
95 private final int next2LastButtonLoc = lastButtonXLoc - buttonWidth - sepWidth;
96
97 private final int firstButtonLoc = next2LastButtonLoc - buttonWidth - sepWidth;
98
99 private final int labelColumn = 12;
100
101 private final int fieldColumn = 168;
102
103 private final int labelWidth = 155;
104
105 private final int fieldWidth = 320;
106
107 private static final long serialVersionUID = 1L;
108
109 static JFrame frame;
110
111 private JPanel jContentPane = null;
112
113 // private JPanel jPanelContentSouth = null;
114
115 // private JPanel jPanelContentNorth = null;
116
117 // private JPanel jPanelContentWest = null;
118
119 // private JPanel jPanelContentEast = null;
120
121 private JTabbedPane jTabbedPane = null;
122
123 private JPanel jPanelUserDef = null;
124
125 private JPanel jPanelUserDefNorth = null;
126
127 private JPanel jPanelUserDefCenter = null;
128
129 private JTextField jTextFieldAntTaskFile = null;
130
131 private JLabel jLabelAntTaskId = null;
132
133 private JTextField jTextFieldAntTaskId = null;
134
135 private JButton jButtonAntTaskAdd = null;
136
137 private JButton jButtonAntTaskDel = null;
138
139 private JTextField jTextFieldAntCmdOpts = null;
140
141 private JScrollPane jScrollPaneAntTasks = null;
142
143 private JTable jTableAntTasks = null;
144
145 private DefaultTableModel ffsTableModel = null;
146
147 private DefaultTableModel sectionsTableModel = null;
148
149 private DefaultTableModel sectionTableModel = null;
150
151 private DefaultTableModel subsectionsTableModel = null;
152
153 private DefaultTableModel antTaskTableModel = null;
154
155 private DefaultTableModel ffsAttributesTableModel = null;
156
157 private DefaultTableModel optionsTableModel = null;
158
159 private JPanel jPanelFfsTab = null;
160
161 private JPanel jPanelFfsTabCenter = null;
162
163 private JPanel jPanelFfsTabCenterN = null;
164
165 private JPanel jPanelFfsTabCenterS = null;
166
167 private JLabel jLabelFfsKey = null;
168
169 private JTextField jTextFieldFfsKey = null;
170
171 private JButton jButtonFfsAdd = null;
172
173 private JButton jButtonFfsDel = null;
174
175 private JScrollPane jScrollPaneFfsAttribs = null;
176
177 private JTable jTableFfsAttribs = null;
178
179 private JPanel jPanelOptionsTab = null;
180
181 private JLabel jLabelOptionContents = null;
182
183 private JTextField jTextFieldOptionContents = null;
184
185 private JLabel jLabelToolChainFamily = null;
186
187 private JLabel jLabelSupArch = null;
188
189 private JLabel jLabelToolCmd = null;
190
191 private JTextField jTextFieldToolCmd = null;
192
193 private JScrollPane jScrollPaneOptions = null;
194
195 private JTable jTableOptions = null;
196
197 private JLabel jTitle = null;
198
199 private JButton jButtonOptionsAdd = null;
200
201 private JButton jButtonOptionsDel = null;
202
203 private JButton jButtonFfsAttribNew = null;
204
205 private JButton jButtonFfsAttribRemove = null;
206
207 private FpdFileContents ffc = null;
208
209 private OpeningPlatformType docConsole = null;
210
211 private JPanel jArchitectureSelections = null;
212
213 private JCheckBox jCheckBoxIA32 = null;
214
215 private JCheckBox jCheckBoxIpf = null;
216
217 private JCheckBox jCheckBoxX64 = null;
218
219 private JCheckBox jCheckBoxEBC = null;
220
221 private JCheckBox jCheckBoxARM = null;
222
223 private JCheckBox jCheckBoxPPC = null;
224
225 private JLabel jLabelBuildTargets = null;
226
227 private JTextField jTextFieldBuildTargets = null;
228
229 private JTextField jTextFieldTagName = null;
230
231 private JLabel jLabelTagName = null;
232
233 private int selectedRow = -1;
234
235 private JLabel jLabelAntTaskFile = null;
236
237 private JLabel jLabelAntCmdOpts = null;
238
239 private JScrollPane jScrollPaneFfs = null;
240
241 private JTable jTableFfs = null;
242
243 private JLabel jLabelFfsSection = null;
244
245 private JScrollPane jScrollPaneFfsSection = null;
246
247 private JTable jTableFfsSection = null;
248
249 private JLabel jLabelFfsSubSections = null;
250
251 private JScrollPane jScrollPaneFfsSubSection = null;
252
253 private JTable jTableFfsSubSection = null;
254
255 private JLabel jLabelEncapType = null;
256
257 private JTextField jTextFieldEncapType = null;
258
259 private JPanel jPanelFfsAttribButtonGroup = null;
260
261 private JLabel jLabelFfsAttribs = null;
262
263 private JButton jButtonFfsSectionNew = null;
264
265 private JButton jButtonFfsSectionRemove = null;
266
267 private JButton jButtonFfsSubSectionNew = null;
268
269 private JButton jButtonFfsSubSectionRemove = null;
270
271 private JLabel jLabelFfsSections = null;
272
273 private JButton jButtonFfsSectionsNew = null;
274
275 private JButton jButtonFfsSectionsRemove = null;
276
277 private JScrollPane jScrollPaneFfsSections = null;
278
279 private JTable jTableFfsSections = null;
280
281 private JButton jButtonAntTaskFileBrowse = null;
282
283 private JTextField jTextFieldToolChainFamily = null;
284
285 private JSplitPane jSplitPaneFfsC = null;
286
287 private JPanel jPanelFfsCTop = null;
288
289 private JSplitPane jSplitPaneFfsCBottom = null;
290
291 private JPanel jPanelFfsCBottomTop = null;
292
293 private JPanel jPanelFfsCBottomBottom = null;
294
295 private JPanel jPanelSectionN = null;
296
297 private JPanel jPanelSectionC = null;
298
299 private JPanel jPanelSectionsN = null;
300
301 private JPanel jPanelSectionsC = null;
302
303 private JPanel jPanelSubSectionN = null;
304
305 private JPanel jPanelSubSectionC = null;
306
307 private JPanel jPanelOptionsContainer = null;
308
309 private JPanel jPanelUserDefCenterN = null;
310
311 private JPanel jPanelUserDefCenterC = null;
312
313 /**
314 * This method initializes jPanel
315 *
316 * @return javax.swing.JPanel
317 private JPanel getJPanelContentSouth() {
318 if (jPanelContentSouth == null) {
319 jPanelContentSouth = new JPanel();
320 }
321 return jPanelContentSouth;
322 }
323 */
324
325 /**
326 * This method initializes jPanel1
327 *
328 * @return javax.swing.JPanel
329 private JPanel getJPanelContentNorth() {
330 if (jPanelContentNorth == null) {
331 jPanelContentNorth = new JPanel();
332 }
333 return jPanelContentNorth;
334 }
335 */
336
337 /**
338 * This method initializes jPanel2
339 *
340 * @return javax.swing.JPanel
341 private JPanel getJPanelContentWest() {
342 if (jPanelContentWest == null) {
343 jPanelContentWest = new JPanel();
344 }
345 return jPanelContentWest;
346 }
347 */
348
349 /**
350 * This method initializes jPanel3
351 *
352 * @return javax.swing.JPanel
353 private JPanel getJPanelContentEast() {
354 if (jPanelContentEast == null) {
355 jPanelContentEast = new JPanel();
356 }
357 return jPanelContentEast;
358 }
359 */
360
361 /**
362 * This method initializes jTabbedPane
363 *
364 * @return javax.swing.JTabbedPane
365 */
366 private JTabbedPane getJTabbedPane() {
367 if (jTabbedPane == null) {
368 jTabbedPane = new JTabbedPane();
369 jTabbedPane.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null);
370 jTabbedPane.addTab("Tool Arguments", null, getJPanelOptionsTab(), null);
371 jTabbedPane.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null);
372 }
373 return jTabbedPane;
374 }
375
376 /**
377 * This method initializes this
378 *
379 * @return void
380 */
381 private void initialize() {
382 this.setSize(722, 577);
383 this.setTitle("Platform Build Options");
384 this.setContentPane(getJContentPane());
385 }
386
387 /**
388 * This method initializes jContentPane
389 *
390 * @return javax.swing.JPanel
391 */
392 private JPanel getJContentPane() {
393 if (jContentPane == null) {
394 jContentPane = new JPanel();
395 jContentPane.setLayout(new BorderLayout());
396 // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
397 // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
398 // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
399 // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
400 jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
401 }
402 return jContentPane;
403 }
404
405 /**
406 * @param args
407 */
408 public static void main(String[] args) {
409 // TODO Auto-generated method stub
410 new FpdBuildOptions().setVisible(true);
411 }
412
413 /**
414 * This is the default constructor
415 */
416 public FpdBuildOptions() {
417 super();
418 initialize();
419 this.setVisible(true);
420 }
421
422 public FpdBuildOptions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
423 this();
424 ffc = new FpdFileContents(fpd);
425 init(ffc);
426 }
427
428 public FpdBuildOptions(OpeningPlatformType opt) {
429 this(opt.getXmlFpd());
430 docConsole = opt;
431 }
432
433 private void init(FpdFileContents ffc) {
434 initOptionTable();
435 initAntTaskTable();
436 initFfsTable();
437 this.addInternalFrameListener(new InternalFrameAdapter() {
438 public void internalFrameDeactivated(InternalFrameEvent e) {
439 if (jTableFfs.isEditing()) {
440 jTableFfs.getCellEditor().stopCellEditing();
441 }
442 if (jTableFfsSection.isEditing()) {
443 jTableFfsSection.getCellEditor().stopCellEditing();
444 }
445 if (jTableAntTasks.isEditing()) {
446 jTableAntTasks.getCellEditor().stopCellEditing();
447 }
448 if (jTableFfsSubSection.isEditing()) {
449 jTableFfsSubSection.getCellEditor().stopCellEditing();
450 }
451 if (jTableFfsAttribs.isEditing()) {
452 jTableFfsAttribs.getCellEditor().stopCellEditing();
453 }
454 if (jTableOptions.isEditing()) {
455 jTableOptions.getCellEditor().stopCellEditing();
456 }
457 }
458 });
459 }
460
461 /**
462 * This method initializes jPanel13
463 *
464 * @return javax.swing.JPanel
465 */
466 private JPanel getJPanelFfsTab() {
467 if (jPanelFfsTab == null) {
468 jPanelFfsTab = new JPanel();
469 jPanelFfsTab.setLayout(new BorderLayout());
470 jPanelFfsTab.add(getJPanelFfsTabCenter(), java.awt.BorderLayout.CENTER);
471 jPanelFfsTab.add(getJScrollPaneFfs(), java.awt.BorderLayout.WEST);
472 }
473 return jPanelFfsTab;
474 }
475
476 /**
477 * This method initializes jPanel18
478 *
479 * @return javax.swing.JPanel
480 */
481 private JPanel getJPanelFfsTabCenter() {
482 if (jPanelFfsTabCenter == null) {
483 jPanelFfsTabCenter = new JPanel();
484 jPanelFfsTabCenter.setLayout(new BorderLayout());
485 jPanelFfsTabCenter.add(getJPanelFfsTabCenterN(), java.awt.BorderLayout.NORTH);
486 jPanelFfsTabCenter.add(getJPanelFfsTabCenterS(), java.awt.BorderLayout.SOUTH);
487 jPanelFfsTabCenter.add(getJSplitPaneFfsC(), java.awt.BorderLayout.CENTER);
488 }
489 return jPanelFfsTabCenter;
490 }
491
492 /**
493 * This method initializes jPanel15
494 *
495 * @return javax.swing.JPanel
496 */
497 private JPanel getJPanelFfsTabCenterN() {
498 if (jPanelFfsTabCenterN == null) {
499 jLabelEncapType = new JLabel();
500 jLabelEncapType.setText("Encapsulation Type");
501 FlowLayout flowLayout5 = new FlowLayout();
502 flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT);
503 jLabelFfsKey = new JLabel();
504 jLabelFfsKey.setText("FFS Key");
505 jPanelFfsTabCenterN = new JPanel();
506 jPanelFfsTabCenterN.setLayout(flowLayout5);
507 jPanelFfsTabCenterN.add(jLabelFfsKey, null);
508 jPanelFfsTabCenterN.add(getJTextFieldFfsKey(), null);
509 jPanelFfsTabCenterN.add(jLabelEncapType, null);
510 jPanelFfsTabCenterN.add(getJTextFieldEncapType(), null);
511 jPanelFfsTabCenterN.add(getJButtonFfsAdd(), null);
512 jPanelFfsTabCenterN.add(getJButtonFfsDel(), null);
513 }
514 return jPanelFfsTabCenterN;
515 }
516
517 /**
518 * This method initializes jPanel16
519 *
520 * @return javax.swing.JPanel
521 */
522 private JPanel getJPanelFfsTabCenterS() {
523 if (jPanelFfsTabCenterS == null) {
524 jLabelFfsAttribs = new JLabel();
525 jLabelFfsAttribs.setText("Attributes");
526 FlowLayout flowLayout6 = new FlowLayout();
527 flowLayout6.setHgap(5);
528 flowLayout6.setVgap(20);
529 flowLayout6.setAlignment(java.awt.FlowLayout.CENTER);
530 jPanelFfsTabCenterS = new JPanel();
531 jPanelFfsTabCenterS.setPreferredSize(new java.awt.Dimension(491, 130));
532 jPanelFfsTabCenterS.setLayout(flowLayout6);
533 jPanelFfsTabCenterS.add(jLabelFfsAttribs, null);
534 jPanelFfsTabCenterS.add(getJScrollPaneFfsAttribs(), null);
535 jPanelFfsTabCenterS.add(getJPanelFfsAttribButtonGroup(), null);
536 }
537 return jPanelFfsTabCenterS;
538 }
539
540 /**
541 * This method initializes jTextField6
542 *
543 * @return javax.swing.JTextField
544 */
545 private JTextField getJTextFieldFfsKey() {
546 if (jTextFieldFfsKey == null) {
547 jTextFieldFfsKey = new JTextField();
548 jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(100, 20));
549 jTextFieldFfsKey.setEditable(true);
550 jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() {
551 public void focusLost(java.awt.event.FocusEvent e) {
552 if (jTableFfs.getSelectedRow() < 0) {
553 return;
554 }
555 // ffc.updateBuildOptionsFfsKey(jTable.getSelectedRow(), jTextField6.getText());
556 }
557 });
558 }
559 return jTextFieldFfsKey;
560 }
561
562 /**
563 * This method initializes jButton8
564 *
565 * @return javax.swing.JButton
566 */
567 private JButton getJButtonFfsAdd() {
568 if (jButtonFfsAdd == null) {
569 jButtonFfsAdd = new JButton();
570 jButtonFfsAdd.setPreferredSize(new java.awt.Dimension(70, 20));
571 jButtonFfsAdd.setText("Add");
572 jButtonFfsAdd.addActionListener(new AbstractAction() {
573 /**
574 *
575 */
576 private static final long serialVersionUID = -2923720717273384221L;
577
578 public void actionPerformed(java.awt.event.ActionEvent e) {
579 if (jTextFieldFfsKey.getText().length() > 0) {
580 String[] row = { jTextFieldFfsKey.getText() };
581 ffsTableModel.addRow(row);
582 docConsole.setSaved(false);
583 ffc.genBuildOptionsFfs(jTextFieldFfsKey.getText(), jTextFieldEncapType.getText());
584 }
585 }
586 });
587 }
588 return jButtonFfsAdd;
589 }
590
591 /**
592 * This method initializes jButton9
593 *
594 * @return javax.swing.JButton
595 */
596 private JButton getJButtonFfsDel() {
597 if (jButtonFfsDel == null) {
598 jButtonFfsDel = new JButton();
599 jButtonFfsDel.setPreferredSize(new java.awt.Dimension(70, 20));
600 jButtonFfsDel.setText("Delete");
601 jButtonFfsDel.addActionListener(new AbstractAction() {
602 /**
603 *
604 */
605 private static final long serialVersionUID = -4002678939178194476L;
606
607 public void actionPerformed(ActionEvent arg0) {
608 if (jTableFfs.getSelectedRow() < 0) {
609 return;
610 }
611 docConsole.setSaved(false);
612 ffc.removeBuildOptionsFfs(jTableFfs.getSelectedRow());
613 ffsTableModel.removeRow(jTableFfs.getSelectedRow());
614 }
615 });
616 }
617 return jButtonFfsDel;
618 }
619
620 /**
621 * This method initializes jScrollPane5
622 *
623 * @return javax.swing.JScrollPane
624 */
625 private JScrollPane getJScrollPaneFfsAttribs() {
626 if (jScrollPaneFfsAttribs == null) {
627 jScrollPaneFfsAttribs = new JScrollPane();
628 jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
629 jScrollPaneFfsAttribs.setViewportView(getJTableFfsAttribs());
630 }
631 return jScrollPaneFfsAttribs;
632 }
633
634 /**
635 * This method initializes jTable4
636 *
637 * @return javax.swing.JTable
638 */
639 private JTable getJTableFfsAttribs() {
640 if (jTableFfsAttribs == null) {
641 ffsAttributesTableModel = new DefaultTableModel();
642 jTableFfsAttribs = new JTable(ffsAttributesTableModel);
643 jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
644 jTableFfsAttribs.setRowHeight(20);
645 ffsAttributesTableModel.addColumn("Name");
646 ffsAttributesTableModel.addColumn("Value");
647
648 jTableFfsAttribs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
649 jTableFfsAttribs.getModel().addTableModelListener(new TableModelListener() {
650 public void tableChanged(TableModelEvent arg0) {
651 // TODO Auto-generated method stub
652 int row = arg0.getFirstRow();
653 TableModel m = (TableModel) arg0.getSource();
654 if (arg0.getType() == TableModelEvent.UPDATE) {
655 //ToDo Data Validition check.
656 String name = m.getValueAt(row, 0) + "";
657 String value = m.getValueAt(row, 1) + "";
658
659 if (name.length() == 0) {
660 return;
661 }
662 if (value.length() == 0) {
663 return;
664 }
665 docConsole.setSaved(false);
666 ffc.updateBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), row, name, value);
667 }
668 }
669 });
670 }
671 return jTableFfsAttribs;
672 }
673
674 private void initFfsTable() {
675 int ffsCount = ffc.getBuildOptionsFfsCount();
676 if (ffsCount < 0) {
677 return;
678 }
679 String[][] saa = new String[ffsCount][1];
680 ffc.getBuildOptionsFfsKey(saa);
681 for (int i = 0; i < saa.length; ++i) {
682 ffsTableModel.addRow(saa[i]);
683 }
684 }
685
686 /**
687 * This method initializes jButton17
688 *
689 * @return javax.swing.JButton
690 */
691 private JButton getJButtonFfsAttribNew() {
692 if (jButtonFfsAttribNew == null) {
693 jButtonFfsAttribNew = new JButton();
694 jButtonFfsAttribNew.setPreferredSize(new java.awt.Dimension(80, 20));
695 jButtonFfsAttribNew.setText("New");
696 jButtonFfsAttribNew.addActionListener(new AbstractAction() {
697 /**
698 *
699 */
700 private static final long serialVersionUID = 1L;
701
702 public void actionPerformed(ActionEvent arg0) {
703 if (jTableFfs.getSelectedRow() < 0) {
704 return;
705 }
706 Object[] o = { "", "" };
707 ffsAttributesTableModel.addRow(o);
708 docConsole.setSaved(false);
709 ffc.genBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), "", "");
710 }
711 });
712 }
713 return jButtonFfsAttribNew;
714 }
715
716 /**
717 * This method initializes jButton18
718 *
719 * @return javax.swing.JButton
720 */
721 private JButton getJButtonFfsAttribRemove() {
722 if (jButtonFfsAttribRemove == null) {
723 jButtonFfsAttribRemove = new JButton();
724 jButtonFfsAttribRemove.setPreferredSize(new java.awt.Dimension(80, 20));
725 jButtonFfsAttribRemove.setText("Remove");
726 jButtonFfsAttribRemove.addActionListener(new AbstractAction() {
727 /**
728 *
729 */
730 private static final long serialVersionUID = 1L;
731
732 public void actionPerformed(ActionEvent arg0) {
733 if (jTableFfs.getSelectedRow() < 0) {
734 return;
735 }
736 if (jTableFfsAttribs.getSelectedRow() >= 0) {
737 docConsole.setSaved(false);
738 ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow());
739 ffc.removeBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(),
740 jTableFfsAttribs.getSelectedRow());
741 }
742 }
743 });
744 }
745 return jButtonFfsAttribRemove;
746 }
747
748 /**
749 * This method initializes jScrollPane
750 *
751 * @return javax.swing.JScrollPane
752 */
753 private JScrollPane getJScrollPaneFfs() {
754 if (jScrollPaneFfs == null) {
755 jScrollPaneFfs = new JScrollPane();
756 jScrollPaneFfs.setPreferredSize(new java.awt.Dimension(150, 419));
757 jScrollPaneFfs.setViewportView(getJTableFfs());
758 }
759 return jScrollPaneFfs;
760 }
761
762 /**
763 * This method initializes jTable
764 *
765 * @return javax.swing.JTable
766 */
767 private JTable getJTableFfs() {
768 if (jTableFfs == null) {
769 ffsTableModel = new DefaultTableModel();
770 ffsTableModel.addColumn("FFS Type");
771 jTableFfs = new JTable(ffsTableModel);
772 jTableFfs.setShowGrid(false);
773 jTableFfs.setRowHeight(20);
774
775 jTableFfs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
776 jTableFfs.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
777 public void valueChanged(ListSelectionEvent e) {
778
779 if (e.getValueIsAdjusting()) {
780 return;
781 }
782 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
783 if (lsm.isSelectionEmpty()) {
784 return;
785 } else {
786 int row = lsm.getMinSelectionIndex();
787 sectionTableModel.setRowCount(0);
788 sectionsTableModel.setRowCount(0);
789 subsectionsTableModel.setRowCount(0);
790 ffsAttributesTableModel.setRowCount(0);
791 String[] sArray = { "", "" };
792 LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
793 ArrayList<String> alSections = new ArrayList<String>();
794 ArrayList<String> alSection = new ArrayList<String>();
795 ffc.getBuildOptionsFfs(row, sArray, lhm, alSections, alSection);
796 jTextFieldFfsKey.setText(sArray[0]);
797 jTextFieldEncapType.setText(sArray[1]);
798 for (int i = 0; i < alSection.size(); ++i) {
799 String[] sectionRow = { alSection.get(i) };
800 sectionTableModel.addRow(sectionRow);
801 }
802 for (int j = 0; j < alSections.size(); ++j) {
803 String[] sectionsRow = { alSections.get(j) };
804 sectionsTableModel.addRow(sectionsRow);
805 }
806 if (lhm.size() <= 0) {
807 return;
808 }
809 Set<String> keySet = lhm.keySet();
810 Iterator<String> is = keySet.iterator();
811 while (is.hasNext()) {
812 String key = is.next();
813 String[] attribRow = { key, lhm.get(key) };
814 ffsAttributesTableModel.addRow(attribRow);
815 }
816 }
817 }
818 });
819
820 jTableFfs.getModel().addTableModelListener(new TableModelListener() {
821 public void tableChanged(TableModelEvent arg0) {
822 // TODO Auto-generated method stub
823 int row = arg0.getFirstRow();
824 TableModel m = (TableModel) arg0.getSource();
825 if (arg0.getType() == TableModelEvent.UPDATE) {
826 //ToDo Data Validition check.
827 String id = m.getValueAt(row, 0) + "";
828
829 if (id.length() == 0) {
830 return;
831 }
832 docConsole.setSaved(false);
833 ffc.updateBuildOptionsFfsKey(row, id);
834 }
835 }
836 });
837 }
838 return jTableFfs;
839 }
840
841 /**
842 * This method initializes jScrollPane1
843 *
844 * @return javax.swing.JScrollPane
845 */
846 private JScrollPane getJScrollPaneFfsSection() {
847 if (jScrollPaneFfsSection == null) {
848 jScrollPaneFfsSection = new JScrollPane();
849 // jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
850 jScrollPaneFfsSection.setViewportView(getJTableFfsSection());
851 }
852 return jScrollPaneFfsSection;
853 }
854
855 /**
856 * This method initializes jTable1
857 *
858 * @return javax.swing.JTable
859 */
860 private JTable getJTableFfsSection() {
861 if (jTableFfsSection == null) {
862 sectionTableModel = new DefaultTableModel();
863 sectionTableModel.addColumn("SectionType");
864
865 jTableFfsSection = new JTable(sectionTableModel);
866 jTableFfsSection.setRowHeight(20);
867 JComboBox cb = new JComboBox();
868 cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
869 cb.addItem("EFI_SECTION_VERSION");
870 cb.addItem("EFI_SECTION_USER_INTERFACE");
871 cb.addItem("EFI_SECTION_DXE_DEPEX");
872 cb.addItem("EFI_SECTION_PEI_DEPEX");
873 cb.addItem("EFI_SECTION_PE32");
874 cb.addItem("EFI_SECTION_PIC");
875 cb.addItem("EFI_SECTION_TE");
876 cb.addItem("EFI_SECTION_RAW");
877 cb.addItem("EFI_SECTION_COMPRESSION");
878 cb.addItem("EFI_SECTION_GUID_DEFINED");
879 cb.addItem("EFI_SECTION_COMPATIBILITY16");
880 cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
881 jTableFfsSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
882
883 jTableFfsSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
884
885 jTableFfsSection.getModel().addTableModelListener(new TableModelListener() {
886 public void tableChanged(TableModelEvent arg0) {
887 // TODO Auto-generated method stub
888 if (jTableFfs.getSelectedRow() < 0) {
889 return;
890 }
891 int row = arg0.getFirstRow();
892 TableModel m = (TableModel) arg0.getSource();
893 if (arg0.getType() == TableModelEvent.UPDATE) {
894 //ToDo Data Validition check.
895 String type = m.getValueAt(row, 0) + "";
896 docConsole.setSaved(false);
897 ffc.updateBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row, type);
898 }
899 }
900 });
901 }
902 return jTableFfsSection;
903 }
904
905 /**
906 * This method initializes jScrollPane3
907 *
908 * @return javax.swing.JScrollPane
909 */
910 private JScrollPane getJScrollPaneFfsSubSection() {
911 if (jScrollPaneFfsSubSection == null) {
912 jScrollPaneFfsSubSection = new JScrollPane();
913 // jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
914 jScrollPaneFfsSubSection.setViewportView(getJTableFfsSubSection());
915 }
916 return jScrollPaneFfsSubSection;
917 }
918
919 /**
920 * This method initializes jTable3
921 *
922 * @return javax.swing.JTable
923 */
924 private JTable getJTableFfsSubSection() {
925 if (jTableFfsSubSection == null) {
926 subsectionsTableModel = new DefaultTableModel();
927 subsectionsTableModel.addColumn("SectionType");
928 jTableFfsSubSection = new JTable(subsectionsTableModel);
929 jTableFfsSubSection.setRowHeight(20);
930 JComboBox cb = new JComboBox();
931 cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
932 cb.addItem("EFI_SECTION_VERSION");
933 cb.addItem("EFI_SECTION_USER_INTERFACE");
934 cb.addItem("EFI_SECTION_DXE_DEPEX");
935 cb.addItem("EFI_SECTION_PEI_DEPEX");
936 cb.addItem("EFI_SECTION_PE32");
937 cb.addItem("EFI_SECTION_PIC");
938 cb.addItem("EFI_SECTION_TE");
939 cb.addItem("EFI_SECTION_RAW");
940 cb.addItem("EFI_SECTION_COMPRESSION");
941 cb.addItem("EFI_SECTION_GUID_DEFINED");
942 cb.addItem("EFI_SECTION_COMPATIBILITY16");
943 cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
944 jTableFfsSubSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
945 jTableFfsSubSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
946
947 jTableFfsSubSection.getModel().addTableModelListener(new TableModelListener() {
948 public void tableChanged(TableModelEvent arg0) {
949 // TODO Auto-generated method stub
950 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
951 return;
952 }
953 int row = arg0.getFirstRow();
954 TableModel m = (TableModel) arg0.getSource();
955 if (arg0.getType() == TableModelEvent.UPDATE) {
956 //ToDo Data Validition check.
957 String type = m.getValueAt(row, 0) + "";
958 docConsole.setSaved(false);
959 ffc.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
960 jTableFfsSections.getSelectedRow(), row, type);
961 }
962 }
963 });
964 }
965 return jTableFfsSubSection;
966 }
967
968 /**
969 * This method initializes jTextField
970 *
971 * @return javax.swing.JTextField
972 */
973 private JTextField getJTextFieldEncapType() {
974 if (jTextFieldEncapType == null) {
975 jTextFieldEncapType = new JTextField();
976 jTextFieldEncapType.setPreferredSize(new java.awt.Dimension(100, 20));
977 jTextFieldEncapType.addFocusListener(new java.awt.event.FocusAdapter() {
978 public void focusLost(java.awt.event.FocusEvent e) {
979 if (jTableFfs.getSelectedRow() < 0) {
980 return;
981 }
982 ffc.updateBuildOptionsFfsSectionsType(jTableFfs.getSelectedRow(), jTextFieldEncapType.getText());
983 }
984 });
985 }
986 return jTextFieldEncapType;
987 }
988
989 /**
990 * This method initializes jPanel4
991 *
992 * @return javax.swing.JPanel
993 */
994 private JPanel getJPanelFfsAttribButtonGroup() {
995 if (jPanelFfsAttribButtonGroup == null) {
996 jPanelFfsAttribButtonGroup = new JPanel();
997 jPanelFfsAttribButtonGroup.setPreferredSize(new java.awt.Dimension(100, 100));
998 jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribNew(), null);
999 jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribRemove(), null);
1000 }
1001 return jPanelFfsAttribButtonGroup;
1002 }
1003
1004 /**
1005 * This method initializes jButton
1006 *
1007 * @return javax.swing.JButton
1008 */
1009 private JButton getJButtonFfsSectionNew() {
1010 if (jButtonFfsSectionNew == null) {
1011 jButtonFfsSectionNew = new JButton();
1012 jButtonFfsSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
1013 jButtonFfsSectionNew.setText("New");
1014 jButtonFfsSectionNew.addActionListener(new java.awt.event.ActionListener() {
1015 public void actionPerformed(java.awt.event.ActionEvent e) {
1016 if (jTableFfs.getSelectedRow() < 0) {
1017 return;
1018 }
1019 docConsole.setSaved(false);
1020 String[] row = { "EFI_SECTION_RAW" };
1021 sectionTableModel.addRow(row);
1022 ffc.genBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row[0]);
1023 }
1024 });
1025 }
1026 return jButtonFfsSectionNew;
1027 }
1028
1029 /**
1030 * This method initializes jButton1
1031 *
1032 * @return javax.swing.JButton
1033 */
1034 private JButton getJButtonFfsSectionRemove() {
1035 if (jButtonFfsSectionRemove == null) {
1036 jButtonFfsSectionRemove = new JButton();
1037 jButtonFfsSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
1038 jButtonFfsSectionRemove.setText("Remove");
1039
1040 jButtonFfsSectionRemove.addActionListener(new java.awt.event.ActionListener() {
1041 public void actionPerformed(java.awt.event.ActionEvent e) {
1042 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) {
1043 return;
1044 }
1045 docConsole.setSaved(false);
1046 sectionTableModel.removeRow(jTableFfsSection.getSelectedRow());
1047 ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(),
1048 jTableFfsSection.getSelectedRow());
1049 }
1050 });
1051 }
1052 return jButtonFfsSectionRemove;
1053 }
1054
1055 /**
1056 * This method initializes jButton2
1057 *
1058 * @return javax.swing.JButton
1059 */
1060 private JButton getJButtonFfsSubSectionNew() {
1061 if (jButtonFfsSubSectionNew == null) {
1062 jButtonFfsSubSectionNew = new JButton();
1063 jButtonFfsSubSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
1064 jButtonFfsSubSectionNew.setText("New");
1065 jButtonFfsSubSectionNew.addActionListener(new java.awt.event.ActionListener() {
1066 public void actionPerformed(java.awt.event.ActionEvent e) {
1067 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
1068 return;
1069 }
1070 docConsole.setSaved(false);
1071 String[] row = { "EFI_SECTION_RAW" };
1072 subsectionsTableModel.addRow(row);
1073 ffc.genBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
1074 jTableFfsSections.getSelectedRow(), row[0]);
1075
1076 }
1077 });
1078 }
1079 return jButtonFfsSubSectionNew;
1080 }
1081
1082 /**
1083 * This method initializes jButton3
1084 *
1085 * @return javax.swing.JButton
1086 */
1087 private JButton getJButtonFfsSubSectionRemove() {
1088 if (jButtonFfsSubSectionRemove == null) {
1089 jButtonFfsSubSectionRemove = new JButton();
1090 jButtonFfsSubSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
1091 jButtonFfsSubSectionRemove.setText("Remove");
1092 jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() {
1093 public void actionPerformed(java.awt.event.ActionEvent e) {
1094 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0
1095 || jTableFfsSubSection.getSelectedRow() < 0) {
1096 return;
1097 }
1098 docConsole.setSaved(false);
1099 subsectionsTableModel.removeRow(jTableFfsSubSection.getSelectedRow());
1100 ffc.removeBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
1101 jTableFfsSections.getSelectedRow(),
1102 jTableFfsSubSection.getSelectedRow());
1103 }
1104 });
1105 }
1106 return jButtonFfsSubSectionRemove;
1107 }
1108
1109 /**
1110 * This method initializes jButton6
1111 *
1112 * @return javax.swing.JButton
1113 */
1114 private JButton getJButtonFfsSectionsNew() {
1115 if (jButtonFfsSectionsNew == null) {
1116 jButtonFfsSectionsNew = new JButton();
1117 jButtonFfsSectionsNew.setPreferredSize(new java.awt.Dimension(80, 20));
1118 jButtonFfsSectionsNew.setText("New");
1119 jButtonFfsSectionsNew.addActionListener(new java.awt.event.ActionListener() {
1120 public void actionPerformed(java.awt.event.ActionEvent e) {
1121 if (jTableFfs.getSelectedRow() < 0) {
1122 return;
1123 }
1124 docConsole.setSaved(false);
1125 String[] row = { "" };
1126 sectionsTableModel.addRow(row);
1127 ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), "");
1128 }
1129 });
1130 }
1131 return jButtonFfsSectionsNew;
1132 }
1133
1134 /**
1135 * This method initializes jButton7
1136 *
1137 * @return javax.swing.JButton
1138 */
1139 private JButton getJButtonFfsSectionsRemove() {
1140 if (jButtonFfsSectionsRemove == null) {
1141 jButtonFfsSectionsRemove = new JButton();
1142 jButtonFfsSectionsRemove.setPreferredSize(new java.awt.Dimension(80, 20));
1143 jButtonFfsSectionsRemove.setText("Remove");
1144 jButtonFfsSectionsRemove.addActionListener(new java.awt.event.ActionListener() {
1145 public void actionPerformed(java.awt.event.ActionEvent e) {
1146 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
1147 return;
1148 }
1149 docConsole.setSaved(false);
1150 sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow());
1151 ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(),
1152 jTableFfsSections.getSelectedRow());
1153 }
1154 });
1155 }
1156 return jButtonFfsSectionsRemove;
1157 }
1158
1159 private JScrollPane getJScrollPaneFfsSections() {
1160 if (jScrollPaneFfsSections == null) {
1161 jScrollPaneFfsSections = new JScrollPane();
1162 // jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
1163 jScrollPaneFfsSections.setViewportView(getJTableFfsSections());
1164 }
1165 return jScrollPaneFfsSections;
1166 }
1167
1168 /**
1169 * This method initializes jTable6
1170 *
1171 * @return javax.swing.JTable
1172 */
1173 private JTable getJTableFfsSections() {
1174 if (jTableFfsSections == null) {
1175 sectionsTableModel = new DefaultTableModel();
1176 sectionsTableModel.addColumn("EncapsulationType");
1177 jTableFfsSections = new JTable(sectionsTableModel);
1178 jTableFfsSections.setRowHeight(20);
1179 jTableFfsSections.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1180 jTableFfsSections.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1181 public void valueChanged(ListSelectionEvent e) {
1182 if (e.getValueIsAdjusting()) {
1183 return;
1184 }
1185 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1186 if (lsm.isSelectionEmpty()) {
1187 return;
1188 } else {
1189 int sectionsRow = lsm.getMinSelectionIndex();
1190 if (jTableFfs.getSelectedRow() < 0) {
1191 return;
1192 }
1193 subsectionsTableModel.setRowCount(0);
1194 ArrayList<String> al = new ArrayList<String>();
1195 ffc.getBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), sectionsRow, al);
1196 for (int i = 0; i < al.size(); ++i) {
1197 String[] subsectionRow = { al.get(i) };
1198 subsectionsTableModel.addRow(subsectionRow);
1199 }
1200 }
1201 }
1202 });
1203
1204 jTableFfsSections.getModel().addTableModelListener(new TableModelListener() {
1205 public void tableChanged(TableModelEvent arg0) {
1206 // TODO Auto-generated method stub
1207 int row = arg0.getFirstRow();
1208 TableModel m = (TableModel) arg0.getSource();
1209 if (arg0.getType() == TableModelEvent.UPDATE) {
1210 //ToDo Data Validition check.
1211 String encapType = m.getValueAt(row, 0) + "";
1212 docConsole.setSaved(false);
1213 ffc.updateBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), row, encapType);
1214 }
1215 }
1216 });
1217 }
1218 return jTableFfsSections;
1219 }
1220
1221 /**
1222 * This method initializes jSplitPaneFfsC
1223 *
1224 * @return javax.swing.JSplitPane
1225 */
1226 private JSplitPane getJSplitPaneFfsC() {
1227 if (jSplitPaneFfsC == null) {
1228 jSplitPaneFfsC = new JSplitPane();
1229 jSplitPaneFfsC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
1230 jSplitPaneFfsC.setDividerLocation(130);
1231 jSplitPaneFfsC.setTopComponent(getJPanelFfsCTop());
1232 jSplitPaneFfsC.setBottomComponent(getJSplitPaneFfsCBottom());
1233 jSplitPaneFfsC.setDividerSize(5);
1234 }
1235 return jSplitPaneFfsC;
1236 }
1237
1238 /**
1239 * This method initializes jPanelFfsCTop
1240 *
1241 * @return javax.swing.JPanel
1242 */
1243 private JPanel getJPanelFfsCTop() {
1244 if (jPanelFfsCTop == null) {
1245 jPanelFfsCTop = new JPanel();
1246 jPanelFfsCTop.setLayout(new BorderLayout());
1247 jPanelFfsCTop.add(getJPanelSectionN(), java.awt.BorderLayout.NORTH);
1248 jPanelFfsCTop.add(getJPanelSectionC(), java.awt.BorderLayout.CENTER);
1249 }
1250 return jPanelFfsCTop;
1251 }
1252
1253 /**
1254 * This method initializes jSplitPaneFfsCBottom
1255 *
1256 * @return javax.swing.JSplitPane
1257 */
1258 private JSplitPane getJSplitPaneFfsCBottom() {
1259 if (jSplitPaneFfsCBottom == null) {
1260 jSplitPaneFfsCBottom = new JSplitPane();
1261 jSplitPaneFfsCBottom.setDividerSize(5);
1262 jSplitPaneFfsCBottom.setDividerLocation(130);
1263 jSplitPaneFfsCBottom.setTopComponent(getJPanelFfsCBottomTop());
1264 jSplitPaneFfsCBottom.setBottomComponent(getJPanelFfsCBottomBottom());
1265 jSplitPaneFfsCBottom.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
1266 }
1267 return jSplitPaneFfsCBottom;
1268 }
1269
1270 /**
1271 * This method initializes jPanelFfsCBottomTop
1272 *
1273 * @return javax.swing.JPanel
1274 */
1275 private JPanel getJPanelFfsCBottomTop() {
1276 if (jPanelFfsCBottomTop == null) {
1277 jPanelFfsCBottomTop = new JPanel();
1278 jPanelFfsCBottomTop.setLayout(new BorderLayout());
1279 jPanelFfsCBottomTop.add(getJPanelSectionsN(), java.awt.BorderLayout.NORTH);
1280 jPanelFfsCBottomTop.add(getJPanelSectionsC(), java.awt.BorderLayout.CENTER);
1281 }
1282 return jPanelFfsCBottomTop;
1283 }
1284
1285 /**
1286 * This method initializes jPanelFfsCBottomBottom
1287 *
1288 * @return javax.swing.JPanel
1289 */
1290 private JPanel getJPanelFfsCBottomBottom() {
1291 if (jPanelFfsCBottomBottom == null) {
1292 jPanelFfsCBottomBottom = new JPanel();
1293 jPanelFfsCBottomBottom.setLayout(new BorderLayout());
1294 jPanelFfsCBottomBottom.add(getJPanelSubSectionN(), java.awt.BorderLayout.NORTH);
1295 jPanelFfsCBottomBottom.add(getJPanelSubSectionC(), java.awt.BorderLayout.CENTER);
1296 }
1297 return jPanelFfsCBottomBottom;
1298 }
1299
1300 /**
1301 * This method initializes jPanelSectionN
1302 *
1303 * @return javax.swing.JPanel
1304 */
1305 private JPanel getJPanelSectionN() {
1306 if (jPanelSectionN == null) {
1307 jPanelSectionN = new JPanel();
1308 jLabelFfsSection = new JLabel();
1309 jLabelFfsSection.setText("Section");
1310 jPanelSectionN.add(jLabelFfsSection, null);
1311 jPanelSectionN.add(getJButtonFfsSectionNew(), null);
1312 jPanelSectionN.add(getJButtonFfsSectionRemove(), null);
1313 }
1314 return jPanelSectionN;
1315 }
1316
1317 /**
1318 * This method initializes jPanelSectionC
1319 *
1320 * @return javax.swing.JPanel
1321 */
1322 private JPanel getJPanelSectionC() {
1323 if (jPanelSectionC == null) {
1324 jPanelSectionC = new JPanel();
1325 jPanelSectionC.add(getJScrollPaneFfsSection(), null);
1326 }
1327 return jPanelSectionC;
1328 }
1329
1330 /**
1331 * This method initializes jPanelSectionsN
1332 *
1333 * @return javax.swing.JPanel
1334 */
1335 private JPanel getJPanelSectionsN() {
1336 if (jPanelSectionsN == null) {
1337 jPanelSectionsN = new JPanel();
1338 jLabelFfsSections = new JLabel();
1339 jLabelFfsSections.setText("Sections");
1340 jPanelSectionsN.add(jLabelFfsSections, null);
1341 jPanelSectionsN.add(getJButtonFfsSectionsNew(), null);
1342 jPanelSectionsN.add(getJButtonFfsSectionsRemove(), null);
1343 }
1344 return jPanelSectionsN;
1345 }
1346
1347 /**
1348 * This method initializes jPanelSectionsC
1349 *
1350 * @return javax.swing.JPanel
1351 */
1352 private JPanel getJPanelSectionsC() {
1353 if (jPanelSectionsC == null) {
1354 jPanelSectionsC = new JPanel();
1355 jPanelSectionsC.add(getJScrollPaneFfsSections(), null);
1356 }
1357 return jPanelSectionsC;
1358 }
1359
1360 /**
1361 * This method initializes jPanelSubSectionN
1362 *
1363 * @return javax.swing.JPanel
1364 */
1365 private JPanel getJPanelSubSectionN() {
1366 if (jPanelSubSectionN == null) {
1367 jPanelSubSectionN = new JPanel();
1368 jLabelFfsSubSections = new JLabel();
1369 jLabelFfsSubSections.setText("Sub-Sections");
1370 jPanelSubSectionN.add(jLabelFfsSubSections, null);
1371 jPanelSubSectionN.add(getJButtonFfsSubSectionNew(), null);
1372 jPanelSubSectionN.add(getJButtonFfsSubSectionRemove(), null);
1373 }
1374 return jPanelSubSectionN;
1375 }
1376
1377 /**
1378 * This method initializes jPanelSubSectionC
1379 *
1380 * @return javax.swing.JPanel
1381 */
1382 private JPanel getJPanelSubSectionC() {
1383 if (jPanelSubSectionC == null) {
1384 jPanelSubSectionC = new JPanel();
1385 jPanelSubSectionC.add(getJScrollPaneFfsSubSection(), null);
1386 }
1387 return jPanelSubSectionC;
1388 }
1389
1390 /**
1391 * The following section contains all Build Options content
1392 */
1393
1394 /**
1395 * This method initializes jPanelOptionsTab
1396 *
1397 * This is the main Options screen
1398 *
1399 * @return javax.swing.JPanel jPanelOptionsTab
1400 */
1401 private JPanel getJPanelOptionsTab() {
1402 if (jPanelOptionsTab == null) {
1403 // This container holds the Options Tab content
1404
1405 // FlowLayout flowLayout9 = new FlowLayout();
1406 // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
1407
1408 jPanelOptionsTab = new JPanel();
1409 jPanelOptionsTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
1410 jPanelOptionsTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
1411 jPanelOptionsTab.setAutoscrolls(true);
1412 jPanelOptionsTab.setLocation(0, 0);
1413 jPanelOptionsTab.setLayout(null);
1414 jPanelOptionsTab.add(getJPanelOptionsContainer(), null);
1415 jPanelOptionsTab.add(getJScrollPaneOptions(), null);
1416
1417 }
1418 return jPanelOptionsTab;
1419 }
1420
1421 /**
1422 * This method initializes jPanelOptionsContainer
1423 *
1424 * @return javax.swing.JPanel
1425 */
1426 private JPanel getJPanelOptionsContainer() {
1427 if (jPanelOptionsContainer == null) {
1428 jLabelTagName = new JLabel();
1429 jLabelTagName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
1430 jLabelTagName.setLocation(new java.awt.Point(labelColumn, rowOne));
1431 jLabelTagName.setText("Tag Name");
1432 jLabelBuildTargets = new JLabel();
1433 jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
1434 jLabelBuildTargets.setLocation(new java.awt.Point(labelColumn, rowTwo));
1435 jLabelBuildTargets.setText("Build Targets");
1436 jLabelToolCmd = new JLabel();
1437 jLabelToolCmd.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
1438 jLabelToolCmd.setLocation(new java.awt.Point(labelColumn, rowThree));
1439 jLabelToolCmd.setText("Tool Command");
1440 jLabelSupArch = new JLabel();
1441 jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
1442 jLabelSupArch.setLocation(new java.awt.Point(labelColumn, rowFour));
1443 jLabelSupArch.setText("Supported Architectures");
1444 jLabelToolChainFamily = new JLabel();
1445 jLabelToolChainFamily.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
1446 jLabelToolChainFamily.setLocation(new java.awt.Point(labelColumn, rowFive));
1447 jLabelToolChainFamily.setText("Tool Chain Family");
1448
1449 jLabelOptionContents = new JLabel();
1450 jLabelOptionContents.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
1451 jLabelOptionContents.setLocation(new java.awt.Point(labelColumn, rowSix));
1452 jLabelOptionContents.setText("Option Contents");
1453
1454 jPanelOptionsContainer = new JPanel();
1455
1456 jPanelOptionsContainer.setLayout(null);
1457
1458 jPanelOptionsContainer.setLocation(new java.awt.Point(2, 2));
1459 jPanelOptionsContainer.setBounds(new java.awt.Rectangle(2, 2, dialogWidth * 2, dialogHeight));
1460 jPanelOptionsContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
1461 /*
1462 jPanelOptionsContainer
1463 .setBorder(javax.swing.BorderFactory
1464 .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
1465 */
1466 jPanelOptionsContainer.add(jLabelTagName, null);
1467 jPanelOptionsContainer.add(getJTextFieldTagName(), null);
1468
1469 jPanelOptionsContainer.add(jLabelBuildTargets, null);
1470 jPanelOptionsContainer.add(getJTextFieldBuildTargets(), null);
1471
1472 jPanelOptionsContainer.add(jLabelToolChainFamily, null);
1473 jPanelOptionsContainer.add(getJTextFieldToolChainFamily(), null);
1474
1475 jPanelOptionsContainer.add(jLabelToolCmd, null);
1476 jPanelOptionsContainer.add(getJTextFieldToolCmd(), null);
1477
1478 jPanelOptionsContainer.add(jLabelSupArch, null);
1479 jPanelOptionsContainer.add(getArchitectureSelections(), null);
1480
1481 jPanelOptionsContainer.add(jLabelOptionContents, null);
1482 jPanelOptionsContainer.add(getJTextFieldOptionContents(), null);
1483
1484 jPanelOptionsContainer.add(getJButtonOptionsAdd(), null);
1485 jPanelOptionsContainer.add(getJButtonOptionsDel(), null);
1486 }
1487 return jPanelOptionsContainer;
1488 }
1489
1490 /**
1491 * This method initializes jTextFieldOptionTagName Row 1
1492 *
1493 * @return javax.swing.JTextField
1494 */
1495 private JTextField getJTextFieldTagName() {
1496 if (jTextFieldTagName == null) {
1497 jTextFieldTagName = new JTextField();
1498 jTextFieldTagName.setBounds(new java.awt.Rectangle(fieldColumn, rowOne, fieldWidth, oneRowHeight));
1499 jTextFieldTagName.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1500 jTextFieldTagName.setLocation(new java.awt.Point(fieldColumn, rowOne));
1501 }
1502 return jTextFieldTagName;
1503 }
1504
1505 /**
1506 * This method initializes jTextFieldBuildTargets Row 2
1507 *
1508 * @return javax.swing.JTextField jTextFieldBuildTargets
1509 */
1510 private JTextField getJTextFieldBuildTargets() {
1511 if (jTextFieldBuildTargets == null) {
1512 jTextFieldBuildTargets = new JTextField();
1513 jTextFieldBuildTargets.setBounds(new java.awt.Rectangle(fieldColumn, rowTwo, fieldWidth, oneRowHeight));
1514 jTextFieldBuildTargets.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1515 jTextFieldBuildTargets.setLocation(new java.awt.Point(fieldColumn, rowTwo));
1516 }
1517 return jTextFieldBuildTargets;
1518 }
1519
1520 /**
1521 * This method initializes jTextFieldToolCmd Row 3
1522 *
1523 * This should be a dropdown box of command codes from tools_def.txt
1524 *
1525 * @return javax.swing.JTextField jTextFieldToolCmd
1526 */
1527 private JTextField getJTextFieldToolCmd() {
1528 if (jTextFieldToolCmd == null) {
1529 jTextFieldToolCmd = new JTextField();
1530 jTextFieldToolCmd.setBounds(new java.awt.Rectangle(fieldColumn, rowThree, fieldWidth, oneRowHeight));
1531 jTextFieldToolCmd.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1532 jTextFieldToolCmd.setLocation(new java.awt.Point(fieldColumn, rowThree));
1533 }
1534 return jTextFieldToolCmd;
1535 }
1536
1537 /**
1538 * This method initializes jArchitectureSelections Row 4
1539 *
1540 * @return jArchitectureSelections
1541 */
1542 private JPanel getArchitectureSelections() {
1543 if (jArchitectureSelections == null) {
1544 jArchitectureSelections = new JPanel();
1545 jArchitectureSelections.setLayout(null);
1546 jArchitectureSelections.add(getJCheckBoxIA32(), null);
1547 jArchitectureSelections.add(getJCheckBoxX64(), null);
1548 jArchitectureSelections.add(getJCheckBoxIpf(), null);
1549 jArchitectureSelections.add(getJCheckBoxEBC(), null);
1550 jArchitectureSelections.add(getJCheckBoxARM(), null);
1551 jArchitectureSelections.add(getJCheckBoxPPC(), null);
1552 jArchitectureSelections.setBounds(new java.awt.Rectangle(fieldColumn, rowFour, fieldWidth, oneRowHeight));
1553 jArchitectureSelections.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1554 jArchitectureSelections.setLocation(new java.awt.Point(fieldColumn, rowFour));
1555 }
1556 return jArchitectureSelections;
1557 }
1558
1559 /**
1560 * This method initializes jCheckBoxIA32
1561 *
1562 * @return javax.swing.JCheckBox jCheckBoxIA32
1563 */
1564 private JCheckBox getJCheckBoxIA32() {
1565 if (jCheckBoxIA32 == null) {
1566 jCheckBoxIA32 = new JCheckBox();
1567 jCheckBoxIA32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
1568 jCheckBoxIA32.setText("IA32");
1569 }
1570 return jCheckBoxIA32;
1571 }
1572
1573 /**
1574 * This method initializes jCheckBoxX64
1575 *
1576 * @return javax.swing.JCheckBox jCheckBoxX64
1577 */
1578 private JCheckBox getJCheckBoxX64() {
1579 if (jCheckBoxX64 == null) {
1580 jCheckBoxX64 = new JCheckBox();
1581 jCheckBoxX64.setText("X64");
1582 jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
1583 }
1584 return jCheckBoxX64;
1585 }
1586
1587 /**
1588 * This method initializes jCheckBoxIpf
1589 *
1590 * @return javax.swing.JCheckBox jCheckBoxIpf
1591 */
1592 private JCheckBox getJCheckBoxIpf() {
1593 if (jCheckBoxIpf == null) {
1594 jCheckBoxIpf = new JCheckBox();
1595 jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
1596 jCheckBoxIpf.setText("IPF");
1597 }
1598 return jCheckBoxIpf;
1599 }
1600
1601
1602 /**
1603 * This method initializes jCheckBoxEBC
1604 *
1605 * @return javax.swing.JCheckBox jCheckBoxEBC
1606 */
1607 private JCheckBox getJCheckBoxEBC() {
1608 if (jCheckBoxEBC == null) {
1609 jCheckBoxEBC = new JCheckBox();
1610 jCheckBoxEBC.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
1611 jCheckBoxEBC.setText("EBC");
1612 }
1613 return jCheckBoxEBC;
1614 }
1615
1616 /**
1617 * This method initializes jCheckBoxARM
1618 *
1619 * @return javax.swing.JCheckBox jCheckBoxARM
1620 */
1621 private JCheckBox getJCheckBoxARM() {
1622 if (jCheckBoxARM == null) {
1623 jCheckBoxARM = new JCheckBox();
1624 jCheckBoxARM.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
1625 jCheckBoxARM.setText("ARM");
1626 }
1627 return jCheckBoxARM;
1628 }
1629
1630 /**
1631 * This method initializes jCheckBoxPPC
1632 *
1633 * @return javax.swing.JCheckBox jCheckBoxPPC
1634 */
1635 private JCheckBox getJCheckBoxPPC() {
1636 if (jCheckBoxPPC == null) {
1637 jCheckBoxPPC = new JCheckBox();
1638 jCheckBoxPPC.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
1639 jCheckBoxPPC.setText("PPC");
1640 }
1641 return jCheckBoxPPC;
1642 }
1643
1644 /**
1645 * This method initializes jTextFieldToolChainFamily Row 5
1646 *
1647 * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
1648 *
1649 * @return javax.swing.JTextField
1650 */
1651 private JTextField getJTextFieldToolChainFamily() {
1652 if (jTextFieldToolChainFamily == null) {
1653 jTextFieldToolChainFamily = new JTextField();
1654 jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(fieldColumn, rowFive, fieldWidth, oneRowHeight));
1655 jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1656 jTextFieldToolChainFamily.setLocation(new java.awt.Point(fieldColumn, rowFive));
1657 }
1658 return jTextFieldToolChainFamily;
1659 }
1660
1661 /**
1662 * This method initializes jTextFieldOptionContents Row 6
1663 *
1664 * This is where we should put the checkbox & entry data for the command arguments
1665 *
1666 * @return javax.swing.JTextField
1667 */
1668 private JTextField getJTextFieldOptionContents() {
1669 if (jTextFieldOptionContents == null) {
1670 jTextFieldOptionContents = new JTextField();
1671 jTextFieldOptionContents.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1672 jTextFieldOptionContents.setBounds(fieldColumn, rowSix, fieldWidth, oneRowHeight);
1673 jTextFieldOptionContents.setLocation(new java.awt.Point(fieldColumn, rowSix));
1674 }
1675 return jTextFieldOptionContents;
1676 }
1677
1678 /**
1679 * This method initializes jButtonOptionsAdd
1680 *
1681 * Add entry from the top screen to the table
1682 *
1683 * @return javax.swing.JButton jButtonOptionsAdd
1684 */
1685 private JButton getJButtonOptionsAdd() {
1686 if (jButtonOptionsAdd == null) {
1687 jButtonOptionsAdd = new JButton();
1688 jButtonOptionsAdd.setText("Add");
1689
1690 jButtonOptionsAdd.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
1691 jButtonOptionsAdd.setBounds(new java.awt.Rectangle(firstButtonLoc, buttonRow, buttonWidth, oneRowHeight));
1692 jButtonOptionsAdd.setLocation(new java.awt.Point(firstButtonLoc, buttonRow));
1693 jButtonOptionsAdd.addActionListener(new AbstractAction() {
1694 /**
1695 *
1696 */
1697 private static final long serialVersionUID = 1L;
1698
1699 public void actionPerformed(java.awt.event.ActionEvent e) {
1700 boolean[] boolArray = { jCheckBoxIA32.isSelected(), jCheckBoxIpf.isSelected(),
1701 jCheckBoxX64.isSelected(), jCheckBoxEBC.isSelected(),
1702 jCheckBoxARM.isSelected(), jCheckBoxPPC.isSelected() };
1703 String s = boolToList(boolArray);
1704 Object[] o = { jTextFieldBuildTargets.getText(), jTextFieldToolChainFamily.getText(), s,
1705 jTextFieldToolCmd.getText(), jTextFieldTagName.getText(),
1706 jTextFieldOptionContents.getText() };
1707 optionsTableModel.addRow(o);
1708 docConsole.setSaved(false);
1709 ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText()),
1710 jTextFieldToolChainFamily.getText(), jTextFieldTagName.getText(),
1711 jTextFieldToolCmd.getText(), stringToVector(s),
1712 jTextFieldOptionContents.getText());
1713 }
1714 });
1715 }
1716 return jButtonOptionsAdd;
1717 }
1718
1719 /**
1720 * This method initializes jButtonOptionsDel
1721 *
1722 * Remove a line from the table below
1723 *
1724 * @return javax.swing.JButton jButtonOptionsDel
1725 */
1726 private JButton getJButtonOptionsDel() {
1727 if (jButtonOptionsDel == null) {
1728 jButtonOptionsDel = new JButton();
1729 jButtonOptionsDel.setText("Delete");
1730 jButtonOptionsDel.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
1731 jButtonOptionsDel.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));
1732 jButtonOptionsDel.setLocation(new java.awt.Point(next2LastButtonLoc, buttonRow));
1733 jButtonOptionsDel.addActionListener(new AbstractAction() {
1734 /**
1735 *
1736 */
1737 private static final long serialVersionUID = 1L;
1738
1739 public void actionPerformed(java.awt.event.ActionEvent e) {
1740 if (selectedRow >= 0) {
1741 optionsTableModel.removeRow(selectedRow);
1742 docConsole.setSaved(false);
1743 ffc.removeBuildOptionsOpt(selectedRow);
1744 }
1745 }
1746 });
1747 }
1748 return jButtonOptionsDel;
1749 }
1750
1751 /**
1752 * This method initializes jScrollPaneOptions
1753 * Contains the Table and is located below the data entry section
1754 * @return javax.swing.JScrollPane jScrollPaneOptoins
1755 */
1756 private JScrollPane getJScrollPaneOptions() {
1757 if (jScrollPaneOptions == null) {
1758 jScrollPaneOptions = new JScrollPane();
1759 jScrollPaneOptions.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight * 2));
1760 jScrollPaneOptions.setBounds(new java.awt.Rectangle(2, (dialogHeight * 2) + 2, dialogWidth * 2, dialogHeight * 2));
1761 jScrollPaneOptions.setLocation(new java.awt.Point(2, dialogHeight + 2));
1762
1763 jScrollPaneOptions.setViewportView(getJTableOptions());
1764 }
1765 return jScrollPaneOptions;
1766 }
1767
1768 /**
1769 * This method initializes jTableOptions
1770 *
1771 * @return javax.swing.JTable jTableOptions
1772 */
1773 private JTable getJTableOptions() {
1774 if (jTableOptions == null) {
1775 jTitle = new JLabel();
1776 jTitle.setText("Current Option Configuration Lines");
1777 jTitle.setBounds(2, 2, labelWidth, oneRowHeight);
1778
1779 optionsTableModel = new DefaultTableModel();
1780 jTableOptions = new JTable(optionsTableModel);
1781 jTableOptions.setRowHeight(20);
1782 optionsTableModel.addColumn("Build Targets");
1783 optionsTableModel.addColumn("Tool Chain Family");
1784 optionsTableModel.addColumn("Supported Architectures");
1785 optionsTableModel.addColumn("Tool Command Code");
1786 optionsTableModel.addColumn("TagName");
1787 optionsTableModel.addColumn("Contents");
1788
1789 javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
1790 JComboBox cb = new JComboBox();
1791 cb.addItem("MSFT");
1792 cb.addItem("GCC");
1793 cb.addItem("CYGWIN");
1794 cb.addItem("INTEL");
1795 cb.addItem("USER_DEFINED");
1796 toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1797 Vector<String> vArch = new Vector<String>();
1798 vArch.add("IA32");
1799 vArch.add("X64");
1800 vArch.add("IPF");
1801 vArch.add("EBC");
1802 vArch.add("ARM");
1803 vArch.add("PPC");
1804 jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch));
1805
1806 jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
1807
1808 jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1809 jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
1810 jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1811 public void valueChanged(ListSelectionEvent e) {
1812 selectedRow = -1;
1813 if (e.getValueIsAdjusting()) {
1814 return;
1815 }
1816 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1817 if (lsm.isSelectionEmpty()) {
1818 return;
1819 } else {
1820 selectedRow = lsm.getMinSelectionIndex();
1821 }
1822 }
1823 });
1824
1825 jTableOptions.getModel().addTableModelListener(new TableModelListener() {
1826 public void tableChanged(TableModelEvent arg0) {
1827 // TODO Auto-generated method stub
1828 int row = arg0.getFirstRow();
1829 TableModel m = (TableModel) arg0.getSource();
1830 if (arg0.getType() == TableModelEvent.UPDATE) {
1831 //ToDo Data Validition check.
1832 String targets = m.getValueAt(row, 0) + "";
1833 Vector<Object> targetName = new Vector<Object>();
1834 String[] sArray = targets.split("( )+");
1835 for (int i = 0; i < sArray.length; ++i) {
1836 targetName.add(sArray[i]);
1837 }
1838 String toolChain = m.getValueAt(row, 1) + "";
1839 String archs = m.getValueAt(row, 2) + "";
1840 Vector<Object> supArch = null;
1841 if (archs.length() > 0) {
1842 supArch = new Vector<Object>();
1843 String[] sArray1 = archs.split("( )+");
1844 for (int i = 0; i < sArray1.length; ++i) {
1845 supArch.add(sArray1[i]);
1846 }
1847 }
1848
1849 String toolCmd = m.getValueAt(row, 3) + "";
1850 String tagName = m.getValueAt(row, 4) + "";
1851 String contents = m.getValueAt(row, 5) + "";
1852 docConsole.setSaved(false);
1853 ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents);
1854 }
1855 }
1856 });
1857 }
1858 return jTableOptions;
1859 }
1860
1861 private Vector<Object> stringToVector(String s) {
1862 String[] sArray = s.split(" ");
1863 Vector<Object> v = null;
1864 if (s.length() > 0) {
1865 v = new Vector<Object>();
1866 for (int i = 0; i < sArray.length; ++i) {
1867 v.add(sArray[i]);
1868 }
1869 }
1870 return v;
1871 }
1872
1873 private String boolToList(boolean[] bool) {
1874 String s = " ";
1875 if (bool[0]) {
1876 s += "IA32 ";
1877 }
1878 if (bool[1]) {
1879 s += "IPF ";
1880 }
1881 if (bool[2]) {
1882 s += "X64 ";
1883 }
1884 if (bool[3]) {
1885 s += "EBC ";
1886 }
1887 if (bool[4]) {
1888 s += "ARM ";
1889 }
1890 if (bool[5]) {
1891 s += "PPC ";
1892 }
1893 if (s == " ") {
1894 s += "IA32";
1895 }
1896 return s.trim();
1897 }
1898
1899 private void initOptionTable() {
1900 if (ffc.getBuildOptionsOptCount() == 0) {
1901 //ToDo get default options from *.txt file
1902 return;
1903 }
1904 String[][] saa = new String[ffc.getBuildOptionsOptCount()][6];
1905 ffc.getBuildOptionsOpts(saa);
1906 for (int i = 0; i < saa.length; ++i) {
1907 optionsTableModel.addRow(saa[i]);
1908 }
1909 }
1910
1911
1912 /**
1913 * Everything below should pertain to the ANT Task Tab
1914 */
1915
1916 /**
1917 * This method initializes jButton12
1918 *
1919 * @return javax.swing.JButton
1920 */
1921 private JButton getJButtonAntTaskFileBrowse() {
1922 if (jButtonAntTaskFileBrowse == null) {
1923 jButtonAntTaskFileBrowse = new JButton();
1924 jButtonAntTaskFileBrowse.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
1925 jButtonAntTaskFileBrowse.setText("Browse");
1926 jButtonAntTaskFileBrowse.addActionListener(new AbstractAction() {
1927 private static final long serialVersionUID = 1L;
1928
1929 public void actionPerformed(ActionEvent arg0) {
1930 //
1931 // Select files from current workspace
1932 //
1933 String dirPrefix = System.getenv("WORKSPACE");
1934 JFileChooser chooser = new JFileChooser(dirPrefix);
1935 File theFile = null;
1936 String headerDest = null;
1937
1938 chooser.setMultiSelectionEnabled(false);
1939 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1940 int retval = chooser.showOpenDialog(frame);
1941 if (retval == JFileChooser.APPROVE_OPTION) {
1942
1943 theFile = chooser.getSelectedFile();
1944 String file = theFile.getPath();
1945 if (!file.startsWith(dirPrefix)) {
1946 JOptionPane.showMessageDialog(frame, "You can only select files in current package!");
1947 return;
1948 }
1949 } else {
1950 return;
1951 }
1952
1953 headerDest = theFile.getPath();
1954 jTextFieldAntTaskFile.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/'));
1955
1956 }
1957
1958 });
1959 }
1960 return jButtonAntTaskFileBrowse;
1961 }
1962
1963 /**
1964 * This method initializes jPanelUserDefCenterN
1965 *
1966 * @return javax.swing.JPanel
1967 */
1968 private JPanel getJPanelUserDefCenterN() {
1969 if (jPanelUserDefCenterN == null) {
1970 jPanelUserDefCenterN = new JPanel();
1971 jPanelUserDefCenterN.add(jLabelAntCmdOpts, null);
1972 jPanelUserDefCenterN.add(getJTextFieldAntCmdOpts(), null);
1973 jPanelUserDefCenterN.add(getJButtonAntTaskAdd(), null);
1974 jPanelUserDefCenterN.add(getJButtonAntTaskDel(), null);
1975 }
1976 return jPanelUserDefCenterN;
1977 }
1978
1979 /**
1980 * This method initializes jPanelUserDefCenterC
1981 *
1982 * @return javax.swing.JPanel
1983 */
1984 private JPanel getJPanelUserDefCenterC() {
1985 if (jPanelUserDefCenterC == null) {
1986 jPanelUserDefCenterC = new JPanel();
1987 jPanelUserDefCenterC.add(getJScrollPaneAntTasks(), null);
1988 }
1989 return jPanelUserDefCenterC;
1990 }
1991
1992 /**
1993 * This method initializes jPanel8
1994 *
1995 * @return javax.swing.JPanel
1996 */
1997 private JPanel getJPanelUserDef() {
1998 if (jPanelUserDef == null) {
1999 jPanelUserDef = new JPanel();
2000 jPanelUserDef.setLayout(new BorderLayout());
2001 jPanelUserDef.add(getJPanelUserDefNorth(), java.awt.BorderLayout.NORTH);
2002 jPanelUserDef.add(getJPanelUserDefCenter(), java.awt.BorderLayout.CENTER);
2003
2004 }
2005 return jPanelUserDef;
2006 }
2007
2008 /**
2009 * This method initializes jPanel9
2010 *
2011 * @return javax.swing.JPanel
2012 */
2013 private JPanel getJPanelUserDefNorth() {
2014 if (jPanelUserDefNorth == null) {
2015 jLabelAntTaskFile = new JLabel();
2016 jLabelAntTaskFile.setText("ANT Task File");
2017 jLabelAntTaskFile.setPreferredSize(new java.awt.Dimension(80, 20));
2018 FlowLayout flowLayout8 = new FlowLayout();
2019 flowLayout8.setAlignment(java.awt.FlowLayout.CENTER);
2020 jLabelAntTaskId = new JLabel();
2021 jLabelAntTaskId.setText("ID");
2022 jPanelUserDefNorth = new JPanel();
2023 jPanelUserDefNorth.setLayout(flowLayout8);
2024 jPanelUserDefNorth.add(jLabelAntTaskFile, null);
2025 jPanelUserDefNorth.add(getJTextFieldAntTaskFile(), null);
2026 jPanelUserDefNorth.add(getJButtonAntTaskFileBrowse(), null);
2027 jPanelUserDefNorth.add(jLabelAntTaskId, null);
2028 jPanelUserDefNorth.add(getJTextFieldAntTaskId(), null);
2029 }
2030 return jPanelUserDefNorth;
2031 }
2032
2033 /**
2034 * This method initializes jPanel11
2035 *
2036 * @return javax.swing.JPanel
2037 */
2038 private JPanel getJPanelUserDefCenter() {
2039 if (jPanelUserDefCenter == null) {
2040 jLabelAntCmdOpts = new JLabel();
2041 jLabelAntCmdOpts.setText("ANT Command Options");
2042 jLabelAntCmdOpts.setPreferredSize(new java.awt.Dimension(131, 20));
2043 jPanelUserDefCenter = new JPanel();
2044 jPanelUserDefCenter.setLayout(new BorderLayout());
2045
2046 jPanelUserDefCenter.add(getJPanelUserDefCenterN(), java.awt.BorderLayout.NORTH);
2047 jPanelUserDefCenter.add(getJPanelUserDefCenterC(), java.awt.BorderLayout.CENTER);
2048 }
2049 return jPanelUserDefCenter;
2050 }
2051
2052 /**
2053 * This method initializes jTextField2
2054 *
2055 * @return javax.swing.JTextField
2056 */
2057 private JTextField getJTextFieldAntTaskFile() {
2058 if (jTextFieldAntTaskFile == null) {
2059 jTextFieldAntTaskFile = new JTextField();
2060 jTextFieldAntTaskFile.setPreferredSize(new java.awt.Dimension(200, 20));
2061 }
2062 return jTextFieldAntTaskFile;
2063 }
2064
2065 /**
2066 * This method initializes jTextField3
2067 *
2068 * @return javax.swing.JTextField
2069 */
2070 private JTextField getJTextFieldAntTaskId() {
2071 if (jTextFieldAntTaskId == null) {
2072 jTextFieldAntTaskId = new JTextField();
2073 jTextFieldAntTaskId.setPreferredSize(new java.awt.Dimension(100, 20));
2074 }
2075 return jTextFieldAntTaskId;
2076 }
2077
2078 /**
2079 * This method initializes jButton4
2080 *
2081 * @return javax.swing.JButton
2082 */
2083 private JButton getJButtonAntTaskAdd() {
2084 if (jButtonAntTaskAdd == null) {
2085 jButtonAntTaskAdd = new JButton();
2086 jButtonAntTaskAdd.setPreferredSize(new java.awt.Dimension(90, 20));
2087 jButtonAntTaskAdd.setText("Add");
2088 jButtonAntTaskAdd.addActionListener(new ActionListener() {
2089 public void actionPerformed(ActionEvent e) {
2090 if (!DataValidation.isInt(jTextFieldAntTaskId.getText())
2091 || jTextFieldAntTaskId.getText().length() != 8) {
2092 JOptionPane.showMessageDialog(frame, "ID must be an 8-digit integer.");
2093 return;
2094 }
2095 Object[] o = { jTextFieldAntTaskId.getText(), null, null };
2096 o[1] = jTextFieldAntTaskFile.getText();
2097 o[2] = jTextFieldAntCmdOpts.getText();
2098 ffc.genBuildOptionsUserDefAntTask(o[0] + "", o[1] + "", o[2] + "");
2099 antTaskTableModel.addRow(o);
2100 docConsole.setSaved(false);
2101 }
2102 });
2103 }
2104 return jButtonAntTaskAdd;
2105 }
2106
2107 /**
2108 * This method initializes jButton5
2109 *
2110 * @return javax.swing.JButton
2111 */
2112 private JButton getJButtonAntTaskDel() {
2113 if (jButtonAntTaskDel == null) {
2114 jButtonAntTaskDel = new JButton();
2115 jButtonAntTaskDel.setPreferredSize(new java.awt.Dimension(90, 20));
2116 jButtonAntTaskDel.setText("Delete");
2117 jButtonAntTaskDel.addActionListener(new ActionListener() {
2118 public void actionPerformed(ActionEvent e) {
2119 if (selectedRow >= 0) {
2120 docConsole.setSaved(false);
2121 antTaskTableModel.removeRow(selectedRow);
2122 ffc.removeBuildOptionsUserDefAntTask(selectedRow);
2123 }
2124 }
2125 });
2126 }
2127 return jButtonAntTaskDel;
2128 }
2129
2130 /**
2131 * This method initializes jTextField4
2132 *
2133 * @return javax.swing.JTextField
2134 */
2135 private JTextField getJTextFieldAntCmdOpts() {
2136 if (jTextFieldAntCmdOpts == null) {
2137 jTextFieldAntCmdOpts = new JTextField();
2138 jTextFieldAntCmdOpts.setPreferredSize(new java.awt.Dimension(270, 20));
2139 jTextFieldAntCmdOpts.setEnabled(true);
2140 }
2141 return jTextFieldAntCmdOpts;
2142 }
2143
2144 /**
2145 * This method initializes jScrollPane2
2146 *
2147 * @return javax.swing.JScrollPane
2148 */
2149 private JScrollPane getJScrollPaneAntTasks() {
2150 if (jScrollPaneAntTasks == null) {
2151 jScrollPaneAntTasks = new JScrollPane();
2152 jScrollPaneAntTasks.setPreferredSize(new java.awt.Dimension(600, 400));
2153 jScrollPaneAntTasks.setViewportView(getJTableAntTasks());
2154 }
2155 return jScrollPaneAntTasks;
2156 }
2157
2158 /**
2159 * This method initializes jTable2
2160 *
2161 * @return javax.swing.JTable
2162 */
2163 private JTable getJTableAntTasks() {
2164 if (jTableAntTasks == null) {
2165 antTaskTableModel = new DefaultTableModel();
2166 jTableAntTasks = new JTable(antTaskTableModel);
2167 jTableAntTasks.setRowHeight(20);
2168 antTaskTableModel.addColumn("ID");
2169 antTaskTableModel.addColumn("Filename");
2170 antTaskTableModel.addColumn("ANT Command Options");
2171
2172 jTableAntTasks.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
2173 jTableAntTasks.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
2174 public void valueChanged(ListSelectionEvent e) {
2175 selectedRow = -1;
2176 if (e.getValueIsAdjusting()) {
2177 return;
2178 }
2179 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
2180 if (lsm.isSelectionEmpty()) {
2181 return;
2182 } else {
2183 selectedRow = lsm.getMinSelectionIndex();
2184 }
2185 }
2186 });
2187
2188 jTableAntTasks.getModel().addTableModelListener(new TableModelListener() {
2189 public void tableChanged(TableModelEvent arg0) {
2190 // TODO Auto-generated method stub
2191 int row = arg0.getFirstRow();
2192 TableModel m = (TableModel) arg0.getSource();
2193 if (arg0.getType() == TableModelEvent.UPDATE) {
2194 //ToDo Data Validition check.
2195 String id = m.getValueAt(row, 0) + "";
2196 String file = m.getValueAt(row, 1) + "";
2197 String execOrder = m.getValueAt(row, 2) + "";
2198 if (id.length() == 0) {
2199 return;
2200 }
2201 if (file.length() == 0 && execOrder.length() == 0) {
2202 return;
2203 }
2204 if (file.length() == 0) {
2205 file = null;
2206 }
2207 if (execOrder.length() == 0) {
2208 execOrder = null;
2209 }
2210 ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder);
2211
2212 }
2213 }
2214 });
2215 }
2216 return jTableAntTasks;
2217 }
2218
2219 private void initAntTaskTable() {
2220 if (ffc.getBuildOptionsUserDefAntTaskCount() == 0) {
2221 return;
2222 }
2223 String[][] saa = new String[ffc.getBuildOptionsUserDefAntTaskCount()][3];
2224 ffc.getBuildOptionsUserDefAntTasks(saa);
2225 for (int i = 0; i < saa.length; ++i) {
2226 antTaskTableModel.addRow(saa[i]);
2227 }
2228 }
2229
2230 } // @jve:decl-index=0:visual-constraint="10,10"