]>
Commit | Line | Data |
---|---|---|
a13899c5 | 1 | /** @file\r |
2 | Java class SpdLibClassDecls is GUI for create library definition elements of 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.packaging.ui;\r | |
14 | \r | |
a13899c5 | 15 | import java.awt.Dimension;\r |
a13899c5 | 16 | import java.awt.event.ActionEvent;\r |
a13899c5 | 17 | import java.awt.event.ComponentEvent;\r |
a13899c5 | 18 | import java.io.File;\r |
af25df16 | 19 | import java.util.HashMap;\r |
20 | import java.util.Iterator;\r | |
af25df16 | 21 | import java.util.Set;\r |
a13899c5 | 22 | import java.util.Vector;\r |
23 | \r | |
24 | import javax.swing.AbstractAction;\r | |
a13899c5 | 25 | import javax.swing.JFileChooser;\r |
26 | import javax.swing.JOptionPane;\r | |
27 | import javax.swing.JPanel;\r | |
a13899c5 | 28 | import javax.swing.JTable;\r |
29 | import javax.swing.JTextField;\r | |
0a35c6e2 | 30 | import javax.swing.JTextArea;\r |
a13899c5 | 31 | import javax.swing.JComboBox;\r |
32 | import javax.swing.JLabel;\r | |
a13899c5 | 33 | import javax.swing.JScrollPane;\r |
34 | import javax.swing.JButton;\r | |
35 | import javax.swing.JFrame;\r | |
36 | import javax.swing.ListSelectionModel;\r | |
37 | import javax.swing.event.InternalFrameAdapter;\r | |
38 | import javax.swing.event.InternalFrameEvent;\r | |
39 | import javax.swing.event.ListSelectionEvent;\r | |
40 | import javax.swing.event.ListSelectionListener;\r | |
41 | import javax.swing.event.TableModelEvent;\r | |
42 | import javax.swing.event.TableModelListener;\r | |
43 | import javax.swing.table.DefaultTableModel;\r | |
44 | import javax.swing.table.TableModel;\r | |
a13899c5 | 45 | import org.tianocore.PackageSurfaceAreaDocument;\r |
0a35c6e2 | 46 | import org.tianocore.frameworkwizard.common.DataType;\r |
ce73a791 | 47 | import org.tianocore.frameworkwizard.common.DataValidation;\r |
3658f95e | 48 | import org.tianocore.frameworkwizard.common.GlobalData;\r |
a13899c5 | 49 | import org.tianocore.frameworkwizard.common.Tools;\r |
d6d24759 | 50 | import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r |
a13899c5 | 51 | import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r |
52 | import org.tianocore.frameworkwizard.common.ui.StarLabel;\r | |
53 | import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r | |
ce73a791 | 54 | import org.tianocore.frameworkwizard.platform.ui.ListEditor;\r |
fbf730ff | 55 | import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;\r |
af25df16 | 56 | import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r |
3658f95e | 57 | import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r |
a13899c5 | 58 | \r |
a13899c5 | 59 | \r |
60 | /**\r | |
61 | GUI for create library definition elements of spd file.\r | |
62 | \r | |
63 | @since PackageEditor 1.0\r | |
64 | **/\r | |
65 | public class SpdLibClassDecls extends IInternalFrame implements TableModelListener{\r | |
ce73a791 | 66 | /**\r |
67 | * \r | |
68 | */\r | |
69 | private static final long serialVersionUID = 1L;\r | |
70 | \r | |
a13899c5 | 71 | static JFrame frame;\r |
72 | \r | |
73 | private JTable jTable = null;\r | |
74 | \r | |
75 | private DefaultTableModel model = null;\r | |
76 | \r | |
77 | private JPanel jContentPane = null;\r | |
78 | \r | |
0a35c6e2 | 79 | private JTextField jTextFieldAddClass = null;\r |
a13899c5 | 80 | \r |
81 | private JComboBox jComboBoxSelect = null;\r | |
82 | \r | |
0a35c6e2 | 83 | private JScrollPane jScrollPaneTable = null;\r |
a13899c5 | 84 | \r |
85 | private JButton jButtonAdd = null;\r | |
86 | \r | |
87 | private JButton jButtonRemove = null;\r | |
88 | \r | |
97796eaa | 89 | private JButton jButtonRemoveAll = null;\r |
a13899c5 | 90 | \r |
97796eaa | 91 | private JLabel jLabelHdr = null;\r |
a13899c5 | 92 | \r |
97796eaa | 93 | private JTextField jTextFieldHdr = null;\r |
a13899c5 | 94 | \r |
95 | private JButton jButtonBrowse = null;\r | |
96 | \r | |
0a35c6e2 | 97 | private StarLabel starLabel1 = null;\r |
a13899c5 | 98 | \r |
0a35c6e2 | 99 | private StarLabel starLabel3 = null;\r |
a13899c5 | 100 | \r |
101 | private SpdFileContents sfc = null;\r | |
d6d24759 | 102 | \r |
103 | private OpeningPackageType docConsole = null;\r | |
a13899c5 | 104 | \r |
2f8a7517 | 105 | private JLabel jLabel1ClassName = null;\r |
a13899c5 | 106 | \r |
107 | private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,53"\r | |
108 | \r | |
109 | private int selectedRow = -1;\r | |
110 | \r | |
0a35c6e2 | 111 | private StarLabel starLabel2 = null;\r |
a13899c5 | 112 | \r |
2f8a7517 | 113 | private JLabel jLabel2HelpText = null;\r |
a13899c5 | 114 | \r |
0a35c6e2 | 115 | private JTextArea jTextAreaHelp = null;\r |
116 | \r | |
117 | private JScrollPane jHelpTextScrollPane = null;\r | |
a13899c5 | 118 | \r |
2f8a7517 | 119 | private JLabel jLabel3RecInstName = null;\r |
a13899c5 | 120 | \r |
2f8a7517 | 121 | private JTextField jTextField1RecInstName = null;\r |
a13899c5 | 122 | \r |
2f8a7517 | 123 | private JLabel jLabel4RecInstVer = null;\r |
a13899c5 | 124 | \r |
2f8a7517 | 125 | private JTextField jTextField2RecInstVer = null;\r |
a13899c5 | 126 | \r |
2f8a7517 | 127 | private JLabel jLabel5SupArchList = null;\r |
a13899c5 | 128 | \r |
2f8a7517 | 129 | private JLabel jLabel6SupModList = null;\r |
a13899c5 | 130 | \r |
97796eaa | 131 | private JScrollPane jScrollPaneModules = null;\r |
a13899c5 | 132 | \r |
97796eaa | 133 | private JScrollPane jScrollPane1Arch = null;\r |
af25df16 | 134 | \r |
97796eaa | 135 | private ICheckBoxList iCheckBoxListModules = null;\r |
a13899c5 | 136 | \r |
4da2e625 | 137 | private ICheckBoxList iCheckBoxListArch = null;\r |
af25df16 | 138 | \r |
139 | private JComboBox jComboBox = null;\r | |
97796eaa | 140 | \r |
141 | private int cnClassName = 0;\r | |
142 | private int cnHdrFile = 1;\r | |
143 | private int cnHelpText = 2;\r | |
144 | private int cnRecInstName = 3;\r | |
145 | private int cnRecInstVer = 4;\r | |
146 | private int cnSupArch = 5;\r | |
147 | private int cnSupMod = 6;\r | |
0a35c6e2 | 148 | \r |
149 | private final int shortLabel = 90;\r | |
150 | private final int longLabel = 220;\r | |
151 | private final int labelCol = 12;\r | |
152 | private final int shortValueCol = labelCol + shortLabel + 6;\r | |
153 | private final int longValueCol = labelCol + longLabel + 6;\r | |
154 | private final int longValueWidth = 347;\r | |
155 | private final int shortWidth = 140;\r | |
156 | private final int medWidth = 240;\r | |
157 | \r | |
158 | private final int buttonWidth = 99;\r | |
159 | \r | |
160 | private final int addButtonCol = shortValueCol + 10;\r | |
161 | private final int removeButtonCol = addButtonCol + buttonWidth + 10;\r | |
162 | private final int removeAllButtonCol = removeButtonCol + buttonWidth + 10;\r | |
163 | \r | |
164 | private final int rowOne = 12;\r | |
165 | private final int rowTwo = rowOne + 25;\r | |
166 | private final int rowThree = rowTwo + 60 + 25;\r | |
167 | private final int rowFour = rowThree + 25;\r | |
168 | private final int rowFive = rowFour + 40 + 25;\r | |
169 | private final int rowSix = rowFive + 40 + 25;\r | |
170 | private final int rowSeven = rowSix;\r | |
171 | private final int rowEight = rowSeven + 30;\r | |
172 | \r | |
af25df16 | 173 | HashMap<String, String> libNameGuidMap = new HashMap<String, String>();\r |
ce73a791 | 174 | \r |
ce73a791 | 175 | \r |
a13899c5 | 176 | /**\r |
177 | This method initializes this\r | |
178 | \r | |
179 | **/\r | |
180 | private void initialize() {\r | |
181 | \r | |
182 | this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\r | |
183 | \r | |
184 | }\r | |
185 | \r | |
a13899c5 | 186 | /**\r |
0a35c6e2 | 187 | This method initializes jTextFieldAddClass \r |
a13899c5 | 188 | \r |
189 | @return javax.swing.JTextField \r | |
190 | **/\r | |
0a35c6e2 | 191 | private JTextField getJTextFieldAddClass() {\r |
192 | if (jTextFieldAddClass == null) {\r | |
193 | jTextFieldAddClass = new JTextField();\r | |
194 | jTextFieldAddClass.setBounds(new java.awt.Rectangle(shortValueCol,rowOne,longValueWidth,20));\r | |
195 | jTextFieldAddClass.setPreferredSize(new java.awt.Dimension(longValueWidth,20));\r | |
196 | jTextFieldAddClass.setEnabled(true);\r | |
a13899c5 | 197 | }\r |
0a35c6e2 | 198 | return jTextFieldAddClass;\r |
a13899c5 | 199 | }\r |
200 | \r | |
201 | /**\r | |
202 | This method initializes jComboBoxSelect \r | |
203 | \r | |
204 | @return javax.swing.JComboBox \r | |
205 | **/\r | |
206 | private JComboBox getJComboBoxSelect() {\r | |
207 | if (jComboBoxSelect == null) {\r | |
208 | jComboBoxSelect = new JComboBox();\r | |
209 | jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));\r | |
210 | jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,22));\r | |
211 | jComboBoxSelect.setEnabled(true);\r | |
212 | jComboBoxSelect.setVisible(false);\r | |
213 | }\r | |
214 | return jComboBoxSelect;\r | |
215 | }\r | |
216 | \r | |
217 | /**\r | |
0a35c6e2 | 218 | This method initializes jScrollPaneTable \r |
a13899c5 | 219 | \r |
220 | @return javax.swing.JScrollPane \r | |
97796eaa | 221 | \r |
222 | Used for the Table of Library Classes that are provided by this package\r | |
223 | \r | |
a13899c5 | 224 | **/\r |
0a35c6e2 | 225 | private JScrollPane getJScrollPaneTable() {\r |
226 | if (jScrollPaneTable == null) {\r | |
227 | jScrollPaneTable = new JScrollPane();\r | |
228 | jScrollPaneTable.setBounds(new java.awt.Rectangle(labelCol,rowEight,400,253));\r | |
229 | jScrollPaneTable.setViewportView(getJTable());\r | |
a13899c5 | 230 | }\r |
0a35c6e2 | 231 | return jScrollPaneTable;\r |
a13899c5 | 232 | }\r |
233 | \r | |
234 | /**\r | |
235 | This method initializes jTable \r | |
236 | \r | |
237 | @return javax.swing.JTable \r | |
238 | **/\r | |
239 | private JTable getJTable() {\r | |
240 | if (jTable == null) {\r | |
241 | model = new DefaultTableModel();\r | |
242 | jTable = new JTable(model);\r | |
243 | jTable.setRowHeight(20);\r | |
d129bd96 | 244 | jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r |
97796eaa | 245 | jTable.setColumnSelectionAllowed(false);\r |
246 | model.addColumn("Class Name");\r | |
247 | model.addColumn("Header");\r | |
248 | model.addColumn("Help Text");\r | |
d129bd96 | 249 | model.addColumn("Recommended Instance");\r |
250 | model.addColumn("Version");\r | |
816ea437 | 251 | model.addColumn("Supported Architectures");\r |
252 | model.addColumn("Supported Module Types");\r | |
ce73a791 | 253 | \r |
fbf730ff | 254 | jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor());\r |
255 | \r | |
ce73a791 | 256 | Vector<String> vArch = new Vector<String>();\r |
257 | vArch.add("IA32");\r | |
258 | vArch.add("X64");\r | |
259 | vArch.add("IPF");\r | |
260 | vArch.add("EBC");\r | |
261 | vArch.add("ARM");\r | |
262 | vArch.add("PPC");\r | |
d129bd96 | 263 | jTable.getColumnModel().getColumn(cnSupArch).setCellEditor(new ListEditor(vArch));\r |
ce73a791 | 264 | \r |
265 | Vector<String> vModule = new Vector<String>();\r | |
266 | vModule.add("BASE");\r | |
267 | vModule.add("SEC");\r | |
268 | vModule.add("PEI_CORE");\r | |
269 | vModule.add("PEIM");\r | |
270 | vModule.add("DXE_CORE");\r | |
271 | vModule.add("DXE_DRIVER");\r | |
272 | vModule.add("DXE_RUNTIME_DRIVER");\r | |
273 | vModule.add("DXE_SAL_DRIVER");\r | |
274 | vModule.add("DXE_SMM_DRIVER");\r | |
275 | vModule.add("UEFI_DRIVER");\r | |
276 | vModule.add("UEFI_APPLICATION");\r | |
277 | vModule.add("USER_DEFINED");\r | |
97796eaa | 278 | \r |
279 | jTable.getColumnModel().getColumn(cnSupMod).setCellEditor(new ListEditor(vModule));\r | |
a13899c5 | 280 | \r |
281 | jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r | |
282 | jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r | |
283 | public void valueChanged(ListSelectionEvent e) {\r | |
284 | if (e.getValueIsAdjusting()){\r | |
285 | return;\r | |
286 | }\r | |
287 | ListSelectionModel lsm = (ListSelectionModel)e.getSource();\r | |
288 | if (lsm.isSelectionEmpty()) {\r | |
289 | return;\r | |
290 | }\r | |
291 | else{\r | |
292 | selectedRow = lsm.getMinSelectionIndex();\r | |
293 | }\r | |
294 | }\r | |
295 | });\r | |
296 | \r | |
297 | jTable.getModel().addTableModelListener(this);\r | |
298 | \r | |
299 | }\r | |
300 | return jTable;\r | |
301 | }\r | |
302 | \r | |
303 | \r | |
304 | public void tableChanged(TableModelEvent arg0) {\r | |
305 | // TODO Auto-generated method stub\r | |
306 | int row = arg0.getFirstRow();\r | |
a490bca8 | 307 | int column = arg0.getColumn();\r |
a13899c5 | 308 | TableModel m = (TableModel)arg0.getSource();\r |
309 | if (arg0.getType() == TableModelEvent.UPDATE){\r | |
a490bca8 | 310 | \r |
97796eaa | 311 | String lib = m.getValueAt(row, cnClassName) + "";\r |
312 | String hdr = m.getValueAt(row, cnHdrFile) + "";\r | |
313 | String hlp = m.getValueAt(row, cnHelpText) + "";\r | |
a490bca8 | 314 | String name = null;\r |
315 | if (m.getValueAt(row, cnRecInstName) != null) {\r | |
316 | name = m.getValueAt(row, cnRecInstName).toString();\r | |
317 | } \r | |
318 | String ver = null;\r | |
319 | if (m.getValueAt(row, cnRecInstVer) != null){\r | |
320 | ver = m.getValueAt(row, cnRecInstVer).toString();\r | |
321 | }\r | |
a13899c5 | 322 | String arch = null;\r |
97796eaa | 323 | if (m.getValueAt(row, cnSupArch) != null) {\r |
324 | arch = m.getValueAt(row, cnSupArch).toString();\r | |
a13899c5 | 325 | }\r |
326 | String module = null;\r | |
97796eaa | 327 | if (m.getValueAt(row, cnSupMod) != null) {\r |
328 | module = m.getValueAt(row, cnSupMod).toString();\r | |
a13899c5 | 329 | }\r |
d129bd96 | 330 | String[] rowData = {lib, hdr, hlp, name, ver};\r |
ce73a791 | 331 | if (!dataValidation(rowData)) {\r |
332 | return;\r | |
333 | }\r | |
12e17a0a | 334 | \r |
a490bca8 | 335 | String guid = null;\r |
336 | if (name != null && name.length() > 0) {\r | |
337 | getLibInstances(lib);\r | |
338 | guid = nameToGuid(name);\r | |
b2d4baa6 | 339 | if (guid == null){\r |
816ea437 | 340 | JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");\r |
b2d4baa6 | 341 | return;\r |
342 | }\r | |
a490bca8 | 343 | }\r |
12e17a0a | 344 | \r |
a490bca8 | 345 | String[] sa = new String[7];\r |
346 | sfc.getSpdLibClassDeclaration(sa, row);\r | |
347 | Object cellData = m.getValueAt(row, column);\r | |
348 | if (cellData == null) {\r | |
349 | cellData = "";\r | |
350 | }\r | |
351 | if (column == cnRecInstName) {\r | |
352 | if (guid == null) {\r | |
353 | if (sa[cnRecInstName] == null) {\r | |
354 | return;\r | |
355 | }\r | |
356 | }\r | |
357 | else {\r | |
358 | if (guid.equals(sa[cnRecInstName])) {\r | |
359 | return;\r | |
360 | }\r | |
361 | }\r | |
362 | }\r | |
363 | else {\r | |
364 | if (cellData.equals(sa[column])) {\r | |
365 | return;\r | |
366 | }\r | |
367 | if (cellData.toString().length() == 0 && sa[column] == null) {\r | |
368 | return;\r | |
369 | }\r | |
370 | }\r | |
371 | docConsole.setSaved(false);\r | |
d129bd96 | 372 | sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);\r |
a13899c5 | 373 | }\r |
374 | }\r | |
375 | \r | |
376 | /**\r | |
377 | This method initializes jButtonAdd \r | |
378 | \r | |
379 | @return javax.swing.JButton \r | |
380 | **/\r | |
381 | private JButton getJButtonAdd() {\r | |
382 | if (jButtonAdd == null) {\r | |
383 | jButtonAdd = new JButton();\r | |
a13899c5 | 384 | jButtonAdd.setText("Add");\r |
0a35c6e2 | 385 | jButtonAdd.setSize(new java.awt.Dimension(buttonWidth,20));\r |
386 | jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowSeven,buttonWidth,20));\r | |
a13899c5 | 387 | jButtonAdd.addActionListener(this);\r |
388 | }\r | |
389 | return jButtonAdd;\r | |
390 | }\r | |
391 | \r | |
392 | /**\r | |
393 | This method initializes jButtonRemove \r | |
394 | \r | |
395 | @return javax.swing.JButton \r | |
396 | **/\r | |
397 | private JButton getJButtonRemove() {\r | |
398 | if (jButtonRemove == null) {\r | |
399 | jButtonRemove = new JButton();\r | |
a13899c5 | 400 | jButtonRemove.setText("Remove");\r |
0a35c6e2 | 401 | jButtonRemove.setSize(new java.awt.Dimension(buttonWidth,20));\r |
402 | jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowSeven,buttonWidth,20));\r | |
a13899c5 | 403 | jButtonRemove.addActionListener(this);\r |
404 | }\r | |
405 | return jButtonRemove;\r | |
406 | }\r | |
407 | \r | |
408 | /**\r | |
409 | This method initializes jButtonRemoveAll \r | |
410 | \r | |
411 | @return javax.swing.JButton \r | |
412 | **/\r | |
97796eaa | 413 | private JButton getJButtonRemoveAll() {\r |
414 | if (jButtonRemoveAll == null) {\r | |
415 | jButtonRemoveAll = new JButton();\r | |
416 | jButtonRemoveAll.setText("Remove All");\r | |
0a35c6e2 | 417 | jButtonRemoveAll.setSize(new java.awt.Dimension(buttonWidth,20));\r |
418 | jButtonRemoveAll.setBounds(new java.awt.Rectangle(removeAllButtonCol,rowSeven,buttonWidth,20));\r | |
97796eaa | 419 | jButtonRemoveAll.addActionListener(this);\r |
a13899c5 | 420 | }\r |
97796eaa | 421 | return jButtonRemoveAll;\r |
a13899c5 | 422 | }\r |
423 | \r | |
a13899c5 | 424 | /**\r |
425 | This is the default constructor\r | |
426 | **/\r | |
427 | public SpdLibClassDecls() {\r | |
428 | super();\r | |
429 | initialize();\r | |
430 | init();\r | |
431 | \r | |
432 | }\r | |
433 | \r | |
434 | public SpdLibClassDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){\r | |
435 | this();\r | |
436 | sfc = new SpdFileContents(inPsa);\r | |
437 | init(sfc);\r | |
438 | }\r | |
d6d24759 | 439 | \r |
440 | public SpdLibClassDecls(OpeningPackageType opt) {\r | |
441 | this(opt.getXmlSpd());\r | |
442 | docConsole = opt;\r | |
443 | }\r | |
a13899c5 | 444 | /**\r |
445 | This method initializes this\r | |
446 | \r | |
447 | @return void\r | |
448 | **/\r | |
449 | private void init() {\r | |
450 | \r | |
451 | this.setContentPane(getJContentPane());\r | |
452 | this.setTitle("Library Class Declarations");\r | |
453 | this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));\r | |
454 | this.setVisible(true);\r | |
455 | this.addInternalFrameListener(new InternalFrameAdapter(){\r | |
456 | public void internalFrameDeactivated(InternalFrameEvent e){\r | |
457 | if (jTable.isEditing()) {\r | |
458 | jTable.getCellEditor().stopCellEditing();\r | |
459 | }\r | |
460 | }\r | |
461 | });\r | |
a13899c5 | 462 | }\r |
463 | \r | |
464 | private void init(SpdFileContents sfc) {\r | |
465 | if (sfc.getSpdLibClassDeclarationCount() == 0) {\r | |
466 | return ;\r | |
467 | }\r | |
468 | //\r | |
469 | // initialize table using SpdFileContents object\r | |
470 | //\r | |
471 | String[][] saa = new String[sfc.getSpdLibClassDeclarationCount()][7];\r | |
472 | sfc.getSpdLibClassDeclarations(saa);\r | |
473 | int i = 0;\r | |
474 | while (i < saa.length) {\r | |
12e17a0a | 475 | if (saa[i][3] != null && saa[i][3].length() > 0) {\r |
476 | getLibInstances(saa[i][0]);\r | |
477 | saa[i][3] = guidToName(saa[i][3]);\r | |
478 | }\r | |
479 | \r | |
a13899c5 | 480 | model.addRow(saa[i]);\r |
481 | i++;\r | |
482 | }\r | |
483 | }\r | |
484 | private JScrollPane getJContentPane(){\r | |
485 | if (topScrollPane == null){\r | |
486 | topScrollPane = new JScrollPane();\r | |
a13899c5 | 487 | topScrollPane.setViewportView(getJContentPane1());\r |
488 | }\r | |
489 | return topScrollPane;\r | |
490 | }\r | |
491 | /**\r | |
492 | This method initializes jContentPane\r | |
493 | \r | |
494 | @return javax.swing.JPanel\r | |
495 | **/\r | |
496 | private JPanel getJContentPane1() {\r | |
497 | if (jContentPane == null) {\r | |
97796eaa | 498 | // Library Class\r |
0a35c6e2 | 499 | starLabel1 = new StarLabel();\r |
500 | starLabel1.setLocation(new java.awt.Point(1,rowOne));\r | |
97796eaa | 501 | jLabel1ClassName = new JLabel();\r |
0a35c6e2 | 502 | jLabel1ClassName.setBounds(new java.awt.Rectangle(labelCol,rowOne,shortLabel,20));\r |
97796eaa | 503 | jLabel1ClassName.setText("Library Class");\r |
504 | \r | |
505 | // Help Text\r | |
0a35c6e2 | 506 | starLabel2 = new StarLabel();\r |
507 | starLabel2.setBounds(new java.awt.Rectangle(1,rowTwo,10,20));\r | |
97796eaa | 508 | jLabel2HelpText = new JLabel();\r |
0a35c6e2 | 509 | jLabel2HelpText.setBounds(new java.awt.Rectangle(labelCol,rowTwo,shortLabel,20));\r |
97796eaa | 510 | jLabel2HelpText.setText("Help Text");\r |
511 | \r | |
512 | // Header File\r | |
0a35c6e2 | 513 | starLabel3 = new StarLabel();\r |
514 | starLabel3.setLocation(new java.awt.Point(1,rowThree));\r | |
97796eaa | 515 | jLabelHdr = new JLabel();\r |
0a35c6e2 | 516 | jLabelHdr.setBounds(new java.awt.Rectangle(labelCol,rowThree,longLabel,20));\r |
97796eaa | 517 | jLabelHdr.setText("Include Header for Specified Class");\r |
518 | \r | |
2f8a7517 | 519 | jLabel6SupModList = new JLabel();\r |
0a35c6e2 | 520 | jLabel6SupModList.setBounds(new java.awt.Rectangle(labelCol,rowFive,longLabel,20));\r |
521 | jLabel6SupModList.setText("Supported Module Types");\r | |
2f8a7517 | 522 | jLabel6SupModList.setEnabled(true);\r |
97796eaa | 523 | \r |
2f8a7517 | 524 | jLabel5SupArchList = new JLabel();\r |
0a35c6e2 | 525 | jLabel5SupArchList.setBounds(new java.awt.Rectangle(labelCol,rowFour,longLabel,20));\r |
526 | jLabel5SupArchList.setText("Supported Architectures");\r | |
2f8a7517 | 527 | jLabel5SupArchList.setEnabled(true);\r |
0a35c6e2 | 528 | \r |
a13899c5 | 529 | jContentPane = new JPanel();\r |
1be13d3f | 530 | jContentPane.setPreferredSize(new Dimension(680, 600));\r |
a13899c5 | 531 | jContentPane.setLayout(null);\r |
97796eaa | 532 | jContentPane.add(jLabelHdr, null);\r |
0a35c6e2 | 533 | jContentPane.add(starLabel1, null);\r |
534 | jContentPane.add(starLabel3, null);\r | |
535 | jContentPane.add(getJTextFieldAddClass(), null);\r | |
a13899c5 | 536 | jContentPane.add(getJComboBoxSelect(), null);\r |
0a35c6e2 | 537 | jContentPane.add(getJScrollPaneTable(), null);\r |
a13899c5 | 538 | jContentPane.add(getJButtonAdd(), null);\r |
539 | jContentPane.add(getJButtonRemove(), null);\r | |
97796eaa | 540 | jContentPane.add(getJButtonRemoveAll(), null);\r |
a13899c5 | 541 | \r |
97796eaa | 542 | jContentPane.add(getJTextFieldHdr(), null);\r |
a13899c5 | 543 | jContentPane.add(getJButtonBrowse(), null);\r |
2f8a7517 | 544 | jContentPane.add(jLabel1ClassName, null);\r |
0a35c6e2 | 545 | jContentPane.add(starLabel2, null);\r |
2f8a7517 | 546 | jContentPane.add(jLabel2HelpText, null);\r |
0a35c6e2 | 547 | jContentPane.add(getJHelpTextScrollPane(), null);\r |
d129bd96 | 548 | \r |
2f8a7517 | 549 | jContentPane.add(jLabel5SupArchList, null);\r |
550 | jContentPane.add(jLabel6SupModList, null);\r | |
a13899c5 | 551 | \r |
97796eaa | 552 | jContentPane.add(getJScrollPaneModules(), null);\r |
553 | jContentPane.add(getJScrollPane1Arch(), null);\r | |
af25df16 | 554 | \r |
a13899c5 | 555 | }\r |
556 | \r | |
557 | return jContentPane;\r | |
558 | }\r | |
559 | \r | |
a13899c5 | 560 | \r |
561 | /* (non-Javadoc)\r | |
562 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
563 | */\r | |
564 | public void actionPerformed(ActionEvent arg0) {\r | |
d6d24759 | 565 | \r |
a13899c5 | 566 | if (arg0.getSource() == jButtonAdd) {\r |
567 | \r | |
568 | //ToDo: check before add\r | |
2f8a7517 | 569 | // LAH WAS String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2RecInstVer.getText(), null, null};\r |
570 | String[] row = {null, null, null, null, null, null, null};\r | |
0a35c6e2 | 571 | row[cnClassName] = jTextFieldAddClass.getText();\r |
97796eaa | 572 | row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/');\r |
0a35c6e2 | 573 | row[cnHelpText] = jTextAreaHelp.getText();\r |
d129bd96 | 574 | row[cnRecInstName] = jComboBox.getSelectedItem()+"";\r |
575 | row[cnRecInstVer] = jTextField2RecInstVer.getText();\r | |
4da2e625 | 576 | row[cnSupArch] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());\r |
97796eaa | 577 | if (row[cnSupArch].length() == 0) {\r |
578 | row[cnSupArch] = null;\r | |
a13899c5 | 579 | }\r |
97796eaa | 580 | row[cnSupMod] = vectorToString(iCheckBoxListModules.getAllCheckedItemsString());\r |
581 | if (row[cnSupMod].length() == 0){\r | |
582 | row[cnSupMod] = null;\r | |
a13899c5 | 583 | }\r |
ce73a791 | 584 | if (!dataValidation(row)) {\r |
585 | return;\r | |
586 | }\r | |
12e17a0a | 587 | //\r |
588 | //convert to GUID before storing recommended lib instance.\r | |
589 | //\r | |
322b7723 | 590 | getLibInstances(row[cnClassName]);\r |
d129bd96 | 591 | String recommendGuid = nameToGuid(row[cnRecInstName]);\r |
b2d4baa6 | 592 | if (row[cnRecInstName].equals("null")) {\r |
593 | row[cnRecInstName] = null;\r | |
594 | }\r | |
595 | else{\r | |
596 | if (recommendGuid == null) {\r | |
816ea437 | 597 | JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");\r |
b2d4baa6 | 598 | return;\r |
599 | }\r | |
600 | }\r | |
2f8a7517 | 601 | \r |
d129bd96 | 602 | sfc.genSpdLibClassDeclarations(row[cnClassName], recommendGuid, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, row[cnRecInstVer], null, row[cnSupMod]);\r |
a490bca8 | 603 | model.addRow(row);\r |
604 | jTable.changeSelection(model.getRowCount()-1, 0, false, false);\r | |
605 | docConsole.setSaved(false);\r | |
a13899c5 | 606 | }\r |
607 | //\r | |
608 | // remove selected line\r | |
609 | //\r | |
610 | if (arg0.getSource() == jButtonRemove) {\r | |
611 | if (jTable.isEditing()){\r | |
612 | jTable.getCellEditor().stopCellEditing();\r | |
613 | }\r | |
614 | int rowSelected = selectedRow;\r | |
615 | if (rowSelected >= 0) {\r | |
616 | model.removeRow(rowSelected);\r | |
d129bd96 | 617 | docConsole.setSaved(false);\r |
a13899c5 | 618 | sfc.removeSpdLibClass(rowSelected);\r |
619 | }\r | |
620 | }\r | |
621 | \r | |
97796eaa | 622 | if (arg0.getSource() == jButtonRemoveAll) {\r |
a13899c5 | 623 | if (model.getRowCount() == 0) {\r |
624 | return;\r | |
625 | }\r | |
d129bd96 | 626 | docConsole.setSaved(false);\r |
a13899c5 | 627 | model.setRowCount(0);\r |
628 | sfc.removeSpdLibClass();\r | |
629 | }\r | |
a13899c5 | 630 | }\r |
631 | \r | |
ce73a791 | 632 | private boolean dataValidation(String[] row) {\r |
97796eaa | 633 | if (!DataValidation.isKeywordType(row[cnClassName])) {\r |
816ea437 | 634 | JOptionPane.showMessageDialog(frame, "Library Class name entered does not match KeyWord datatype.");\r |
ce73a791 | 635 | return false;\r |
636 | }\r | |
97796eaa | 637 | if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {\r |
816ea437 | 638 | JOptionPane.showMessageDialog(frame, "Include Header does not match the PathAndFilename datatype.");\r |
d129bd96 | 639 | return false;\r |
ce73a791 | 640 | }\r |
97796eaa | 641 | if (row[cnHelpText].length() == 0) {\r |
816ea437 | 642 | JOptionPane.showMessageDialog(frame, "Help Text must be entered!");\r |
d129bd96 | 643 | return false;\r |
644 | }\r | |
a490bca8 | 645 | if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) {\r |
646 | if (row[cnRecInstName] == null || row[cnRecInstName].length() == 0) {\r | |
816ea437 | 647 | JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with the Instance Name.");\r |
a490bca8 | 648 | return false;\r |
649 | }\r | |
650 | \r | |
d129bd96 | 651 | if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {\r |
816ea437 | 652 | JOptionPane.showMessageDialog(frame, "Recommended Instance Version does not match Version datatype.");\r |
d129bd96 | 653 | return false;\r |
654 | }\r | |
ce73a791 | 655 | }\r |
656 | return true;\r | |
657 | }\r | |
a13899c5 | 658 | /**\r |
659 | Add contents in list to sfc\r | |
660 | **/\r | |
661 | protected void save() {\r | |
662 | \r | |
663 | }\r | |
664 | \r | |
665 | /**\r | |
666 | This method initializes jTextField \r | |
667 | \r | |
668 | @return javax.swing.JTextField \r | |
669 | **/\r | |
97796eaa | 670 | private JTextField getJTextFieldHdr() {\r |
671 | if (jTextFieldHdr == null) {\r | |
672 | jTextFieldHdr = new JTextField();\r | |
0a35c6e2 | 673 | jTextFieldHdr.setPreferredSize(new java.awt.Dimension(shortWidth,20));\r |
674 | jTextFieldHdr.setLocation(new java.awt.Point(longValueCol,rowThree));\r | |
675 | jTextFieldHdr.setSize(new java.awt.Dimension(shortWidth,20));\r | |
a13899c5 | 676 | }\r |
97796eaa | 677 | return jTextFieldHdr;\r |
a13899c5 | 678 | }\r |
679 | \r | |
680 | /**\r | |
681 | This method initializes jButtonBrowse \r | |
682 | \r | |
683 | @return javax.swing.JButton \r | |
684 | **/\r | |
685 | private JButton getJButtonBrowse() {\r | |
686 | if (jButtonBrowse == null) {\r | |
687 | jButtonBrowse = new JButton();\r | |
0a35c6e2 | 688 | jButtonBrowse.setBounds(new java.awt.Rectangle(longValueCol + shortWidth + 7,rowThree,90,20));\r |
a13899c5 | 689 | jButtonBrowse.setText("Browse");\r |
97796eaa | 690 | jButtonBrowse.setPreferredSize(new java.awt.Dimension(99,20));\r |
a13899c5 | 691 | jButtonBrowse.addActionListener(new AbstractAction() {\r |
692 | \r | |
ce73a791 | 693 | /**\r |
694 | * \r | |
695 | */\r | |
696 | private static final long serialVersionUID = 1L;\r | |
697 | \r | |
a13899c5 | 698 | public void actionPerformed(ActionEvent arg0) {\r |
699 | //\r | |
700 | // Select files from current pkg\r | |
701 | //\r | |
702 | String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));\r | |
703 | JFileChooser chooser = new JFileChooser(dirPrefix);\r | |
704 | File theFile = null;\r | |
705 | String headerDest = null;\r | |
706 | \r | |
707 | chooser.setMultiSelectionEnabled(false);\r | |
708 | chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r | |
709 | int retval = chooser.showOpenDialog(frame);\r | |
710 | if (retval == JFileChooser.APPROVE_OPTION) {\r | |
711 | \r | |
712 | theFile = chooser.getSelectedFile();\r | |
713 | String file = theFile.getPath();\r | |
714 | if (!file.startsWith(dirPrefix)) {\r | |
816ea437 | 715 | JOptionPane.showMessageDialog(frame, "You can only select files in current package directory structure!");\r |
a13899c5 | 716 | return;\r |
717 | }\r | |
718 | \r | |
719 | \r | |
720 | }\r | |
721 | else {\r | |
722 | return;\r | |
723 | }\r | |
724 | \r | |
725 | headerDest = theFile.getPath();\r | |
726 | int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());\r | |
97796eaa | 727 | jTextFieldHdr.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));\r |
a13899c5 | 728 | \r |
729 | }\r | |
730 | \r | |
731 | });\r | |
732 | }\r | |
733 | return jButtonBrowse;\r | |
734 | }\r | |
735 | \r | |
736 | public void componentResized(ComponentEvent arg0) {\r | |
737 | int intPreferredWidth = 500;\r | |
738 | \r | |
0a35c6e2 | 739 | Tools.resizeComponentWidth(this.jTextFieldAddClass, this.getWidth(), intPreferredWidth-28);\r |
740 | Tools.resizeComponentWidth(this.jHelpTextScrollPane, this.getWidth(), intPreferredWidth-28);\r | |
741 | Tools.resizeComponentWidth(this.jScrollPaneTable, this.getWidth(), intPreferredWidth-10);\r | |
742 | Tools.resizeComponentWidth(this.jTextFieldHdr, this.getWidth(), intPreferredWidth - 7);\r | |
743 | Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), intPreferredWidth,\r | |
744 | DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON); \r | |
a13899c5 | 745 | }\r |
746 | \r | |
747 | /**\r | |
0a35c6e2 | 748 | * This method initializes jHelpTextScrollPane\r |
749 | *\r | |
750 | * @return javax.swing.JScrollPane jHelpTextScrollPane\r | |
a13899c5 | 751 | */\r |
0a35c6e2 | 752 | private JScrollPane getJHelpTextScrollPane() {\r |
753 | if (jHelpTextScrollPane == null) {\r | |
754 | jHelpTextScrollPane = new JScrollPane();\r | |
755 | jHelpTextScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
756 | jHelpTextScrollPane.setPreferredSize(new java.awt.Dimension(longValueWidth, 80));\r | |
757 | jHelpTextScrollPane.setSize(new java.awt.Dimension(longValueWidth, 80));\r | |
758 | jHelpTextScrollPane.setLocation(new java.awt.Point(shortValueCol,rowTwo));\r | |
759 | jHelpTextScrollPane.setViewportView(getJTextAreaHelp());\r | |
a13899c5 | 760 | }\r |
0a35c6e2 | 761 | return jHelpTextScrollPane;\r |
a13899c5 | 762 | }\r |
763 | \r | |
764 | /**\r | |
0a35c6e2 | 765 | * This method initializes jTextAreaHelp \r |
a13899c5 | 766 | * \r |
0a35c6e2 | 767 | * @return javax.swing.JTextArea \r |
a13899c5 | 768 | */\r |
0a35c6e2 | 769 | private JTextArea getJTextAreaHelp() {\r |
770 | if (jTextAreaHelp == null) {\r | |
771 | jTextAreaHelp = new JTextArea();\r | |
772 | jTextAreaHelp.setLineWrap(true);\r | |
773 | jTextAreaHelp.setWrapStyleWord(true);\r | |
a13899c5 | 774 | }\r |
0a35c6e2 | 775 | return jTextAreaHelp;\r |
a13899c5 | 776 | }\r |
777 | \r | |
97796eaa | 778 | private JScrollPane getJScrollPaneModules() {\r |
779 | if (jScrollPaneModules == null) {\r | |
780 | jScrollPaneModules = new JScrollPane();\r | |
0a35c6e2 | 781 | jScrollPaneModules.setBounds(new java.awt.Rectangle(longValueCol,rowFive,medWidth,60));\r |
782 | jScrollPaneModules.setPreferredSize(new java.awt.Dimension(medWidth, 60));\r | |
97796eaa | 783 | jScrollPaneModules.setViewportView(getICheckBoxListSupportedModules());\r |
a13899c5 | 784 | }\r |
97796eaa | 785 | return jScrollPaneModules;\r |
a13899c5 | 786 | }\r |
787 | \r | |
97796eaa | 788 | private ICheckBoxList getICheckBoxListSupportedModules() {\r |
789 | if (iCheckBoxListModules == null) {\r | |
790 | iCheckBoxListModules = new ICheckBoxList();\r | |
0a35c6e2 | 791 | iCheckBoxListModules.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));\r |
a13899c5 | 792 | Vector<String> v = new Vector<String>();\r |
793 | v.add("BASE");\r | |
794 | v.add("SEC");\r | |
795 | v.add("PEI_CORE");\r | |
796 | v.add("PEIM");\r | |
797 | v.add("DXE_CORE");\r | |
798 | v.add("DXE_DRIVER");\r | |
799 | v.add("DXE_RUNTIME_DRIVER");\r | |
800 | v.add("DXE_SAL_DRIVER");\r | |
801 | v.add("DXE_SMM_DRIVER");\r | |
802 | v.add("UEFI_DRIVER");\r | |
803 | v.add("UEFI_APPLICATION");\r | |
804 | v.add("USER_DEFINED");\r | |
97796eaa | 805 | iCheckBoxListModules.setAllItems(v);\r |
a13899c5 | 806 | }\r |
97796eaa | 807 | return iCheckBoxListModules;\r |
a13899c5 | 808 | }\r |
809 | \r | |
a13899c5 | 810 | private String vectorToString(Vector<String> v) {\r |
811 | String s = " ";\r | |
812 | for (int i = 0; i < v.size(); ++i) {\r | |
813 | s += v.get(i);\r | |
814 | s += " ";\r | |
815 | }\r | |
816 | return s.trim();\r | |
817 | }\r | |
af25df16 | 818 | \r |
97796eaa | 819 | private JScrollPane getJScrollPane1Arch() {\r |
820 | if (jScrollPane1Arch == null) {\r | |
821 | jScrollPane1Arch = new JScrollPane();\r | |
0a35c6e2 | 822 | jScrollPane1Arch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));\r |
823 | jScrollPane1Arch.setPreferredSize(new java.awt.Dimension(medWidth, 60));\r | |
4da2e625 | 824 | jScrollPane1Arch.setViewportView(getICheckBoxListArch());\r |
af25df16 | 825 | }\r |
97796eaa | 826 | return jScrollPane1Arch;\r |
af25df16 | 827 | }\r |
ce73a791 | 828 | /**\r |
af25df16 | 829 | * This method initializes iCheckBoxList \r |
ce73a791 | 830 | * \r |
af25df16 | 831 | * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList \r |
ce73a791 | 832 | */\r |
4da2e625 | 833 | private ICheckBoxList getICheckBoxListArch() {\r |
834 | if (iCheckBoxListArch == null) {\r | |
835 | iCheckBoxListArch = new ICheckBoxList();\r | |
0a35c6e2 | 836 | iCheckBoxListArch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));\r |
af25df16 | 837 | Vector<String> v = new Vector<String>();\r |
838 | v.add("IA32");\r | |
839 | v.add("X64");\r | |
840 | v.add("IPF");\r | |
841 | v.add("EBC");\r | |
842 | v.add("ARM");\r | |
843 | v.add("PPC");\r | |
4da2e625 | 844 | iCheckBoxListArch.setAllItems(v);\r |
ce73a791 | 845 | }\r |
4da2e625 | 846 | return iCheckBoxListArch;\r |
ce73a791 | 847 | }\r |
848 | \r | |
af25df16 | 849 | private void getLibInstances(String libClass){\r |
850 | libNameGuidMap.clear();\r | |
851 | try {\r | |
3658f95e | 852 | Iterator ismi = GlobalData.vModuleList.iterator();\r |
af25df16 | 853 | while (ismi.hasNext()) {\r |
854 | ModuleIdentification mi = (ModuleIdentification) ismi.next();\r | |
3658f95e | 855 | \r |
daa4663b | 856 | Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r |
857 | for (int i = 0; i < classProduced.size(); ++i) {\r | |
858 | if (classProduced.get(i).equals(libClass)) {\r | |
af25df16 | 859 | libNameGuidMap.put(mi.getName(), mi.getGuid());\r |
860 | }\r | |
861 | }\r | |
862 | }\r | |
3658f95e | 863 | \r |
af25df16 | 864 | }\r |
865 | catch(Exception e){\r | |
816ea437 | 866 | JOptionPane.showMessageDialog(frame, "Search Instances Failed.");\r |
af25df16 | 867 | }\r |
868 | \r | |
a13899c5 | 869 | }\r |
af25df16 | 870 | \r |
12e17a0a | 871 | private String nameToGuid(String name) {\r |
d129bd96 | 872 | String s = null;\r |
12e17a0a | 873 | if (!libNameGuidMap.containsKey(name)) {\r |
874 | return s;\r | |
875 | }\r | |
876 | \r | |
877 | s = libNameGuidMap.get(name);\r | |
878 | return s;\r | |
879 | }\r | |
880 | \r | |
881 | private String guidToName(String guid){\r | |
882 | String s = "";\r | |
883 | if (!libNameGuidMap.containsValue(guid)) {\r | |
884 | return s;\r | |
885 | }\r | |
886 | Set<String> key = libNameGuidMap.keySet();\r | |
887 | Iterator<String> is = key.iterator();\r | |
888 | while(is.hasNext()) {\r | |
889 | s = is.next();\r | |
890 | if (libNameGuidMap.get(s).equals(guid)) {\r | |
891 | break;\r | |
892 | }\r | |
893 | }\r | |
894 | return s;\r | |
895 | }\r | |
896 | \r | |
a13899c5 | 897 | }\r |
898 | \r | |
899 | \r |