39f65c7ef207b6e6ecab91beefd3187d48893393
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdBuildOptions.java
1 /** @file
2
3 The file is used to create, update BuildOptions of Fpd file
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15 package org.tianocore.frameworkwizard.platform.ui;
16
17 import java.awt.BorderLayout;
18
19 import javax.swing.JPanel;
20 import javax.swing.JTabbedPane;
21 import javax.swing.JCheckBox;
22 import javax.swing.JLabel;
23 import java.awt.FlowLayout;
24 import javax.swing.AbstractAction;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
27 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 }
629 });
630 }
631 return jButtonFfsDel;
632 }
633
634 /**
635 * This method initializes jScrollPane5
636 *
637 * @return javax.swing.JScrollPane
638 */
639 private JScrollPane getJScrollPaneFfsAttribs() {
640 if (jScrollPaneFfsAttribs == null) {
641 jScrollPaneFfsAttribs = new JScrollPane();
642 jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
643 jScrollPaneFfsAttribs.setViewportView(getJTableFfsAttribs());
644 }
645 return jScrollPaneFfsAttribs;
646 }
647
648 /**
649 * This method initializes jTable4
650 *
651 * @return javax.swing.JTable
652 */
653 private JTable getJTableFfsAttribs() {
654 if (jTableFfsAttribs == null) {
655 ffsAttributesTableModel = new DefaultTableModel();
656 jTableFfsAttribs = new JTable(ffsAttributesTableModel);
657 jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
658 jTableFfsAttribs.setRowHeight(20);
659 ffsAttributesTableModel.addColumn("Name");
660 ffsAttributesTableModel.addColumn("Value");
661
662 jTableFfsAttribs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
663 jTableFfsAttribs.getModel().addTableModelListener(new TableModelListener() {
664 public void tableChanged(TableModelEvent arg0) {
665 // TODO Auto-generated method stub
666 int row = arg0.getFirstRow();
667 TableModel m = (TableModel) arg0.getSource();
668 if (arg0.getType() == TableModelEvent.UPDATE) {
669 //ToDo Data Validition check.
670 String name = m.getValueAt(row, 0) + "";
671 String value = m.getValueAt(row, 1) + "";
672
673 if (name.length() == 0) {
674 return;
675 }
676 if (value.length() == 0) {
677 return;
678 }
679 docConsole.setSaved(false);
680 ffc.updateBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), row, name, value);
681 }
682 }
683 });
684 }
685 return jTableFfsAttribs;
686 }
687
688 private void initFfsTable() {
689 int ffsCount = ffc.getBuildOptionsFfsCount();
690 if (ffsCount < 0) {
691 return;
692 }
693 String[][] saa = new String[ffsCount][1];
694 ffc.getBuildOptionsFfsKey(saa);
695 for (int i = 0; i < saa.length; ++i) {
696 ffsTableModel.addRow(saa[i]);
697 }
698 }
699
700 /**
701 * This method initializes jButton17
702 *
703 * @return javax.swing.JButton
704 */
705 private JButton getJButtonFfsAttribNew() {
706 if (jButtonFfsAttribNew == null) {
707 jButtonFfsAttribNew = new JButton();
708 jButtonFfsAttribNew.setPreferredSize(new java.awt.Dimension(80, 20));
709 jButtonFfsAttribNew.setText("New");
710 jButtonFfsAttribNew.addActionListener(new AbstractAction() {
711 /**
712 *
713 */
714 private static final long serialVersionUID = 1L;
715
716 public void actionPerformed(ActionEvent arg0) {
717 if (jTableFfs.getSelectedRow() < 0) {
718 return;
719 }
720 Object[] o = { "", "" };
721 ffsAttributesTableModel.addRow(o);
722 docConsole.setSaved(false);
723 ffc.genBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), "", "");
724 }
725 });
726 }
727 return jButtonFfsAttribNew;
728 }
729
730 /**
731 * This method initializes jButton18
732 *
733 * @return javax.swing.JButton
734 */
735 private JButton getJButtonFfsAttribRemove() {
736 if (jButtonFfsAttribRemove == null) {
737 jButtonFfsAttribRemove = new JButton();
738 jButtonFfsAttribRemove.setPreferredSize(new java.awt.Dimension(80, 20));
739 jButtonFfsAttribRemove.setText("Remove");
740 jButtonFfsAttribRemove.addActionListener(new AbstractAction() {
741 /**
742 *
743 */
744 private static final long serialVersionUID = 1L;
745
746 public void actionPerformed(ActionEvent arg0) {
747 if (jTableFfs.getSelectedRow() < 0) {
748 return;
749 }
750 if (jTableFfsAttribs.getSelectedRow() >= 0) {
751 docConsole.setSaved(false);
752 ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow());
753 ffc.removeBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(),
754 jTableFfsAttribs.getSelectedRow());
755 }
756 }
757 });
758 }
759 return jButtonFfsAttribRemove;
760 }
761
762 /**
763 * This method initializes jScrollPane
764 *
765 * @return javax.swing.JScrollPane
766 */
767 private JScrollPane getJScrollPaneFfs() {
768 if (jScrollPaneFfs == null) {
769 jScrollPaneFfs = new JScrollPane();
770 jScrollPaneFfs.setPreferredSize(new java.awt.Dimension(150, 419));
771 jScrollPaneFfs.setViewportView(getJTableFfs());
772 }
773 return jScrollPaneFfs;
774 }
775
776 /**
777 * This method initializes jTable
778 *
779 * @return javax.swing.JTable
780 */
781 private JTable getJTableFfs() {
782 if (jTableFfs == null) {
783 ffsTableModel = new DefaultTableModel();
784 ffsTableModel.addColumn("FFS Type");
785 jTableFfs = new JTable(ffsTableModel);
786 jTableFfs.setShowGrid(false);
787 jTableFfs.setRowHeight(20);
788
789 jTableFfs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
790 jTableFfs.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
791 public void valueChanged(ListSelectionEvent e) {
792
793 if (e.getValueIsAdjusting()) {
794 return;
795 }
796 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
797 if (lsm.isSelectionEmpty()) {
798 return;
799 } else {
800 int row = lsm.getMinSelectionIndex();
801 sectionTableModel.setRowCount(0);
802 sectionsTableModel.setRowCount(0);
803 subsectionsTableModel.setRowCount(0);
804 ffsAttributesTableModel.setRowCount(0);
805 String[] sArray = { "", "" };
806 LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
807 ArrayList<String> alSections = new ArrayList<String>();
808 ArrayList<String> alSection = new ArrayList<String>();
809 ffc.getBuildOptionsFfs(row, sArray, lhm, alSections, alSection);
810 jTextFieldFfsKey.setText(sArray[0]);
811 jTextFieldEncapType.setText(sArray[1]);
812 for (int i = 0; i < alSection.size(); ++i) {
813 String[] sectionRow = { alSection.get(i) };
814 sectionTableModel.addRow(sectionRow);
815 }
816 for (int j = 0; j < alSections.size(); ++j) {
817 String[] sectionsRow = { alSections.get(j) };
818 sectionsTableModel.addRow(sectionsRow);
819 }
820 if (lhm.size() <= 0) {
821 return;
822 }
823 Set<String> keySet = lhm.keySet();
824 Iterator<String> is = keySet.iterator();
825 while (is.hasNext()) {
826 String key = is.next();
827 String[] attribRow = { key, lhm.get(key) };
828 ffsAttributesTableModel.addRow(attribRow);
829 }
830 }
831 }
832 });
833
834 jTableFfs.getModel().addTableModelListener(new TableModelListener() {
835 public void tableChanged(TableModelEvent arg0) {
836 // TODO Auto-generated method stub
837 int row = arg0.getFirstRow();
838 TableModel m = (TableModel) arg0.getSource();
839 if (arg0.getType() == TableModelEvent.UPDATE) {
840 //ToDo Data Validition check.
841 String id = m.getValueAt(row, 0) + "";
842
843 if (id.length() == 0) {
844 return;
845 }
846 docConsole.setSaved(false);
847 ffc.updateBuildOptionsFfsKey(row, id);
848 }
849 }
850 });
851 }
852 return jTableFfs;
853 }
854
855 /**
856 * This method initializes jScrollPane1
857 *
858 * @return javax.swing.JScrollPane
859 */
860 private JScrollPane getJScrollPaneFfsSection() {
861 if (jScrollPaneFfsSection == null) {
862 jScrollPaneFfsSection = new JScrollPane();
863 // jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
864 jScrollPaneFfsSection.setViewportView(getJTableFfsSection());
865 }
866 return jScrollPaneFfsSection;
867 }
868
869 /**
870 * This method initializes jTable1
871 *
872 * @return javax.swing.JTable
873 */
874 private JTable getJTableFfsSection() {
875 if (jTableFfsSection == null) {
876 sectionTableModel = new DefaultTableModel();
877 sectionTableModel.addColumn("SectionType");
878
879 jTableFfsSection = new JTable(sectionTableModel);
880 jTableFfsSection.setRowHeight(20);
881 JComboBox cb = new JComboBox();
882 cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
883 cb.addItem("EFI_SECTION_VERSION");
884 cb.addItem("EFI_SECTION_USER_INTERFACE");
885 cb.addItem("EFI_SECTION_DXE_DEPEX");
886 cb.addItem("EFI_SECTION_PEI_DEPEX");
887 cb.addItem("EFI_SECTION_PE32");
888 cb.addItem("EFI_SECTION_PIC");
889 cb.addItem("EFI_SECTION_TE");
890 cb.addItem("EFI_SECTION_RAW");
891 cb.addItem("EFI_SECTION_COMPRESSION");
892 cb.addItem("EFI_SECTION_GUID_DEFINED");
893 cb.addItem("EFI_SECTION_COMPATIBILITY16");
894 cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
895 jTableFfsSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
896
897 jTableFfsSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
898
899 jTableFfsSection.getModel().addTableModelListener(new TableModelListener() {
900 public void tableChanged(TableModelEvent arg0) {
901 // TODO Auto-generated method stub
902 if (jTableFfs.getSelectedRow() < 0) {
903 return;
904 }
905 int row = arg0.getFirstRow();
906 TableModel m = (TableModel) arg0.getSource();
907 if (arg0.getType() == TableModelEvent.UPDATE) {
908 //ToDo Data Validition check.
909 String type = m.getValueAt(row, 0) + "";
910 docConsole.setSaved(false);
911 ffc.updateBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row, type);
912 }
913 }
914 });
915 }
916 return jTableFfsSection;
917 }
918
919 /**
920 * This method initializes jScrollPane3
921 *
922 * @return javax.swing.JScrollPane
923 */
924 private JScrollPane getJScrollPaneFfsSubSection() {
925 if (jScrollPaneFfsSubSection == null) {
926 jScrollPaneFfsSubSection = new JScrollPane();
927 // jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
928 jScrollPaneFfsSubSection.setViewportView(getJTableFfsSubSection());
929 }
930 return jScrollPaneFfsSubSection;
931 }
932
933 /**
934 * This method initializes jTable3
935 *
936 * @return javax.swing.JTable
937 */
938 private JTable getJTableFfsSubSection() {
939 if (jTableFfsSubSection == null) {
940 subsectionsTableModel = new DefaultTableModel();
941 subsectionsTableModel.addColumn("SectionType");
942 jTableFfsSubSection = new JTable(subsectionsTableModel);
943 jTableFfsSubSection.setRowHeight(20);
944 JComboBox cb = new JComboBox();
945 cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
946 cb.addItem("EFI_SECTION_VERSION");
947 cb.addItem("EFI_SECTION_USER_INTERFACE");
948 cb.addItem("EFI_SECTION_DXE_DEPEX");
949 cb.addItem("EFI_SECTION_PEI_DEPEX");
950 cb.addItem("EFI_SECTION_PE32");
951 cb.addItem("EFI_SECTION_PIC");
952 cb.addItem("EFI_SECTION_TE");
953 cb.addItem("EFI_SECTION_RAW");
954 cb.addItem("EFI_SECTION_COMPRESSION");
955 cb.addItem("EFI_SECTION_GUID_DEFINED");
956 cb.addItem("EFI_SECTION_COMPATIBILITY16");
957 cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
958 jTableFfsSubSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
959 jTableFfsSubSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
960
961 jTableFfsSubSection.getModel().addTableModelListener(new TableModelListener() {
962 public void tableChanged(TableModelEvent arg0) {
963 // TODO Auto-generated method stub
964 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
965 return;
966 }
967 int row = arg0.getFirstRow();
968 TableModel m = (TableModel) arg0.getSource();
969 if (arg0.getType() == TableModelEvent.UPDATE) {
970 //ToDo Data Validition check.
971 String type = m.getValueAt(row, 0) + "";
972 docConsole.setSaved(false);
973 ffc.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
974 jTableFfsSections.getSelectedRow(), row, type);
975 }
976 }
977 });
978 }
979 return jTableFfsSubSection;
980 }
981
982 /**
983 * This method initializes jTextField
984 *
985 * @return javax.swing.JTextField
986 */
987 private JTextField getJTextFieldEncapType() {
988 if (jTextFieldEncapType == null) {
989 jTextFieldEncapType = new JTextField();
990 jTextFieldEncapType.setPreferredSize(new java.awt.Dimension(100, 20));
991 jTextFieldEncapType.addFocusListener(new java.awt.event.FocusAdapter() {
992 public void focusLost(java.awt.event.FocusEvent e) {
993 if (jTableFfs.getSelectedRow() < 0) {
994 return;
995 }
996 ffc.updateBuildOptionsFfsSectionsType(jTableFfs.getSelectedRow(), jTextFieldEncapType.getText());
997 }
998 });
999 }
1000 return jTextFieldEncapType;
1001 }
1002
1003 /**
1004 * This method initializes jPanel4
1005 *
1006 * @return javax.swing.JPanel
1007 */
1008 private JPanel getJPanelFfsAttribButtonGroup() {
1009 if (jPanelFfsAttribButtonGroup == null) {
1010 jPanelFfsAttribButtonGroup = new JPanel();
1011 jPanelFfsAttribButtonGroup.setPreferredSize(new java.awt.Dimension(100, 100));
1012 jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribNew(), null);
1013 jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribRemove(), null);
1014 }
1015 return jPanelFfsAttribButtonGroup;
1016 }
1017
1018 /**
1019 * This method initializes jButton
1020 *
1021 * @return javax.swing.JButton
1022 */
1023 private JButton getJButtonFfsSectionNew() {
1024 if (jButtonFfsSectionNew == null) {
1025 jButtonFfsSectionNew = new JButton();
1026 jButtonFfsSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
1027 jButtonFfsSectionNew.setText("New");
1028 jButtonFfsSectionNew.addActionListener(new java.awt.event.ActionListener() {
1029 public void actionPerformed(java.awt.event.ActionEvent e) {
1030 if (jTableFfs.getSelectedRow() < 0) {
1031 return;
1032 }
1033 docConsole.setSaved(false);
1034 String[] row = { "EFI_SECTION_RAW" };
1035 sectionTableModel.addRow(row);
1036 ffc.genBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row[0]);
1037 }
1038 });
1039 }
1040 return jButtonFfsSectionNew;
1041 }
1042
1043 /**
1044 * This method initializes jButton1
1045 *
1046 * @return javax.swing.JButton
1047 */
1048 private JButton getJButtonFfsSectionRemove() {
1049 if (jButtonFfsSectionRemove == null) {
1050 jButtonFfsSectionRemove = new JButton();
1051 jButtonFfsSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
1052 jButtonFfsSectionRemove.setText("Remove");
1053
1054 jButtonFfsSectionRemove.addActionListener(new java.awt.event.ActionListener() {
1055 public void actionPerformed(java.awt.event.ActionEvent e) {
1056 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) {
1057 return;
1058 }
1059 docConsole.setSaved(false);
1060 sectionTableModel.removeRow(jTableFfsSection.getSelectedRow());
1061 ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(),
1062 jTableFfsSection.getSelectedRow());
1063 }
1064 });
1065 }
1066 return jButtonFfsSectionRemove;
1067 }
1068
1069 /**
1070 * This method initializes jButton2
1071 *
1072 * @return javax.swing.JButton
1073 */
1074 private JButton getJButtonFfsSubSectionNew() {
1075 if (jButtonFfsSubSectionNew == null) {
1076 jButtonFfsSubSectionNew = new JButton();
1077 jButtonFfsSubSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
1078 jButtonFfsSubSectionNew.setText("New");
1079 jButtonFfsSubSectionNew.addActionListener(new java.awt.event.ActionListener() {
1080 public void actionPerformed(java.awt.event.ActionEvent e) {
1081 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
1082 return;
1083 }
1084 docConsole.setSaved(false);
1085 String[] row = { "EFI_SECTION_RAW" };
1086 subsectionsTableModel.addRow(row);
1087 ffc.genBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
1088 jTableFfsSections.getSelectedRow(), row[0]);
1089
1090 }
1091 });
1092 }
1093 return jButtonFfsSubSectionNew;
1094 }
1095
1096 /**
1097 * This method initializes jButton3
1098 *
1099 * @return javax.swing.JButton
1100 */
1101 private JButton getJButtonFfsSubSectionRemove() {
1102 if (jButtonFfsSubSectionRemove == null) {
1103 jButtonFfsSubSectionRemove = new JButton();
1104 jButtonFfsSubSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
1105 jButtonFfsSubSectionRemove.setText("Remove");
1106 jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() {
1107 public void actionPerformed(java.awt.event.ActionEvent e) {
1108 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0
1109 || jTableFfsSubSection.getSelectedRow() < 0) {
1110 return;
1111 }
1112 docConsole.setSaved(false);
1113 subsectionsTableModel.removeRow(jTableFfsSubSection.getSelectedRow());
1114 ffc.removeBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
1115 jTableFfsSections.getSelectedRow(),
1116 jTableFfsSubSection.getSelectedRow());
1117 }
1118 });
1119 }
1120 return jButtonFfsSubSectionRemove;
1121 }
1122
1123 /**
1124 * This method initializes jButton6
1125 *
1126 * @return javax.swing.JButton
1127 */
1128 private JButton getJButtonFfsSectionsNew() {
1129 if (jButtonFfsSectionsNew == null) {
1130 jButtonFfsSectionsNew = new JButton();
1131 jButtonFfsSectionsNew.setPreferredSize(new java.awt.Dimension(80, 20));
1132 jButtonFfsSectionsNew.setText("New");
1133 jButtonFfsSectionsNew.addActionListener(new java.awt.event.ActionListener() {
1134 public void actionPerformed(java.awt.event.ActionEvent e) {
1135 if (jTableFfs.getSelectedRow() < 0) {
1136 return;
1137 }
1138 docConsole.setSaved(false);
1139 String[] row = { "" };
1140 sectionsTableModel.addRow(row);
1141 ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), "");
1142 }
1143 });
1144 }
1145 return jButtonFfsSectionsNew;
1146 }
1147
1148 /**
1149 * This method initializes jButton7
1150 *
1151 * @return javax.swing.JButton
1152 */
1153 private JButton getJButtonFfsSectionsRemove() {
1154 if (jButtonFfsSectionsRemove == null) {
1155 jButtonFfsSectionsRemove = new JButton();
1156 jButtonFfsSectionsRemove.setPreferredSize(new java.awt.Dimension(80, 20));
1157 jButtonFfsSectionsRemove.setText("Remove");
1158 jButtonFfsSectionsRemove.addActionListener(new java.awt.event.ActionListener() {
1159 public void actionPerformed(java.awt.event.ActionEvent e) {
1160 if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
1161 return;
1162 }
1163 docConsole.setSaved(false);
1164 sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow());
1165 ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(),
1166 jTableFfsSections.getSelectedRow());
1167 }
1168 });
1169 }
1170 return jButtonFfsSectionsRemove;
1171 }
1172
1173 private JScrollPane getJScrollPaneFfsSections() {
1174 if (jScrollPaneFfsSections == null) {
1175 jScrollPaneFfsSections = new JScrollPane();
1176 // jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
1177 jScrollPaneFfsSections.setViewportView(getJTableFfsSections());
1178 }
1179 return jScrollPaneFfsSections;
1180 }
1181
1182 /**
1183 * This method initializes jTable6
1184 *
1185 * @return javax.swing.JTable
1186 */
1187 private JTable getJTableFfsSections() {
1188 if (jTableFfsSections == null) {
1189 sectionsTableModel = new DefaultTableModel();
1190 sectionsTableModel.addColumn("EncapsulationType");
1191 jTableFfsSections = new JTable(sectionsTableModel);
1192 jTableFfsSections.setRowHeight(20);
1193 jTableFfsSections.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1194 jTableFfsSections.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1195 public void valueChanged(ListSelectionEvent e) {
1196 if (e.getValueIsAdjusting()) {
1197 return;
1198 }
1199 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1200 if (lsm.isSelectionEmpty()) {
1201 return;
1202 } else {
1203 int sectionsRow = lsm.getMinSelectionIndex();
1204 if (jTableFfs.getSelectedRow() < 0) {
1205 return;
1206 }
1207 subsectionsTableModel.setRowCount(0);
1208 ArrayList<String> al = new ArrayList<String>();
1209 ffc.getBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), sectionsRow, al);
1210 for (int i = 0; i < al.size(); ++i) {
1211 String[] subsectionRow = { al.get(i) };
1212 subsectionsTableModel.addRow(subsectionRow);
1213 }
1214 }
1215 }
1216 });
1217
1218 jTableFfsSections.getModel().addTableModelListener(new TableModelListener() {
1219 public void tableChanged(TableModelEvent arg0) {
1220 // TODO Auto-generated method stub
1221 int row = arg0.getFirstRow();
1222 TableModel m = (TableModel) arg0.getSource();
1223 if (arg0.getType() == TableModelEvent.UPDATE) {
1224 //ToDo Data Validition check.
1225 String encapType = m.getValueAt(row, 0) + "";
1226 docConsole.setSaved(false);
1227 ffc.updateBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), row, encapType);
1228 }
1229 }
1230 });
1231 }
1232 return jTableFfsSections;
1233 }
1234
1235 /**
1236 * This method initializes jSplitPaneFfsC
1237 *
1238 * @return javax.swing.JSplitPane
1239 */
1240 private JSplitPane getJSplitPaneFfsC() {
1241 if (jSplitPaneFfsC == null) {
1242 jSplitPaneFfsC = new JSplitPane();
1243 jSplitPaneFfsC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
1244 jSplitPaneFfsC.setDividerLocation(130);
1245 jSplitPaneFfsC.setTopComponent(getJPanelFfsCTop());
1246 jSplitPaneFfsC.setBottomComponent(getJSplitPaneFfsCBottom());
1247 jSplitPaneFfsC.setDividerSize(5);
1248 }
1249 return jSplitPaneFfsC;
1250 }
1251
1252 /**
1253 * This method initializes jPanelFfsCTop
1254 *
1255 * @return javax.swing.JPanel
1256 */
1257 private JPanel getJPanelFfsCTop() {
1258 if (jPanelFfsCTop == null) {
1259 jPanelFfsCTop = new JPanel();
1260 jPanelFfsCTop.setLayout(new BorderLayout());
1261 jPanelFfsCTop.add(getJPanelSectionN(), java.awt.BorderLayout.NORTH);
1262 jPanelFfsCTop.add(getJScrollPaneFfsSection(), java.awt.BorderLayout.CENTER);
1263 }
1264 return jPanelFfsCTop;
1265 }
1266
1267 /**
1268 * This method initializes jSplitPaneFfsCBottom
1269 *
1270 * @return javax.swing.JSplitPane
1271 */
1272 private JSplitPane getJSplitPaneFfsCBottom() {
1273 if (jSplitPaneFfsCBottom == null) {
1274 jSplitPaneFfsCBottom = new JSplitPane();
1275 jSplitPaneFfsCBottom.setDividerSize(5);
1276 jSplitPaneFfsCBottom.setDividerLocation(130);
1277 jSplitPaneFfsCBottom.setTopComponent(getJPanelFfsCBottomTop());
1278 jSplitPaneFfsCBottom.setBottomComponent(getJPanelFfsCBottomBottom());
1279 jSplitPaneFfsCBottom.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
1280 }
1281 return jSplitPaneFfsCBottom;
1282 }
1283
1284 /**
1285 * This method initializes jPanelFfsCBottomTop
1286 *
1287 * @return javax.swing.JPanel
1288 */
1289 private JPanel getJPanelFfsCBottomTop() {
1290 if (jPanelFfsCBottomTop == null) {
1291 jPanelFfsCBottomTop = new JPanel();
1292 jPanelFfsCBottomTop.setLayout(new BorderLayout());
1293 jPanelFfsCBottomTop.add(getJPanelSectionsN(), java.awt.BorderLayout.NORTH);
1294 jPanelFfsCBottomTop.add(getJScrollPaneFfsSections(), java.awt.BorderLayout.CENTER);
1295 }
1296 return jPanelFfsCBottomTop;
1297 }
1298
1299 /**
1300 * This method initializes jPanelFfsCBottomBottom
1301 *
1302 * @return javax.swing.JPanel
1303 */
1304 private JPanel getJPanelFfsCBottomBottom() {
1305 if (jPanelFfsCBottomBottom == null) {
1306 jPanelFfsCBottomBottom = new JPanel();
1307 jPanelFfsCBottomBottom.setLayout(new BorderLayout());
1308 jPanelFfsCBottomBottom.add(getJPanelSubSectionN(), java.awt.BorderLayout.NORTH);
1309 jPanelFfsCBottomBottom.add(getJScrollPaneFfsSubSection(), java.awt.BorderLayout.CENTER);
1310 }
1311 return jPanelFfsCBottomBottom;
1312 }
1313
1314 /**
1315 * This method initializes jPanelSectionN
1316 *
1317 * @return javax.swing.JPanel
1318 */
1319 private JPanel getJPanelSectionN() {
1320 if (jPanelSectionN == null) {
1321 jPanelSectionN = new JPanel();
1322 jLabelFfsSection = new JLabel();
1323 jLabelFfsSection.setText("Section");
1324 jPanelSectionN.add(jLabelFfsSection, null);
1325 jPanelSectionN.add(getJButtonFfsSectionNew(), null);
1326 jPanelSectionN.add(getJButtonFfsSectionRemove(), null);
1327 }
1328 return jPanelSectionN;
1329 }
1330
1331 /**
1332 * This method initializes jPanelSectionsN
1333 *
1334 * @return javax.swing.JPanel
1335 */
1336 private JPanel getJPanelSectionsN() {
1337 if (jPanelSectionsN == null) {
1338 jPanelSectionsN = new JPanel();
1339 jLabelFfsSections = new JLabel();
1340 jLabelFfsSections.setText("Sections");
1341 jPanelSectionsN.add(jLabelFfsSections, null);
1342 jPanelSectionsN.add(getJButtonFfsSectionsNew(), null);
1343 jPanelSectionsN.add(getJButtonFfsSectionsRemove(), null);
1344 }
1345 return jPanelSectionsN;
1346 }
1347
1348 /**
1349 * This method initializes jPanelSubSectionN
1350 *
1351 * @return javax.swing.JPanel
1352 */
1353 private JPanel getJPanelSubSectionN() {
1354 if (jPanelSubSectionN == null) {
1355 jPanelSubSectionN = new JPanel();
1356 jLabelFfsSubSections = new JLabel();
1357 jLabelFfsSubSections.setText("Sub-Sections");
1358 jPanelSubSectionN.add(jLabelFfsSubSections, null);
1359 jPanelSubSectionN.add(getJButtonFfsSubSectionNew(), null);
1360 jPanelSubSectionN.add(getJButtonFfsSubSectionRemove(), null);
1361 }
1362 return jPanelSubSectionN;
1363 }
1364
1365 /**
1366 * The following section contains all Build Options content
1367 */
1368
1369 /**
1370 * This method initializes jPanelOptionsTab
1371 *
1372 * This is the main Options screen
1373 *
1374 * @return javax.swing.JPanel jPanelOptionsTab
1375 */
1376 private JPanel getJPanelOptionsTab() {
1377 if (jPanelOptionsTab == null) {
1378 // This container holds the Options Tab content
1379
1380 // FlowLayout flowLayout9 = new FlowLayout();
1381 // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
1382
1383 GridLayout gridLayout = new GridLayout();
1384 gridLayout.setRows(2);
1385 jPanelOptionsTab = new JPanel();
1386 jPanelOptionsTab.setLayout(gridLayout);
1387 jPanelOptionsTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
1388 jPanelOptionsTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
1389 jPanelOptionsTab.setAutoscrolls(true);
1390 jPanelOptionsTab.setLocation(0, 0);
1391 jPanelOptionsTab.add(getJPanelOptionsContainer(), null);
1392 // jPanelOptionsTab.add(getJScrollPaneOptions(), null);
1393 jPanelOptionsTab.add(getJPanelTableOptionsContainer(), null);
1394 }
1395 return jPanelOptionsTab;
1396 }
1397
1398 /**
1399 * This method initializes jPanelOptionsContainer
1400 *
1401 * @return javax.swing.JPanel
1402 */
1403 private JPanel getJPanelOptionsContainer() {
1404 if (jPanelOptionsContainer == null) {
1405 jLabelTagName = new JLabel();
1406 jLabelTagName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
1407 jLabelTagName.setLocation(new java.awt.Point(labelColumn, rowOne));
1408 jLabelTagName.setText("Tag Name");
1409 jLabelBuildTargets = new JLabel();
1410 jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
1411 jLabelBuildTargets.setLocation(new java.awt.Point(labelColumn, rowTwo));
1412 jLabelBuildTargets.setText("Build Targets");
1413 jLabelToolCmd = new JLabel();
1414 jLabelToolCmd.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
1415 jLabelToolCmd.setLocation(new java.awt.Point(labelColumn, rowThree));
1416 jLabelToolCmd.setText("Tool Command");
1417 jLabelSupArch = new JLabel();
1418 jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
1419 jLabelSupArch.setLocation(new java.awt.Point(labelColumn, rowFour));
1420 jLabelSupArch.setText("Supported Architectures");
1421 jLabelToolChainFamily = new JLabel();
1422 jLabelToolChainFamily.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
1423 jLabelToolChainFamily.setLocation(new java.awt.Point(labelColumn, rowFive));
1424 jLabelToolChainFamily.setText("Tool Chain Family");
1425
1426 jLabelOptionContents = new JLabel();
1427 jLabelOptionContents.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
1428 jLabelOptionContents.setLocation(new java.awt.Point(labelColumn, rowSix));
1429 jLabelOptionContents.setText("Argument Strings");
1430
1431 jPanelOptionsContainer = new JPanel();
1432
1433 jPanelOptionsContainer.setLayout(null);
1434
1435 jPanelOptionsContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
1436 /*
1437 jPanelOptionsContainer
1438 .setBorder(javax.swing.BorderFactory
1439 .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
1440 */
1441 jPanelOptionsContainer.add(jLabelTagName, null);
1442 jPanelOptionsContainer.add(getJTextFieldTagName(), null);
1443
1444 jPanelOptionsContainer.add(jLabelBuildTargets, null);
1445 jPanelOptionsContainer.add(getJTextFieldBuildTargets(), null);
1446
1447 jPanelOptionsContainer.add(jLabelToolChainFamily, null);
1448 jPanelOptionsContainer.add(getJTextFieldToolChainFamily(), null);
1449
1450 jPanelOptionsContainer.add(jLabelToolCmd, null);
1451 jPanelOptionsContainer.add(getJTextFieldToolCmd(), null);
1452
1453 jPanelOptionsContainer.add(jLabelSupArch, null);
1454 jPanelOptionsContainer.add(getArchitectureSelections(), null);
1455
1456 jPanelOptionsContainer.add(jLabelOptionContents, null);
1457 jPanelOptionsContainer.add(getJTextFieldOptionContents(), null);
1458
1459 jPanelOptionsContainer.add(getJButtonOptionsAdd(), null);
1460 jPanelOptionsContainer.add(getJButtonOptionsDel(), null);
1461 }
1462 return jPanelOptionsContainer;
1463 }
1464
1465 /**
1466 * This method initializes jTextFieldOptionTagName Row 1
1467 *
1468 * @return javax.swing.JTextField
1469 */
1470 private JTextField getJTextFieldTagName() {
1471 if (jTextFieldTagName == null) {
1472 jTextFieldTagName = new JTextField();
1473 jTextFieldTagName.setBounds(new java.awt.Rectangle(fieldColumn, rowOne, fieldWidth, oneRowHeight));
1474 jTextFieldTagName.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1475 jTextFieldTagName.setLocation(new java.awt.Point(fieldColumn, rowOne));
1476 }
1477 return jTextFieldTagName;
1478 }
1479
1480 /**
1481 * This method initializes jTextFieldBuildTargets Row 2
1482 *
1483 * @return javax.swing.JTextField jTextFieldBuildTargets
1484 */
1485 private JTextField getJTextFieldBuildTargets() {
1486 if (jTextFieldBuildTargets == null) {
1487 jTextFieldBuildTargets = new JTextField();
1488 jTextFieldBuildTargets.setBounds(new java.awt.Rectangle(fieldColumn, rowTwo, fieldWidth, oneRowHeight));
1489 jTextFieldBuildTargets.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1490 jTextFieldBuildTargets.setLocation(new java.awt.Point(fieldColumn, rowTwo));
1491 }
1492 return jTextFieldBuildTargets;
1493 }
1494
1495 /**
1496 * This method initializes jTextFieldToolCmd Row 3
1497 *
1498 * This should be a dropdown box of command codes from tools_def.txt
1499 *
1500 * @return javax.swing.JTextField jTextFieldToolCmd
1501 */
1502 private JTextField getJTextFieldToolCmd() {
1503 if (jTextFieldToolCmd == null) {
1504 jTextFieldToolCmd = new JTextField();
1505 jTextFieldToolCmd.setBounds(new java.awt.Rectangle(fieldColumn, rowThree, fieldWidth, oneRowHeight));
1506 jTextFieldToolCmd.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1507 jTextFieldToolCmd.setLocation(new java.awt.Point(fieldColumn, rowThree));
1508 }
1509 return jTextFieldToolCmd;
1510 }
1511
1512 /**
1513 * This method initializes jArchitectureSelections Row 4
1514 *
1515 * @return jArchitectureSelections
1516 */
1517 private JPanel getArchitectureSelections() {
1518 if (jArchitectureSelections == null) {
1519 jArchitectureSelections = new JPanel();
1520 jArchitectureSelections.setLayout(null);
1521 jArchitectureSelections.add(getJCheckBoxIA32(), null);
1522 jArchitectureSelections.add(getJCheckBoxX64(), null);
1523 jArchitectureSelections.add(getJCheckBoxIpf(), null);
1524 jArchitectureSelections.add(getJCheckBoxEBC(), null);
1525 jArchitectureSelections.add(getJCheckBoxARM(), null);
1526 jArchitectureSelections.add(getJCheckBoxPPC(), null);
1527 jArchitectureSelections.setBounds(new java.awt.Rectangle(fieldColumn, rowFour, fieldWidth, oneRowHeight));
1528 jArchitectureSelections.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1529 jArchitectureSelections.setLocation(new java.awt.Point(fieldColumn, rowFour));
1530 }
1531 return jArchitectureSelections;
1532 }
1533
1534 /**
1535 * This method initializes jCheckBoxIA32
1536 *
1537 * @return javax.swing.JCheckBox jCheckBoxIA32
1538 */
1539 private JCheckBox getJCheckBoxIA32() {
1540 if (jCheckBoxIA32 == null) {
1541 jCheckBoxIA32 = new JCheckBox();
1542 jCheckBoxIA32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
1543 jCheckBoxIA32.setText("IA32");
1544 }
1545 return jCheckBoxIA32;
1546 }
1547
1548 /**
1549 * This method initializes jCheckBoxX64
1550 *
1551 * @return javax.swing.JCheckBox jCheckBoxX64
1552 */
1553 private JCheckBox getJCheckBoxX64() {
1554 if (jCheckBoxX64 == null) {
1555 jCheckBoxX64 = new JCheckBox();
1556 jCheckBoxX64.setText("X64");
1557 jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
1558 }
1559 return jCheckBoxX64;
1560 }
1561
1562 /**
1563 * This method initializes jCheckBoxIpf
1564 *
1565 * @return javax.swing.JCheckBox jCheckBoxIpf
1566 */
1567 private JCheckBox getJCheckBoxIpf() {
1568 if (jCheckBoxIpf == null) {
1569 jCheckBoxIpf = new JCheckBox();
1570 jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
1571 jCheckBoxIpf.setText("IPF");
1572 }
1573 return jCheckBoxIpf;
1574 }
1575
1576
1577 /**
1578 * This method initializes jCheckBoxEBC
1579 *
1580 * @return javax.swing.JCheckBox jCheckBoxEBC
1581 */
1582 private JCheckBox getJCheckBoxEBC() {
1583 if (jCheckBoxEBC == null) {
1584 jCheckBoxEBC = new JCheckBox();
1585 jCheckBoxEBC.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
1586 jCheckBoxEBC.setText("EBC");
1587 }
1588 return jCheckBoxEBC;
1589 }
1590
1591 /**
1592 * This method initializes jCheckBoxARM
1593 *
1594 * @return javax.swing.JCheckBox jCheckBoxARM
1595 */
1596 private JCheckBox getJCheckBoxARM() {
1597 if (jCheckBoxARM == null) {
1598 jCheckBoxARM = new JCheckBox();
1599 jCheckBoxARM.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
1600 jCheckBoxARM.setText("ARM");
1601 }
1602 return jCheckBoxARM;
1603 }
1604
1605 /**
1606 * This method initializes jCheckBoxPPC
1607 *
1608 * @return javax.swing.JCheckBox jCheckBoxPPC
1609 */
1610 private JCheckBox getJCheckBoxPPC() {
1611 if (jCheckBoxPPC == null) {
1612 jCheckBoxPPC = new JCheckBox();
1613 jCheckBoxPPC.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
1614 jCheckBoxPPC.setText("PPC");
1615 }
1616 return jCheckBoxPPC;
1617 }
1618
1619 /**
1620 * This method initializes jTextFieldToolChainFamily Row 5
1621 *
1622 * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
1623 *
1624 * @return javax.swing.JTextField
1625 */
1626 private JTextField getJTextFieldToolChainFamily() {
1627 if (jTextFieldToolChainFamily == null) {
1628 jTextFieldToolChainFamily = new JTextField();
1629 jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(fieldColumn, rowFive, fieldWidth, oneRowHeight));
1630 jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1631 jTextFieldToolChainFamily.setLocation(new java.awt.Point(fieldColumn, rowFive));
1632 }
1633 return jTextFieldToolChainFamily;
1634 }
1635
1636 /**
1637 * This method initializes jTextFieldOptionContents Row 6
1638 *
1639 * This is where we should put the checkbox & entry data for the command arguments
1640 *
1641 * @return javax.swing.JTextField
1642 */
1643 private JTextField getJTextFieldOptionContents() {
1644 if (jTextFieldOptionContents == null) {
1645 jTextFieldOptionContents = new JTextField();
1646 jTextFieldOptionContents.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
1647 jTextFieldOptionContents.setBounds(fieldColumn, rowSix, fieldWidth, oneRowHeight);
1648 jTextFieldOptionContents.setLocation(new java.awt.Point(fieldColumn, rowSix));
1649 }
1650 return jTextFieldOptionContents;
1651 }
1652
1653 /**
1654 * This method initializes jButtonOptionsAdd
1655 *
1656 * Add entry from the top screen to the table
1657 *
1658 * @return javax.swing.JButton jButtonOptionsAdd
1659 */
1660 private JButton getJButtonOptionsAdd() {
1661 if (jButtonOptionsAdd == null) {
1662 jButtonOptionsAdd = new JButton();
1663 jButtonOptionsAdd.setText("Add");
1664
1665 jButtonOptionsAdd.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
1666 jButtonOptionsAdd.setBounds(new java.awt.Rectangle(firstButtonLoc, buttonRow, buttonWidth, oneRowHeight));
1667 jButtonOptionsAdd.setLocation(new java.awt.Point(firstButtonLoc, buttonRow));
1668 jButtonOptionsAdd.addActionListener(new AbstractAction() {
1669 /**
1670 *
1671 */
1672 private static final long serialVersionUID = 1L;
1673
1674 public void actionPerformed(java.awt.event.ActionEvent e) {
1675 boolean[] boolArray = { jCheckBoxIA32.isSelected(), jCheckBoxIpf.isSelected(),
1676 jCheckBoxX64.isSelected(), jCheckBoxEBC.isSelected(),
1677 jCheckBoxARM.isSelected(), jCheckBoxPPC.isSelected() };
1678 String s = boolToList(boolArray);
1679 Object[] o = { jTextFieldBuildTargets.getText(), jTextFieldToolChainFamily.getText(), s,
1680 jTextFieldToolCmd.getText(), jTextFieldTagName.getText(),
1681 jTextFieldOptionContents.getText() };
1682 optionsTableModel.addRow(o);
1683 docConsole.setSaved(false);
1684 ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText()),
1685 jTextFieldToolChainFamily.getText(), jTextFieldTagName.getText(),
1686 jTextFieldToolCmd.getText(), stringToVector(s),
1687 jTextFieldOptionContents.getText());
1688 }
1689 });
1690 }
1691 return jButtonOptionsAdd;
1692 }
1693
1694 /**
1695 * This method initializes jButtonOptionsDel
1696 *
1697 * Remove a line from the table below
1698 *
1699 * @return javax.swing.JButton jButtonOptionsDel
1700 */
1701 private JButton getJButtonOptionsDel() {
1702 if (jButtonOptionsDel == null) {
1703 jButtonOptionsDel = new JButton();
1704 jButtonOptionsDel.setText("Delete");
1705 jButtonOptionsDel.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
1706 jButtonOptionsDel.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));
1707 jButtonOptionsDel.setLocation(new java.awt.Point(next2LastButtonLoc, buttonRow));
1708 jButtonOptionsDel.addActionListener(new AbstractAction() {
1709 /**
1710 *
1711 */
1712 private static final long serialVersionUID = 1L;
1713
1714 public void actionPerformed(java.awt.event.ActionEvent e) {
1715 if (selectedRow >= 0) {
1716 optionsTableModel.removeRow(selectedRow);
1717 docConsole.setSaved(false);
1718 ffc.removeBuildOptionsOpt(selectedRow);
1719 }
1720 }
1721 });
1722 }
1723 return jButtonOptionsDel;
1724 }
1725
1726 public void componentResized(ComponentEvent arg0) {
1727 int intPreferredWidth = 500;
1728
1729 Tools.resizeComponentWidth(this.jScrollPaneOptions, this.getWidth(), intPreferredWidth);
1730
1731 }
1732 /**
1733 * This method initializes jScrollPaneOptions
1734 * Contains the Table and is located below the data entry section
1735 * @return javax.swing.JScrollPane jScrollPaneOptoins
1736 */
1737 private JScrollPane getJScrollPaneOptions() {
1738 if (jScrollPaneOptions == null) {
1739 jScrollPaneOptions = new JScrollPane();
1740 jScrollPaneOptions.setViewportView(getJTableOptions());
1741 }
1742 return jScrollPaneOptions;
1743 }
1744
1745 /**
1746 * This method initializes jTableOptions
1747 *
1748 * @return javax.swing.JTable jTableOptions
1749 */
1750 private JTable getJTableOptions() {
1751 if (jTableOptions == null) {
1752
1753 optionsTableModel = new DefaultTableModel();
1754 jTableOptions = new JTable(optionsTableModel);
1755 jTableOptions.setRowHeight(20);
1756 optionsTableModel.addColumn("Build Targets");
1757 optionsTableModel.addColumn("Tool Chain Family");
1758 optionsTableModel.addColumn("Supported Architectures");
1759 optionsTableModel.addColumn("Tool Command Code");
1760 optionsTableModel.addColumn("TagName");
1761 optionsTableModel.addColumn("Arguments");
1762
1763 javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
1764 JComboBox cb = new JComboBox();
1765 cb.addItem("MSFT");
1766 cb.addItem("GCC");
1767 cb.addItem("CYGWIN");
1768 cb.addItem("INTEL");
1769 cb.addItem("USER_DEFINED");
1770 toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
1771 Vector<String> vArch = new Vector<String>();
1772 vArch.add("IA32");
1773 vArch.add("X64");
1774 vArch.add("IPF");
1775 vArch.add("EBC");
1776 vArch.add("ARM");
1777 vArch.add("PPC");
1778 jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch));
1779
1780 jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor());
1781
1782 jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1783 jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
1784 jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
1785 public void valueChanged(ListSelectionEvent e) {
1786 selectedRow = -1;
1787 if (e.getValueIsAdjusting()) {
1788 return;
1789 }
1790 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1791 if (lsm.isSelectionEmpty()) {
1792 return;
1793 } else {
1794 selectedRow = lsm.getMinSelectionIndex();
1795 }
1796 }
1797 });
1798
1799 jTableOptions.getModel().addTableModelListener(new TableModelListener() {
1800 public void tableChanged(TableModelEvent arg0) {
1801 // TODO Auto-generated method stub
1802 int row = arg0.getFirstRow();
1803 TableModel m = (TableModel) arg0.getSource();
1804 if (arg0.getType() == TableModelEvent.UPDATE) {
1805 //ToDo Data Validition check.
1806 String targets = m.getValueAt(row, 0) + "";
1807 Vector<Object> targetName = new Vector<Object>();
1808 String[] sArray = targets.split("( )+");
1809 for (int i = 0; i < sArray.length; ++i) {
1810 targetName.add(sArray[i]);
1811 }
1812 String toolChain = m.getValueAt(row, 1) + "";
1813 String archs = m.getValueAt(row, 2) + "";
1814 Vector<Object> supArch = null;
1815 if (archs.length() > 0) {
1816 supArch = new Vector<Object>();
1817 String[] sArray1 = archs.split("( )+");
1818 for (int i = 0; i < sArray1.length; ++i) {
1819 supArch.add(sArray1[i]);
1820 }
1821 }
1822
1823 String toolCmd = m.getValueAt(row, 3) + "";
1824 String tagName = m.getValueAt(row, 4) + "";
1825 String contents = m.getValueAt(row, 5) + "";
1826 docConsole.setSaved(false);
1827 ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents);
1828 }
1829 }
1830 });
1831 }
1832 return jTableOptions;
1833 }
1834
1835 private Vector<Object> stringToVector(String s) {
1836 String[] sArray = s.split(" ");
1837 Vector<Object> v = null;
1838 if (s.length() > 0) {
1839 v = new Vector<Object>();
1840 for (int i = 0; i < sArray.length; ++i) {
1841 v.add(sArray[i]);
1842 }
1843 }
1844 return v;
1845 }
1846
1847 private String boolToList(boolean[] bool) {
1848 String s = " ";
1849 if (bool[0]) {
1850 s += "IA32 ";
1851 }
1852 if (bool[1]) {
1853 s += "IPF ";
1854 }
1855 if (bool[2]) {
1856 s += "X64 ";
1857 }
1858 if (bool[3]) {
1859 s += "EBC ";
1860 }
1861 if (bool[4]) {
1862 s += "ARM ";
1863 }
1864 if (bool[5]) {
1865 s += "PPC ";
1866 }
1867 if (s.equals(" ")) {
1868 s += "IA32";
1869 }
1870 return s.trim();
1871 }
1872
1873 private void initOptionTable() {
1874 if (ffc.getBuildOptionsOptCount() == 0) {
1875 //ToDo get default options from *.txt file
1876 return;
1877 }
1878 String[][] saa = new String[ffc.getBuildOptionsOptCount()][6];
1879 ffc.getBuildOptionsOpts(saa);
1880 for (int i = 0; i < saa.length; ++i) {
1881 optionsTableModel.addRow(saa[i]);
1882 }
1883 }
1884
1885
1886 /**
1887 * Everything below should pertain to the ANT Task Tab
1888 */
1889
1890 /**
1891 * This method initializes jButton12
1892 *
1893 * @return javax.swing.JButton
1894 */
1895 private JButton getJButtonAntTaskFileBrowse() {
1896 if (jButtonAntTaskFileBrowse == null) {
1897 jButtonAntTaskFileBrowse = new JButton();
1898 jButtonAntTaskFileBrowse.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
1899 jButtonAntTaskFileBrowse.setText("Browse");
1900 jButtonAntTaskFileBrowse.addActionListener(new AbstractAction() {
1901 private static final long serialVersionUID = 1L;
1902
1903 public void actionPerformed(ActionEvent arg0) {
1904 //
1905 // Select files from current workspace
1906 //
1907 String dirPrefix = System.getenv("WORKSPACE");
1908 JFileChooser chooser = new JFileChooser(dirPrefix);
1909 File theFile = null;
1910 String headerDest = null;
1911
1912 chooser.setMultiSelectionEnabled(false);
1913 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
1914 int retval = chooser.showOpenDialog(frame);
1915 if (retval == JFileChooser.APPROVE_OPTION) {
1916
1917 theFile = chooser.getSelectedFile();
1918 String file = theFile.getPath();
1919 if (!file.startsWith(dirPrefix)) {
1920 JOptionPane.showMessageDialog(frame, "You can only select files in current package!");
1921 return;
1922 }
1923 } else {
1924 return;
1925 }
1926
1927 headerDest = theFile.getPath();
1928 jTextFieldAntTaskFile.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/'));
1929
1930 }
1931
1932 });
1933 }
1934 return jButtonAntTaskFileBrowse;
1935 }
1936
1937 /**
1938 * This method initializes jPanelUserDefCenterN
1939 *
1940 * @return javax.swing.JPanel
1941 */
1942 private JPanel getJPanelUserDefCenterN() {
1943 if (jPanelUserDefCenterN == null) {
1944 jPanelUserDefCenterN = new JPanel();
1945 jPanelUserDefCenterN.add(jLabelAntCmdOpts, null);
1946 jPanelUserDefCenterN.add(getJTextFieldAntCmdOpts(), null);
1947 jPanelUserDefCenterN.add(getJButtonAntTaskAdd(), null);
1948 jPanelUserDefCenterN.add(getJButtonAntTaskDel(), null);
1949 }
1950 return jPanelUserDefCenterN;
1951 }
1952
1953 /**
1954 * This method initializes jPanel8
1955 *
1956 * @return javax.swing.JPanel
1957 */
1958 private JPanel getJPanelUserDef() {
1959 if (jPanelUserDef == null) {
1960 jPanelUserDef = new JPanel();
1961 jPanelUserDef.setLayout(new BorderLayout());
1962 jPanelUserDef.add(getJPanelUserDefNorth(), java.awt.BorderLayout.NORTH);
1963 jPanelUserDef.add(getJPanelUserDefCenter(), java.awt.BorderLayout.CENTER);
1964
1965 }
1966 return jPanelUserDef;
1967 }
1968
1969 /**
1970 * This method initializes jPanel9
1971 *
1972 * @return javax.swing.JPanel
1973 */
1974 private JPanel getJPanelUserDefNorth() {
1975 if (jPanelUserDefNorth == null) {
1976 jLabelAntTaskFile = new JLabel();
1977 jLabelAntTaskFile.setText("ANT Task File");
1978 jLabelAntTaskFile.setPreferredSize(new java.awt.Dimension(80, 20));
1979 FlowLayout flowLayout8 = new FlowLayout();
1980 flowLayout8.setAlignment(java.awt.FlowLayout.CENTER);
1981 jLabelAntTaskId = new JLabel();
1982 jLabelAntTaskId.setText("ID");
1983 jPanelUserDefNorth = new JPanel();
1984 jPanelUserDefNorth.setLayout(flowLayout8);
1985 jPanelUserDefNorth.add(jLabelAntTaskFile, null);
1986 jPanelUserDefNorth.add(getJTextFieldAntTaskFile(), null);
1987 jPanelUserDefNorth.add(getJButtonAntTaskFileBrowse(), null);
1988 jPanelUserDefNorth.add(jLabelAntTaskId, null);
1989 jPanelUserDefNorth.add(getJTextFieldAntTaskId(), null);
1990 }
1991 return jPanelUserDefNorth;
1992 }
1993
1994 /**
1995 * This method initializes jPanel11
1996 *
1997 * @return javax.swing.JPanel
1998 */
1999 private JPanel getJPanelUserDefCenter() {
2000 if (jPanelUserDefCenter == null) {
2001 jLabelAntCmdOpts = new JLabel();
2002 jLabelAntCmdOpts.setText("ANT Command Options");
2003 jLabelAntCmdOpts.setPreferredSize(new java.awt.Dimension(131, 20));
2004 jPanelUserDefCenter = new JPanel();
2005 jPanelUserDefCenter.setLayout(new BorderLayout());
2006
2007 jPanelUserDefCenter.add(getJPanelUserDefCenterN(), java.awt.BorderLayout.NORTH);
2008 jPanelUserDefCenter.add(getJScrollPaneAntTasks(), java.awt.BorderLayout.CENTER);
2009 }
2010 return jPanelUserDefCenter;
2011 }
2012
2013 /**
2014 * This method initializes jTextField2
2015 *
2016 * @return javax.swing.JTextField
2017 */
2018 private JTextField getJTextFieldAntTaskFile() {
2019 if (jTextFieldAntTaskFile == null) {
2020 jTextFieldAntTaskFile = new JTextField();
2021 jTextFieldAntTaskFile.setPreferredSize(new java.awt.Dimension(200, 20));
2022 }
2023 return jTextFieldAntTaskFile;
2024 }
2025
2026 /**
2027 * This method initializes jTextField3
2028 *
2029 * @return javax.swing.JTextField
2030 */
2031 private JTextField getJTextFieldAntTaskId() {
2032 if (jTextFieldAntTaskId == null) {
2033 jTextFieldAntTaskId = new JTextField();
2034 jTextFieldAntTaskId.setPreferredSize(new java.awt.Dimension(100, 20));
2035 }
2036 return jTextFieldAntTaskId;
2037 }
2038
2039 /**
2040 * This method initializes jButton4
2041 *
2042 * @return javax.swing.JButton
2043 */
2044 private JButton getJButtonAntTaskAdd() {
2045 if (jButtonAntTaskAdd == null) {
2046 jButtonAntTaskAdd = new JButton();
2047 jButtonAntTaskAdd.setPreferredSize(new java.awt.Dimension(90, 20));
2048 jButtonAntTaskAdd.setText("Add");
2049 jButtonAntTaskAdd.addActionListener(new ActionListener() {
2050 public void actionPerformed(ActionEvent e) {
2051 if (!DataValidation.isInt(jTextFieldAntTaskId.getText())
2052 || jTextFieldAntTaskId.getText().length() != 8) {
2053 JOptionPane.showMessageDialog(frame, "ID must be an 8-digit integer.");
2054 return;
2055 }
2056 Object[] o = { jTextFieldAntTaskId.getText(), null, null };
2057 o[1] = jTextFieldAntTaskFile.getText();
2058 o[2] = jTextFieldAntCmdOpts.getText();
2059 ffc.genBuildOptionsUserDefAntTask(o[0] + "", o[1] + "", o[2] + "");
2060 antTaskTableModel.addRow(o);
2061 docConsole.setSaved(false);
2062 }
2063 });
2064 }
2065 return jButtonAntTaskAdd;
2066 }
2067
2068 /**
2069 * This method initializes jButton5
2070 *
2071 * @return javax.swing.JButton
2072 */
2073 private JButton getJButtonAntTaskDel() {
2074 if (jButtonAntTaskDel == null) {
2075 jButtonAntTaskDel = new JButton();
2076 jButtonAntTaskDel.setPreferredSize(new java.awt.Dimension(90, 20));
2077 jButtonAntTaskDel.setText("Delete");
2078 jButtonAntTaskDel.addActionListener(new ActionListener() {
2079 public void actionPerformed(ActionEvent e) {
2080 if (selectedRow >= 0) {
2081 docConsole.setSaved(false);
2082 antTaskTableModel.removeRow(selectedRow);
2083 ffc.removeBuildOptionsUserDefAntTask(selectedRow);
2084 }
2085 }
2086 });
2087 }
2088 return jButtonAntTaskDel;
2089 }
2090
2091 /**
2092 * This method initializes jTextField4
2093 *
2094 * @return javax.swing.JTextField
2095 */
2096 private JTextField getJTextFieldAntCmdOpts() {
2097 if (jTextFieldAntCmdOpts == null) {
2098 jTextFieldAntCmdOpts = new JTextField();
2099 jTextFieldAntCmdOpts.setPreferredSize(new java.awt.Dimension(270, 20));
2100 jTextFieldAntCmdOpts.setEnabled(true);
2101 }
2102 return jTextFieldAntCmdOpts;
2103 }
2104
2105 /**
2106 * This method initializes jScrollPane2
2107 *
2108 * @return javax.swing.JScrollPane
2109 */
2110 private JScrollPane getJScrollPaneAntTasks() {
2111 if (jScrollPaneAntTasks == null) {
2112 jScrollPaneAntTasks = new JScrollPane();
2113 jScrollPaneAntTasks.setPreferredSize(new java.awt.Dimension(600, 400));
2114 jScrollPaneAntTasks.setViewportView(getJTableAntTasks());
2115 }
2116 return jScrollPaneAntTasks;
2117 }
2118
2119 /**
2120 * This method initializes jTable2
2121 *
2122 * @return javax.swing.JTable
2123 */
2124 private JTable getJTableAntTasks() {
2125 if (jTableAntTasks == null) {
2126 antTaskTableModel = new DefaultTableModel();
2127 jTableAntTasks = new JTable(antTaskTableModel);
2128 jTableAntTasks.setRowHeight(20);
2129 antTaskTableModel.addColumn("ID");
2130 antTaskTableModel.addColumn("Filename");
2131 antTaskTableModel.addColumn("ANT Command Options");
2132
2133 jTableAntTasks.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
2134 jTableAntTasks.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
2135 public void valueChanged(ListSelectionEvent e) {
2136 selectedRow = -1;
2137 if (e.getValueIsAdjusting()) {
2138 return;
2139 }
2140 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
2141 if (lsm.isSelectionEmpty()) {
2142 return;
2143 } else {
2144 selectedRow = lsm.getMinSelectionIndex();
2145 }
2146 }
2147 });
2148
2149 jTableAntTasks.getModel().addTableModelListener(new TableModelListener() {
2150 public void tableChanged(TableModelEvent arg0) {
2151 // TODO Auto-generated method stub
2152 int row = arg0.getFirstRow();
2153 TableModel m = (TableModel) arg0.getSource();
2154 if (arg0.getType() == TableModelEvent.UPDATE) {
2155 //ToDo Data Validition check.
2156 String id = m.getValueAt(row, 0) + "";
2157 String file = m.getValueAt(row, 1) + "";
2158 String execOrder = m.getValueAt(row, 2) + "";
2159 if (id.length() == 0) {
2160 return;
2161 }
2162 if (file.length() == 0 && execOrder.length() == 0) {
2163 return;
2164 }
2165 if (file.length() == 0) {
2166 file = null;
2167 }
2168 if (execOrder.length() == 0) {
2169 execOrder = null;
2170 }
2171 ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder);
2172
2173 }
2174 }
2175 });
2176 }
2177 return jTableAntTasks;
2178 }
2179
2180 private void initAntTaskTable() {
2181 if (ffc.getBuildOptionsUserDefAntTaskCount() == 0) {
2182 return;
2183 }
2184 String[][] saa = new String[ffc.getBuildOptionsUserDefAntTaskCount()][3];
2185 ffc.getBuildOptionsUserDefAntTasks(saa);
2186 for (int i = 0; i < saa.length; ++i) {
2187 antTaskTableModel.addRow(saa[i]);
2188 }
2189 }
2190
2191 } // @jve:decl-index=0:visual-constraint="10,10"