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