View Javadoc

1   package com.melloware.jukes.gui.tool;
2   
3   
4   import org.apache.log4j.Level;
5   
6   import com.l2fprod.common.beans.BaseBeanInfo;
7   import com.l2fprod.common.beans.ExtendedPropertyDescriptor;
8   import com.l2fprod.common.beans.editor.ComboBoxPropertyEditor;
9   import com.l2fprod.common.beans.editor.DirectoryPropertyEditor;
10  import com.l2fprod.common.beans.editor.FilePropertyEditor;
11  import com.l2fprod.common.beans.editor.IntegerPropertyEditor;
12  import com.melloware.jukes.file.filter.PlaylistFilter;
13  import com.melloware.jukes.gui.view.component.SpectrumTimeAnalyzer;
14  
15  /**
16   * Static class used to represent settings in property sheet.
17   * <p>
18   * Copyright (c) 1999-2007 Melloware, Inc. <http://www.melloware.com>
19   * @author Emil A. Lefkof III <info@melloware.com>
20   * @version 4.0
21   * AZ - modifications 2009
22   */
23  public class SettingsBeanInfo
24      extends BaseBeanInfo {
25  	
26  	private static final String[] LOG_LEVELS = new String[] { Level.DEBUG.toString(), Level.INFO.toString(), Level.WARN.toString(), Level.ERROR.toString() };
27      private static final String[] ANALYZER_MODES = new String[] { SpectrumTimeAnalyzer.OFF, SpectrumTimeAnalyzer.ANALYZER, SpectrumTimeAnalyzer.SCOPE };
28  	private static final String DATABASE = "Database";
29  	private static final String DISPLAY = "Display";
30  	private static final String FILES = "Files and Directories";
31  	private static final String PLAYER = "Player";
32  	private static final String TAGS = "Tags"; //AZ
33  	
34  
35      public SettingsBeanInfo() {
36          super(Settings.class);
37          ExtendedPropertyDescriptor descriptor = null;
38          
39          descriptor = addProperty("databaseLocation");
40          descriptor.setCategory(DATABASE);
41          descriptor.setDisplayName("Local Database Location");
42          descriptor.setShortDescription(Resources.getString("label.databaseLocation"));
43          descriptor.setPropertyEditorClass(DirectoryPropertyEditor.class);
44          
45          descriptor = addProperty("remoteDatabaseURL");
46          descriptor.setCategory(DATABASE);
47          descriptor.setDisplayName("Remote Database URL");
48          descriptor.setShortDescription(Resources.getString("label.remoteDatabaseURL"));
49          
50          descriptor = addProperty("displayFormatDisc");
51          descriptor.setCategory(DISPLAY);
52          descriptor.setDisplayName("Disc Display Format");
53          descriptor.setShortDescription(Resources.getString("label.displayFormatDisc"));
54  
55          descriptor = addProperty("displayFormatTrack");
56          descriptor.setCategory(DISPLAY);
57          descriptor.setDisplayName("Track Display Format");
58          descriptor.setShortDescription(Resources.getString("label.displayFormatTrack"));
59  
60          descriptor = addProperty("newFileInDays");
61          descriptor.setCategory(DISPLAY);
62          descriptor.setDisplayName("New File Marker (in days)");
63          descriptor.setShortDescription(Resources.getString("label.newFileInDays"));
64          
65          descriptor = addProperty("catalogScrollUnits");
66          descriptor.setCategory(DISPLAY);
67          descriptor.setDisplayName("Catalog Scroll Units");
68          descriptor.setShortDescription(Resources.getString("label.catalogScrollUnits"));
69          
70          descriptor = addProperty("auditInfo");
71          descriptor.setCategory(DISPLAY);
72          descriptor.setDisplayName("Audit Information");
73          descriptor.setShortDescription(Resources.getString("label.auditInfo"));
74          
75          descriptor = addProperty("coverSizeSmall");
76          descriptor.setCategory(DISPLAY);
77          descriptor.setDisplayName("Cover Size Small (in pixels)");
78          descriptor.setShortDescription(Resources.getString("label.coverSizeSmall"));
79          
80          descriptor = addProperty("coverSizeLarge");
81          descriptor.setCategory(DISPLAY);
82          descriptor.setDisplayName("Cover Size Large (in pixels)");
83          descriptor.setShortDescription(Resources.getString("label.coverSizeLarge"));
84          
85          descriptor = addProperty("rowColorEven");
86          descriptor.setCategory(DISPLAY);
87          descriptor.setDisplayName("Row Color Even");
88          descriptor.setShortDescription(Resources.getString("label.rowColorEven"));
89          
90          descriptor = addProperty("rowColorOdd");
91          descriptor.setCategory(DISPLAY);
92          descriptor.setDisplayName("Row Color Odd");
93          descriptor.setShortDescription(Resources.getString("label.rowColorOdd"));
94          
95          /**
96           * AZ - showDefaultTree
97           */
98          descriptor = addProperty("showDefaultTree");
99          descriptor.setCategory(DISPLAY);
100         descriptor.setDisplayName("Show Main Tree by Default");
101         descriptor.setShortDescription(Resources.getString("label.showDefaultTree"));
102  
103         /**
104          * AZ - showEmptyNode
105          */
106         descriptor = addProperty("showEmptyNode");
107         descriptor.setCategory(DISPLAY);
108         descriptor.setDisplayName("Show Empty Nodes in the Tree");
109         descriptor.setShortDescription(Resources.getString("label.showEmptyNode"));
110  
111         /**
112          * AZ - useCDNumber
113          */
114         descriptor = addProperty("useCDNumber");
115         descriptor.setCategory(TAGS);
116         descriptor.setDisplayName("Use CD Number");
117         descriptor.setShortDescription(Resources.getString("label.useCDNumber"));
118         
119         /**
120          * AZ - albumArtistTag
121          */
122         descriptor = addProperty("albumArtistTag");
123         descriptor.setCategory(TAGS);
124         descriptor.setDisplayName("Album Artist TAG");
125         descriptor.setShortDescription(Resources.getString("label.albumArtistTag"));
126         /**
127          * AZ - update TAGs in music files
128          */
129         descriptor = addProperty("updateTags");
130         descriptor.setCategory(TAGS);
131         descriptor.setDisplayName("Update audio tags in files");
132         descriptor.setShortDescription(Resources.getString("label.updateTags"));
133         
134         descriptor = addProperty("startInDirectory");
135         descriptor.setCategory(FILES);
136         descriptor.setDisplayName("Music Directory");
137         descriptor.setShortDescription(Resources.getString("label.startInDirectory"));
138         descriptor.setPropertyEditorClass(DirectoryPropertyEditor.class);
139 
140         descriptor = addProperty("fileFormatMusic");
141         descriptor.setCategory(FILES);
142         descriptor.setDisplayName("File Format Music");
143         descriptor.setShortDescription(Resources.getString("label.fileFormatMusic"));
144         
145         descriptor = addProperty("fileFormatImage");
146         descriptor.setCategory(FILES);
147         descriptor.setDisplayName("File Format Image");
148         descriptor.setShortDescription(Resources.getString("label.fileFormatImage"));
149         
150         descriptor = addProperty("playlistType");
151         descriptor.setCategory(FILES);
152         descriptor.setDisplayName("Default Playlist Type");
153         descriptor.setShortDescription(Resources.getString("label.playlistType"));
154         descriptor.setPropertyEditorClass(PlaylistTypeEditor.class);
155         
156         descriptor = addProperty("fileBackup");
157         descriptor.setCategory(FILES);
158         descriptor.setDisplayName("Backup File");
159         descriptor.setShortDescription(Resources.getString("label.fileBackup"));
160         descriptor.setPropertyEditorClass(FilePropertyEditor.class);
161         
162         descriptor = addProperty("logLevel");
163         descriptor.setCategory(FILES);
164         descriptor.setDisplayName("Logfile Level");
165         descriptor.setShortDescription(Resources.getString("label.logLevel"));
166         descriptor.setPropertyEditorClass(LogLevelTypeEditor.class);
167     
168         /**
169          * AZ - copyImages
170          */
171         descriptor = addProperty("copyImagesToDirectory");
172         descriptor.setCategory(FILES);
173         descriptor.setDisplayName("Copy Images");
174         descriptor.setShortDescription(Resources.getString("label.copyImagesToDirectory"));
175 
176         /**
177          * AZ - imagesLocation
178          */
179         descriptor = addProperty("imagesLocation");
180         descriptor.setCategory(FILES);
181         descriptor.setDisplayName("Images Directory");
182         descriptor.setShortDescription(Resources.getString("label.imagesLocation"));
183         descriptor.setPropertyEditorClass(DirectoryPropertyEditor.class);
184 
185         descriptor = addProperty("analyzerMode");
186         descriptor.setCategory(PLAYER);
187         descriptor.setDisplayName("Spectrum Analyzer Mode");
188         descriptor.setShortDescription(Resources.getString("label.analyzerMode"));
189         descriptor.setPropertyEditorClass(SpectrumAnalyzerTypeEditor.class);
190         
191         descriptor = addProperty("playerBufferSize");
192         descriptor.setCategory(PLAYER);
193         descriptor.setDisplayName("Buffer Size (in bytes)");
194         descriptor.setShortDescription(Resources.getString("label.playerBufferSize"));
195         descriptor.setPropertyEditorClass(IntegerPropertyEditor.class);
196         
197         descriptor = addProperty("fadeInOnPlay");
198         descriptor.setCategory(PLAYER);
199         descriptor.setDisplayName("Fade In On Play");
200         descriptor.setShortDescription(Resources.getString("label.fadeInOnPlay"));
201         
202         descriptor = addProperty("fadeOutOnChange");
203         descriptor.setCategory(PLAYER);
204         descriptor.setDisplayName("Fade Out On Change");
205         descriptor.setShortDescription(Resources.getString("label.fadeOutOnChange"));
206         
207         descriptor = addProperty("fadeOutOnPause");
208         descriptor.setCategory(PLAYER);
209         descriptor.setDisplayName("Fade Out On Pause");
210         descriptor.setShortDescription(Resources.getString("label.fadeOutOnPause"));
211         
212         descriptor = addProperty("fadeOutOnStop");
213         descriptor.setCategory(PLAYER);
214         descriptor.setDisplayName("Fade Out On Stop");
215         descriptor.setShortDescription(Resources.getString("label.fadeOutOnStop"));
216     }
217     
218     /**
219      * Class used to pick playlist types from a combo box
220      */
221     public static class PlaylistTypeEditor extends ComboBoxPropertyEditor {
222   	  public PlaylistTypeEditor() {
223   	    super();	    
224   	    setAvailableValues(PlaylistFilter.EXTENSIONS);
225   	  }
226   	}
227     
228     /**
229      * Class used to pick log levels for output
230      */
231     public static class LogLevelTypeEditor extends ComboBoxPropertyEditor {
232   	  public LogLevelTypeEditor() {
233   	    super();
234   	    setAvailableValues(LOG_LEVELS);
235   	  }
236   	}
237     
238     /**
239      * Class used to pick Spectrum Analyzer Levels.
240      */
241     public static class SpectrumAnalyzerTypeEditor extends ComboBoxPropertyEditor {
242      public SpectrumAnalyzerTypeEditor() {
243        super();
244        setAvailableValues(ANALYZER_MODES);
245      }
246    }
247 }