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