View Javadoc

1   package com.melloware.jukes.gui.tool;
2   
3   import java.awt.Color;
4   import java.io.File;
5   import java.util.Locale;
6   import java.util.prefs.Preferences;
7   
8   import org.apache.commons.io.FilenameUtils;
9   import org.apache.commons.lang.SystemUtils;
10  import org.apache.log4j.Level;
11  
12  import com.jgoodies.binding.beans.Model;
13  import com.melloware.jukes.file.filter.XspfFilter;
14  import com.melloware.jukes.gui.view.component.SpectrumTimeAnalyzer;
15  
16  
17  /**
18   * Provides bound properties for application related settings.
19   * <p>
20   * Copyright (c) 1999-2007 Melloware, Inc. <http://www.melloware.com>
21   * @author Emil A. Lefkof III <info@melloware.com>
22   * @version 4.0
23   * AZ - modifications 2009
24   *
25   * @see java.util.prefs.Preferences
26   */
27  public final class Settings
28      extends Model {   
29      public static final String PROPERTYNAME_FADE_IN_ON_PLAY = "fadeInOnPlay";
30      public static final String PROPERTYNAME_FADE_OUT_ON_PAUSE = "fadeOutOnPause";
31      public static final String PROPERTYNAME_FADE_OUT_ON_STOP = "fadeOutOnStop";
32      public static final String PROPERTYNAME_FADE_OUT_ON_CHANGE = "fadeOutOnChange";
33      public static final String PROPERTYNAME_UPDATE_TAGS = "updateTags";
34      public static final String PROPERTYNAME_DISPLAY_FORMAT_DISC = "displayFormatDisc";
35      public static final String PROPERTYNAME_DISPLAY_FORMAT_TRACK = "displayFormatTrack";
36      public static final String PROPERTYNAME_DIRECTORY_START_IN = "startInDirectory";
37      public static final String PROPERTYNAME_DIRECTORY_DB_LOCATION = "databaseLocation";
38      public static final String PROPERTYNAME_FILE_FORMAT_MUSIC = "fileFormatMusic";
39      public static final String PROPERTYNAME_FILE_FORMAT_IMAGE = "fileFormatImage";
40      public static final String PROPERTYNAME_NEW_FILE_IN_DAYS = "newFileInDays";
41      public static final String PROPERTYNAME_LOCALE = "locale";
42      public static final String PROPERTYNAME_ROW_COLOR_EVEN = "rowColorEven";
43      public static final String PROPERTYNAME_ROW_COLOR_ODD = "rowColorOdd";
44      public static final String PROPERTYNAME_PLAYLIST_TYPE = "playlistType";
45      public static final String PROPERTYNAME_LOG_LEVEL = "logLevel";
46      public static final String PROPERTYNAME_PLAYER_BUFFER_SIZE = "playerBufferSize";
47      public static final String PROPERTYNAME_FILE_BACKUP = "fileBackup";
48      public static final String PROPERTYNAME_COVER_SIZE_SMALL = "coverSizeSmall";
49      public static final String PROPERTYNAME_COVER_SIZE_LARGE = "coverSizeLarge";
50      public static final String PROPERTYNAME_AUDIT_INFO = "auditInfo";
51      public static final String PROPERTYNAME_REMOTE_DATABASE_URL = "remoteDatabaseURL";
52      public static final String PROPERTYNAME_CATALOG_SCROLL_UNITS = "catalogScrollUnits";
53      public static final String PROPERTYNAME_ANALYZER_MODE = "analyzerMode";
54      /** AZ **/
55      public static final String PROPERTYNAME_USE_CD_NUMBER = "useCDNumber";
56      public static final String PROPERTYNAME_ALBUM_ARTIST_TAG = "albumArtistTag";
57      public static final String PROPERTYNAME_COPY_IMAGES = "copyImagesToDirectory";
58      public static final String PROPERTYNAME_IMAGES_LOCATION = "imagesLocation"; 
59      public static final String PROPERTYNAME_SHOW_DEFAULT_TREE = "showDefaultTree";
60      public static final String PROPERTYNAME_SHOW_EMPTY_NODE = "showEmptyNode";
61      /**
62       * URL of remote database location.
63       */
64      public static final String DEFAULT_REMOTE_DATABASE_URL = "jdbc:hsqldb:hsql://127.0.0.1/jukes";
65  
66      /**
67       * The default value (true) for fading properties.
68       */
69      private static final boolean DEFAULT_FADING = true;
70  
71      /**
72       * The default value (false) for property 'updateTags'.
73       */
74      private static final boolean DEFAULT_UPDATE_TAGS = false;
75  
76      /**
77       * The default value (true) for property 'auditInfo'.
78       */
79      private static final boolean DEFAULT_AUDIT_INFO = true;
80      
81      /**    AZ
82       * The default value (true) for property 'useCDNumber'.
83       */
84      private static final boolean DEFAULT_USE_CD_NUMBER = true;
85      /**    AZ
86       * The default value for property 'albumArtistTag'.
87       */
88      private static final String DEFAULT_ALBUM_ARTIST_TAG = "ALBUM ARTIST";
89           
90      /**    AZ
91       * The default value (false) for property 'copyImagesToDirectory'.
92       */
93      private static final boolean DEFAULT_COPY_IMAGES = false;
94      
95      /**    AZ
96       * The default value (true) for property 'showDefaultTree'.
97       */
98      private static final boolean DEFAULT_SHOW_DEFAULT_TREE = true;
99      
100     /**    AZ
101      * The default value (false) for property 'showEmptyNode'.
102      */
103     private static final boolean DEFAULT_SHOW_EMPTY_NODE = false;
104     
105     /** AZ redirected to current directory
106      * The default value for property 'imagesLocation'.
107      */
108     private static final File DEFAULT_IMAGES_LOCATION = new File(FilenameUtils.normalizeNoEndSeparator(SystemUtils.USER_DIR
109     														+ SystemUtils.FILE_SEPARATOR 
110     														+ "images"));       
111 
112     /**AZ redirected to current directory
113      * The default value for property 'startInDirectory'.
114      */
115     private static final File DEFAULT_DIRECTORY_START_IN = new File(FilenameUtils.normalizeNoEndSeparator(SystemUtils.USER_DIR));
116 
117     /**AZ redirected to current directory
118      * The default value for property 'databaseLocation'.
119      */
120     private static final File DEFAULT_DIRECTORY_DB_LOCATION = new File(FilenameUtils.normalizeNoEndSeparator(SystemUtils.USER_DIR
121                                                                                                              + SystemUtils.FILE_SEPARATOR
122                                                                                                              + "db"));
123 
124     /**AZ redirected to current directory
125      * The default value for property 'fileBackup'.
126      */
127     private static final File DEFAULT_FILE_BACKUP = new File(FilenameUtils.normalizeNoEndSeparator(SystemUtils.USER_DIR
128                                                                                                    + SystemUtils.FILE_SEPARATOR
129                                                                                                    + "backup"
130                                                                                                    + SystemUtils.FILE_SEPARATOR
131                                                                                                    + Resources.APPLICATION_LOCATION
132                                                                                                    + "-backup.zip"));
133 
134     /**
135      * The default value for property 'fileFormatMusic'.
136      */
137     private static final String DEFAULT_FILE_FORMAT_MUSIC = "%n - %t";
138 
139     /**
140      * The default value for property 'fileFormatImage'.
141      */
142     private static final String DEFAULT_FILE_FORMAT_IMAGE = "%a - %d";
143 
144     /**
145      * The default value for property 'fileFormatMusic'.
146      */
147     private static final String DEFAULT_DISPLAY_FORMAT_DISC = "[%y] %d (%r)";
148 
149     /**
150      * The default value for property 'fileFormatMusic'.
151      */
152     private static final String DEFAULT_DISPLAY_FORMAT_TRACK = "%n. %t  (%r)";
153 
154     /**
155      * The default value for property 'locale'.
156      */
157     private static final String DEFAULT_LOCALE = Locale.getDefault().getLanguage();
158 
159     /**
160      * The default value for property 'rowColorEven'.
161      */
162     private static final Color DEFAULT_ROW_COLOR_EVEN = Color.WHITE;
163 
164     /**
165      * The default value for property 'rowColorOdd'.
166      */
167     private static final Color DEFAULT_ROW_COLOR_ODD = new Color(0xee, 0xee, 0xff);
168 
169     /**
170      * The default value for property 'newFileInDays'.
171      */
172     private static final int DEFAULT_NEW_FILE_IN_DAYS = 30;
173     
174     /**
175      * The default value for property 'analyzerMode'.
176      */
177     private static final String DEFAULT_ANALYZER_MODE = SpectrumTimeAnalyzer.ANALYZER;
178 
179     /**
180      * The default value for property 'catalogScrollUnits'.
181      */
182     private static final int DEFAULT_CATALOG_SCROLL_UNITS = 5;
183 
184     /**
185      * The default value for property 'coverSizeSmall'.
186      */
187     private static final int DEFAULT_COVER_SIZE_SMALL = 91;
188 
189     /**
190      * The default value for property 'coverSizeLarge'.
191      */
192     private static final int DEFAULT_COVER_SIZE_LARGE = 300;
193 
194     /**
195      * The default value for property 'playerBufferSize'.
196      */
197     private static final int DEFAULT_PLAYER_BUFFER_SIZE = 512000;
198 
199     /**
200      * The default value for property 'playlistType'.
201      */
202     private static final String DEFAULT_PLAYLIST_TYPE = XspfFilter.XSPF;
203     
204     /**
205      * The default value for playerVolume.
206      */
207     private static final float DEFAULT_KEY_PLAYER_VOLUME = 0.7f;
208 
209     /**
210      * The default value for property 'logLevel'.
211      */
212     private static final String DEFAULT_LOG_LEVEL = Level.INFO.toString();
213 
214     private static final String KEY_FADE_IN_ON_PLAY = "state.fadeInOnPlay";
215     private static final String KEY_FADE_OUT_ON_STOP = "state.fadeOutOnStop";
216     private static final String KEY_FADE_OUT_ON_PAUSE = "state.fadeOutOnPause";
217     private static final String KEY_FADE_OUT_ON_CHANGE = "state.fadeOutOnChange";
218     private static final String KEY_DIRECTORY_START_IN = "state.startInDirectory";
219     private static final String KEY_DIRECTORY_DB_LOCATION = "state.databaseLocation";
220     private static final String KEY_FILE_FORMAT_MUSIC = "state.fileFormatMusic";
221     private static final String KEY_FILE_FORMAT_IMAGE = "state.fileFormatImage";
222     private static final String KEY_NEW_FILE_IN_DAYS = "state.newFileInDays";
223     private static final String KEY_DISPLAY_FORMAT_TRACK = "state.displayFormatTrack";
224     private static final String KEY_DISPLAY_FORMAT_DISC = "state.displayFormatDisc";
225     private static final String KEY_LOCALE = "state.locale";
226     private static final String KEY_UPDATE_TAGS = "state.updateTags";
227     private static final String KEY_ROW_COLOR_EVEN = "state.rowColorEven";
228     private static final String KEY_ROW_COLOR_ODD = "state.rowColorOdd";
229     private static final String KEY_PLAYLIST_TYPE = "state.playlistType";
230     private static final String KEY_LOG_LEVEL = "state.logLevel";
231     private static final String KEY_PLAYER_BUFFER_SIZE = "state.playerBufferSize";
232     private static final String KEY_FILE_BACKUP = "state.fileBackup";
233     private static final String KEY_COVER_SIZE_SMALL = "state.coverSizeSmall";
234     private static final String KEY_COVER_SIZE_LARGE = "state.coverSizeLarge";
235     private static final String KEY_AUDIT_INFO = "state.auditInfo";
236     private static final String KEY_REMOTE_DATABASE_URL = "state.remoteDatabaseURL";
237     private static final String KEY_CATALOG_SCROLL_UNITS = "state.catalogScrollUnits";
238     private static final String KEY_ANALYZER_MODE = "state.analyzerMode";
239     /** AZ  */
240     private static final String KEY_USE_CD_NUMBER = "state.useCDNumber";
241     private static final String KEY_ALBUM_ARTIST_TAG = "state.albumArtistTag";
242     private static final String KEY_COPY_IMAGES = "state.copyImagesToDirectory";
243     private static final String KEY_IMAGES_LOCATION = "state.imagesLocation";
244     private static final String KEY_SHOW_DEFAULT_TREE = "state.showDefaultTree";
245     private static final String KEY_SHOW_EMPTY_NODE = "state.showEmptyNode";
246     private static final String KEY_PLAYER_VOLUME = "playerVolume";
247 
248     
249     /** AZ  
250      * Default player volume
251      */
252     private float playerVolume = DEFAULT_KEY_PLAYER_VOLUME;
253     
254     /**
255      * Whether to show Audit Info or not
256      */
257     private boolean auditInfo = DEFAULT_AUDIT_INFO;
258     
259     /** AZ  
260      * Default description of TXXX tag for Album Artist
261      */
262     private String albumArtistTag = DEFAULT_ALBUM_ARTIST_TAG;
263     /** AZ   
264      * Whether to use CD Number or not
265      */
266     private boolean useCDNumber = DEFAULT_USE_CD_NUMBER;
267     /** AZ   
268      * Whether to copy images to user defined directory or not
269      */
270     private boolean copyImagesToDirectory = DEFAULT_COPY_IMAGES;
271     /** AZ
272      * Describes where the images location is.
273      */
274     private File imagesLocation = DEFAULT_IMAGES_LOCATION;
275     
276     /** AZ   
277      * Whether to show main tree by default
278      */
279     private boolean showDefaultTree = DEFAULT_SHOW_DEFAULT_TREE;
280     
281     /** AZ   
282      * Whether to show empty node by default
283      */
284     private boolean showEmptyNode = DEFAULT_SHOW_EMPTY_NODE;
285     
286     /**
287      * Describes whether a song shall be faded out or not
288      */
289     private boolean fadeInOnPlay = DEFAULT_FADING;
290     private boolean fadeOutOnChange = DEFAULT_FADING;
291     private boolean fadeOutOnPause = DEFAULT_FADING;
292     private boolean fadeOutOnStop = DEFAULT_FADING;
293 
294     /**
295      * Whether to update the tags on a Disc Find (slow).
296      */
297     private boolean updateTags = DEFAULT_UPDATE_TAGS;
298 
299     /**
300      * Describes the alternating row color.
301      */
302     private Color rowColorEven = DEFAULT_ROW_COLOR_EVEN;
303 
304     /**
305      * Describes the alternating row color.
306      */
307     private Color rowColorOdd = DEFAULT_ROW_COLOR_ODD;
308 
309     /**
310      * Describes where the HSQLDB database location is.
311      */
312     private File databaseLocation = DEFAULT_DIRECTORY_DB_LOCATION;
313 
314     /**
315      * Describes the file to backup to.
316      */
317     private File fileBackup = DEFAULT_FILE_BACKUP;
318 
319     /**
320      * Describes what the start in directory is for all Find Dialogs.
321      */
322     private File startInDirectory = DEFAULT_DIRECTORY_START_IN;
323 
324     /**
325      * Describes scroll speed of the catalog tree view
326      */
327     private int catalogScrollUnits = DEFAULT_CATALOG_SCROLL_UNITS;
328 
329     /**
330      * Describes cover size of the large covers
331      */
332     private int coverSizeLarge = DEFAULT_COVER_SIZE_LARGE;
333 
334     /**
335      * Describes cover size of the small covers
336      */
337     private int coverSizeSmall = DEFAULT_COVER_SIZE_SMALL;
338 
339     /**
340      * Describes the number of days a file is considered 'new'
341      */
342     private int newFileInDays = DEFAULT_NEW_FILE_IN_DAYS;
343     
344     /**
345      * Describes the mode to start the spectrum analyzer in
346      */
347     private String analyzerMode = DEFAULT_ANALYZER_MODE;
348 
349     /**
350      * Describes the buffer size of the audio player
351      */
352     private int playerBufferSize = DEFAULT_PLAYER_BUFFER_SIZE;
353 
354     /**
355      * Describes the format to display discs.
356      */
357     private String displayFormatDisc = DEFAULT_DISPLAY_FORMAT_DISC;
358 
359     /**
360      * Describes the format to display tracks
361      */
362     private String displayFormatTrack = DEFAULT_DISPLAY_FORMAT_TRACK;
363 
364     /**
365      * Describes what the image file renaming convention is.
366      */
367     private String fileFormatImage = DEFAULT_FILE_FORMAT_IMAGE;
368 
369     /**
370      * Describes what the music file renaming convention is.
371      */
372     private String fileFormatMusic = DEFAULT_FILE_FORMAT_MUSIC;
373 
374     /**
375      * Describes what the current filter is.
376      */
377     private String filter = "";
378 
379     /**
380      * Describes the country locale
381      */
382     private String locale = DEFAULT_LOCALE;
383 
384     /**
385      * Describes the logger level
386      */
387     private String logLevel = DEFAULT_LOG_LEVEL;
388 
389     /**
390      * Describes the country locale
391      */
392     private String playlistType = DEFAULT_PLAYLIST_TYPE;
393 
394     /**
395      * Describes the location of the remote database if connecting to one
396      */
397     private String remoteDatabaseURL = DEFAULT_REMOTE_DATABASE_URL;
398 
399     /**
400      * Gets the catalogScrollUnits.
401      * <p>
402      * @return Returns the catalogScrollUnits.
403      */
404     public int getCatalogScrollUnits() {
405         return this.catalogScrollUnits;
406     }
407 
408     /**
409      * Gets the coverSizeLarge.
410      * <p>
411      * @return Returns the coverSizeLarge.
412      */
413     public int getCoverSizeLarge() {
414         return this.coverSizeLarge;
415     }
416 
417     /**
418      * Gets the coverSizeSmall.
419      * <p>
420      * @return Returns the coverSizeSmall.
421      */
422     public int getCoverSizeSmall() {
423         return this.coverSizeSmall;
424     }
425 
426     /**
427      * Gets the databaseLocation.
428      * <p>
429      * @return Returns the databaseLocation.
430      */
431     public File getDatabaseLocation() {
432         return this.databaseLocation;
433     }
434 
435     /**
436      * Gets the displayFormatDisc.
437      * <p>
438      * @return Returns the displayFormatDisc.
439      */
440     public String getDisplayFormatDisc() {
441         return this.displayFormatDisc;
442     }
443 
444     /**
445      * Gets the displayFormatTrack.
446      * <p>
447      * @return Returns the displayFormatTrack.
448      */
449     public String getDisplayFormatTrack() {
450         return this.displayFormatTrack;
451     }
452 
453     /**
454      * Gets the fileBackup.
455      * <p>
456      * @return Returns the fileBackup.
457      */
458     public File getFileBackup() {
459         return this.fileBackup;
460     }
461 
462     /**
463      * Gets the fileFormatImage.
464      * <p>
465      * @return Returns the fileFormatImage.
466      */
467     public String getFileFormatImage() {
468         return this.fileFormatImage;
469     }
470 
471     /**
472      * Gets the fileFormatMusic.
473      * <p>
474      * @return Returns the fileFormatMusic.
475      */
476     public String getFileFormatMusic() {
477         return this.fileFormatMusic;
478     }
479 
480     /**
481      * Gets the filter.
482      * <p>
483      * @return Returns the filter.
484      */
485     public String getFilter() {
486         return this.filter;
487     }
488 
489     /**
490      * Gets the locale.
491      * <p>
492      * @return Returns the locale.
493      */
494     public String getLocale() {
495         return this.locale;
496     }
497 
498     /**
499      * Gets the logLevel.
500      * <p>
501      * @return Returns the logLevel.
502      */
503     public String getLogLevel() {
504         return this.logLevel;
505     }
506 
507     /**
508      * Gets the newFileInDays.
509      * <p>
510      * @return Returns the newFileInDays.
511      */
512     public int getNewFileInDays() {
513         return this.newFileInDays;
514     }
515 
516     /**
517      * Gets the playerBufferSize.
518      * <p>
519      * @return Returns the playerBufferSize.
520      */
521     public int getPlayerBufferSize() {
522         return this.playerBufferSize;
523     }
524 
525     /**
526      * Gets the playlistType.
527      * <p>
528      * @return Returns the playlistType.
529      */
530     public String getPlaylistType() {
531         return this.playlistType;
532     }
533 
534     /**
535      * Gets the remoteDatabaseURL.
536      * <p>
537      * @return Returns the remoteDatabaseURL.
538      */
539     public String getRemoteDatabaseURL() {
540         return this.remoteDatabaseURL;
541     }
542 
543     /**
544      * Gets the rowColorEven.
545      * <p>
546      * @return Returns the rowColorEven.
547      */
548     public Color getRowColorEven() {
549         return this.rowColorEven;
550     }
551 
552     /**
553      * Gets the rowColorOdd.
554      * <p>
555      * @return Returns the rowColorOdd.
556      */
557     public Color getRowColorOdd() {
558         return this.rowColorOdd;
559     }
560 
561     /**
562      * Gets the startInDirectory.
563      * <p>
564      * @return Returns the startInDirectory.
565      */
566     public File getStartInDirectory() {
567         return this.startInDirectory;
568     }
569     
570     /**
571      * Gets the analyzerMode.
572      * <p>
573      * @return Returns the analyzerMode.
574      */
575     public String getAnalyzerMode() {
576        return this.analyzerMode;
577     }
578 
579     /** AZ
580      * Gets the albumArtistTag.
581      * <p>
582      * @return Returns the albumArtistTag.
583      */
584     public String getAlbumArtistTag() {
585        return this.albumArtistTag;
586     }
587     /** AZ
588      * Gets the imagesLocation.
589      * <p>
590      * @return Returns the imagesLocation.
591      */
592     public File getImagesLocation() {
593         return this.imagesLocation;
594     }
595     /**
596      * Sets the auditInfo.
597      * <p>
598      * @param aAuditInfo The auditInfo to set.
599      */
600     public void setAuditInfo(boolean aAuditInfo) {
601         boolean oldValue = isAuditInfo();
602         this.auditInfo = aAuditInfo;
603         firePropertyChange(PROPERTYNAME_AUDIT_INFO, oldValue, aAuditInfo);
604     }
605 
606     /**
607      * Sets the catalogScrollUnits.
608      * <p>
609      * @param aCatalogScrollUnits The catalogScrollUnits to set.
610      */
611     public void setCatalogScrollUnits(int aCatalogScrollUnits) {
612         int oldValue = getCatalogScrollUnits();
613         this.catalogScrollUnits = aCatalogScrollUnits;
614         firePropertyChange(PROPERTYNAME_CATALOG_SCROLL_UNITS, oldValue, aCatalogScrollUnits);
615     }
616 
617     /**
618      * Sets the coverSizeLarge.
619      * <p>
620      * @param aCoverSizeLarge The coverSizeLarge to set.
621      */
622     public void setCoverSizeLarge(int aCoverSizeLarge) {
623         int oldValue = getCoverSizeLarge();
624         this.coverSizeLarge = aCoverSizeLarge;
625         firePropertyChange(PROPERTYNAME_COVER_SIZE_LARGE, oldValue, aCoverSizeLarge);
626     }
627 
628     /**
629      * Sets the coverSizeSmall.
630      * <p>
631      * @param aCoverSizeSmall The coverSizeSmall to set.
632      */
633     public void setCoverSizeSmall(int aCoverSizeSmall) {
634         int oldValue = getCoverSizeSmall();
635         this.coverSizeSmall = aCoverSizeSmall;
636         firePropertyChange(PROPERTYNAME_COVER_SIZE_SMALL, oldValue, aCoverSizeSmall);
637 
638     }
639 
640     /**
641      * Sets the databaseLocation.
642      * <p>
643      * @param aDatabaseLocation The databaseLocation to set.
644      */
645     public void setDatabaseLocation(File aDatabaseLocation) {
646         File oldValue = getDatabaseLocation();
647         this.databaseLocation = aDatabaseLocation;
648         firePropertyChange(PROPERTYNAME_DIRECTORY_DB_LOCATION, oldValue, aDatabaseLocation);
649     }
650 
651     /**
652      * Sets the displayFormatDisc.
653      * <p>
654      * @param aDisplayFormatDisc The displayFormatDisc to set.
655      */
656     public void setDisplayFormatDisc(String aDisplayFormatDisc) {
657         String oldValue = getDisplayFormatDisc();
658         this.displayFormatDisc = aDisplayFormatDisc;
659         firePropertyChange(PROPERTYNAME_DISPLAY_FORMAT_DISC, oldValue, aDisplayFormatDisc);
660     }
661 
662     /**
663      * Sets the displayFormatTrack.
664      * <p>
665      * @param aDisplayFormatTrack The displayFormatTrack to set.
666      */
667     public void setDisplayFormatTrack(String aDisplayFormatTrack) {
668         String oldValue = getDisplayFormatTrack();
669         this.displayFormatTrack = aDisplayFormatTrack;
670         firePropertyChange(PROPERTYNAME_DISPLAY_FORMAT_TRACK, oldValue, aDisplayFormatTrack);
671     }
672 
673     /**
674      * Sets the fadeInOnPlay.
675      * <p>
676      * @param aFadeInOnPlay The fadeInOnPlay to set.
677      */
678     public void setFadeInOnPlay(boolean aFadeInOnPlay) {
679         boolean oldValue = isFadeInOnPlay();
680         this.fadeInOnPlay = aFadeInOnPlay;
681         firePropertyChange(PROPERTYNAME_FADE_IN_ON_PLAY, oldValue, aFadeInOnPlay);
682     }
683 
684     /**
685      * Sets the fadeOutOnChange.
686      * <p>
687      * @param aFadeOutOnChange The fadeOutOnChange to set.
688      */
689     public void setFadeOutOnChange(boolean aFadeOutOnChange) {
690         boolean oldValue = isFadeOutOnChange();
691         this.fadeOutOnChange = aFadeOutOnChange;
692         firePropertyChange(PROPERTYNAME_FADE_OUT_ON_CHANGE, oldValue, aFadeOutOnChange);
693     }
694 
695     /**
696      * Sets the fadeOutOnPause.
697      * <p>
698      * @param aFadeOutOnPause The fadeOutOnPause to set.
699      */
700     public void setFadeOutOnPause(boolean aFadeOutOnPause) {
701         boolean oldValue = isFadeOutOnPause();
702         this.fadeOutOnPause = aFadeOutOnPause;
703         firePropertyChange(PROPERTYNAME_FADE_OUT_ON_PAUSE, oldValue, aFadeOutOnPause);
704     }
705 
706     /**
707      * Sets the fadeOutOnStop.
708      * <p>
709      * @param aFadeOutOnStop The fadeOutOnStop to set.
710      */
711     public void setFadeOutOnStop(boolean aFadeOutOnStop) {
712         boolean oldValue = isFadeOutOnStop();
713         this.fadeOutOnStop = aFadeOutOnStop;
714         firePropertyChange(PROPERTYNAME_FADE_OUT_ON_STOP, oldValue, aFadeOutOnStop);
715     }
716 
717     /**
718      * Sets the fileBackup.
719      * <p>
720      * @param aFileBackup The fileBackup to set.
721      */
722     public void setFileBackup(File aFileBackup) {
723         File oldValue = getFileBackup();
724         this.fileBackup = aFileBackup;
725         firePropertyChange(PROPERTYNAME_FILE_BACKUP, oldValue, aFileBackup);
726     }
727 
728     /**
729      * Sets the fileFormatImage.
730      * <p>
731      * @param aFileFormatImage The fileFormatImage to set.
732      */
733     public void setFileFormatImage(String aFileFormatImage) {
734         String oldValue = getFileFormatImage();
735         this.fileFormatImage = aFileFormatImage;
736         firePropertyChange(PROPERTYNAME_FILE_FORMAT_IMAGE, oldValue, aFileFormatImage);
737     }
738 
739     /**
740      * Sets the fileFormatMusic.
741      * <p>
742      * @param aFileFormat The fileFormatMusic to set.
743      */
744     public void setFileFormatMusic(String aFileFormat) {
745         String oldValue = getFileFormatMusic();
746         this.fileFormatMusic = aFileFormat;
747         firePropertyChange(PROPERTYNAME_FILE_FORMAT_MUSIC, oldValue, aFileFormat);
748     }
749 
750     /**
751      * Sets the filter.
752      * <p>
753      * @param aFilter The filter to set.
754      */
755     public void setFilter(String aFilter) {
756         this.filter = aFilter;
757     }
758 
759     /**
760      * Sets the locale.
761      * <p>
762      * @param aLocale The locale to set.
763      */
764     public void setLocale(String aLocale) {
765         String oldValue = getLocale();
766         this.locale = aLocale;
767         firePropertyChange(PROPERTYNAME_LOCALE, oldValue, aLocale);
768 
769     }
770 
771     /**
772      * Sets the logLevel.
773      * <p>
774      * @param aLogLevel The logLevel to set.
775      */
776     public void setLogLevel(String aLogLevel) {
777         String oldValue = getLogLevel();
778         this.logLevel = aLogLevel;
779         firePropertyChange(PROPERTYNAME_LOG_LEVEL, oldValue, aLogLevel);
780     }
781 
782     /**
783      * Sets the newFileInDays.
784      * <p>
785      * @param aNewFileInDays The newFileInDays to set.
786      */
787     public void setNewFileInDays(int aNewFileInDays) {
788         int oldValue = getNewFileInDays();
789         this.newFileInDays = aNewFileInDays;
790         firePropertyChange(PROPERTYNAME_NEW_FILE_IN_DAYS, oldValue, aNewFileInDays);
791 
792     }
793 
794     /**
795      * Sets the playerBufferSize.
796      * <p>
797      * @param aPlayerBufferSize The playerBufferSize to set.
798      */
799     public void setPlayerBufferSize(int aPlayerBufferSize) {
800         int oldValue = getPlayerBufferSize();
801         this.playerBufferSize = aPlayerBufferSize;
802         firePropertyChange(PROPERTYNAME_PLAYER_BUFFER_SIZE, oldValue, aPlayerBufferSize);
803     }
804     
805     /**
806      * Sets the analyzerMode.
807      * <p>
808      * @param aAnalyzerMode The analyzerMode to set.
809      */
810     public void setAnalyzerMode(String aAnalyzerMode) {
811        String oldValue = getAnalyzerMode();
812        this.analyzerMode = aAnalyzerMode;
813        firePropertyChange(PROPERTYNAME_ANALYZER_MODE, oldValue, aAnalyzerMode);
814     }
815     /**AZ
816    * Sets the useCDNumber.
817      * <p>
818      * @param aUseCDNumber The useCDNumber to set.
819      */
820     public void setUseCDNumber(boolean aUseCDNumber) {
821         boolean oldValue = isUseCDNumber();
822         this.useCDNumber = aUseCDNumber;
823         firePropertyChange(PROPERTYNAME_USE_CD_NUMBER, oldValue, aUseCDNumber);
824     }
825     
826     /**AZ
827      * Sets the showDefaultTree.
828        * <p>
829        * @param aShowDefaultTree The showDefaultTree to set.
830        */
831       public void setShowDefaultTree(boolean aShowDefaultTree) {
832           boolean oldValue = isShowDefaultTree();
833           this.showDefaultTree = aShowDefaultTree;
834           firePropertyChange(PROPERTYNAME_SHOW_DEFAULT_TREE, oldValue, aShowDefaultTree);
835       }
836       
837       /**AZ
838        * Sets the showEmptyNode.
839          * <p>
840          * @param aShowEmptyNode The showEmptyNode to set.
841          */
842         public void setShowEmptyNode(boolean aShowEmptyNode) {
843             boolean oldValue = isShowEmptyNode();
844             this.showEmptyNode = aShowEmptyNode;
845             firePropertyChange(PROPERTYNAME_SHOW_EMPTY_NODE, oldValue, aShowEmptyNode);
846         }
847     
848     /** AZ
849      * Sets the imagesLocation.
850      * <p>
851      * @param aImagesLocation The imagesLocation to set.
852      */
853     public void setImagesLocation(File aImagesLocation) {
854         File oldValue = getImagesLocation();
855         this.imagesLocation = aImagesLocation;
856         firePropertyChange(PROPERTYNAME_IMAGES_LOCATION, oldValue, aImagesLocation);
857     }
858 
859     /**AZ
860      * Sets the copyImages.
861        * <p>
862        * @param aCopyImages The copyImages to set.
863        */
864     public void setCopyImagesToDirectory(boolean aCopyImages) {
865         boolean oldValue = isCopyImagesToDirectory();
866         this.copyImagesToDirectory = aCopyImages;
867         firePropertyChange(PROPERTYNAME_COPY_IMAGES, oldValue, aCopyImages);
868     }
869     /** AZ
870      * Sets the albumArtistTag
871      * <p>
872      * @param aAlbumArtistTag The albumArtistTag to set.
873      */
874     public void setAlbumArtistTag(String aAlbumArtistTag) {
875         String oldValue = getAlbumArtistTag();
876         this.albumArtistTag = aAlbumArtistTag;
877         firePropertyChange(PROPERTYNAME_ALBUM_ARTIST_TAG, oldValue, aAlbumArtistTag);
878     }
879        /**
880      * Sets the playlistType.
881      * <p>
882      * @param aPlaylistType The playlistType to set.
883      */
884     public void setPlaylistType(String aPlaylistType) {
885         String oldValue = getPlaylistType();
886         this.playlistType = aPlaylistType;
887         firePropertyChange(PROPERTYNAME_PLAYLIST_TYPE, oldValue, aPlaylistType);
888     }
889 
890     /**
891      * Sets the remoteDatabaseURL.
892      * <p>
893      * @param aRemoteDatabaseURL The remoteDatabaseURL to set.
894      */
895     public void setRemoteDatabaseURL(String aRemoteDatabaseURL) {
896         String oldValue = getRemoteDatabaseURL();
897         this.remoteDatabaseURL = aRemoteDatabaseURL;
898         firePropertyChange(PROPERTYNAME_REMOTE_DATABASE_URL, oldValue, aRemoteDatabaseURL);
899 
900     }
901 
902     /**
903      * Sets the rowColorEven.
904      * <p>
905      * @param aRowColorEven The rowColorEven to set.
906      */
907     public void setRowColorEven(Color aRowColorEven) {
908         Color oldValue = getRowColorEven();
909         this.rowColorEven = aRowColorEven;
910         firePropertyChange(PROPERTYNAME_ROW_COLOR_EVEN, oldValue, aRowColorEven);
911     }
912 
913     /**
914      * Sets the rowColorOdd.
915      * <p>
916      * @param aRowColorOdd The rowColorOdd to set.
917      */
918     public void setRowColorOdd(Color aRowColorOdd) {
919         Color oldValue = getRowColorOdd();
920         this.rowColorOdd = aRowColorOdd;
921         firePropertyChange(PROPERTYNAME_ROW_COLOR_ODD, oldValue, aRowColorOdd);
922     }
923 
924     /**
925      * Sets the startInDirectory.
926      * <p>
927      * @param aStartInDirectory The startInDirectory to set.
928      */
929     public void setStartInDirectory(File aStartInDirectory) {
930         File oldValue = getStartInDirectory();
931         startInDirectory = aStartInDirectory;
932         firePropertyChange(PROPERTYNAME_DIRECTORY_START_IN, oldValue, aStartInDirectory);
933     }
934 
935     /**
936      * Sets the updateTags.
937      * <p>
938      * @param aUpdateTags The updateTags to set.
939      */
940     public void setUpdateTags(boolean aUpdateTags) {
941         boolean oldValue = isUpdateTags();
942         this.updateTags = aUpdateTags;
943         firePropertyChange(PROPERTYNAME_UPDATE_TAGS, oldValue, aUpdateTags);
944     }
945     
946     /**AZ
947      * Gets the useCDNumber.
948      * <p>
949      * @return Returns the useCDNumber.
950      */
951     public boolean isUseCDNumber() {
952         return this.useCDNumber;
953     } 
954     
955     /** AZ
956      * Gets the showDefaultTree.
957      * <p>
958      * @return Returns the showDefaultTree.
959      */
960     public boolean isShowDefaultTree() {
961        return this.showDefaultTree;
962     }
963     
964     /** AZ
965      * Gets the showEmptyNode.
966      * <p>
967      * @return Returns the showEmptyNode.
968      */
969     public boolean isShowEmptyNode() {
970        return this.showEmptyNode;
971     }
972     
973     /**AZ
974      * Gets the copyImagesToDirectory.
975      * <p>
976      * @return Returns the copyImages.
977      */
978     public boolean isCopyImagesToDirectory() {
979         return this.copyImagesToDirectory;
980     }  
981 
982     /**
983      * Gets the auditInfo.
984      * <p>
985      * @return Returns the auditInfo.
986      */
987     public boolean isAuditInfo() {
988         return this.auditInfo;
989     }
990 
991     /**
992      * Gets the fadeInOnPlay.
993      * <p>
994      * @return Returns the fadeInOnPlay.
995      */
996     public boolean isFadeInOnPlay() {
997         return this.fadeInOnPlay;
998     }
999 
1000     /**
1001      * Gets the fadeOutOnChange.
1002      * <p>
1003      * @return Returns the fadeOutOnChange.
1004      */
1005     public boolean isFadeOutOnChange() {
1006         return this.fadeOutOnChange;
1007     }
1008 
1009     /**
1010      * Gets the fadeOutOnPause.
1011      * <p>
1012      * @return Returns the fadeOutOnPause.
1013      */
1014     public boolean isFadeOutOnPause() {
1015         return this.fadeOutOnPause;
1016     }
1017 
1018     /**
1019      * Gets the fadeOutOnStop.
1020      * <p>
1021      * @return Returns the fadeOutOnStop.
1022      */
1023     public boolean isFadeOutOnStop() {
1024         return this.fadeOutOnStop;
1025     }
1026 
1027     /**
1028      * Gets the updateTags.
1029      * <p>
1030      * @return Returns the updateTags.
1031      */
1032     public boolean isUpdateTags() {
1033         return this.updateTags;
1034     }
1035 
1036     /**
1037      * Sets the player volume
1038      * <p>
1039      * @param volume in the range 0 <--> 1
1040      */
1041     public void setPlayerVolume(float volume) {
1042     	if (volume > 1) {
1043     		volume = 1;
1044     	} else if (volume < 0) {
1045     		volume = 0;
1046     	}
1047     	this.playerVolume = volume;
1048     }
1049     
1050     /**
1051      * Gets the player volume
1052      * <p>
1053      */
1054     public float getPlayerVolume() {
1055     	return this.playerVolume;
1056     }
1057     
1058     /**
1059      * Restores the persistent properties from the specified Preferences.
1060      *
1061      * @param prefs   the Preferences object that holds the property values
1062      */
1063     public void restoreFrom(Preferences prefs) {
1064         setFadeInOnPlay(prefs.getBoolean(KEY_FADE_IN_ON_PLAY, DEFAULT_FADING));
1065         setFadeOutOnChange(prefs.getBoolean(KEY_FADE_OUT_ON_CHANGE, DEFAULT_FADING));
1066         setFadeOutOnPause(prefs.getBoolean(KEY_FADE_OUT_ON_PAUSE, DEFAULT_FADING));
1067         setFadeOutOnStop(prefs.getBoolean(KEY_FADE_OUT_ON_STOP, DEFAULT_FADING));
1068         setUpdateTags(prefs.getBoolean(KEY_UPDATE_TAGS, DEFAULT_UPDATE_TAGS));
1069         setStartInDirectory(new File(prefs.get(KEY_DIRECTORY_START_IN, DEFAULT_DIRECTORY_START_IN.getAbsolutePath())));
1070         setDatabaseLocation(new File(prefs.get(KEY_DIRECTORY_DB_LOCATION,
1071                                                DEFAULT_DIRECTORY_DB_LOCATION.getAbsolutePath())));
1072         setFileBackup(new File(prefs.get(KEY_FILE_BACKUP, DEFAULT_FILE_BACKUP.getAbsolutePath())));
1073         setFileFormatMusic(prefs.get(KEY_FILE_FORMAT_MUSIC, DEFAULT_FILE_FORMAT_MUSIC));
1074         setFileFormatImage(prefs.get(KEY_FILE_FORMAT_IMAGE, DEFAULT_FILE_FORMAT_IMAGE));
1075         setNewFileInDays(prefs.getInt(KEY_NEW_FILE_IN_DAYS, DEFAULT_NEW_FILE_IN_DAYS));
1076         setAnalyzerMode(prefs.get(KEY_ANALYZER_MODE, DEFAULT_ANALYZER_MODE));
1077         setDisplayFormatDisc(prefs.get(KEY_DISPLAY_FORMAT_DISC, DEFAULT_DISPLAY_FORMAT_DISC));
1078         setDisplayFormatTrack(prefs.get(KEY_DISPLAY_FORMAT_TRACK, DEFAULT_DISPLAY_FORMAT_TRACK));
1079         setLocale(prefs.get(KEY_LOCALE, DEFAULT_LOCALE));
1080         setRowColorEven(new Color(prefs.getInt(KEY_ROW_COLOR_EVEN, DEFAULT_ROW_COLOR_EVEN.getRGB())));
1081         setRowColorOdd(new Color(prefs.getInt(KEY_ROW_COLOR_ODD, DEFAULT_ROW_COLOR_ODD.getRGB())));
1082         setPlaylistType(prefs.get(KEY_PLAYLIST_TYPE, DEFAULT_PLAYLIST_TYPE));
1083         setLogLevel(prefs.get(KEY_LOG_LEVEL, DEFAULT_LOG_LEVEL));
1084         setPlayerBufferSize(prefs.getInt(KEY_PLAYER_BUFFER_SIZE, DEFAULT_PLAYER_BUFFER_SIZE));
1085         setAuditInfo(prefs.getBoolean(KEY_AUDIT_INFO, DEFAULT_AUDIT_INFO));
1086         setCoverSizeSmall(prefs.getInt(KEY_COVER_SIZE_SMALL, DEFAULT_COVER_SIZE_SMALL));
1087         setCoverSizeLarge(prefs.getInt(KEY_COVER_SIZE_LARGE, DEFAULT_COVER_SIZE_LARGE));
1088         setRemoteDatabaseURL(prefs.get(KEY_REMOTE_DATABASE_URL, DEFAULT_REMOTE_DATABASE_URL));
1089         setCatalogScrollUnits(prefs.getInt(KEY_CATALOG_SCROLL_UNITS, DEFAULT_CATALOG_SCROLL_UNITS));
1090         /** AZ **/
1091         setUseCDNumber(prefs.getBoolean(KEY_USE_CD_NUMBER, DEFAULT_USE_CD_NUMBER));
1092         setAlbumArtistTag(prefs.get(KEY_ALBUM_ARTIST_TAG, DEFAULT_ALBUM_ARTIST_TAG));
1093         setCopyImagesToDirectory(prefs.getBoolean(KEY_COPY_IMAGES, DEFAULT_COPY_IMAGES));
1094         setImagesLocation(new File(prefs.get(KEY_IMAGES_LOCATION, DEFAULT_IMAGES_LOCATION.getAbsolutePath())));
1095         setShowDefaultTree(prefs.getBoolean(KEY_SHOW_DEFAULT_TREE, DEFAULT_SHOW_DEFAULT_TREE));      
1096         setShowEmptyNode(prefs.getBoolean(KEY_SHOW_EMPTY_NODE, DEFAULT_SHOW_EMPTY_NODE));
1097         setPlayerVolume(prefs.getFloat(KEY_PLAYER_VOLUME, DEFAULT_KEY_PLAYER_VOLUME));
1098       }
1099 
1100     /**
1101      * Stores the persistent properties in the specified Preferences.
1102      *
1103      * @param prefs   the Preferences object that holds the property values
1104      */
1105     void storeIn(Preferences prefs) {
1106         prefs.putBoolean(KEY_FADE_IN_ON_PLAY, isFadeInOnPlay());
1107         prefs.putBoolean(KEY_FADE_OUT_ON_STOP, isFadeOutOnStop());
1108         prefs.putBoolean(KEY_FADE_OUT_ON_PAUSE, isFadeOutOnPause());
1109         prefs.putBoolean(KEY_FADE_OUT_ON_CHANGE, isFadeOutOnChange());
1110         prefs.putBoolean(KEY_UPDATE_TAGS, isUpdateTags());
1111         prefs.put(KEY_DIRECTORY_START_IN, getStartInDirectory().getAbsolutePath());
1112         prefs.put(KEY_DIRECTORY_DB_LOCATION, getDatabaseLocation().getAbsolutePath());
1113         prefs.put(KEY_FILE_BACKUP, getFileBackup().getAbsolutePath());
1114         prefs.put(KEY_FILE_FORMAT_MUSIC, getFileFormatMusic());
1115         prefs.put(KEY_FILE_FORMAT_IMAGE, getFileFormatImage());
1116         prefs.putInt(KEY_NEW_FILE_IN_DAYS, getNewFileInDays());
1117         prefs.put(KEY_ANALYZER_MODE, getAnalyzerMode());
1118         prefs.put(KEY_DISPLAY_FORMAT_DISC, getDisplayFormatDisc());
1119         prefs.put(KEY_DISPLAY_FORMAT_TRACK, getDisplayFormatTrack());
1120         prefs.put(KEY_LOCALE, getLocale());
1121         prefs.putInt(KEY_ROW_COLOR_EVEN, getRowColorEven().getRGB());
1122         prefs.putInt(KEY_ROW_COLOR_ODD, getRowColorOdd().getRGB());
1123         prefs.put(KEY_PLAYLIST_TYPE, getPlaylistType());
1124         prefs.put(KEY_LOG_LEVEL, getLogLevel());
1125         prefs.putInt(KEY_PLAYER_BUFFER_SIZE, getPlayerBufferSize());
1126         prefs.putBoolean(KEY_AUDIT_INFO, isAuditInfo());
1127         prefs.putInt(KEY_COVER_SIZE_SMALL, getCoverSizeSmall());
1128         prefs.putInt(KEY_COVER_SIZE_LARGE, getCoverSizeLarge());
1129         prefs.put(KEY_REMOTE_DATABASE_URL, getRemoteDatabaseURL());
1130         prefs.putInt(KEY_CATALOG_SCROLL_UNITS, getCatalogScrollUnits());
1131         /** AZ  **/
1132         prefs.putBoolean(KEY_USE_CD_NUMBER, isUseCDNumber());
1133         prefs.put(KEY_ALBUM_ARTIST_TAG, getAlbumArtistTag());
1134         prefs.putBoolean(KEY_COPY_IMAGES, isCopyImagesToDirectory());
1135         prefs.put(KEY_IMAGES_LOCATION, getImagesLocation().getAbsolutePath());
1136         prefs.putBoolean(KEY_SHOW_DEFAULT_TREE, isShowDefaultTree());
1137         prefs.putBoolean(KEY_SHOW_EMPTY_NODE, isShowEmptyNode());   
1138         prefs.putFloat(KEY_PLAYER_VOLUME, playerVolume);
1139      }
1140  
1141 
1142 }