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