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