Line | Hits | Source |
---|---|---|
1 | /******************************************************************************* | |
2 | * InternetCafe is a software solution that helps the management of Cybercafes | |
3 | * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005. | |
4 | * Copyright (C) 2006 Guido Angelo Ingenito | |
5 | ||
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version 2 | |
9 | * of the License, or (at your option) any later version. | |
10 | ||
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | *******************************************************************************/ | |
20 | package ui; | |
21 | ||
22 | import java.awt.event.ActionEvent; | |
23 | import java.awt.event.ActionListener; | |
24 | import java.awt.event.KeyEvent; | |
25 | ||
26 | import javax.swing.Box; | |
27 | import javax.swing.ImageIcon; | |
28 | import javax.swing.JMenu; | |
29 | import javax.swing.JMenuBar; | |
30 | import javax.swing.JMenuItem; | |
31 | import javax.swing.JSeparator; | |
32 | import javax.swing.KeyStroke; | |
33 | ||
34 | import org.apache.log4j.Logger; | |
35 | ||
36 | import ui.command.CommandExecutor; | |
37 | import ui.command.IO.ExitCommand; | |
38 | import ui.command.IO.ExportSessionListCommand; | |
39 | import ui.command.IO.ExportUserListCommand; | |
40 | import ui.command.IO.ImportUserFromVCardCommand; | |
41 | import ui.command.IO.LoadDBCommand; | |
42 | import ui.command.IO.LogOutAdministratorCommand; | |
43 | import ui.command.IO.SaveDBAsCommand; | |
44 | import ui.command.IO.SaveDBCommand; | |
45 | import ui.command.information.ShowAboutFrameCommand; | |
46 | import ui.command.information.ShowMessageFrameCommand; | |
47 | import ui.command.information.ShowTextFileDialogCommand; | |
48 | import ui.help.HelpMenuItem; | |
49 | import base.ConfigurationManager; | |
50 | ||
51 | @SuppressWarnings("serial") //$NON-NLS-1$ | |
52 | 0 | public class ICMenuBar extends JMenuBar { |
53 | 0 | |
54 | 0 | private static final transient Logger logger = Logger |
55 | 0 | .getLogger(ICMenuBar.class.getName()); |
56 | ||
57 | private JMenu menuFile; | |
58 | ||
59 | private JMenu subMenuFileNew; | |
60 | ||
61 | private JMenuItem subMenuFileNewUserFromVCard; | |
62 | ||
63 | private JMenu subMenuFileExport; | |
64 | ||
65 | private JMenuItem subMenuFileExportSessionList; | |
66 | ||
67 | private JMenuItem subMenuFileExportUserList; | |
68 | ||
69 | private JMenuItem menuFileLoadDB; | |
70 | ||
71 | private JMenuItem menuFileSaveDB; | |
72 | ||
73 | private JMenuItem menuFileSaveDBAs; | |
74 | ||
75 | private JMenuItem menuFilePrint; | |
76 | ||
77 | private JMenuItem menuFilePrintPreview; | |
78 | ||
79 | private JMenuItem menuFileExit; | |
80 | ||
81 | private JMenu menuEdit; | |
82 | ||
83 | private JMenuItem menuEditUndo; | |
84 | ||
85 | private JMenuItem menuEditRedo; | |
86 | ||
87 | private JMenuItem menuEditCut; | |
88 | ||
89 | private JMenuItem menuEditCopy; | |
90 | ||
91 | private JMenuItem menuEditPaste; | |
92 | ||
93 | private JMenuItem menuEditSelectAll; | |
94 | ||
95 | private JMenu menuSecurity; | |
96 | ||
97 | private JMenuItem menuSecurityLogOut; | |
98 | ||
99 | private JMenu menuHelp; | |
100 | ||
101 | private JMenuItem menuHelpContent; | |
102 | ||
103 | private JMenuItem menuHelpMessage; | |
104 | ||
105 | private JMenuItem menuHelpAbout; | |
106 | ||
107 | private JMenuItem menuHelpLicense; | |
108 | ||
109 | 0 | public ICMenuBar() { |
110 | 0 | initialize(); |
111 | 0 | } |
112 | 0 | |
113 | protected void initialize() { | |
114 | 0 | add(getMenuFile()); |
115 | 0 | add(getMenuEdit()); |
116 | 0 | add(getMenuSecurity()); |
117 | 0 | add(Box.createHorizontalGlue()); |
118 | 0 | add(getMenuHelp()); |
119 | 0 | } |
120 | ||
121 | /** | |
122 | * @return Returns the menuFile. | |
123 | */ | |
124 | protected JMenu getMenuFile() { | |
125 | 0 | if (menuFile == null) { |
126 | 0 | menuFile = new JMenu(Messages.getString("menubar.file")); //$NON-NLS-1$ |
127 | 0 | menuFile.setMnemonic(KeyEvent.VK_F); |
128 | 0 | |
129 | 0 | menuFile.add(getSubMenuFileNew()); |
130 | 0 | menuFile.add(new JSeparator()); |
131 | 0 | menuFile.add(getMenuFileLoadDB()); |
132 | 0 | menuFile.add(new JSeparator()); |
133 | 0 | menuFile.add(getMenuFileSaveDB()); |
134 | 0 | menuFile.add(getMenuFileSaveDBAs()); |
135 | 0 | menuFile.add(new JSeparator()); |
136 | 0 | menuFile.add(getSubMenuFileExport()); |
137 | 0 | menuFile.add(new JSeparator()); |
138 | 0 | menuFile.add(getMenuFilePrint()); |
139 | 0 | menuFile.add(getMenuFilePrintPreview()); |
140 | 0 | menuFile.add(new JSeparator()); |
141 | 0 | menuFile.add(getMenuFileExit()); |
142 | 0 | |
143 | } | |
144 | 0 | return menuFile; |
145 | } | |
146 | ||
147 | /** | |
148 | * @return Returns the subMenuFileNew. | |
149 | 0 | */ |
150 | 0 | protected JMenu getSubMenuFileNew() { |
151 | 0 | if (subMenuFileNew == null) { |
152 | 0 | subMenuFileNew = new JMenu(Messages.getString("menubar.file.new")); //$NON-NLS-1$ |
153 | 0 | subMenuFileNew.add(getSubMenuFileNewUserFromVCard()); |
154 | } | |
155 | 0 | return subMenuFileNew; |
156 | } | |
157 | ||
158 | /** | |
159 | * @return Returns the menuFilePrint. | |
160 | 0 | */ |
161 | 0 | protected JMenuItem getMenuFilePrint() { |
162 | 0 | if (menuFilePrint == null) { |
163 | 0 | menuFilePrint = new JMenuItem(Messages.getString("menubar.file.print")); //$NON-NLS-1$ |
164 | 0 | menuFilePrint.setIcon(new ImageIcon(this.getClass().getResource( |
165 | 0 | "/icon/16x16/actions/document-print.png"))); //$NON-NLS-1$ |
166 | ||
167 | 0 | menuFilePrint.addActionListener(new ActionListener() { |
168 | public void actionPerformed(ActionEvent arg0) { | |
169 | logger.debug("actionPerformed menuFilePrint"); //$NON-NLS-1$ | |
170 | } | |
171 | 0 | }); |
172 | } | |
173 | 0 | return menuFilePrint; |
174 | } | |
175 | ||
176 | /** | |
177 | * @return Returns the menuFilePrintPreview. | |
178 | 0 | */ |
179 | 0 | protected JMenuItem getMenuFilePrintPreview() { |
180 | 0 | if (menuFilePrintPreview == null) { |
181 | 0 | menuFilePrintPreview = new JMenuItem(Messages.getString("menubar.file.printpreview")); //$NON-NLS-1$ |
182 | 0 | menuFilePrintPreview.setIcon(new ImageIcon(this.getClass() |
183 | 0 | .getResource( |
184 | 0 | "/icon/16x16/actions/document-print-preview.png"))); //$NON-NLS-1$ |
185 | ||
186 | 0 | menuFilePrintPreview.addActionListener(new ActionListener() { |
187 | public void actionPerformed(ActionEvent arg0) { | |
188 | logger.debug("actionPerformed menuFilePrintPreview"); //$NON-NLS-1$ | |
189 | ||
190 | } | |
191 | 0 | }); |
192 | } | |
193 | 0 | return menuFilePrintPreview; |
194 | } | |
195 | ||
196 | /** | |
197 | * @return Returns the menuFileExit. | |
198 | 0 | */ |
199 | 0 | protected JMenuItem getMenuFileExit() { |
200 | 0 | if (menuFileExit == null) { |
201 | 0 | menuFileExit = new JMenuItem(Messages.getString("menubar.file.exit")); //$NON-NLS-1$ |
202 | /*menuFileExit.setIcon(new ImageIcon(this.getClass().getResource( | |
203 | 0 | "/icon/16x16/actions/application-exit.png"))); |
204 | */ | |
205 | 0 | menuFileExit.setAccelerator(KeyStroke.getKeyStroke( |
206 | 0 | KeyEvent.VK_Q, ActionEvent.ALT_MASK)); |
207 | ||
208 | 0 | menuFileExit.addActionListener(new ActionListener() { |
209 | public void actionPerformed(ActionEvent arg0) { | |
210 | logger.debug("actionPerformed menuFileExit"); //$NON-NLS-1$ | |
211 | 0 | CommandExecutor.getInstance().executeCommand( |
212 | new ExitCommand(), false); | |
213 | } | |
214 | }); | |
215 | } | |
216 | 0 | return menuFileExit; |
217 | } | |
218 | 0 | |
219 | 0 | /** |
220 | 0 | * @return Returns the menuFileLoadDB. |
221 | */ | |
222 | protected JMenuItem getMenuFileLoadDB() { | |
223 | 0 | if (menuFileLoadDB == null) { |
224 | 0 | menuFileLoadDB = new JMenuItem(Messages.getString("menubar.file.loaddatabase")); //$NON-NLS-1$ |
225 | 0 | menuFileLoadDB.setIcon(new ImageIcon(this.getClass().getResource( |
226 | 0 | "/icon/16x16/actions/document-open.png"))); //$NON-NLS-1$ |
227 | ||
228 | 0 | menuFileLoadDB.addActionListener(new ActionListener() { |
229 | public void actionPerformed(ActionEvent arg0) { | |
230 | logger.debug("actionPerformed menuFileLoadDB"); //$NON-NLS-1$ | |
231 | 0 | CommandExecutor.getInstance().executeCommand( |
232 | new LoadDBCommand(), false); | |
233 | } | |
234 | }); | |
235 | } | |
236 | 0 | return menuFileLoadDB; |
237 | } | |
238 | 0 | |
239 | 0 | /** |
240 | 0 | * @return Returns the menuFileSaveDB. |
241 | */ | |
242 | protected JMenuItem getMenuFileSaveDB() { | |
243 | 0 | if (menuFileSaveDB == null) { |
244 | 0 | menuFileSaveDB = new JMenuItem(Messages.getString("menubar.file.savedatabase")); //$NON-NLS-1$ |
245 | 0 | menuFileSaveDB.setIcon(new ImageIcon(this.getClass().getResource( |
246 | 0 | "/icon/16x16/actions/document-save.png"))); //$NON-NLS-1$ |
247 | ||
248 | 0 | menuFileSaveDB.setAccelerator(KeyStroke.getKeyStroke( |
249 | 0 | KeyEvent.VK_S, ActionEvent.CTRL_MASK)); |
250 | ||
251 | 0 | menuFileSaveDB.addActionListener(new ActionListener() { |
252 | public void actionPerformed(ActionEvent arg0) { | |
253 | logger.debug("actionPerformed menuFileSaveDB"); //$NON-NLS-1$ | |
254 | CommandExecutor.getInstance().executeCommand( | |
255 | new SaveDBCommand(), false); | |
256 | } | |
257 | }); | |
258 | 0 | } |
259 | 0 | return menuFileSaveDB; |
260 | 0 | } |
261 | ||
262 | /** | |
263 | 0 | * @return Returns the menuFileSaveDBAs. |
264 | */ | |
265 | protected JMenuItem getMenuFileSaveDBAs() { | |
266 | 0 | if (menuFileSaveDBAs == null) { |
267 | 0 | menuFileSaveDBAs = new JMenuItem(Messages.getString("menubar.file.savedatabaseas")); //$NON-NLS-1$ |
268 | 0 | menuFileSaveDBAs.setIcon(new ImageIcon(this.getClass().getResource( |
269 | 0 | "/icon/16x16/actions/document-save-as.png"))); //$NON-NLS-1$ |
270 | ||
271 | 0 | menuFileSaveDBAs.setAccelerator(KeyStroke.getKeyStroke( |
272 | 0 | KeyEvent.VK_S, ActionEvent.CTRL_MASK+ActionEvent.SHIFT_MASK)); |
273 | ||
274 | 0 | menuFileSaveDBAs.addActionListener(new ActionListener() { |
275 | public void actionPerformed(ActionEvent arg0) { | |
276 | logger.debug("actionPerformed menuFileSaveDBAs"); //$NON-NLS-1$ | |
277 | CommandExecutor.getInstance().executeCommand( | |
278 | 0 | new SaveDBAsCommand(), false); |
279 | 0 | } |
280 | 0 | }); |
281 | } | |
282 | 0 | return menuFileSaveDBAs; |
283 | } | |
284 | ||
285 | /** | |
286 | * @return Returns the menuSecurity. | |
287 | */ | |
288 | protected JMenu getMenuSecurity() { | |
289 | 0 | if (menuSecurity == null) { |
290 | 0 | menuSecurity = new JMenu(Messages.getString("menubar.security")); //$NON-NLS-1$ |
291 | 0 | menuSecurity.setMnemonic(KeyEvent.VK_S); |
292 | 0 | menuSecurity.add(getMenuSecurityLogOut()); |
293 | } | |
294 | 0 | return menuSecurity; |
295 | } | |
296 | ||
297 | /** | |
298 | * @return Returns the menuSecurityLogOut. | |
299 | */ | |
300 | protected JMenuItem getMenuSecurityLogOut() { | |
301 | 0 | if (menuSecurityLogOut == null) { |
302 | 0 | menuSecurityLogOut = new JMenuItem(Messages.getString("menubar.security.logout")); //$NON-NLS-1$ |
303 | 0 | menuSecurityLogOut.setIcon(new ImageIcon(this.getClass() |
304 | 0 | .getResource("/icon/16x16/actions/system-log-out.png"))); //$NON-NLS-1$ |
305 | ||
306 | 0 | menuSecurityLogOut.addActionListener(new ActionListener() { |
307 | public void actionPerformed(ActionEvent arg0) { | |
308 | logger.debug("actionPerformed menuSecurityLogOut"); //$NON-NLS-1$ | |
309 | 0 | CommandExecutor.getInstance().executeCommand( |
310 | 0 | new LogOutAdministratorCommand(), false); |
311 | 0 | } |
312 | 0 | }); |
313 | 0 | } |
314 | 0 | return menuSecurityLogOut; |
315 | 0 | } |
316 | ||
317 | /** | |
318 | 0 | * @return Returns the menuHelp. |
319 | */ | |
320 | protected JMenu getMenuHelp() { | |
321 | 0 | if (menuHelp == null) { |
322 | 0 | menuHelp = new JMenu(Messages.getString("menubar.help")); //$NON-NLS-1$ |
323 | 0 | menuHelp.setMnemonic(KeyEvent.VK_H); |
324 | ||
325 | 0 | menuHelp.add(getMenuHelpContent()); |
326 | 0 | menuHelp.add(getMenuHelpAbout()); |
327 | 0 | menuHelp.add(getMenuHelpLicense()); |
328 | 0 | menuHelp.add(new JSeparator()); |
329 | 0 | menuHelp.add(getMenuHelpMessage()); |
330 | ||
331 | 0 | } |
332 | 0 | return menuHelp; |
333 | } | |
334 | ||
335 | /** | |
336 | * @return Returns the menuHelpContent. | |
337 | */ | |
338 | 0 | protected JMenuItem getMenuHelpContent() { |
339 | 0 | if (menuHelpContent == null) { |
340 | 0 | menuHelpContent = new HelpMenuItem(Messages.getString("menubar.help.contents")); //$NON-NLS-1$ |
341 | ||
342 | // menuHelpContent.setIcon(new | |
343 | 0 | // ImageIcon(this.getClass().getResource("/icon/16x16/actions/help-contents.png"))); |
344 | } | |
345 | 0 | return menuHelpContent; |
346 | } | |
347 | ||
348 | /** | |
349 | * @return Returns the menuHelpAbout. | |
350 | */ | |
351 | protected JMenuItem getMenuHelpAbout() { | |
352 | 0 | if (menuHelpAbout == null) { |
353 | 0 | menuHelpAbout = new JMenuItem(Messages.getString("menubar.help.about")); //$NON-NLS-1$ |
354 | // menuHelpAbout.setIcon(new | |
355 | // ImageIcon(this.getClass().getResource("/icon/16x16/actions/help-about.png"))); | |
356 | ||
357 | 0 | menuHelpAbout.addActionListener(new ActionListener() { |
358 | public void actionPerformed(ActionEvent arg0) { | |
359 | 0 | logger.debug("actionPerformed menuHelpAbout"); //$NON-NLS-1$ |
360 | 0 | CommandExecutor.getInstance().executeCommand( |
361 | 0 | new ShowAboutFrameCommand(), false); |
362 | } | |
363 | }); | |
364 | ||
365 | } | |
366 | 0 | return menuHelpAbout; |
367 | } | |
368 | ||
369 | 0 | /** |
370 | * @return Returns the menuHelpMessage. | |
371 | */ | |
372 | protected JMenuItem getMenuHelpMessage() { | |
373 | 0 | if (menuHelpMessage == null) { |
374 | 0 | menuHelpMessage = new JMenuItem(Messages.getString("menubar.help.messages")); //$NON-NLS-1$ |
375 | 0 | menuHelpMessage.addActionListener(new ActionListener() { |
376 | 0 | public void actionPerformed(ActionEvent arg0) { |
377 | 0 | logger.debug("actionPerformed menuHelpMessage"); //$NON-NLS-1$ |
378 | 0 | CommandExecutor.getInstance().executeCommand( |
379 | new ShowMessageFrameCommand(), false); | |
380 | } | |
381 | 0 | }); |
382 | } | |
383 | 0 | return menuHelpMessage; |
384 | } | |
385 | ||
386 | /** | |
387 | * @return Returns the menuHelpLicense. | |
388 | */ | |
389 | protected JMenuItem getMenuHelpLicense() { | |
390 | 0 | if (menuHelpLicense == null) { |
391 | 0 | menuHelpLicense = new JMenuItem(Messages.getString("menubar.help.license")); //$NON-NLS-1$ |
392 | 0 | menuHelpLicense.setIcon(new ImageIcon(this.getClass().getResource( |
393 | 0 | "/icon/16x16/mimetypes/application-certificate.png"))); //$NON-NLS-1$ |
394 | ||
395 | 0 | menuHelpLicense.addActionListener(new ActionListener() { |
396 | public void actionPerformed(ActionEvent arg0) { | |
397 | 0 | logger.debug("actionPerformed menuHelpLicense"); //$NON-NLS-1$ |
398 | 0 | CommandExecutor.getInstance().executeCommand( |
399 | 0 | new ShowTextFileDialogCommand("License", //$NON-NLS-1$ |
400 | 0 | ConfigurationManager.LICENSE_FILE), false); |
401 | 0 | } |
402 | 0 | }); |
403 | 0 | } |
404 | 0 | return menuHelpLicense; |
405 | 0 | } |
406 | 0 | |
407 | /** | |
408 | 0 | * @return Returns the menuEdit. |
409 | */ | |
410 | protected JMenu getMenuEdit() { | |
411 | 0 | if (menuEdit == null) { |
412 | 0 | menuEdit = new JMenu(Messages.getString("menubar.edit")); //$NON-NLS-1$ |
413 | 0 | menuEdit.setMnemonic(KeyEvent.VK_E); |
414 | ||
415 | 0 | menuEdit.add(getMenuEditUndo()); |
416 | 0 | menuEdit.add(getMenuEditRedo()); |
417 | 0 | menuEdit.add(new JSeparator()); |
418 | 0 | menuEdit.add(getMenuEditCut()); |
419 | 0 | menuEdit.add(getMenuEditCopy()); |
420 | 0 | menuEdit.add(getMenuEditPaste()); |
421 | 0 | menuEdit.add(new JSeparator()); |
422 | 0 | menuEdit.add(getMenuEditSelectAll()); |
423 | } | |
424 | 0 | return menuEdit; |
425 | } | |
426 | ||
427 | 0 | /** |
428 | 0 | * @return Returns the menuEditCopy. |
429 | 0 | */ |
430 | protected JMenuItem getMenuEditCopy() { | |
431 | 0 | if (menuEditCopy == null) { |
432 | 0 | menuEditCopy = new JMenuItem(Messages.getString("menubar.edit.copy")); //$NON-NLS-1$ |
433 | 0 | menuEditCopy.setAccelerator(KeyStroke.getKeyStroke( |
434 | 0 | KeyEvent.VK_C, ActionEvent.CTRL_MASK)); |
435 | ||
436 | 0 | menuEditCopy.setIcon(new ImageIcon(this.getClass().getResource( |
437 | 0 | "/icon/16x16/actions/edit-copy.png"))); //$NON-NLS-1$ |
438 | } | |
439 | 0 | return menuEditCopy; |
440 | 0 | } |
441 | 0 | |
442 | /** | |
443 | * @return Returns the menuEditCut. | |
444 | 0 | */ |
445 | protected JMenuItem getMenuEditCut() { | |
446 | 0 | if (menuEditCut == null) { |
447 | 0 | menuEditCut = new JMenuItem(Messages.getString("menubar.edit.cut")); //$NON-NLS-1$ |
448 | 0 | menuEditCut.setAccelerator(KeyStroke.getKeyStroke( |
449 | 0 | KeyEvent.VK_X, ActionEvent.CTRL_MASK)); |
450 | ||
451 | 0 | menuEditCut.setIcon(new ImageIcon(this.getClass().getResource( |
452 | 0 | "/icon/16x16/actions/edit-cut.png"))); //$NON-NLS-1$ |
453 | 0 | } |
454 | 0 | return menuEditCut; |
455 | } | |
456 | 0 | |
457 | /** | |
458 | * @return Returns the menuEditPaste. | |
459 | */ | |
460 | protected JMenuItem getMenuEditPaste() { | |
461 | 0 | if (menuEditPaste == null) { |
462 | 0 | menuEditPaste = new JMenuItem(Messages.getString("menubar.edit.paste")); //$NON-NLS-1$ |
463 | 0 | menuEditPaste.setAccelerator(KeyStroke.getKeyStroke( |
464 | 0 | KeyEvent.VK_V, ActionEvent.CTRL_MASK)); |
465 | 0 | |
466 | 0 | menuEditPaste.setIcon(new ImageIcon(this.getClass().getResource( |
467 | 0 | "/icon/16x16/actions/edit-paste.png"))); //$NON-NLS-1$ |
468 | 0 | } |
469 | 0 | return menuEditPaste; |
470 | } | |
471 | ||
472 | /** | |
473 | * @return Returns the menuEditRedo. | |
474 | */ | |
475 | 0 | protected JMenuItem getMenuEditRedo() { |
476 | 0 | if (menuEditRedo == null) { |
477 | 0 | menuEditRedo = new JMenuItem(Messages.getString("menubar.edit.redo")); //$NON-NLS-1$ |
478 | 0 | menuEditRedo.setAccelerator(KeyStroke.getKeyStroke( |
479 | 0 | KeyEvent.VK_Y, ActionEvent.CTRL_MASK)); |
480 | 0 | |
481 | 0 | menuEditRedo.setIcon(new ImageIcon(this.getClass().getResource( |
482 | 0 | "/icon/16x16/actions/edit-redo.png"))); //$NON-NLS-1$ |
483 | } | |
484 | 0 | return menuEditRedo; |
485 | } | |
486 | ||
487 | 0 | /** |
488 | 0 | * @return Returns the menuEditUndo. |
489 | 0 | */ |
490 | protected JMenuItem getMenuEditUndo() { | |
491 | 0 | if (menuEditUndo == null) { |
492 | 0 | menuEditUndo = new JMenuItem(Messages.getString("menubar.edit.undo")); //$NON-NLS-1$ |
493 | 0 | menuEditUndo.setAccelerator(KeyStroke.getKeyStroke( |
494 | 0 | KeyEvent.VK_Z, ActionEvent.CTRL_MASK)); |
495 | 0 | menuEditUndo.setIcon(new ImageIcon(this.getClass().getResource( |
496 | 0 | "/icon/16x16/actions/edit-undo.png"))); //$NON-NLS-1$ |
497 | } | |
498 | 0 | return menuEditUndo; |
499 | } | |
500 | ||
501 | /** | |
502 | * @return Returns the menuEditSelectAll. | |
503 | */ | |
504 | 0 | protected JMenuItem getMenuEditSelectAll() { |
505 | 0 | if (menuEditSelectAll == null) { |
506 | 0 | menuEditSelectAll = new JMenuItem(Messages.getString("menubar.edit.selectall")); //$NON-NLS-1$ |
507 | 0 | menuEditSelectAll.setAccelerator(KeyStroke.getKeyStroke( |
508 | 0 | KeyEvent.VK_A, ActionEvent.CTRL_MASK)); |
509 | ||
510 | 0 | menuEditSelectAll.setIcon(new ImageIcon(this.getClass().getResource( |
511 | 0 | "/icon/16x16/actions/edit-select-all.png"))); //$NON-NLS-1$ |
512 | 0 | } |
513 | 0 | return menuEditSelectAll; |
514 | } | |
515 | 0 | |
516 | /** | |
517 | * @return Returns the subMenuFileNewUserFromVCard. | |
518 | 0 | */ |
519 | protected JMenuItem getSubMenuFileNewUserFromVCard() { | |
520 | 0 | if (subMenuFileNewUserFromVCard == null) { |
521 | 0 | subMenuFileNewUserFromVCard = new JMenuItem(Messages.getString("menubar.file.new.userfromvcard")); //$NON-NLS-1$ |
522 | 0 | subMenuFileNewUserFromVCard.setAccelerator(KeyStroke.getKeyStroke( |
523 | 0 | KeyEvent.VK_N, ActionEvent.CTRL_MASK)); |
524 | ||
525 | 0 | subMenuFileNewUserFromVCard.setIcon(new ImageIcon(this.getClass().getResource( |
526 | 0 | "/icon/16x16/actions/contact-new.png"))); //$NON-NLS-1$ |
527 | 0 | subMenuFileNewUserFromVCard.addActionListener(new ActionListener(){ |
528 | 0 | |
529 | public void actionPerformed(ActionEvent arg0) { | |
530 | 0 | logger |
531 | .debug("actionPerformed subMenuFileNewUserFromVCard"); //$NON-NLS-1$ | |
532 | ||
533 | CommandExecutor.getInstance().executeCommand( | |
534 | new ImportUserFromVCardCommand(), false); | |
535 | } | |
536 | ||
537 | }); | |
538 | ||
539 | } | |
540 | 0 | return subMenuFileNewUserFromVCard; |
541 | } | |
542 | 0 | |
543 | /** | |
544 | * @return Returns the subMenuFileExport. | |
545 | */ | |
546 | protected JMenu getSubMenuFileExport() { | |
547 | 0 | if (subMenuFileExport == null) { |
548 | 0 | subMenuFileExport = new JMenu(Messages.getString("menubar.file.export")); //$NON-NLS-1$ |
549 | 0 | subMenuFileExport |
550 | 0 | .add(getSubMenuFileExportUserList()); |
551 | 0 | subMenuFileExport |
552 | 0 | .add(getSubMenuFileExportSessionList()); |
553 | } | |
554 | 0 | return subMenuFileExport; |
555 | 0 | } |
556 | ||
557 | /** | |
558 | * @return Returns the subMenuFileExportSessionList. | |
559 | */ | |
560 | protected JMenuItem getSubMenuFileExportSessionList() { | |
561 | 0 | if (subMenuFileExportSessionList == null) { |
562 | 0 | subMenuFileExportSessionList = new JMenuItem( |
563 | 0 | Messages.getString("menubar.file.export.sessionlist")); //$NON-NLS-1$ |
564 | 0 | subMenuFileExportSessionList.setIcon(new ImageIcon(this.getClass().getResource( |
565 | 0 | "/icon/16x16/apps/preferences-system-windows.png"))); //$NON-NLS-1$ |
566 | 0 | subMenuFileExportSessionList |
567 | 0 | .addActionListener(new ActionListener() { |
568 | 0 | public void actionPerformed(ActionEvent arg0) { |
569 | logger | |
570 | .debug("actionPerformed subMenuFileExportUserList"); //$NON-NLS-1$ | |
571 | CommandExecutor | |
572 | .getInstance() | |
573 | .executeCommand( | |
574 | new ExportSessionListCommand(),false); | |
575 | } | |
576 | }); | |
577 | } | |
578 | 0 | return subMenuFileExportSessionList; |
579 | } | |
580 | ||
581 | /** | |
582 | * @return Returns the subMenuFileExportUserList. | |
583 | */ | |
584 | protected JMenuItem getSubMenuFileExportUserList() { | |
585 | 0 | if (subMenuFileExportUserList == null) { |
586 | 0 | subMenuFileExportUserList = new JMenuItem( |
587 | 0 | Messages.getString("menubar.file.export.userlist")); //$NON-NLS-1$ |
588 | 0 | subMenuFileExportUserList.setIcon(new ImageIcon(this.getClass().getResource( |
589 | 0 | "/icon/16x16/apps/system-users.png"))); //$NON-NLS-1$ |
590 | ||
591 | 0 | subMenuFileExportUserList |
592 | 0 | .addActionListener(new ActionListener() { |
593 | public void actionPerformed(ActionEvent arg0) { | |
594 | logger | |
595 | .debug("actionPerformed subMenuFileExportUserList"); //$NON-NLS-1$ | |
596 | CommandExecutor | |
597 | .getInstance() | |
598 | .executeCommand( | |
599 | new ExportUserListCommand(),false); | |
600 | } | |
601 | }); | |
602 | ||
603 | } | |
604 | 0 | return subMenuFileExportUserList; |
605 | } | |
606 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |