View Javadoc

1   package com.melloware.jukes.gui.tool;
2   
3   import java.awt.event.ActionEvent;
4   import java.beans.PropertyChangeEvent;
5   import java.beans.PropertyChangeListener;
6   import java.util.Locale;
7   import java.util.ResourceBundle;
8   
9   import javax.swing.AbstractAction;
10  
11  import org.apache.commons.logging.Log;
12  import org.apache.commons.logging.LogFactory;
13  
14  import com.jgoodies.uif.action.ActionManager;
15  import com.jgoodies.uifextras.help.HelpBroker;
16  import com.melloware.jukes.db.orm.Catalog;
17  import com.melloware.jukes.gui.Jukes;
18  
19  /**
20   * Provides all UI <code>Actions</code> and their IDs. Therefore it declares
21   * static fields for action ids and implementations of the <code>Action</code>
22   * interface. These actions are registered to the <code>ActionManager</code>.
23   * <p>
24   * This class demos three different styles to implement <code>Action</code>;
25   * they differ in readability, number of classes loaded, and the ability to
26   * write more or less large action bodies, while preserving good code
27   * formatting:
28   * <ol>
29   * <li>anonymous classes: This approach provides a literally compact way to
30   * write down a bunch of action implementations, which will work better, if you
31   * have tiny method bodys. In our demo, all method bodies just delegate to the
32   * application controller. Does not provide human readable name in case of an
33   * error and so, may be more difficult to debug. Requires a class for every
34   * action.
35   * <li>nested top-level classes: This approach requires a little bit more
36   * writing than the first approach. Writing larger method bodies does not affect
37   * the registering method. The extra class names help you find bugs. Requires a
38   * class for every action.
39   * <li>instances of a single dispatching class: This approach leads to good
40   * readability in the registering method and requires only one class to load for
41   * all actions. Works better with small action bodies. May lead to runtime
42   * errors, if you haven't defined a dispatch for an action ID.
43   * </ol>
44   * <p>
45   * Copyright (c) 1999-2007 Melloware, Inc. <http://www.melloware.com>
46   * AZ Development 2010
47   * @author Emil A. Lefkof III <info@melloware.com>
48   * @version 4.0
49   * @see ActionManager
50   * @see Action
51   * @see AbstractAction
52   * @see MainController
53   */
54  public final class Actions {
55  
56     private static final Log LOG = LogFactory.getLog(Actions.class);
57  
58     public static final String LANG_ENGLISH_ID = "language.english";
59     public static final String LANG_FRENCH_ID = "language.french";
60     public static final String LANG_GERMAN_ID = "language.german";
61     public static final String LANG_SPANISH_ID = "language.spanish";
62     public static final String LANG_PORTUGEUSE_ID = "language.portuguese";
63     public static final String LANG_NORWEGIAN_ID = "language.norwegian";
64     public static final String LANG_DUTCH_ID = "language.dutch";
65     public static final String LANG_ITALIAN_ID = "language.italian";
66     public static final String LANG_SWEDISH_ID = "language.swedish";
67     public static final String LANG_FINNISH_ID = "language.finnish";
68     public static final String LANG_RUSSIAN_ID = "language.russian";
69     public static final String LANG_UKRAINIAN_ID = "language.ukrainian";
70     public static final String LANG_CHINESE_ID = "language.chinese";
71     public static final String LANG_KOREAN_ID = "language.korean";
72     public static final String LANG_TAMIL_ID = "language.tamil";
73     public static final String LANG_TELEGU_ID = "language.telegu";
74     public static final String LANG_HINDHI_ID = "language.hindhi";
75     public static final String LANG_INDONESIAN_ID = "language.indonesian";
76     public static final String HELP_CONTENTS_ID = "openHelpContents";
77     public static final String HELP_TIP_OF_THE_DAY_ID = "openTipOfTheDay";
78     public static final String HELP_ABOUT_DIALOG_ID = "openAboutDialog";
79     public static final String HELP_FORUMS_ID = "help.forums";
80     public static final String HELP_DONATE_ID = "help.donate";
81     public static final String HELP_CONTACT_ID = "help.contact";
82     public static final String TITLECASE_ID = "titlecase";
83     public static final String FILE_RENAME_ID = "file.rename";
84     public static final String CATALOG_EXPORT_ID = "export.list";
85     public static final String DIRECTORY_ID = "directorychooser";
86     public static final String FILE_CHOOSER_ID = "filechooser";
87     public static final String COMMIT_ID = "commit";
88     public static final String ROLLBACK_ID = "rollback";
89     public static final String UNLOCK_ID = "unlock";
90     public static final String REFRESH_ID = "refresh";
91     public static final String PREFERENCES_ID = "preferences";
92     public static final String PREFERENCES_IMPORT_ID = "preferences.import";
93     public static final String PREFERENCES_EXPORT_ID = "preferences.export";
94     public static final String CONNECT_ID = "connect";
95     public static final String DELETE_ID = "delete";
96     public static final String DISC_WEB_ID = "disc.web";
97     public static final String DISC_COVER_ID = "disc.cover";
98     public static final String DISC_ADD_ID = "disc.add";
99     public static final String DISC_ADD_TITLECASE_ID = "disc.add.titlecase";
100    public static final String DISC_ADD_COMMENTS_ID = "disc.add.comments";
101    public static final String DISC_ADD_RESET_NUMBERS_ID = "disc.add.resettracks";
102    public static final String DISC_ADD_RESET_FROM_FILENAME_ID = "disc.add.resetfromfilename";
103    public static final String DISC_FINDER_ID = "disc.finder";
104    public static final String DISC_REMOVER_ID = "disc.remover";
105    public static final String APP_HIDE_ID = "application.hide";
106    public static final String APP_SHOW_ID = "application.show";
107    public static final String TOOL_STATISTICS_ID = "statistics";
108    public static final String TOOL_MEMORY_ID = "memory";
109    public static final String TOOL_DIFFERENCE_ID = "difference.tool";
110    public static final String TOOL_LOCATION_ID = "location.tool";
111    public static final String TOOL_BACKUP_ID = "backup.tool";
112    public static final String TOOL_CHECK_GENRES_ID = "genres.tool"; //AZ
113    public static final String TRACK_PLAY_IMMEDIATE_ID = "play.immediate";
114    public static final String PLAYER_QUEUE_ID = "player.queue";
115    public static final String PLAYER_QUEUE_NEXT_ID = "player.queuenext";
116    public static final String PLAYER_PLAY_ID = "player.play";
117    public static final String PLAYER_PAUSE_ID = "player.pause";
118    public static final String PLAYER_STOP_ID = "player.stop";
119    public static final String PLAYER_PREVIOUS_ID = "player.previous";
120    public static final String PLAYER_NEXT_ID = "player.next";
121    public static final String FILTER_SHOW_ID = "filter.show";
122    public static final String FILTER_APPLY_ID = "filter.apply";
123    public static final String FILTER_CLEAR_ID = "filter.clear";
124    public static final String FILTER_CLOSE_ID = "filter.close";
125    public static final String PLAYLIST_CLOSE_ID = "playlist.close";
126    public static final String PLAYLIST_SHOW_ID = "playlist.show";
127    public static final String PLAYLIST_TOGGLE_ID = "playlist.toggle";
128    public static final String PLAYLIST_SHUFFLE_LIST_ID = "playlist.shufflelist";
129    public static final String PLAYLIST_SHUFFLE_CATALOG_ID = "playlist.shufflecatalog";
130    public static final String PLAYLIST_MOVEUP_ID = "playlist.moveup";
131    public static final String PLAYLIST_MOVEDOWN_ID = "playlist.movedown";
132    public static final String PLAYLIST_MOVEOVER_ID = "playlist.moveover";
133    public static final String PLAYLIST_REMOVE_TRACK_ID = "playlist.removetrack";
134    public static final String PLAYLIST_CLEAR_ID = "playlist.clear";
135    public static final String PLAYLIST_GOTO_ID = "playlist.goto";
136    public static final String PLAYLIST_SAVE_ID = "playlist.save";
137    public static final String PLAYLIST_LOAD_ID = "playlist.load";
138    public static final String SEARCH_ID = "search";
139    public static final String REPORT_CATALOG_ID = "report.catalog";
140    public static final String REPORT_CATALOG_BY_GENRES_ID = "report.catalogbygenres"; //AZ
141    public static final String REPORT_NOCOVERART_ID = "report.nocoverart";
142    public static final String REPORT_BITRATE_ID = "report.bitrate";
143    public static final String REPORT_ALBUMS_FOR_ARTIST_ID = "report.albumsforartist";//AZ
144    public static final String REPORT_GENRES_ID = "report.genres"; //AZ
145    public static final String EXIT_ID = "exit";
146    public static final String DISCLIST_CLOSE_ID = "disclist.close";//AZ
147    public static final String DISCLIST_SHOW_ID = "disclist.show";//AZ
148    public static final String DISCLIST_MOVEUP_ID = "disclist.moveup";//AZ
149    public static final String DISCLIST_MOVEDOWN_ID = "disclist.movedown";//AZ
150    public static final String DISCLIST_REMOVE_DISC_ID = "disclist.removedisc";//AZ
151    public static final String DISCLIST_CLEAR_ID = "disclist.clear";//AZ
152    public static final String DISCLIST_GOTO_ID = "disclist.goto";//AZ
153    public static final String DISCLIST_SAVE_ID = "disclist.save";//AZ
154    public static final String DISCLIST_LOAD_ID = "disclist.load";//AZ
155    public static final String DISCLIST_QUEUE_ID = "disclist.queue";//AZ
156    public static final String DISCLIST_SET_CURRENT_ID = "disclist.setcurrent";//AZ
157    public static final String TRACK_ADD_ID = "track.add"; //AZ
158    public static final String FREE_DB_ID = "free.db"; //AZ
159    public static final String DB_XML_EXPORT_ID = "db.xml.export"; //AZ
160    public static final String DB_XML_IMPORT_ID = "db.xml.import"; //AZ
161    
162 
163    /**
164     * Refers to the controller that is used to forward all action behavior to.
165     * @see #getController()
166     */
167    private final MainController controller;
168 
169    /**
170     * Initializes the actions used in this application. Registers all actions
171     * with the <code>ActionManager</code> and observes changes in the main
172     * module's selection and project to update the enablement of some actions.
173     * @param mainModule provides bound properties for the selection and project
174     * @param controller used to forward all action behavior
175     */
176    private Actions(MainModule mainModule, MainController controller) {
177       LOG.debug("Actions created.");
178       this.controller = controller;
179       // set the locale
180       ActionManager.setBundle(ResourceBundle.getBundle("Action", new Locale(MainModule.SETTINGS.getLocale()),
181                Jukes.class.getClassLoader()));
182       registerActions();
183       mainModule.addPropertyChangeListener(new ModuleChangeHandler());
184 
185       updateCatalogActionEnablement(null);
186    }
187 
188    /**
189     * Initializes the actions used in this application. Registers all actions
190     * with the <code>ActionManager</code> and observes changes in the main
191     * module's selection and project to update the enablement of some actions.
192     * @param mainModule provides bound properties for the selection and project
193     * @param controller used to forward all action behavior
194     */
195    public static void initializeFor(MainModule mainModule, MainController controller) {
196       new Actions(mainModule, controller);
197    }
198 
199    public MainController getController() {
200       return controller;
201    }
202 
203    /**
204     * Registers <code>Action</code>s at the <code>ActionManager</code>
205     * using three different styles for demoing purposes, see class comment.
206     */
207    private void registerActions() {
208       registerActionsViaAnonymousClasses();
209    }
210 
211    /**
212     * Registers actions in the <code>ActionManager</code> using a bunch of
213     * anonymous classes.
214     */
215    private void registerActionsViaAnonymousClasses() {
216       ActionManager.register(LANG_ENGLISH_ID, new AbstractAction() {
217          public void actionPerformed(ActionEvent event) {
218             getController().language(event, "en");
219          }
220       });
221       ActionManager.register(LANG_FRENCH_ID, new AbstractAction() {
222          public void actionPerformed(ActionEvent event) {
223             getController().language(event, "fr");
224          }
225       });
226       ActionManager.register(LANG_GERMAN_ID, new AbstractAction() {
227          public void actionPerformed(ActionEvent event) {
228             getController().language(event, "de");
229          }
230       });
231       ActionManager.register(LANG_SPANISH_ID, new AbstractAction() {
232          public void actionPerformed(ActionEvent event) {
233             getController().language(event, "es");
234          }
235       });
236       ActionManager.register(LANG_PORTUGEUSE_ID, new AbstractAction() {
237          public void actionPerformed(ActionEvent event) {
238             getController().language(event, "pt");
239          }
240       });
241       ActionManager.register(LANG_NORWEGIAN_ID, new AbstractAction() {
242          public void actionPerformed(ActionEvent event) {
243             getController().language(event, "no");
244          }
245       });
246       ActionManager.register(LANG_DUTCH_ID, new AbstractAction() {
247          public void actionPerformed(ActionEvent event) {
248             getController().language(event, "nl");
249          }
250       });
251       ActionManager.register(LANG_ITALIAN_ID, new AbstractAction() {
252          public void actionPerformed(ActionEvent event) {
253             getController().language(event, "it");
254          }
255       });
256       ActionManager.register(LANG_SWEDISH_ID, new AbstractAction() {
257          public void actionPerformed(ActionEvent event) {
258             getController().language(event, "sv");
259          }
260       });
261       ActionManager.register(LANG_FINNISH_ID, new AbstractAction() {
262          public void actionPerformed(ActionEvent event) {
263             getController().language(event, "fi");
264          }
265       });
266       ActionManager.register(LANG_RUSSIAN_ID, new AbstractAction() {
267          public void actionPerformed(ActionEvent event) {
268             getController().language(event, "ru");
269          }
270       });
271       ActionManager.register(LANG_UKRAINIAN_ID, new AbstractAction() {
272          public void actionPerformed(ActionEvent event) {
273             getController().language(event, "uk");
274          }
275       });
276       ActionManager.register(LANG_CHINESE_ID, new AbstractAction() {
277          public void actionPerformed(ActionEvent event) {
278             getController().language(event, "zh");
279          }
280       });
281       ActionManager.register(LANG_KOREAN_ID, new AbstractAction() {
282          public void actionPerformed(ActionEvent event) {
283             getController().language(event, "ko");
284          }
285       });
286       ActionManager.register(LANG_TAMIL_ID, new AbstractAction() {
287          public void actionPerformed(ActionEvent event) {
288             getController().language(event, "ta");
289          }
290       });
291       ActionManager.register(LANG_TELEGU_ID, new AbstractAction() {
292          public void actionPerformed(ActionEvent event) {
293             getController().language(event, "te");
294          }
295       });
296       ActionManager.register(LANG_HINDHI_ID, new AbstractAction() {
297          public void actionPerformed(ActionEvent event) {
298             getController().language(event, "hi");
299          }
300       });
301       ActionManager.register(LANG_INDONESIAN_ID, new AbstractAction() {
302          public void actionPerformed(ActionEvent event) {
303             getController().language(event, "in");
304          }
305       });
306       ActionManager.register(PREFERENCES_ID, new AbstractAction() {
307          public void actionPerformed(ActionEvent event) {
308             getController().preferences();
309          }
310       });
311       ActionManager.register(PREFERENCES_IMPORT_ID, new AbstractAction() {
312          public void actionPerformed(ActionEvent event) {
313             getController().preferencesImport(event);
314          }
315       });
316       ActionManager.register(PREFERENCES_EXPORT_ID, new AbstractAction() {
317          public void actionPerformed(ActionEvent event) {
318             getController().preferencesExport(event);
319          }
320       });
321       ActionManager.register(FILTER_APPLY_ID, new AbstractAction() {
322          public void actionPerformed(ActionEvent event) {
323             getController().filter(event);
324          }
325       });
326       ActionManager.register(PLAYLIST_TOGGLE_ID, new AbstractAction() {
327          public void actionPerformed(ActionEvent event) {
328             getController().playlistToggle(event);
329          }
330       });
331       ActionManager.register(PLAYLIST_SHUFFLE_LIST_ID, new AbstractAction() {
332          public void actionPerformed(ActionEvent event) {
333             getController().playlistShuffleList(event);
334          }
335       });
336       ActionManager.register(PLAYLIST_SHUFFLE_CATALOG_ID, new AbstractAction() {
337          public void actionPerformed(ActionEvent event) {
338             getController().playlistShuffleCatalog(event);
339          }
340       });
341       ActionManager.register(PLAYLIST_MOVEUP_ID, new AbstractAction() {
342          public void actionPerformed(ActionEvent event) {
343             getController().playlistMoveUp(event);
344          }
345       });
346       ActionManager.register(PLAYLIST_REMOVE_TRACK_ID, new AbstractAction() {
347          public void actionPerformed(ActionEvent event) {
348             getController().playlistRemoveTracks(event);
349          }
350       });
351       ActionManager.register(PLAYLIST_CLEAR_ID, new AbstractAction() {
352          public void actionPerformed(ActionEvent event) {
353             getController().playlistClear(event);
354          }
355       });
356       ActionManager.register(PLAYLIST_GOTO_ID, new AbstractAction() {
357          public void actionPerformed(ActionEvent event) {
358             getController().playlistGoto(event);
359          }
360       });
361       ActionManager.register(PLAYLIST_SAVE_ID, new AbstractAction() {
362          public void actionPerformed(ActionEvent event) {
363             getController().playlistSave(event);
364          }
365       });
366       ActionManager.register(PLAYLIST_LOAD_ID, new AbstractAction() {
367          public void actionPerformed(ActionEvent event) {
368             getController().playlistLoad(event);
369          }
370       });
371       ActionManager.register(PLAYLIST_MOVEDOWN_ID, new AbstractAction() {
372          public void actionPerformed(ActionEvent event) {
373             getController().playlistMoveDown(event);
374          }
375       });
376       ActionManager.register(PLAYLIST_MOVEOVER_ID, new AbstractAction() {
377          public void actionPerformed(ActionEvent event) {
378             getController().playlistMoveOver(event);
379          }
380       });
381       ActionManager.register(FILTER_SHOW_ID, new AbstractAction() {
382          public void actionPerformed(ActionEvent event) {
383             getController().filterDisplay(event);
384          }
385       });
386       ActionManager.register(FILTER_CLEAR_ID, new AbstractAction() {
387          public void actionPerformed(ActionEvent event) {
388             getController().filterClear(event);
389          }
390       });
391       ActionManager.register(SEARCH_ID, new AbstractAction() {
392          public void actionPerformed(ActionEvent event) {
393             getController().search(event);
394          }
395       });
396       ActionManager.register(TRACK_PLAY_IMMEDIATE_ID, new AbstractAction() {
397          public void actionPerformed(ActionEvent event) {
398             getController().playImmediately(event);
399          }
400       });
401       ActionManager.register(PLAYER_QUEUE_ID, new AbstractAction() {
402          public void actionPerformed(ActionEvent event) {
403             getController().queue(event);
404          }
405       });
406       ActionManager.register(PLAYER_QUEUE_NEXT_ID, new AbstractAction() {
407          public void actionPerformed(ActionEvent event) {
408             getController().queueNext(event);
409          }
410       });
411       ActionManager.register(PLAYER_PLAY_ID, new AbstractAction() {
412          public void actionPerformed(ActionEvent event) {
413             getController().playerPlay(event);
414          }
415       }).setEnabled(false);
416       ActionManager.register(PLAYER_PAUSE_ID, new AbstractAction() {
417          public void actionPerformed(ActionEvent event) {
418             getController().playerPause(event);
419          }
420       }).setEnabled(false);
421       ActionManager.register(PLAYER_STOP_ID, new AbstractAction() {
422          public void actionPerformed(ActionEvent event) {
423             getController().playerStop(event);
424          }
425       }).setEnabled(false);
426       ActionManager.register(PLAYER_NEXT_ID, new AbstractAction() {
427          public void actionPerformed(ActionEvent event) {
428             getController().playerNext(event);
429          }
430       }).setEnabled(false);
431       ActionManager.register(PLAYER_PREVIOUS_ID, new AbstractAction() {
432          public void actionPerformed(ActionEvent event) {
433             getController().playerPrevious(event);
434          }
435       }).setEnabled(false);
436       ActionManager.register(APP_SHOW_ID, new AbstractAction() {
437          public void actionPerformed(ActionEvent event) {
438             getController().showMainWindow();
439          }
440       }).setEnabled(false);
441       ActionManager.register(APP_HIDE_ID, new AbstractAction() {
442          public void actionPerformed(ActionEvent event) {
443             getController().hideMainWindow();
444          }
445       }).setEnabled(true);
446       ActionManager.register(EXIT_ID, new AbstractAction() {
447          public void actionPerformed(ActionEvent event) {
448             getController().aboutToExitApplication();
449          }
450       });
451       ActionManager.register(PLAYLIST_CLOSE_ID, new AbstractAction() {
452          public void actionPerformed(ActionEvent event) {
453             getController().playlistClose(event);
454          }
455       });
456       ActionManager.register(PLAYLIST_SHOW_ID, new AbstractAction() {
457          public void actionPerformed(ActionEvent event) {
458             getController().playlistDisplay(event);
459          }
460       });
461       ActionManager.register(FILTER_CLOSE_ID, new AbstractAction() {
462          public void actionPerformed(ActionEvent event) {
463             getController().filterClose(event);
464          }
465       });
466       ActionManager.register(TITLECASE_ID, new AbstractAction() {
467          public void actionPerformed(ActionEvent event) {
468             getController().titleCase(event);
469          }
470       });
471       ActionManager.register(FILE_RENAME_ID, new AbstractAction() {
472          public void actionPerformed(ActionEvent event) {
473             getController().fileRename(event);
474          }
475       });
476       ActionManager.register(DIRECTORY_ID, new AbstractAction() {
477          public void actionPerformed(ActionEvent event) {
478             getController().chooseDirectory(event);
479          }
480       });
481       ActionManager.register(FILE_CHOOSER_ID, new AbstractAction() {
482          public void actionPerformed(ActionEvent event) {
483             getController().chooseFile(event);
484          }
485       });
486       ActionManager.register(COMMIT_ID, new AbstractAction() {
487          public void actionPerformed(ActionEvent event) {
488             getController().commit(event);
489          }
490       });
491       ActionManager.register(ROLLBACK_ID, new AbstractAction() {
492          public void actionPerformed(ActionEvent event) {
493             getController().rollback(event);
494          }
495       });
496       ActionManager.register(UNLOCK_ID, new AbstractAction() {
497          public void actionPerformed(ActionEvent event) {
498             getController().unlock(event);
499          }
500       });
501       ActionManager.register(REFRESH_ID, new AbstractAction() {
502          public void actionPerformed(ActionEvent event) {
503             getController().refresh(event);
504          }
505       });
506       ActionManager.register(CONNECT_ID, new AbstractAction() {
507          public void actionPerformed(ActionEvent event) {
508             getController().connect(event);
509          }
510       });
511       ActionManager.register(DELETE_ID, new AbstractAction() {
512          public void actionPerformed(ActionEvent event) {
513             getController().delete(event);
514          }
515       });
516       ActionManager.register(TOOL_STATISTICS_ID, new AbstractAction() {
517          public void actionPerformed(ActionEvent event) {
518             getController().statistics(event);
519          }
520       });
521       ActionManager.register(TOOL_DIFFERENCE_ID, new AbstractAction() {
522          public void actionPerformed(ActionEvent event) {
523             getController().differenceTool(event);
524          }
525       });
526       ActionManager.register(TOOL_LOCATION_ID, new AbstractAction() {
527          public void actionPerformed(ActionEvent event) {
528             getController().locationTool(event);
529          }
530       });
531       ActionManager.register(TOOL_BACKUP_ID, new AbstractAction() {
532          public void actionPerformed(ActionEvent event) {
533             getController().backupTool(event);
534          }
535       });
536       //AZ
537       ActionManager.register(TOOL_CHECK_GENRES_ID, new AbstractAction() {
538           public void actionPerformed(ActionEvent event) {
539              getController().genresTool(event);
540           }
541        });
542       ActionManager.register(CATALOG_EXPORT_ID, new AbstractAction() {
543          public void actionPerformed(ActionEvent event) {
544             getController().exportCatalog(event);
545          }
546       });
547       ActionManager.register(TOOL_MEMORY_ID, new AbstractAction() {
548          public void actionPerformed(ActionEvent event) {
549             getController().memory(event);
550          }
551       });
552       ActionManager.register(DISC_WEB_ID, new AbstractAction() {
553          public void actionPerformed(ActionEvent event) {
554             getController().discWebSearch(event);
555          }
556       });
557       ActionManager.register(DISC_COVER_ID, new AbstractAction() {
558          public void actionPerformed(ActionEvent event) {
559             getController().discCoverImage(event);
560          }
561       });
562       ActionManager.register(DISC_ADD_ID, new AbstractAction() {
563          public void actionPerformed(ActionEvent event) {
564             getController().discAdd(event);
565          }
566       });
567       ActionManager.register(DISC_ADD_TITLECASE_ID, new AbstractAction() {
568          public void actionPerformed(ActionEvent event) {
569             getController().discAddTitleCase(event);
570          }
571       });
572       ActionManager.register(DISC_ADD_COMMENTS_ID, new AbstractAction() {
573          public void actionPerformed(ActionEvent event) {
574             getController().discAddComments(event);
575          }
576       });
577       ActionManager.register(DISC_ADD_RESET_FROM_FILENAME_ID, new AbstractAction() {
578          public void actionPerformed(ActionEvent event) {
579             getController().discAddResetFromFilename(event);
580          }
581       });
582       ActionManager.register(DISC_ADD_RESET_NUMBERS_ID, new AbstractAction() {
583          public void actionPerformed(ActionEvent event) {
584             getController().discAddResetTrackNumbers(event);
585          }
586       });
587       ActionManager.register(DISC_FINDER_ID, new AbstractAction() {
588          public void actionPerformed(ActionEvent event) {
589             getController().discFinder(event);
590          }
591       });
592       ActionManager.register(DISC_REMOVER_ID, new AbstractAction() {
593          public void actionPerformed(ActionEvent event) {
594             getController().discRemover(event);
595          }
596       });
597       ActionManager.register(REPORT_CATALOG_ID, new AbstractAction() {
598          public void actionPerformed(ActionEvent event) {
599             getController().reportCatalog(event);
600          }
601       });
602       //AZ
603       ActionManager.register(REPORT_CATALOG_BY_GENRES_ID, new AbstractAction() {
604           public void actionPerformed(ActionEvent event) {
605              getController().reportCatalogByGenres(event);
606           }
607        });
608       ActionManager.register(REPORT_NOCOVERART_ID, new AbstractAction() {
609          public void actionPerformed(ActionEvent event) {
610             getController().reportNoCoverArt(event);
611          }
612       });
613       ActionManager.register(REPORT_BITRATE_ID, new AbstractAction() {
614          public void actionPerformed(ActionEvent event) {
615             getController().reportBitrate(event);
616          }
617       });
618       //AZ
619       ActionManager.register(REPORT_ALBUMS_FOR_ARTIST_ID, new AbstractAction() {
620           public void actionPerformed(ActionEvent event) {
621              getController().reportAlbumsForArtist(event);
622           }
623        });
624       //AZ
625       ActionManager.register(REPORT_GENRES_ID, new AbstractAction() {
626           public void actionPerformed(ActionEvent event) {
627              getController().reportGenres(event);
628           }
629        });
630       ActionManager.register(HELP_CONTACT_ID, new AbstractAction() {
631          public void actionPerformed(ActionEvent event) {
632             getController().contactUs(event);
633          }
634       });
635       ActionManager.register(HELP_CONTENTS_ID, new AbstractAction() {
636          public void actionPerformed(ActionEvent event) {
637             HelpBroker.openDefault();
638          }
639       });
640       ActionManager.register(HELP_TIP_OF_THE_DAY_ID, new AbstractAction() {
641          public void actionPerformed(ActionEvent event) {
642             getController().openTipOfTheDayDialog();
643          }
644       });
645       ActionManager.register(HELP_ABOUT_DIALOG_ID, new AbstractAction() {
646          public void actionPerformed(ActionEvent event) {
647             getController().helpAbout();
648          }
649       });
650       ActionManager.register(HELP_DONATE_ID, new AbstractAction() {
651          public void actionPerformed(ActionEvent event) {
652             getController().donate();
653          }
654       });
655       ActionManager.register(HELP_FORUMS_ID, new AbstractAction() {
656          public void actionPerformed(ActionEvent event) {
657             getController().forums();
658          }
659       });
660       //AZ Development - DiscList actions
661          ActionManager.register(DISCLIST_MOVEUP_ID, new AbstractAction() {
662              public void actionPerformed(ActionEvent event) {
663                 getController().disclistMoveUp(event);
664              }
665           });
666           ActionManager.register(DISCLIST_REMOVE_DISC_ID, new AbstractAction() {
667              public void actionPerformed(ActionEvent event) {
668                 getController().disclistRemoveTracks(event);
669              }
670           });
671           ActionManager.register(DISCLIST_CLEAR_ID, new AbstractAction() {
672              public void actionPerformed(ActionEvent event) {
673                 getController().disclistClear(event);
674              }
675           });
676           ActionManager.register(DISCLIST_GOTO_ID, new AbstractAction() {
677              public void actionPerformed(ActionEvent event) {
678                 getController().disclistGoto(event);
679              }
680           });
681           ActionManager.register(DISCLIST_SAVE_ID, new AbstractAction() {
682              public void actionPerformed(ActionEvent event) {
683                 getController().disclistSave(event);
684              }
685           });
686           ActionManager.register(DISCLIST_LOAD_ID, new AbstractAction() {
687              public void actionPerformed(ActionEvent event) {
688                 getController().disclistLoad(event);
689              }
690           });
691           ActionManager.register(DISCLIST_MOVEDOWN_ID, new AbstractAction() {
692              public void actionPerformed(ActionEvent event) {
693                 getController().disclistMoveDown(event);
694              }   
695       });
696           ActionManager.register(DISCLIST_CLOSE_ID, new AbstractAction() {
697               public void actionPerformed(ActionEvent event) {
698                  getController().disclistClose(event);
699               }
700            });
701            ActionManager.register(DISCLIST_SHOW_ID, new AbstractAction() {
702               public void actionPerformed(ActionEvent event) {
703                  getController().disclistDisplay(event);
704               }
705            });
706            ActionManager.register(DISCLIST_QUEUE_ID, new AbstractAction() {
707                public void actionPerformed(ActionEvent event) {
708                   getController().addToDisclist(event);
709                }
710             });   
711            ActionManager.register(DISCLIST_SET_CURRENT_ID, new AbstractAction() {
712                public void actionPerformed(ActionEvent event) {
713                   getController().setCurrent(event);
714                }
715             }); 
716            //AZ
717            ActionManager.register(TRACK_ADD_ID, new AbstractAction() {
718                public void actionPerformed(ActionEvent event) {
719                   getController().trackAdd(event);
720                }
721             });
722            
723            //AZ
724            ActionManager.register(FREE_DB_ID, new AbstractAction() {
725                public void actionPerformed(ActionEvent event) {
726                   getController().freeDB(event);
727                }
728             });
729            
730            //AZ
731            ActionManager.register(DB_XML_EXPORT_ID, new AbstractAction() {
732                public void actionPerformed(ActionEvent event) {
733                   getController().xmlExport(event);
734                }
735             });
736            
737            //AZ
738            ActionManager.register(DB_XML_IMPORT_ID, new AbstractAction() {
739                public void actionPerformed(ActionEvent event) {
740                   getController().xmlImport(event);
741                }
742             });
743    }
744 
745    /**
746     * Updates the enablement of actions that are related to the catalog state.
747     * @param project the current catalog
748     */
749    private void updateCatalogActionEnablement(Catalog catalog) {
750       boolean enabled = catalog != null;
751       ActionManager.get(Actions.REFRESH_ID).setEnabled(enabled);
752       ActionManager.get(Actions.DISC_ADD_ID).setEnabled(enabled);
753       ActionManager.get(Actions.DISC_FINDER_ID).setEnabled(enabled);
754       ActionManager.get(Actions.DISC_REMOVER_ID).setEnabled(enabled);
755       ActionManager.get(Actions.TOOL_DIFFERENCE_ID).setEnabled(enabled);
756       ActionManager.get(Actions.TOOL_STATISTICS_ID).setEnabled(enabled);
757       ActionManager.get(Actions.DISC_WEB_ID).setEnabled(enabled);
758       ActionManager.get(Actions.CATALOG_EXPORT_ID).setEnabled(enabled);
759       ActionManager.get(Actions.SEARCH_ID).setEnabled(enabled);
760       ActionManager.get(Actions.TOOL_LOCATION_ID).setEnabled(enabled);
761       ActionManager.get(Actions.TOOL_BACKUP_ID).setEnabled(enabled);
762       ActionManager.get(Actions.TOOL_CHECK_GENRES_ID).setEnabled(enabled); //AZ
763       ActionManager.get(Actions.FREE_DB_ID).setEnabled(enabled);//AZ
764       ActionManager.get(Actions.DB_XML_EXPORT_ID).setEnabled(enabled);//AZ
765       ActionManager.get(Actions.DB_XML_IMPORT_ID).setEnabled(enabled);//AZ
766    }
767 
768    // Listens to changes in the navigation selection and update enablements.
769    private class ModuleChangeHandler implements PropertyChangeListener {
770 
771       /**
772        * The selection in the navigation tree has changed. Updates the add and
773        * delete actions.
774        * @param evt describes the property change
775        */
776       public void propertyChange(PropertyChangeEvent evt) {
777          String propertyName = evt.getPropertyName();
778          if (MainModule.PROPERTYNAME_CATALOG.equals(propertyName)) {
779             updateCatalogActionEnablement((Catalog) evt.getNewValue());
780          }
781       }
782    }
783 
784 }