]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | The file is used to create, update FpdHeader of Fpd file\r | |
4 | \r | |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | package org.tianocore.frameworkwizard.platform.ui;\r | |
17 | \r | |
18 | import java.awt.Dimension;\r | |
19 | import java.awt.event.ActionEvent;\r | |
20 | import java.awt.event.ComponentEvent;\r | |
21 | import java.awt.event.FocusAdapter;\r | |
22 | import java.awt.event.FocusEvent;\r | |
23 | import java.util.Vector;\r | |
24 | \r | |
25 | import javax.swing.JButton;\r | |
26 | import javax.swing.JFrame;\r | |
27 | import javax.swing.JLabel;\r | |
28 | import javax.swing.JOptionPane;\r | |
29 | import javax.swing.JPanel;\r | |
30 | import javax.swing.JScrollPane;\r | |
31 | import javax.swing.JTextArea;\r | |
32 | import javax.swing.JTextField;\r | |
33 | \r | |
34 | \r | |
35 | \r | |
36 | import org.tianocore.PlatformSurfaceAreaDocument;\r | |
37 | \r | |
38 | import org.tianocore.frameworkwizard.common.DataValidation;\r | |
39 | import org.tianocore.frameworkwizard.common.Tools;\r | |
40 | import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r | |
41 | import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r | |
42 | import org.tianocore.frameworkwizard.common.ui.StarLabel;\r | |
43 | \r | |
44 | /**\r | |
45 | The class is used to create, update FpdHeader of Fpd file\r | |
46 | It extends IInternalFrame\r | |
47 | \r | |
48 | @since PackageEditor 1.0\r | |
49 | \r | |
50 | **/\r | |
51 | public class FpdHeader extends IInternalFrame {\r | |
52 | \r | |
53 | private int dialogWidth = 560;\r | |
54 | \r | |
55 | private int labelColumn = 12;\r | |
56 | \r | |
57 | private int labelWidth = 155;\r | |
58 | \r | |
59 | private int buttonWidth = 60;\r | |
60 | \r | |
61 | private final int valueColumn = 168;\r | |
62 | \r | |
63 | private final int valueWidth = 320;\r | |
64 | \r | |
65 | private final int specWidth = 420;\r | |
66 | \r | |
67 | private int shortValueWidth = valueWidth - (buttonWidth + 5);\r | |
68 | \r | |
69 | private final int oneRowHeight = 20;\r | |
70 | \r | |
71 | private final int threeRowHeight = 60;\r | |
72 | \r | |
73 | private final int fourRowHeight = 80;\r | |
74 | \r | |
75 | private final int rowSep = 5;\r | |
76 | \r | |
77 | private final int rowOne = 12;\r | |
78 | \r | |
79 | private final int rowTwo = rowOne + oneRowHeight + rowSep;\r | |
80 | \r | |
81 | private final int rowThree = rowTwo + oneRowHeight + rowSep;\r | |
82 | \r | |
83 | private final int rowFour = rowThree + oneRowHeight + rowSep;\r | |
84 | \r | |
85 | private final int rowFive = rowFour + threeRowHeight + rowSep;\r | |
86 | \r | |
87 | private final int rowSix = rowFive + fourRowHeight + rowSep;\r | |
88 | \r | |
89 | private final int rowSeven = rowSix + oneRowHeight + rowSep;\r | |
90 | \r | |
91 | private final int rowEight = rowSeven + oneRowHeight + rowSep;\r | |
92 | \r | |
93 | private final int rowNine = rowEight + fourRowHeight + threeRowHeight +rowSep;\r | |
94 | \r | |
95 | private int dialogHeight = rowNine + threeRowHeight;\r | |
96 | ///\r | |
97 | /// Define class Serial Version UID\r | |
98 | ///\r | |
99 | private static final long serialVersionUID = -8152099582923006900L;\r | |
100 | \r | |
101 | static JFrame frame;\r | |
102 | //\r | |
103 | //Define class members\r | |
104 | //\r | |
105 | private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,53"\r | |
106 | \r | |
107 | private JLabel jLabelBaseName = null;\r | |
108 | \r | |
109 | private JTextField jTextFieldBaseName = null;\r | |
110 | \r | |
111 | private JLabel jLabelGuid = null;\r | |
112 | \r | |
113 | private JTextField jTextFieldGuid = null;\r | |
114 | \r | |
115 | private JLabel jLabelVersion = null;\r | |
116 | \r | |
117 | private JTextField jTextFieldVersion = null;\r | |
118 | \r | |
119 | private JButton jButtonGenerateGuid = null;\r | |
120 | \r | |
121 | private JLabel jLabelLicense = null;\r | |
122 | \r | |
123 | private JTextArea jTextAreaLicense = null;\r | |
124 | \r | |
125 | private JLabel jLabelCopyright = null;\r | |
126 | \r | |
127 | private JLabel jLabelDescription = null;\r | |
128 | \r | |
129 | private JTextArea jTextAreaDescription = null;\r | |
130 | \r | |
131 | private JTextField jTextFieldSpecification = null;\r | |
132 | \r | |
133 | private JButton jButtonOk = null;\r | |
134 | \r | |
135 | private JButton jButtonCancel = null;\r | |
136 | \r | |
137 | private JScrollPane jScrollPaneLicense = null;\r | |
138 | \r | |
139 | private JScrollPane jScrollPaneDescription = null;\r | |
140 | \r | |
141 | private JScrollPane jCopyrightScrollPane = null;\r | |
142 | \r | |
143 | private JLabel jLabelAbstract = null;\r | |
144 | \r | |
145 | private JTextField jTextFieldAbstract = null;\r | |
146 | \r | |
147 | private StarLabel jStarLabel1 = null;\r | |
148 | \r | |
149 | private StarLabel jStarLabel2 = null;\r | |
150 | \r | |
151 | private StarLabel jStarLabel3 = null;\r | |
152 | \r | |
153 | private StarLabel jStarLabel4 = null;\r | |
154 | \r | |
155 | private StarLabel jStarLabel5 = null;\r | |
156 | \r | |
157 | private StarLabel jStarLabel7 = null;\r | |
158 | \r | |
159 | private StarLabel jStarLabel8 = null;\r | |
160 | \r | |
161 | private JTextArea jCopyrightTextArea = null;\r | |
162 | \r | |
163 | private JLabel jLabel = null;\r | |
164 | \r | |
165 | private JTextField jTextFieldUrl = null;\r | |
166 | \r | |
167 | private FpdFileContents ffc = null;\r | |
168 | \r | |
169 | private OpeningPlatformType docConsole = null;\r | |
170 | \r | |
171 | /**\r | |
172 | This method initializes jTextFieldBaseName \r | |
173 | \r | |
174 | @return javax.swing.JTextField jTextFieldBaseName\r | |
175 | \r | |
176 | **/\r | |
177 | private JTextField getJTextFieldBaseName() {\r | |
178 | if (jTextFieldBaseName == null) {\r | |
179 | jTextFieldBaseName = new JTextField();\r | |
180 | jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));\r | |
181 | jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));\r | |
182 | jTextFieldBaseName.addFocusListener(new FocusAdapter(){\r | |
183 | public void focusLost(FocusEvent e) {\r | |
184 | if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) {\r | |
185 | JOptionPane.showMessageDialog(frame, "Package Name does not match the UiNameType datatype.");\r | |
186 | return;\r | |
187 | }\r | |
188 | if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) {\r | |
189 | return;\r | |
190 | }\r | |
191 | docConsole.setSaved(false);\r | |
192 | ffc.setFpdHdrPlatformName(jTextFieldBaseName.getText());\r | |
193 | } \r | |
194 | });\r | |
195 | }\r | |
196 | return jTextFieldBaseName;\r | |
197 | }\r | |
198 | \r | |
199 | /**\r | |
200 | This method initializes jTextFieldGuid \r | |
201 | \r | |
202 | @return javax.swing.JTextField jTextFieldGuid\r | |
203 | \r | |
204 | **/\r | |
205 | private JTextField getJTextFieldGuid() {\r | |
206 | if (jTextFieldGuid == null) {\r | |
207 | jTextFieldGuid = new JTextField();\r | |
208 | jTextFieldGuid.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));\r | |
209 | jTextFieldGuid.setPreferredSize(new java.awt.Dimension(shortValueWidth,oneRowHeight));\r | |
210 | jTextFieldGuid.addFocusListener(new FocusAdapter(){\r | |
211 | public void focusLost(FocusEvent e) {\r | |
212 | if (!DataValidation.isGuid(jTextFieldGuid.getText())) {\r | |
213 | JOptionPane.showMessageDialog(frame, "Guid must be in registry (8-4-4-4-12) format.");\r | |
214 | return;\r | |
215 | }\r | |
216 | if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) {\r | |
217 | return;\r | |
218 | }\r | |
219 | docConsole.setSaved(false);\r | |
220 | ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());\r | |
221 | } \r | |
222 | });\r | |
223 | }\r | |
224 | return jTextFieldGuid;\r | |
225 | }\r | |
226 | \r | |
227 | /**\r | |
228 | This method initializes jTextFieldVersion \r | |
229 | \r | |
230 | @return javax.swing.JTextField jTextFieldVersion\r | |
231 | \r | |
232 | **/\r | |
233 | private JTextField getJTextFieldVersion() {\r | |
234 | if (jTextFieldVersion == null) {\r | |
235 | jTextFieldVersion = new JTextField();\r | |
236 | jTextFieldVersion.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));\r | |
237 | jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));\r | |
238 | jTextFieldVersion.addFocusListener(new FocusAdapter(){\r | |
239 | public void focusLost(FocusEvent e) {\r | |
240 | if (!DataValidation.isVersion(jTextFieldVersion.getText())) {\r | |
241 | JOptionPane.showMessageDialog(frame, "Version does not match the Version datatype.");\r | |
242 | return;\r | |
243 | }\r | |
244 | if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) {\r | |
245 | return;\r | |
246 | }\r | |
247 | docConsole.setSaved(false);\r | |
248 | ffc.setFpdHdrVer(jTextFieldVersion.getText());\r | |
249 | } \r | |
250 | });\r | |
251 | }\r | |
252 | return jTextFieldVersion;\r | |
253 | }\r | |
254 | \r | |
255 | /**\r | |
256 | This method initializes jButtonGenerateGuid \r | |
257 | \r | |
258 | @return javax.swing.JButton jButtonGenerateGuid\r | |
259 | \r | |
260 | **/\r | |
261 | private JButton getJButtonGenerateGuid() {\r | |
262 | if (jButtonGenerateGuid == null) {\r | |
263 | jButtonGenerateGuid = new JButton();\r | |
264 | jButtonGenerateGuid.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));\r | |
265 | jButtonGenerateGuid.setText("GEN");\r | |
266 | jButtonGenerateGuid.addActionListener(this);\r | |
267 | }\r | |
268 | return jButtonGenerateGuid;\r | |
269 | }\r | |
270 | \r | |
271 | /**\r | |
272 | This method initializes jTextAreaLicense \r | |
273 | \r | |
274 | @return javax.swing.JTextArea jTextAreaLicense\r | |
275 | \r | |
276 | **/\r | |
277 | private JTextArea getJTextAreaLicense() {\r | |
278 | if (jTextAreaLicense == null) {\r | |
279 | jTextAreaLicense = new JTextArea();\r | |
280 | jTextAreaLicense.setText("");\r | |
281 | jTextAreaLicense.setLineWrap(true);\r | |
282 | jTextAreaLicense.addFocusListener(new FocusAdapter(){\r | |
283 | public void focusLost(FocusEvent e) {\r | |
284 | if (jTextAreaLicense.getText().length() == 0) {\r | |
285 | JOptionPane.showMessageDialog(frame, "License must be entered!");\r | |
286 | return;\r | |
287 | }\r | |
288 | if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) {\r | |
289 | return;\r | |
290 | }\r | |
291 | docConsole.setSaved(false);\r | |
292 | ffc.setFpdHdrLicense(jTextAreaLicense.getText());\r | |
293 | } \r | |
294 | });\r | |
295 | }\r | |
296 | return jTextAreaLicense;\r | |
297 | }\r | |
298 | \r | |
299 | /**\r | |
300 | This method initializes jTextAreaDescription \r | |
301 | \r | |
302 | @return javax.swing.JTextArea jTextAreaDescription\r | |
303 | \r | |
304 | **/\r | |
305 | private JTextArea getJTextAreaDescription() {\r | |
306 | if (jTextAreaDescription == null) {\r | |
307 | jTextAreaDescription = new JTextArea();\r | |
308 | jTextAreaDescription.setLineWrap(true);\r | |
309 | jTextAreaDescription.addFocusListener(new FocusAdapter(){\r | |
310 | public void focusLost(FocusEvent e) {\r | |
311 | if (jTextAreaDescription.getText().length() == 0) {\r | |
312 | JOptionPane.showMessageDialog(frame, "Description must be entered.");\r | |
313 | return;\r | |
314 | }\r | |
315 | if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) {\r | |
316 | return;\r | |
317 | }\r | |
318 | docConsole.setSaved(false);\r | |
319 | ffc.setFpdHdrDescription(jTextAreaDescription.getText());\r | |
320 | } \r | |
321 | });\r | |
322 | }\r | |
323 | return jTextAreaDescription;\r | |
324 | }\r | |
325 | \r | |
326 | /**\r | |
327 | This method initializes jTextFieldSpecification \r | |
328 | \r | |
329 | @return javax.swing.JTextField jTextFieldSpecification\r | |
330 | \r | |
331 | **/\r | |
332 | private JTextField getJTextFieldSpecification() {\r | |
333 | if (jTextFieldSpecification == null) {\r | |
334 | jTextFieldSpecification = new JTextField();\r | |
335 | jTextFieldSpecification.setBounds(new java.awt.Rectangle(labelColumn,rowNine,specWidth,oneRowHeight));\r | |
336 | jTextFieldSpecification.setEditable(false);\r | |
337 | jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth,oneRowHeight));\r | |
338 | jTextFieldSpecification.setBorder(null);\r | |
339 | jTextFieldSpecification.addFocusListener(new FocusAdapter(){\r | |
340 | public void focusLost(FocusEvent e) {\r | |
341 | ffc.setFpdHdrSpec(jTextFieldSpecification.getText());\r | |
342 | } \r | |
343 | });\r | |
344 | }\r | |
345 | return jTextFieldSpecification;\r | |
346 | }\r | |
347 | \r | |
348 | /**\r | |
349 | This method initializes jButtonOk \r | |
350 | \r | |
351 | @return javax.swing.JButton jButtonOk\r | |
352 | \r | |
353 | **/\r | |
354 | private JButton getJButtonOk() {\r | |
355 | if (jButtonOk == null) {\r | |
356 | jButtonOk = new JButton();\r | |
357 | jButtonOk.setText("OK");\r | |
358 | jButtonOk.setBounds(new java.awt.Rectangle(290,351,90,20));\r | |
359 | jButtonOk.setVisible(false);\r | |
360 | jButtonOk.addActionListener(this);\r | |
361 | }\r | |
362 | return jButtonOk;\r | |
363 | }\r | |
364 | \r | |
365 | /**\r | |
366 | This method initializes jButtonCancel \r | |
367 | \r | |
368 | @return javax.swing.JButton jButtonCancel\r | |
369 | \r | |
370 | **/\r | |
371 | private JButton getJButtonCancel() {\r | |
372 | if (jButtonCancel == null) {\r | |
373 | jButtonCancel = new JButton();\r | |
374 | jButtonCancel.setText("Cancel");\r | |
375 | jButtonCancel.setBounds(new java.awt.Rectangle(390,351,90,20));\r | |
376 | jButtonCancel.setVisible(false);\r | |
377 | jButtonCancel.addActionListener(this);\r | |
378 | }\r | |
379 | return jButtonCancel;\r | |
380 | }\r | |
381 | \r | |
382 | /**\r | |
383 | This method initializes jScrollPaneLicense \r | |
384 | \r | |
385 | @return javax.swing.JScrollPane jScrollPaneLicense\r | |
386 | \r | |
387 | **/\r | |
388 | private JScrollPane getJScrollPaneLicense() {\r | |
389 | if (jScrollPaneLicense == null) {\r | |
390 | jScrollPaneLicense = new JScrollPane();\r | |
391 | jScrollPaneLicense.setBounds(new java.awt.Rectangle(valueColumn,rowFive,valueWidth,fourRowHeight));\r | |
392 | jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
393 | jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth,fourRowHeight));\r | |
394 | jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r | |
395 | }\r | |
396 | return jScrollPaneLicense;\r | |
397 | }\r | |
398 | \r | |
399 | /**\r | |
400 | This method initializes jScrollPaneDescription \r | |
401 | \r | |
402 | @return javax.swing.JScrollPane jScrollPaneDescription\r | |
403 | \r | |
404 | **/\r | |
405 | private JScrollPane getJScrollPaneDescription() {\r | |
406 | if (jScrollPaneDescription == null) {\r | |
407 | jScrollPaneDescription = new JScrollPane();\r | |
408 | jScrollPaneDescription.setBounds(new java.awt.Rectangle(valueColumn,rowEight,valueWidth,fourRowHeight));\r | |
409 | jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
410 | jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));\r | |
411 | jScrollPaneDescription.setViewportView(getJTextAreaDescription());\r | |
412 | }\r | |
413 | return jScrollPaneDescription;\r | |
414 | }\r | |
415 | \r | |
416 | /**\r | |
417 | This method initializes jTextFieldAbstract \r | |
418 | \r | |
419 | @return javax.swing.JTextField jTextFieldAbstract\r | |
420 | \r | |
421 | **/\r | |
422 | private JTextField getJTextFieldAbstract() {\r | |
423 | if (jTextFieldAbstract == null) {\r | |
424 | jTextFieldAbstract = new JTextField();\r | |
425 | jTextFieldAbstract.setBounds(new java.awt.Rectangle(valueColumn,rowSeven,valueWidth,oneRowHeight));\r | |
426 | jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));\r | |
427 | jTextFieldAbstract.addFocusListener(new FocusAdapter(){\r | |
428 | public void focusLost(FocusEvent e) {\r | |
429 | if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) {\r | |
430 | JOptionPane.showMessageDialog(frame, "Abstract must be entered.");\r | |
431 | return;\r | |
432 | }\r | |
433 | if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) {\r | |
434 | return;\r | |
435 | }\r | |
436 | docConsole.setSaved(false);\r | |
437 | ffc.setFpdHdrAbs(jTextFieldAbstract.getText());\r | |
438 | } \r | |
439 | });\r | |
440 | }\r | |
441 | return jTextFieldAbstract;\r | |
442 | }\r | |
443 | \r | |
444 | private JScrollPane getCopyrightScrollPane() {\r | |
445 | if (jCopyrightScrollPane == null) {\r | |
446 | jCopyrightScrollPane = new JScrollPane();\r | |
447 | jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));\r | |
448 | jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r | |
449 | jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));\r | |
450 | jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());\r | |
451 | }\r | |
452 | return jCopyrightScrollPane;\r | |
453 | }\r | |
454 | /**\r | |
455 | This method initializes jTextFieldCopyright \r | |
456 | \r | |
457 | @return javax.swing.JTextField jTextFieldCopyright\r | |
458 | \r | |
459 | **/\r | |
460 | private JTextArea getJCopyrightTextArea() {\r | |
461 | if (jCopyrightTextArea == null) {\r | |
462 | jCopyrightTextArea = new JTextArea();\r | |
463 | jCopyrightTextArea.setWrapStyleWord(true);\r | |
464 | jCopyrightTextArea.addFocusListener(new FocusAdapter(){\r | |
465 | public void focusLost(FocusEvent e) {\r | |
466 | if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {\r | |
467 | JOptionPane.showMessageDialog(frame, "Copyright must be entered.");\r | |
468 | return;\r | |
469 | }\r | |
470 | if (jCopyrightTextArea.getText().equals(ffc.getFpdHdrCopyright())) {\r | |
471 | return;\r | |
472 | }\r | |
473 | docConsole.setSaved(false);\r | |
474 | ffc.setFpdHdrCopyright(jCopyrightTextArea.getText());\r | |
475 | } \r | |
476 | });\r | |
477 | }\r | |
478 | return jCopyrightTextArea;\r | |
479 | }\r | |
480 | \r | |
481 | /**\r | |
482 | * This method initializes jTextField \r | |
483 | * \r | |
484 | * @return javax.swing.JTextField \r | |
485 | */\r | |
486 | private JTextField getJTextFieldUrl() {\r | |
487 | if (jTextFieldUrl == null) {\r | |
488 | jTextFieldUrl = new JTextField();\r | |
489 | jTextFieldUrl.setBounds(new java.awt.Rectangle(valueColumn,rowSix,valueWidth,oneRowHeight));\r | |
490 | jTextFieldUrl.setPreferredSize(new Dimension(valueWidth, oneRowHeight));\r | |
491 | jTextFieldUrl.addFocusListener(new FocusAdapter(){\r | |
492 | public void focusLost(FocusEvent e){\r | |
493 | if (jTextFieldUrl.getText().length() == 0 && ffc.getFpdHdrUrl() == null) {\r | |
494 | return;\r | |
495 | }\r | |
496 | if (jTextFieldUrl.getText().equals(ffc.getFpdHdrUrl())) {\r | |
497 | return;\r | |
498 | }\r | |
499 | ffc.setFpdHdrLicense(jTextAreaLicense.getText());\r | |
500 | ffc.setFpdHdrUrl(jTextFieldUrl.getText());\r | |
501 | docConsole.setSaved(false);\r | |
502 | } \r | |
503 | });\r | |
504 | }\r | |
505 | return jTextFieldUrl;\r | |
506 | }\r | |
507 | \r | |
508 | public static void main(String[] args) {\r | |
509 | new FpdHeader().setVisible(true);\r | |
510 | }\r | |
511 | \r | |
512 | /**\r | |
513 | This is the default constructor\r | |
514 | \r | |
515 | **/\r | |
516 | public FpdHeader() {\r | |
517 | super();\r | |
518 | init();\r | |
519 | this.setVisible(true);\r | |
520 | }\r | |
521 | \r | |
522 | /**\r | |
523 | This is the override edit constructor\r | |
524 | \r | |
525 | @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader\r | |
526 | \r | |
527 | **/\r | |
528 | public FpdHeader(PlatformSurfaceAreaDocument.PlatformSurfaceArea inFpd) {\r | |
529 | this();\r | |
530 | ffc = new FpdFileContents(inFpd);\r | |
531 | init(ffc);\r | |
532 | \r | |
533 | }\r | |
534 | \r | |
535 | public FpdHeader(OpeningPlatformType opt) {\r | |
536 | this(opt.getXmlFpd());\r | |
537 | docConsole = opt;\r | |
538 | }\r | |
539 | \r | |
540 | /**\r | |
541 | This method initializes this\r | |
542 | \r | |
543 | **/\r | |
544 | private void init() {\r | |
545 | //this.setSize(500, 515);\r | |
546 | this.setContentPane(getJContentPane());\r | |
547 | this.setTitle("Platform Surface Area Header");\r | |
548 | initFrame();\r | |
549 | \r | |
550 | }\r | |
551 | \r | |
552 | /**\r | |
553 | This method initializes this\r | |
554 | Fill values to all fields if these values are not empty\r | |
555 | \r | |
556 | @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader\r | |
557 | \r | |
558 | **/\r | |
559 | private void init(FpdFileContents ffc) {\r | |
560 | \r | |
561 | if (ffc.getFpdHdrPlatformName() != null) {\r | |
562 | jTextFieldBaseName.setText(ffc.getFpdHdrPlatformName());\r | |
563 | }\r | |
564 | if (ffc.getFpdHdrGuidValue() != null) {\r | |
565 | jTextFieldGuid.setText(ffc.getFpdHdrGuidValue());\r | |
566 | }\r | |
567 | if (ffc.getFpdHdrVer() != null) {\r | |
568 | jTextFieldVersion.setText(ffc.getFpdHdrVer());\r | |
569 | }\r | |
570 | if (ffc.getFpdHdrLicense() != null) {\r | |
571 | jTextAreaLicense.setText(ffc.getFpdHdrLicense());\r | |
572 | }\r | |
573 | if (ffc.getFpdHdrAbs() != null) {\r | |
574 | jTextFieldAbstract.setText(ffc.getFpdHdrAbs());\r | |
575 | }\r | |
576 | if (ffc.getFpdHdrUrl() != null) {\r | |
577 | jTextFieldUrl.setText(ffc.getFpdHdrUrl());\r | |
578 | }\r | |
579 | if (ffc.getFpdHdrCopyright() != null) {\r | |
580 | jCopyrightTextArea.setText(ffc.getFpdHdrCopyright());\r | |
581 | }\r | |
582 | if (ffc.getFpdHdrDescription() != null) {\r | |
583 | jTextAreaDescription.setText(ffc.getFpdHdrDescription());\r | |
584 | }\r | |
585 | if (ffc.getFpdHdrSpec() != null) {\r | |
586 | jTextFieldSpecification.setText(ffc.getFpdHdrSpec());\r | |
587 | }\r | |
588 | ffc.setFpdHdrSpec(jTextFieldSpecification.getText());\r | |
589 | \r | |
590 | ffc.genPlatformDefsSkuInfo("0", "DEFAULT");\r | |
591 | Vector<Object> v = new Vector<Object>();\r | |
592 | ffc.getPlatformDefsSupportedArchs(v);\r | |
593 | if (v.size() == 0) {\r | |
594 | v.add("IA32");\r | |
595 | ffc.setPlatformDefsSupportedArchs(v);\r | |
596 | }\r | |
597 | v.removeAllElements();\r | |
598 | ffc.getPlatformDefsBuildTargets(v);\r | |
599 | if (v.size() == 0) {\r | |
600 | v.add("DEBUG");\r | |
601 | ffc.setPlatformDefsBuildTargets(v);\r | |
602 | }\r | |
603 | if (ffc.getPlatformDefsInterDir() == null) {\r | |
604 | ffc.setPlatformDefsInterDir("UNIFIED");\r | |
605 | }\r | |
606 | }\r | |
607 | \r | |
608 | /**\r | |
609 | This method initializes jContentPane\r | |
610 | \r | |
611 | @return javax.swing.JPanel jContentPane\r | |
612 | \r | |
613 | **/\r | |
614 | private JPanel getJContentPane() {\r | |
615 | if (jContentPane == null) {\r | |
616 | jContentPane = new JPanel();\r | |
617 | jContentPane.setLayout(null);\r | |
618 | jContentPane.setLocation(new java.awt.Point(0, 0));\r | |
619 | jContentPane.setSize(new java.awt.Dimension(dialogWidth - 20 ,dialogHeight - 20));\r | |
620 | \r | |
621 | jLabel = new JLabel();\r | |
622 | jLabel.setBounds(new java.awt.Rectangle(labelColumn,rowSix,labelWidth,oneRowHeight));\r | |
623 | jLabel.setText("URL");\r | |
624 | jLabelAbstract = new JLabel();\r | |
625 | jLabelAbstract.setBounds(new java.awt.Rectangle(labelColumn,rowSeven,labelWidth,oneRowHeight));\r | |
626 | jLabelAbstract.setText("Abstract");\r | |
627 | jLabelDescription = new JLabel();\r | |
628 | jLabelDescription.setText("Description");\r | |
629 | jLabelDescription.setBounds(new java.awt.Rectangle(labelColumn,rowEight,labelWidth,oneRowHeight));\r | |
630 | jLabelCopyright = new JLabel();\r | |
631 | jLabelCopyright.setText("Copyright");\r | |
632 | jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn,rowFour,labelWidth,oneRowHeight));\r | |
633 | jLabelLicense = new JLabel();\r | |
634 | jLabelLicense.setText("License");\r | |
635 | jLabelLicense.setBounds(new java.awt.Rectangle(labelColumn,rowFive,labelWidth,oneRowHeight));\r | |
636 | jLabelVersion = new JLabel();\r | |
637 | jLabelVersion.setText("Version");\r | |
638 | jLabelVersion.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));\r | |
639 | jLabelGuid = new JLabel();\r | |
640 | jLabelGuid.setPreferredSize(new java.awt.Dimension(labelWidth, oneRowHeight));\r | |
641 | jLabelGuid.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));\r | |
642 | jLabelGuid.setText("Guid");\r | |
643 | jLabelBaseName = new JLabel();\r | |
644 | jLabelBaseName.setText("Platform Name");\r | |
645 | jLabelBaseName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));\r | |
646 | jStarLabel1 = new StarLabel();\r | |
647 | jStarLabel1.setLocation(new java.awt.Point(0, rowOne));\r | |
648 | jStarLabel2 = new StarLabel();\r | |
649 | jStarLabel2.setLocation(new java.awt.Point(0, rowTwo));\r | |
650 | jStarLabel3 = new StarLabel();\r | |
651 | jStarLabel3.setLocation(new java.awt.Point(0, rowThree));\r | |
652 | jStarLabel4 = new StarLabel();\r | |
653 | jStarLabel4.setLocation(new java.awt.Point(0,rowFour));\r | |
654 | jStarLabel5 = new StarLabel();\r | |
655 | jStarLabel5.setLocation(new java.awt.Point(0,rowFive));\r | |
656 | jStarLabel7 = new StarLabel();\r | |
657 | jStarLabel7.setLocation(new java.awt.Point(0,rowSeven));\r | |
658 | jStarLabel8 = new StarLabel();\r | |
659 | jStarLabel8.setLocation(new java.awt.Point(0,rowEight));\r | |
660 | \r | |
661 | jContentPane.add(jLabelBaseName, null);\r | |
662 | jContentPane.add(getJTextFieldBaseName(), null);\r | |
663 | jContentPane.add(jLabelGuid, null);\r | |
664 | jContentPane.add(getJTextFieldGuid(), null);\r | |
665 | jContentPane.add(jLabelVersion, null);\r | |
666 | jContentPane.add(getJTextFieldVersion(), null);\r | |
667 | jContentPane.add(getJButtonGenerateGuid(), null);\r | |
668 | jContentPane.add(jLabelLicense, null);\r | |
669 | jContentPane.add(jLabelCopyright, null);\r | |
670 | jContentPane.add(jLabelDescription, null);\r | |
671 | jContentPane.add(getJTextFieldSpecification(), null);\r | |
672 | jContentPane.add(getJButtonOk(), null);\r | |
673 | jContentPane.add(getJButtonCancel(), null);\r | |
674 | jContentPane.add(getJScrollPaneLicense(), null);\r | |
675 | jContentPane.add(getJScrollPaneDescription(), null);\r | |
676 | jContentPane.add(jLabelAbstract, null);\r | |
677 | jContentPane.add(getJTextFieldAbstract(), null);\r | |
678 | \r | |
679 | jContentPane.add(jStarLabel1, null);\r | |
680 | jContentPane.add(jStarLabel2, null);\r | |
681 | jContentPane.add(jStarLabel3, null);\r | |
682 | jContentPane.add(jStarLabel4, null);\r | |
683 | jContentPane.add(jStarLabel5, null);\r | |
684 | jContentPane.add(jStarLabel7, null);\r | |
685 | jContentPane.add(jStarLabel8, null);\r | |
686 | jContentPane.add(getCopyrightScrollPane(), null);\r | |
687 | \r | |
688 | jContentPane.add(jLabel, null);\r | |
689 | jContentPane.add(getJTextFieldUrl(), null);\r | |
690 | }\r | |
691 | return jContentPane;\r | |
692 | }\r | |
693 | \r | |
694 | /* (non-Javadoc)\r | |
695 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
696 | *\r | |
697 | * Override actionPerformed to listen all actions\r | |
698 | *\r | |
699 | */\r | |
700 | public void actionPerformed(ActionEvent arg0) {\r | |
701 | \r | |
702 | if (arg0.getSource() == jButtonGenerateGuid) {\r | |
703 | docConsole.setSaved(false);\r | |
704 | jTextFieldGuid.setText(Tools.generateUuidString());\r | |
705 | ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());\r | |
706 | }\r | |
707 | }\r | |
708 | \r | |
709 | \r | |
710 | /**\r | |
711 | This method initializes Package type and Compontent type\r | |
712 | \r | |
713 | **/\r | |
714 | private void initFrame() {\r | |
715 | \r | |
716 | \r | |
717 | }\r | |
718 | \r | |
719 | /* (non-Javadoc)\r | |
720 | * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r | |
721 | * \r | |
722 | * Override componentResized to resize all components when frame's size is changed\r | |
723 | */\r | |
724 | public void componentResized(ComponentEvent arg0) {\r | |
725 | int intPreferredWidth = dialogWidth;\r | |
726 | int intCurrentWidth = this.getJContentPane().getWidth();\r | |
727 | \r | |
728 | // Tools.resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth);\r | |
729 | // Tools.resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth);\r | |
730 | // Tools.relocateComponentX(this.jButtonGenerateGuid, this.getWidth(), jButtonGenerateGuid.getWidth(), 25);\r | |
731 | // Tools.resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth);\r | |
732 | // Tools.resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth);\r | |
733 | Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);\r | |
734 | Tools.resizeComponentWidth(this.jTextFieldUrl, intCurrentWidth, intPreferredWidth);\r | |
735 | Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth); \r | |
736 | Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);\r | |
737 | // Tools.resizeComponentWidth(this.jTextFieldSpecification, this.getWidth(), intPreferredWidth);\r | |
738 | \r | |
739 | \r | |
740 | \r | |
741 | }\r | |
742 | }\r |