19849d0277f2f6b74e722c5d3f1f374f19d6f7f8
[people/mcb30/edk2.git] / edk2 / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFlash.java
1 /** @file\r
2   Java class FpdFlash is GUI for Flash element operation in SPD file.\r
3  \r
4 Copyright (c) 2006, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution.  The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9 \r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12 **/\r
13 package org.tianocore.frameworkwizard.platform.ui;\r
14 \r
15 import java.awt.BorderLayout;\r
16 import javax.swing.JPanel;\r
17 \r
18 import javax.swing.AbstractAction;\r
19 import javax.swing.DefaultCellEditor;\r
20 import javax.swing.JFileChooser;\r
21 import javax.swing.JFrame;\r
22 import javax.swing.JOptionPane;\r
23 import javax.swing.JTabbedPane;\r
24 import javax.swing.JButton;\r
25 import javax.swing.ListSelectionModel;\r
26 \r
27 import org.tianocore.PlatformSurfaceAreaDocument;\r
28 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
29 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
30 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
31 \r
32 \r
33 import java.awt.FlowLayout;\r
34 import java.awt.event.ActionEvent;\r
35 import java.awt.event.ComponentAdapter;\r
36 import java.awt.event.ComponentEvent;\r
37 import java.awt.event.ItemEvent;\r
38 import java.awt.event.ItemListener;\r
39 import java.io.File;\r
40 import java.util.Iterator;\r
41 import java.util.LinkedHashMap;\r
42 import java.util.Map;\r
43 import java.util.Set;\r
44 \r
45 import javax.swing.JCheckBox;\r
46 import javax.swing.JTextField;\r
47 import java.awt.GridLayout;\r
48 import javax.swing.JLabel;\r
49 import javax.swing.JScrollPane;\r
50 import javax.swing.JTable;\r
51 import javax.swing.event.InternalFrameAdapter;\r
52 import javax.swing.event.InternalFrameEvent;\r
53 import javax.swing.event.ListSelectionEvent;\r
54 import javax.swing.event.ListSelectionListener;\r
55 import javax.swing.event.TableModelEvent;\r
56 import javax.swing.event.TableModelListener;\r
57 import javax.swing.table.DefaultTableModel;\r
58 import javax.swing.table.TableColumn;\r
59 import javax.swing.table.TableModel;\r
60 import javax.swing.JComboBox;\r
61 import java.awt.Dimension;\r
62 \r
63 public class FpdFlash extends IInternalFrame {\r
64 \r
65     /**\r
66      * \r
67      */\r
68     private static final long serialVersionUID = 1L;\r
69     static JFrame frame;\r
70     private JPanel jContentPane = null;\r
71     private JPanel jPanel = null;\r
72     private JPanel jPanel1 = null;\r
73     private JPanel jPanel2 = null;\r
74     private JPanel jPanel3 = null;\r
75     private JTabbedPane jTabbedPane = null;\r
76     private JPanel jPanelFvImages = null;\r
77     private JButton jButtonOk = null;\r
78     private JButton jButtonCancel = null;\r
79     private JPanel jPanelFvImageN = null;\r
80     private JPanel jPanelFvImageS = null;\r
81     private JCheckBox jCheckBox1 = null;\r
82     private JLabel jLabel = null;\r
83     private JTextField jTextField = null;\r
84     private JLabel jLabel1 = null;\r
85     private JTextField jTextField1 = null;\r
86     private JButton jButton = null;\r
87     private JScrollPane jScrollPane1 = null;\r
88     private JTable jTable = null;\r
89     private JPanel jPanel4 = null;\r
90     private JButton jButton1 = null;\r
91     private DefaultTableModel fvPropertyTableModel = null;\r
92     private DefaultTableModel fvImageNameTableModel = null;\r
93     private ImageParaTableModel fvImageParaTableModel = null;\r
94     private DefaultTableModel fvOptionTableModel = null;\r
95     private JPanel jPanelFvImageC = null;\r
96     private JCheckBox jCheckBox2 = null;\r
97     private JLabel jLabel2 = null;\r
98     private JComboBox jComboBox = null;\r
99     private JLabel jLabel3 = null;\r
100     private JLabel jLabel4 = null;\r
101     private JTextField jTextField2 = null;\r
102     private JButton jButton2 = null;\r
103     private JScrollPane jScrollPane2 = null;\r
104     private JTable jTable1 = null;\r
105     private JButton jButton3 = null;\r
106     private JPanel jPanel5 = null;\r
107     private JButton jButton4 = null;\r
108     private JScrollPane jScrollPane3 = null;\r
109     private JTable jTable2 = null;\r
110     private JButton jButton6 = null;\r
111     private JCheckBox jCheckBox3 = null;\r
112     private JPanel jPanel6 = null;\r
113     private OpeningPlatformType docConsole = null;\r
114     private FpdFileContents ffc = null;\r
115     private JPanel jPanel7 = null;\r
116     private JCheckBox jCheckBox = null;\r
117     private JTextField jTextField3 = null;\r
118     private JButton jButton5 = null;\r
119     private JLabel jLabel5 = null;\r
120     private JTextField jTextField4 = null;\r
121     private JLabel jLabel6 = null;\r
122     private JTextField jTextField5 = null;\r
123     private JPanel jPanel8 = null;\r
124     private JButton jButton7 = null;\r
125     private JButton jButton8 = null;\r
126     private JScrollPane jScrollPane = null;\r
127     private JTable jTable3 = null;\r
128     private JButton jButton9 = null;\r
129     public FpdFlash() {\r
130         super();\r
131         // TODO Auto-generated constructor stub\r
132 \r
133         initialize();\r
134         this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r
135         this.setVisible(true);\r
136     }\r
137 \r
138     public FpdFlash(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){\r
139         this();\r
140         ffc = new FpdFileContents(fpd);\r
141         init(ffc);\r
142     }\r
143     \r
144     public FpdFlash(OpeningPlatformType opt) {\r
145         this(opt.getXmlFpd());\r
146         docConsole = opt;\r
147     }\r
148     \r
149     /**\r
150      * This method initializes jPanel   \r
151      *  \r
152      * @return javax.swing.JPanel       \r
153      */\r
154     private JPanel getJPanel() {\r
155         if (jPanel == null) {\r
156             jPanel = new JPanel();\r
157         }\r
158         return jPanel;\r
159     }\r
160 \r
161     /**\r
162      * This method initializes jPanel1  \r
163      *  \r
164      * @return javax.swing.JPanel       \r
165      */\r
166     private JPanel getJPanel1() {\r
167         if (jPanel1 == null) {\r
168             FlowLayout flowLayout = new FlowLayout();\r
169             flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);\r
170             flowLayout.setHgap(15);\r
171             jPanel1 = new JPanel();\r
172             jPanel1.setLayout(flowLayout);\r
173             jPanel1.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);\r
174             jPanel1.add(getJButtonCancel(), null);\r
175             jPanel1.add(getJButtonOk(), null);\r
176         }\r
177         return jPanel1;\r
178     }\r
179 \r
180     /**\r
181      * This method initializes jPanel2  \r
182      *  \r
183      * @return javax.swing.JPanel       \r
184      */\r
185     private JPanel getJPanel2() {\r
186         if (jPanel2 == null) {\r
187             jPanel2 = new JPanel();\r
188         }\r
189         return jPanel2;\r
190     }\r
191 \r
192     /**\r
193      * This method initializes jPanel3  \r
194      *  \r
195      * @return javax.swing.JPanel       \r
196      */\r
197     private JPanel getJPanel3() {\r
198         if (jPanel3 == null) {\r
199             jPanel3 = new JPanel();\r
200         }\r
201         return jPanel3;\r
202     }\r
203 \r
204     /**\r
205      * This method initializes jTabbedPane      \r
206      *  \r
207      * @return javax.swing.JTabbedPane  \r
208      */\r
209     private JTabbedPane getJTabbedPane() {\r
210         if (jTabbedPane == null) {\r
211             jTabbedPane = new JTabbedPane();\r
212             jTabbedPane.addTab("FV Images", null, getJPanelFvImages(), null);\r
213             jTabbedPane.addTab("Flash Definition File", null, getJPanel7(), null);\r
214             \r
215         }\r
216         return jTabbedPane;\r
217     }\r
218 \r
219     /**\r
220      * This method initializes jPanelFvImages   \r
221      *  \r
222      * @return javax.swing.JPanel       \r
223      */\r
224     private JPanel getJPanelFvImages() {\r
225         if (jPanelFvImages == null) {\r
226             jPanelFvImages = new JPanel();\r
227             jPanelFvImages.setLayout(new BorderLayout());\r
228             jPanelFvImages.add(getJPanelFvImageN(), java.awt.BorderLayout.NORTH);\r
229 //            jPanelFvImages.add(getJPanelFvImageW(), java.awt.BorderLayout.WEST);\r
230             jPanelFvImages.add(getJPanelFvImageS(), java.awt.BorderLayout.SOUTH);\r
231             jPanelFvImages.add(getJPanelFvImageC(), java.awt.BorderLayout.CENTER);\r
232             \r
233         }\r
234         return jPanelFvImages;\r
235     }\r
236 \r
237     /**\r
238      * This method initializes jButtonOk        \r
239      *  \r
240      * @return javax.swing.JButton      \r
241      */\r
242     private JButton getJButtonOk() {\r
243         if (jButtonOk == null) {\r
244             jButtonOk = new JButton();\r
245             jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));\r
246             jButtonOk.setText("Cancel");\r
247             jButtonOk.setVisible(false);\r
248         }\r
249         return jButtonOk;\r
250     }\r
251 \r
252     /**\r
253      * This method initializes jButtonCancel    \r
254      *  \r
255      * @return javax.swing.JButton      \r
256      */\r
257     private JButton getJButtonCancel() {\r
258         if (jButtonCancel == null) {\r
259             jButtonCancel = new JButton();\r
260             jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));\r
261             jButtonCancel.setText("Ok");\r
262             jButtonCancel.setVisible(false);\r
263         }\r
264         return jButtonCancel;\r
265     }\r
266 \r
267     /**\r
268      * This method initializes jPanelFvImageN   \r
269      *  \r
270      * @return javax.swing.JPanel       \r
271      */\r
272     private JPanel getJPanelFvImageN() {\r
273         if (jPanelFvImageN == null) {\r
274             jLabel1 = new JLabel();\r
275             jLabel1.setText("Value");\r
276             jLabel1.setEnabled(false);\r
277             jLabel1.setPreferredSize(new java.awt.Dimension(38,20));\r
278             jLabel = new JLabel();\r
279             jLabel.setText("Name");\r
280             jLabel.setEnabled(false);\r
281             jLabel.setPreferredSize(new java.awt.Dimension(38,20));\r
282             FlowLayout flowLayout2 = new FlowLayout();\r
283             flowLayout2.setAlignment(java.awt.FlowLayout.CENTER);\r
284             flowLayout2.setHgap(15);\r
285             jPanelFvImageN = new JPanel();\r
286             jPanelFvImageN.setPreferredSize(new java.awt.Dimension(576,100));\r
287             jPanelFvImageN.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));\r
288             jPanelFvImageN.setLayout(flowLayout2);\r
289             jPanelFvImageN.add(getJCheckBox1(), null);\r
290             jPanelFvImageN.add(jLabel, null);\r
291             jPanelFvImageN.add(getJTextField(), null);\r
292             jPanelFvImageN.add(jLabel1, null);\r
293             jPanelFvImageN.add(getJTextField1(), null);\r
294             jPanelFvImageN.add(getJScrollPane1(), null);\r
295             jPanelFvImageN.add(getJPanel4(), null);\r
296         }\r
297         return jPanelFvImageN;\r
298     }\r
299 \r
300     /**\r
301      * This method initializes jPanelFvImageS   \r
302      *  \r
303      * @return javax.swing.JPanel       \r
304      */\r
305     private JPanel getJPanelFvImageS() {\r
306         if (jPanelFvImageS == null) {\r
307             GridLayout gridLayout2 = new GridLayout();\r
308             gridLayout2.setRows(1);\r
309             jPanelFvImageS = new JPanel();\r
310             jPanelFvImageS.setPreferredSize(new java.awt.Dimension(480,190));\r
311             jPanelFvImageS.setLayout(gridLayout2);\r
312             jPanelFvImageS.add(getJScrollPane3(), null);\r
313         }\r
314         return jPanelFvImageS;\r
315     }\r
316 \r
317 \r
318     /**\r
319      * This method initializes jCheckBox1       \r
320      *  \r
321      * @return javax.swing.JCheckBox    \r
322      */\r
323     private JCheckBox getJCheckBox1() {\r
324         if (jCheckBox1 == null) {\r
325             jCheckBox1 = new JCheckBox();\r
326             jCheckBox1.setText("FV Properties");\r
327             jCheckBox1.addItemListener(new ItemListener(){\r
328 \r
329                 public void itemStateChanged(ItemEvent arg0) {\r
330                     // TODO Auto-generated method stub\r
331                     boolean seleted = jCheckBox1.isSelected();\r
332                     \r
333                         jLabel.setEnabled(seleted);\r
334                         jTextField.setEnabled(seleted);\r
335                         jLabel1.setEnabled(seleted);\r
336                         jTextField1.setEnabled(seleted);\r
337                         jTable.setEnabled(seleted);\r
338                         jButton.setEnabled(seleted);\r
339                         jButton1.setEnabled(seleted);\r
340                     \r
341                    \r
342                 }\r
343                 \r
344             });\r
345         }\r
346         return jCheckBox1;\r
347     }\r
348 \r
349 \r
350     /**\r
351      * This method initializes jTextField       \r
352      *  \r
353      * @return javax.swing.JTextField   \r
354      */\r
355     private JTextField getJTextField() {\r
356         if (jTextField == null) {\r
357             jTextField = new JTextField();\r
358             jTextField.setPreferredSize(new java.awt.Dimension(100,20));\r
359             jTextField.setEnabled(false);\r
360         }\r
361         return jTextField;\r
362     }\r
363 \r
364 \r
365     /**\r
366      * This method initializes jTextField1      \r
367      *  \r
368      * @return javax.swing.JTextField   \r
369      */\r
370     private JTextField getJTextField1() {\r
371         if (jTextField1 == null) {\r
372             jTextField1 = new JTextField();\r
373             jTextField1.setPreferredSize(new java.awt.Dimension(100,20));\r
374             jTextField1.setEnabled(false);\r
375         }\r
376         return jTextField1;\r
377     }\r
378 \r
379 \r
380     /**\r
381      * This method initializes jButton  \r
382      *  \r
383      * @return javax.swing.JButton      \r
384      */\r
385     private JButton getJButton() {\r
386         if (jButton == null) {\r
387             jButton = new JButton();\r
388             jButton.setPreferredSize(new java.awt.Dimension(80,20));\r
389             jButton.setEnabled(false);\r
390             jButton.setText("Add");\r
391             jButton.addActionListener(new AbstractAction() {\r
392                 /**\r
393                  * \r
394                  */\r
395                 private static final long serialVersionUID = 1L;\r
396 \r
397                 public void actionPerformed(ActionEvent e) {\r
398                     if (jTextField.getText().length() > 0 && jTextField1.getText().length() > 0){\r
399                         String[] row = {jTextField.getText(), jTextField1.getText()};                        \r
400                         fvPropertyTableModel.addRow(row);\r
401                         docConsole.setSaved(false);\r
402                         ffc.genFvImagesNameValue(row[0], row[1]);\r
403                     }\r
404                 }\r
405             });\r
406         }\r
407         return jButton;\r
408     }\r
409 \r
410 \r
411     /**\r
412      * This method initializes jScrollPane1     \r
413      *  \r
414      * @return javax.swing.JScrollPane  \r
415      */\r
416     private JScrollPane getJScrollPane1() {\r
417         if (jScrollPane1 == null) {\r
418             jScrollPane1 = new JScrollPane();\r
419             jScrollPane1.setPreferredSize(new java.awt.Dimension(350,55));\r
420             jScrollPane1.setViewportView(getJTable());\r
421         }\r
422         return jScrollPane1;\r
423     }\r
424 \r
425 \r
426     /**\r
427      * This method initializes jTable   \r
428      *  \r
429      * @return javax.swing.JTable       \r
430      */\r
431     private JTable getJTable() {\r
432         if (jTable == null) {\r
433             fvPropertyTableModel = new DefaultTableModel();\r
434             jTable = new JTable(fvPropertyTableModel);\r
435             fvPropertyTableModel.addColumn("Name");\r
436             fvPropertyTableModel.addColumn("Value");\r
437             jTable.setRowHeight(20);\r
438             jTable.setEnabled(false);\r
439             \r
440             jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
441             jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
442                 public void valueChanged(ListSelectionEvent e) {\r
443                     if (e.getValueIsAdjusting()){\r
444                         return;\r
445                     }\r
446                     ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r
447                     if (lsm.isSelectionEmpty()) {\r
448                         return;\r
449                     }\r
450                     else{\r
451 //                        selectedRow = lsm.getMinSelectionIndex();\r
452                     }\r
453                 }\r
454             });\r
455             \r
456             jTable.getModel().addTableModelListener(new TableModelListener(){\r
457                 public void tableChanged(TableModelEvent arg0) {\r
458                     // TODO Auto-generated method stub\r
459                     int row = arg0.getFirstRow();\r
460                     TableModel m = (TableModel)arg0.getSource();\r
461                     if (arg0.getType() == TableModelEvent.UPDATE){\r
462                         \r
463                         String name = m.getValueAt(row, 0) + "";\r
464                         String value = m.getValueAt(row, 1) + "";\r
465                         docConsole.setSaved(false);\r
466                         ffc.updateFvImagesNameValue(row, name, value);\r
467                     }\r
468                 }\r
469             });\r
470         }\r
471         return jTable;\r
472     }\r
473 \r
474 \r
475     /**\r
476      * This method initializes jPanel4  \r
477      *  \r
478      * @return javax.swing.JPanel       \r
479      */\r
480     private JPanel getJPanel4() {\r
481         if (jPanel4 == null) {\r
482             jPanel4 = new JPanel();\r
483             jPanel4.setPreferredSize(new java.awt.Dimension(80,55));\r
484             \r
485             jPanel4.add(getJButton(), null);\r
486             jPanel4.add(getJButton1(), null);\r
487         }\r
488         return jPanel4;\r
489     }\r
490 \r
491 \r
492     /**\r
493      * This method initializes jButton1 \r
494      *  \r
495      * @return javax.swing.JButton      \r
496      */\r
497     private JButton getJButton1() {\r
498         if (jButton1 == null) {\r
499             jButton1 = new JButton();\r
500             jButton1.setPreferredSize(new java.awt.Dimension(80,20));\r
501             jButton1.setEnabled(false);\r
502             jButton1.setText("Delete");\r
503             jButton1.addActionListener(new AbstractAction() {\r
504                 /**\r
505                  * \r
506                  */\r
507                 private static final long serialVersionUID = 1L;\r
508 \r
509                 public void actionPerformed(ActionEvent e) {\r
510                     if (jTable.getSelectedRow() >= 0){\r
511                         fvPropertyTableModel.removeRow(jTable.getSelectedRow());\r
512                         docConsole.setSaved(false);\r
513                         ffc.removeFvImagesNameValue(jTable.getSelectedRow());\r
514                     }\r
515                 }\r
516             });\r
517         }\r
518         return jButton1;\r
519     }\r
520 \r
521 \r
522     /**\r
523      * This method initializes jPanelFvImageC   \r
524      *  \r
525      * @return javax.swing.JPanel       \r
526      */\r
527     private JPanel getJPanelFvImageC() {\r
528         if (jPanelFvImageC == null) {\r
529             jLabel4 = new JLabel();\r
530             jLabel4.setPreferredSize(new Dimension(38, 20));\r
531             jLabel4.setEnabled(false);\r
532             jLabel4.setText("Name");\r
533             jLabel3 = new JLabel();\r
534             jLabel3.setText("FV Image Names");\r
535             jLabel3.setEnabled(false);\r
536             jLabel3.setPreferredSize(new java.awt.Dimension(150,20));\r
537             jLabel2 = new JLabel();\r
538             jLabel2.setText("Type");\r
539             jLabel2.setEnabled(false);\r
540             jLabel2.setPreferredSize(new java.awt.Dimension(70,20));\r
541             FlowLayout flowLayout3 = new FlowLayout();\r
542             flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);\r
543             flowLayout3.setHgap(5);\r
544             jPanelFvImageC = new JPanel();\r
545             jPanelFvImageC.setLayout(flowLayout3);\r
546             jPanelFvImageC.add(getJPanel6(), null);\r
547             \r
548             jPanelFvImageC.add(getJPanel5(), null);\r
549             \r
550         }\r
551         return jPanelFvImageC;\r
552     }\r
553 \r
554 \r
555     /**\r
556      * This method initializes jCheckBox2       \r
557      *  \r
558      * @return javax.swing.JCheckBox    \r
559      */\r
560     private JCheckBox getJCheckBox2() {\r
561         if (jCheckBox2 == null) {\r
562             jCheckBox2 = new JCheckBox();\r
563             jCheckBox2.setText("FV Image Parameters");\r
564             jCheckBox2.setPreferredSize(new java.awt.Dimension(200,20));\r
565             jCheckBox2.addItemListener(new ItemListener(){\r
566 \r
567                 public void itemStateChanged(ItemEvent arg0) {\r
568                     // TODO Auto-generated method stub\r
569                     boolean seleted = jCheckBox2.isSelected();\r
570                     \r
571                         jLabel2.setEnabled(seleted);\r
572                         jLabel3.setEnabled(seleted);\r
573                         jLabel4.setEnabled(seleted);\r
574                         jComboBox.setEnabled(seleted);\r
575                         jTextField2.setEnabled(seleted);\r
576                         \r
577                         jTable1.setEnabled(seleted);\r
578                         jButton2.setEnabled(seleted);\r
579                         jButton3.setEnabled(seleted);\r
580                     \r
581                    \r
582                 }\r
583                 \r
584             });\r
585         }\r
586         return jCheckBox2;\r
587     }\r
588 \r
589 \r
590     /**\r
591      * This method initializes jComboBox        \r
592      *  \r
593      * @return javax.swing.JComboBox    \r
594      */\r
595     private JComboBox getJComboBox() {\r
596         if (jComboBox == null) {\r
597             jComboBox = new JComboBox();\r
598             jComboBox.addItem("ImageName");\r
599             jComboBox.addItem("Attributes");\r
600             jComboBox.addItem("Options");\r
601             jComboBox.addItem("Components");\r
602             jComboBox.setPreferredSize(new java.awt.Dimension(180,20));\r
603             jComboBox.setEnabled(false);\r
604             jComboBox.addItemListener(new ItemListener() {\r
605 \r
606                 public void itemStateChanged(ItemEvent arg0) {\r
607                     // TODO disable attribute settings when ValidImageNames selected.\r
608                     \r
609                 }\r
610                 \r
611             });\r
612         }\r
613         return jComboBox;\r
614     }\r
615 \r
616 \r
617     /**\r
618      * This method initializes jTextField2      \r
619      *  \r
620      * @return javax.swing.JTextField   \r
621      */\r
622     private JTextField getJTextField2() {\r
623         if (jTextField2 == null) {\r
624             jTextField2 = new JTextField();\r
625             jTextField2.setPreferredSize(new java.awt.Dimension(140,20));\r
626             jTextField2.setEnabled(false);\r
627         }\r
628         return jTextField2;\r
629     }\r
630 \r
631 \r
632     /**\r
633      * This method initializes jButton2 \r
634      *  \r
635      * @return javax.swing.JButton      \r
636      */\r
637     private JButton getJButton2() {\r
638         if (jButton2 == null) {\r
639             jButton2 = new JButton();\r
640             jButton2.setPreferredSize(new Dimension(80, 20));\r
641             jButton2.setEnabled(false);\r
642             jButton2.setText("Add");\r
643             jButton2.addActionListener(new AbstractAction() {\r
644                 /**\r
645                  * \r
646                  */\r
647                 private static final long serialVersionUID = 1L;\r
648 \r
649                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
650                     if (jTextField2.getText().length() > 0){\r
651                         String[] row = {jTextField2.getText()};                        \r
652                         fvImageNameTableModel.addRow(row);\r
653                     }\r
654                 }\r
655             });\r
656         }\r
657         return jButton2;\r
658     }\r
659 \r
660 \r
661     /**\r
662      * This method initializes jScrollPane2     \r
663      *  \r
664      * @return javax.swing.JScrollPane  \r
665      */\r
666     private JScrollPane getJScrollPane2() {\r
667         if (jScrollPane2 == null) {\r
668             jScrollPane2 = new JScrollPane();\r
669             jScrollPane2.setPreferredSize(new java.awt.Dimension(350,50));\r
670             jScrollPane2.setViewportView(getJTable1());\r
671         }\r
672         return jScrollPane2;\r
673     }\r
674 \r
675 \r
676     /**\r
677      * This method initializes jTable1  \r
678      *  \r
679      * @return javax.swing.JTable       \r
680      */\r
681     private JTable getJTable1() {\r
682         if (jTable1 == null) {\r
683             fvImageNameTableModel = new DefaultTableModel();\r
684             jTable1 = new JTable(fvImageNameTableModel);\r
685             jTable1.setEnabled(false);\r
686             fvImageNameTableModel.addColumn("FV Image Name");\r
687         }\r
688         return jTable1;\r
689     }\r
690 \r
691 \r
692     /**\r
693      * This method initializes jButton3 \r
694      *  \r
695      * @return javax.swing.JButton      \r
696      */\r
697     private JButton getJButton3() {\r
698         if (jButton3 == null) {\r
699             jButton3 = new JButton();\r
700             jButton3.setPreferredSize(new Dimension(80, 20));\r
701             jButton3.setEnabled(false);\r
702             jButton3.setText("Delete");\r
703             jButton3.addActionListener(new AbstractAction() {\r
704                 /**\r
705                  * \r
706                  */\r
707                 private static final long serialVersionUID = 1L;\r
708 \r
709                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
710                     if (jTable1.getSelectedRow() >= 0){\r
711                                    \r
712                         fvImageNameTableModel.removeRow(jTable1.getSelectedRow());\r
713                     }\r
714                 }\r
715             });\r
716         }\r
717         return jButton3;\r
718     }\r
719 \r
720 \r
721 \r
722                         \r
723   private JPanel getJPanel5() {\r
724                         \r
725 \r
726  if (jPanel5 == null) {\r
727      //ToDo add ButtonGroup for RadioButtons\r
728             jLabel6 = new JLabel();\r
729             jLabel6.setEnabled(true);\r
730             jLabel6.setText("Value");\r
731             jLabel6.setPreferredSize(new Dimension(38, 20));\r
732             jLabel5 = new JLabel();\r
733             jLabel5.setEnabled(true);\r
734             jLabel5.setText("Name");\r
735             jLabel5.setPreferredSize(new Dimension(38, 20));\r
736             jPanel5 = new JPanel();\r
737             jPanel5.setPreferredSize(new java.awt.Dimension(480,150));\r
738             \r
739             jPanel5.setLayout(new FlowLayout());\r
740             \r
741                         jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));\r
742                         jPanel5.add(getJCheckBox3(), null);\r
743                         jPanel5.add(jLabel5, null);\r
744                         jPanel5.add(getJTextField4(), null);\r
745                         jPanel5.add(jLabel6, null);\r
746                         jPanel5.add(getJTextField5(), null);\r
747                         jPanel5.add(getJScrollPane(), null);\r
748                         jPanel5.add(getJPanel8(), null);\r
749                         jPanel5.add(getJButton4(), null);\r
750                         jPanel5.add(getJButton6(), null);\r
751                         jPanel5.add(getJButton9(), null);\r
752             \r
753             \r
754                                 \r
755 \r
756             \r
757         }\r
758         return jPanel5;\r
759     }\r
760 \r
761 \r
762     /**\r
763      * This method initializes jButton4 \r
764      *  \r
765      * @return javax.swing.JButton      \r
766      */\r
767     private JButton getJButton4() {\r
768         if (jButton4 == null) {\r
769             jButton4 = new JButton();\r
770             jButton4.setPreferredSize(new java.awt.Dimension(120,20));\r
771 //            jButton4.setEnabled(false);\r
772             jButton4.setText("Add FV Image");\r
773             jButton4.addActionListener(new AbstractAction() {\r
774                 /**\r
775                  * \r
776                  */\r
777                 private static final long serialVersionUID = 1L;\r
778 \r
779                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
780                     if (jTable2.isEditing()) {\r
781                         jTable2.getCellEditor().stopCellEditing();\r
782                     }\r
783                     if (jTable3.isEditing()) {\r
784                         jTable3.getCellEditor().stopCellEditing();\r
785                     }\r
786                     if (jTable1.getRowCount()== 0){\r
787                         return;\r
788                     }\r
789                     String imageName = " ";\r
790                     for (int i = 0; i < jTable1.getRowCount(); ++i){\r
791                         imageName += (String)jTable1.getValueAt(i, 0);\r
792                         imageName += " ";\r
793                     }\r
794                     imageName = imageName.trim();\r
795                     \r
796                     if (!jCheckBox3.isSelected() && jComboBox.getSelectedIndex() != 0){\r
797                         return;\r
798                       \r
799                     }\r
800                     \r
801                     LinkedHashMap<String, String> m = null;\r
802                     if (jCheckBox3.isSelected()) {\r
803                         m = new LinkedHashMap<String, String>();\r
804                         getOptionNameValue(m);\r
805                     }\r
806                     ffc.genFvImagesFvImage(imageName.split(" "), jComboBox.getSelectedItem()+"", m);\r
807                     docConsole.setSaved(false);\r
808                     Object[] row = {imageName, jComboBox.getSelectedItem()};\r
809                     fvImageParaTableModel.addRow(row); \r
810                 }\r
811             });\r
812         }\r
813         return jButton4;\r
814     }\r
815 \r
816 \r
817     /**\r
818      * This method initializes jScrollPane3     \r
819      *  \r
820      * @return javax.swing.JScrollPane  \r
821      */\r
822     private JScrollPane getJScrollPane3() {\r
823         if (jScrollPane3 == null) {\r
824             jScrollPane3 = new JScrollPane();\r
825             jScrollPane3.setPreferredSize(new java.awt.Dimension(480,150));\r
826             jScrollPane3.setViewportView(getJTable2());\r
827         }\r
828         return jScrollPane3;\r
829     }\r
830 \r
831 \r
832     /**\r
833      * This method initializes jTable2  \r
834      *  \r
835      * @return javax.swing.JTable       \r
836      */\r
837     private JTable getJTable2() {\r
838         if (jTable2 == null) {\r
839             fvImageParaTableModel = new ImageParaTableModel();\r
840             jTable2 = new JTable(fvImageParaTableModel);\r
841             fvImageParaTableModel.addColumn("FvImageNames");\r
842             fvImageParaTableModel.addColumn("Type");\r
843             \r
844             \r
845             TableColumn typeCol = jTable2.getColumnModel().getColumn(1);\r
846             JComboBox cb = new JComboBox();\r
847             cb.addItem("ValidImageNames");\r
848             cb.addItem("Attributes");\r
849             cb.addItem("Options");\r
850             cb.addItem("Components");\r
851             typeCol.setCellEditor(new DefaultCellEditor(cb));\r
852             \r
853             jTable2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
854             jTable2.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
855                 public void valueChanged(ListSelectionEvent e) {\r
856                     if (e.getValueIsAdjusting()){\r
857                         return;\r
858                     }\r
859                     ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r
860                     if (lsm.isSelectionEmpty()) {\r
861                         return;\r
862                     }\r
863                     else{\r
864                         int selectedRow = lsm.getMinSelectionIndex();\r
865                         LinkedHashMap<String, String> optionMap = new LinkedHashMap<String, String>();\r
866                         ffc.getFvImagesFvImageOptions(selectedRow, optionMap);\r
867                         if (optionMap.size() > 0){\r
868                             fvOptionTableModel.setRowCount(0);\r
869                             Set<String> key = optionMap.keySet();\r
870                             Iterator<String> i = key.iterator();\r
871                             while (i.hasNext()) {\r
872                                 \r
873                                 String k = (String)i.next();\r
874                                 String[] row = {k, optionMap.get(k)};\r
875                                 \r
876                                 fvOptionTableModel.addRow(row);\r
877                             }\r
878                         }\r
879                         \r
880                     }\r
881                 }\r
882             });\r
883             \r
884             \r
885         }\r
886         return jTable2;\r
887     }\r
888 \r
889 \r
890     /**\r
891      * This method initializes jButton6 \r
892      *  \r
893      * @return javax.swing.JButton      \r
894      */\r
895     private JButton getJButton6() {\r
896         if (jButton6 == null) {\r
897             jButton6 = new JButton();\r
898             jButton6.setPreferredSize(new java.awt.Dimension(120,20));\r
899 //            jButton6.setEnabled(false);\r
900             jButton6.setText("Delete Row");\r
901             jButton6.addActionListener(new AbstractAction() {\r
902                 /**\r
903                  * \r
904                  */\r
905                 private static final long serialVersionUID = 1L;\r
906 \r
907                 public void actionPerformed(ActionEvent arg0) {\r
908                     // TODO Auto-generated method stub\r
909                     if (jTable2.getSelectedRow() >= 0 ) {\r
910                         ffc.removeFvImagesFvImage(jTable2.getSelectedRow());\r
911                         fvImageParaTableModel.removeRow(jTable2.getSelectedRow());\r
912                         docConsole.setSaved(false);\r
913                     }\r
914                 }\r
915                 \r
916             });\r
917         }\r
918         return jButton6;\r
919     }\r
920 \r
921 \r
922     /**\r
923      * This method initializes jCheckBox3       \r
924      *  \r
925      * @return javax.swing.JCheckBox    \r
926      */\r
927     private JCheckBox getJCheckBox3() {\r
928         if (jCheckBox3 == null) {\r
929             jCheckBox3 = new JCheckBox();\r
930             jCheckBox3.setText("FV Image Options");\r
931             jCheckBox3.addItemListener(new ItemListener(){\r
932 \r
933                 public void itemStateChanged(ItemEvent arg0) {\r
934                     // TODO Auto-generated method stub\r
935 //                    boolean selected = jCheckBox3.isSelected();\r
936                     \r
937                         if (!jCheckBox2.isSelected() || jComboBox.getSelectedIndex() == 0) {\r
938                             return;\r
939                         }\r
940                         \r
941 //                        jLabel5.setEnabled(selected);\r
942 //                        jTextField4.setEnabled(selected);\r
943 //                        jLabel6.setEnabled(selected);\r
944 //                        jTextField5.setEnabled(selected);\r
945 //                        jButton7.setEnabled(selected);\r
946 //                        jButton8.setEnabled(selected);\r
947 \r
948                 }\r
949                 \r
950             });\r
951         }\r
952         return jCheckBox3;\r
953     }\r
954 \r
955 \r
956     /**\r
957      * This method initializes jPanel6  \r
958      *  \r
959      * @return javax.swing.JPanel       \r
960      */\r
961     private JPanel getJPanel6() {\r
962         if (jPanel6 == null) {\r
963             StarLabel starLabel = new StarLabel();\r
964             starLabel.setVisible(false);\r
965             jPanel6 = new JPanel();\r
966             jPanel6.setPreferredSize(new java.awt.Dimension(480,120));\r
967             jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));\r
968             jPanel6.add(getJCheckBox2(), null);\r
969             jPanel6.add(jLabel2, null);\r
970             jPanel6.add(getJComboBox(), null);\r
971             jPanel6.add(new StarLabel(), null);\r
972             jPanel6.add(jLabel3, null);\r
973             jPanel6.add(jLabel4, null);\r
974             jPanel6.add(getJTextField2(), null);\r
975             jPanel6.add(getJButton2(), null);\r
976             jPanel6.add(getJScrollPane2(), null);\r
977             jPanel6.add(getJButton3(), null);\r
978         }\r
979         return jPanel6;\r
980     }\r
981 \r
982     /**\r
983      * This method initializes jPanel7  \r
984      *  \r
985      * @return javax.swing.JPanel       \r
986      */\r
987     private JPanel getJPanel7() {\r
988         if (jPanel7 == null) {\r
989             FlowLayout flowLayout1 = new FlowLayout();\r
990             flowLayout1.setAlignment(FlowLayout.LEFT);\r
991             jPanel7 = new JPanel();\r
992             jPanel7.setLayout(flowLayout1);\r
993             jPanel7.add(getJCheckBox(), null);\r
994             jPanel7.add(getJTextField3(), null);\r
995             jPanel7.add(getJButton5(), null);\r
996             jPanel7.addComponentListener(new ComponentAdapter(){\r
997                 public void componentShown(ComponentEvent e) {\r
998                     if (ffc.getFlashDefinitionFile() != null) {\r
999                         jTextField3.setText(ffc.getFlashDefinitionFile());\r
1000                     }\r
1001                 }\r
1002                 public void componentHidden(ComponentEvent e) {\r
1003                     if (jCheckBox.isSelected()) {\r
1004                         ffc.genFlashDefinitionFile(jTextField3.getText());\r
1005                     }\r
1006                 }\r
1007             });\r
1008         }\r
1009         return jPanel7;\r
1010     }\r
1011 \r
1012     /**\r
1013      * This method initializes jCheckBox        \r
1014      *  \r
1015      * @return javax.swing.JCheckBox    \r
1016      */\r
1017     private JCheckBox getJCheckBox() {\r
1018         if (jCheckBox == null) {\r
1019             jCheckBox = new JCheckBox();\r
1020             jCheckBox.setText("Flash Definition File");\r
1021             jCheckBox.addItemListener(new ItemListener() {\r
1022 \r
1023                 public void itemStateChanged(ItemEvent arg0) {\r
1024                     // TODO Auto-generated method stub\r
1025                     if (jCheckBox.isSelected()){\r
1026                         jTextField3.setEnabled(true);\r
1027                         jButton5.setEnabled(true);\r
1028                     }\r
1029                     else {\r
1030                         \r
1031                         jTextField3.setEnabled(false);\r
1032                         jButton5.setEnabled(false);\r
1033                     }\r
1034                 }\r
1035             });\r
1036         }\r
1037         return jCheckBox;\r
1038     }\r
1039 \r
1040     /**\r
1041      * This method initializes jTextField3      \r
1042      *  \r
1043      * @return javax.swing.JTextField   \r
1044      */\r
1045     private JTextField getJTextField3() {\r
1046         if (jTextField3 == null) {\r
1047             jTextField3 = new JTextField();\r
1048             jTextField3.setEnabled(false);\r
1049             jTextField3.setPreferredSize(new Dimension(300, 20));\r
1050             jTextField3.addFocusListener(new java.awt.event.FocusAdapter() {\r
1051                 public void focusLost(java.awt.event.FocusEvent e) {\r
1052                     ffc.genFlashDefinitionFile(jTextField3.getText());\r
1053                 }\r
1054             });\r
1055         }\r
1056         return jTextField3;\r
1057     }\r
1058 \r
1059     /**\r
1060      * This method initializes jButton5 \r
1061      *  \r
1062      * @return javax.swing.JButton      \r
1063      */\r
1064     private JButton getJButton5() {\r
1065         if (jButton5 == null) {\r
1066             jButton5 = new JButton();\r
1067             jButton5.setEnabled(false);\r
1068             jButton5.setText("Browse");\r
1069             jButton5.setPreferredSize(new Dimension(78, 20));\r
1070             jButton5.addActionListener(new AbstractAction(){\r
1071                 /**\r
1072                  * \r
1073                  */\r
1074                 private static final long serialVersionUID = 1L;\r
1075 \r
1076                 public void actionPerformed(ActionEvent e) {\r
1077                     // TODO Auto-generated method stub\r
1078                     String wsDir = System.getenv("WORKSPACE");\r
1079                     JFileChooser chooser = new JFileChooser(wsDir);\r
1080                     chooser.setMultiSelectionEnabled(false);\r
1081                     chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r
1082                     int retval = chooser.showOpenDialog(frame);\r
1083                     if (retval == JFileChooser.APPROVE_OPTION) {\r
1084 \r
1085                         File theFile = chooser.getSelectedFile();\r
1086                         String filePath = theFile.getPath();\r
1087                         if (!filePath.startsWith(wsDir)) {\r
1088                             JOptionPane.showMessageDialog(frame, "You can only select files in current WORKSPACE.");\r
1089                             return;\r
1090                         }\r
1091                         jTextField3.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));\r
1092                     }\r
1093                 }\r
1094                 \r
1095             });\r
1096         }\r
1097         return jButton5;\r
1098     }\r
1099 \r
1100     /**\r
1101      * This method initializes jTextField4      \r
1102      *  \r
1103      * @return javax.swing.JTextField   \r
1104      */\r
1105     private JTextField getJTextField4() {\r
1106         if (jTextField4 == null) {\r
1107             jTextField4 = new JTextField();\r
1108             jTextField4.setEnabled(true);\r
1109             jTextField4.setPreferredSize(new Dimension(100, 20));\r
1110         }\r
1111         return jTextField4;\r
1112     }\r
1113 \r
1114     /**\r
1115      * This method initializes jTextField5      \r
1116      *  \r
1117      * @return javax.swing.JTextField   \r
1118      */\r
1119     private JTextField getJTextField5() {\r
1120         if (jTextField5 == null) {\r
1121             jTextField5 = new JTextField();\r
1122             jTextField5.setEnabled(true);\r
1123             jTextField5.setPreferredSize(new Dimension(100, 20));\r
1124         }\r
1125         return jTextField5;\r
1126     }\r
1127 \r
1128     /**\r
1129      * This method initializes jPanel8  \r
1130      *  \r
1131      * @return javax.swing.JPanel       \r
1132      */\r
1133     private JPanel getJPanel8() {\r
1134         if (jPanel8 == null) {\r
1135             jPanel8 = new JPanel();\r
1136             jPanel8.setPreferredSize(new Dimension(80, 55));\r
1137             jPanel8.add(getJButton7(), null);\r
1138             jPanel8.add(getJButton8(), null);\r
1139         }\r
1140         return jPanel8;\r
1141     }\r
1142 \r
1143     /**\r
1144      * This method initializes jButton7 \r
1145      *  \r
1146      * @return javax.swing.JButton      \r
1147      */\r
1148     private JButton getJButton7() {\r
1149         if (jButton7 == null) {\r
1150             jButton7 = new JButton();\r
1151             jButton7.setEnabled(true);\r
1152             jButton7.setText("Add");\r
1153             jButton7.setPreferredSize(new Dimension(80, 20));\r
1154             jButton7.addActionListener(new AbstractAction() {\r
1155                 /**\r
1156                  * \r
1157                  */\r
1158                 private static final long serialVersionUID = 1L;\r
1159 \r
1160                 public void actionPerformed(ActionEvent e) {\r
1161                     if (jTextField4.getText().length() > 0 && jTextField5.getText().length() > 0){\r
1162                         String[] row = {jTextField4.getText(), jTextField5.getText()};                        \r
1163                         fvOptionTableModel.addRow(row);\r
1164                     }\r
1165                 }\r
1166             });\r
1167         }\r
1168         return jButton7;\r
1169     }\r
1170 \r
1171     /**\r
1172      * This method initializes jButton8 \r
1173      *  \r
1174      * @return javax.swing.JButton      \r
1175      */\r
1176     private JButton getJButton8() {\r
1177         if (jButton8 == null) {\r
1178             jButton8 = new JButton();\r
1179             jButton8.setEnabled(true);\r
1180             jButton8.setText("Delete");\r
1181             jButton8.setPreferredSize(new Dimension(80, 20));\r
1182             jButton8.addActionListener(new AbstractAction() {\r
1183                 /**\r
1184                  * \r
1185                  */\r
1186                 private static final long serialVersionUID = 1L;\r
1187 \r
1188                 public void actionPerformed(ActionEvent e) {\r
1189                     if (jTable3.getSelectedRow() >= 0){\r
1190                         fvOptionTableModel.removeRow(jTable.getSelectedRow());\r
1191                     }\r
1192                 }\r
1193             });\r
1194         }\r
1195         return jButton8;\r
1196     }\r
1197 \r
1198     /**\r
1199      * This method initializes jScrollPane      \r
1200      *  \r
1201      * @return javax.swing.JScrollPane  \r
1202      */\r
1203     private JScrollPane getJScrollPane() {\r
1204         if (jScrollPane == null) {\r
1205             jScrollPane = new JScrollPane();\r
1206             jScrollPane.setPreferredSize(new java.awt.Dimension(350,80));\r
1207             jScrollPane.setViewportView(getJTable3());\r
1208         }\r
1209         return jScrollPane;\r
1210     }\r
1211 \r
1212     /**\r
1213      * This method initializes jTable3  \r
1214      *  \r
1215      * @return javax.swing.JTable       \r
1216      */\r
1217     private JTable getJTable3() {\r
1218         if (jTable3 == null) {\r
1219             fvOptionTableModel = new DefaultTableModel();\r
1220             fvOptionTableModel.addColumn("Name");\r
1221             fvOptionTableModel.addColumn("Value");\r
1222             jTable3 = new JTable(fvOptionTableModel);\r
1223 \r
1224             jTable3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
1225             jTable3.setRowHeight(20);\r
1226             \r
1227         }\r
1228         return jTable3;\r
1229     }\r
1230 \r
1231     /**\r
1232      * This method initializes jButton9 \r
1233      *  \r
1234      * @return javax.swing.JButton      \r
1235      */\r
1236     private JButton getJButton9() {\r
1237         if (jButton9 == null) {\r
1238             jButton9 = new JButton();\r
1239             jButton9.setPreferredSize(new Dimension(120, 20));\r
1240             jButton9.setActionCommand("Update");\r
1241             jButton9.setText("Update FV");\r
1242             jButton9.addActionListener(new java.awt.event.ActionListener() {\r
1243                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
1244                     int row = jTable2.getSelectedRow();\r
1245                     if (jTable2.isEditing()) {\r
1246                         jTable2.getCellEditor().stopCellEditing();\r
1247                     }\r
1248                     if (jTable3.isEditing()) {\r
1249                         jTable3.getCellEditor().stopCellEditing();\r
1250                     }\r
1251                     \r
1252                         //ToDo Check data validity before update\r
1253                         String name = fvImageParaTableModel.getValueAt(row, 0) + "";\r
1254                         String type = fvImageParaTableModel.getValueAt(row, 1) + "";\r
1255                         \r
1256                         LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();\r
1257                         getOptionNameValue(lhm);\r
1258                         \r
1259                         docConsole.setSaved(false);\r
1260                         ffc.updateFvImagesFvImage(row, name.split(" "), type, lhm);\r
1261                     \r
1262                 }\r
1263             });\r
1264         }\r
1265         return jButton9;\r
1266     }\r
1267 \r
1268     /**\r
1269      * @param args\r
1270      */\r
1271     public static void main(String[] args) {\r
1272         // TODO Auto-generated method stub\r
1273         new FpdFlash().setVisible(true);\r
1274     }\r
1275 \r
1276     /**\r
1277      * This method initializes this\r
1278      * \r
1279      * @return void\r
1280      */\r
1281     private void initialize() {\r
1282         this.setSize(518, 650);\r
1283         this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r
1284         this.setContentPane(getJContentPane());\r
1285         this.setTitle("FPD Flash Definitions");\r
1286         this.addInternalFrameListener(new InternalFrameAdapter(){\r
1287             public void internalFrameDeactivated(InternalFrameEvent e){\r
1288                 if (jTable.isEditing()) {\r
1289                     jTable.getCellEditor().stopCellEditing();\r
1290                 }\r
1291                 if (jTable1.isEditing()) {\r
1292                     jTable1.getCellEditor().stopCellEditing();\r
1293                 }\r
1294                 if (jTable2.isEditing()) {\r
1295                     jTable2.getCellEditor().stopCellEditing();\r
1296                 }\r
1297             }\r
1298         });\r
1299     }\r
1300 \r
1301     private void init(FpdFileContents ffc) {\r
1302         if (ffc.getFvImagesFvImageCount() == 0) {\r
1303             return;\r
1304         }\r
1305         String[][] saa = new String[ffc.getFvImagesFvImageCount()][2];\r
1306 //        ArrayList<LinkedHashMap<String, String>> options = new ArrayList<LinkedHashMap<String, String>>(ffc.getFvImagesFvImageCount());\r
1307 //\r
1308 //        for (int j = 0; j < ffc.getFvImagesFvImageCount(); ++j){\r
1309 //            options.add(new LinkedHashMap<String, String>());\r
1310 //        }\r
1311         ffc.getFvImagesFvImages(saa);\r
1312         \r
1313        \r
1314         int i = 0;\r
1315         while (i < saa.length) {\r
1316             \r
1317             fvImageParaTableModel.addRow(saa[i]);\r
1318             ++i;\r
1319         }\r
1320         \r
1321 //        String fdfFile = ffc.getFlashDefinitionFile();\r
1322 //        if (fdfFile != null) {\r
1323 //            jTextField3.setText(fdfFile);\r
1324 //        }\r
1325     }\r
1326     \r
1327     private void getOptionNameValue(Map<String, String> m){\r
1328         for (int i = 0; i < jTable3.getRowCount(); ++i) {\r
1329             m.put(fvOptionTableModel.getValueAt(i, 0)+"", fvOptionTableModel.getValueAt(i, 1)+"");\r
1330         }\r
1331     }\r
1332     /**\r
1333      * This method initializes jContentPane\r
1334      * \r
1335      * @return javax.swing.JPanel\r
1336      */\r
1337     private JPanel getJContentPane() {\r
1338         if (jContentPane == null) {\r
1339             jContentPane = new JPanel();\r
1340             jContentPane.setLayout(new BorderLayout());\r
1341             jContentPane.add(getJPanel(), java.awt.BorderLayout.EAST);\r
1342             jContentPane.add(getJPanel1(), java.awt.BorderLayout.SOUTH);\r
1343             jContentPane.add(getJPanel2(), java.awt.BorderLayout.WEST);\r
1344             jContentPane.add(getJPanel3(), java.awt.BorderLayout.NORTH);\r
1345             jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);\r
1346         }\r
1347         return jContentPane;\r
1348     }\r
1349 \r
1350 }  //  @jve:decl-index=0:visual-constraint="10,10"\r
1351 \r
1352 class ImageParaTableModel extends DefaultTableModel {\r
1353 \r
1354     private static final long serialVersionUID = 1L;\r
1355     \r
1356    public boolean isCellEditable(int row, int col) {\r
1357         if (getValueAt(row, 1).equals("ImageName") && col >=1) {\r
1358             return false;\r
1359         }\r
1360         return true;\r
1361     }\r
1362 }\r
1363 \r