/[svn]/jsampler/trunk/src/org/jsampler/Prefs.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/Prefs.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 911 by iliev, Mon Aug 7 18:25:58 2006 UTC revision 1329 by iliev, Sat Sep 8 18:33:05 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005 Grigor Kirilov Iliev   *   Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 35  public class Prefs { Line 35  public class Prefs {
35          private final static String VIEW = "VIEW";          private final static String VIEW = "VIEW";
36          private final static String DEF_VIEW = "classic";          private final static String DEF_VIEW = "classic";
37                    
38            private final static String JSAMPLER_HOME = "JSampler.home";
39            private final static String DEF_JSAMPLER_HOME = null;
40            
41          private final static String INTERFACE_LANGUAGE = "iface.language";          private final static String INTERFACE_LANGUAGE = "iface.language";
42          private final static String DEF_INTERFACE_LANGUAGE = "en";          private final static String DEF_INTERFACE_LANGUAGE = "en";
43                    
# Line 50  public class Prefs { Line 53  public class Prefs {
53          private final static String LS_PORT = "LinuxSampler.port";          private final static String LS_PORT = "LinuxSampler.port";
54          private final static int DEF_LS_PORT = 8888;          private final static int DEF_LS_PORT = 8888;
55                    
         private final static String ORCHESTRAS = "Orchestras";  
         private final static String DEF_ORCHESTRAS = null;  
           
56                                    
57          private static Preferences userPrefs = Preferences.userRoot().node(prefNode);          private static Preferences userPrefs = Preferences.userRoot().node(prefNode);
58                    
# Line 157  public class Prefs { Line 157  public class Prefs {
157    
158  // PREFERENCES  // PREFERENCES
159          /**          /**
160             * Gets the absolute path of JSampler home directory.
161             * @return The absolute path of JSampler home directory or
162             * <code>null</code> if the JSampler home directory is not set.
163             */
164            public static String
165            getJSamplerHome() { return user().get(JSAMPLER_HOME, DEF_JSAMPLER_HOME); }
166            
167            /**
168             * Sets the JSampler home directory.
169             * @param home The absolute path of JSampler home directory.
170             * @return <code>true</code> if the JSampler home directory has
171             * been changed and <code>false</code> otherwise.
172             */
173            public static boolean
174            setJSamplerHome(String home) {
175                    if(home == null) {
176                            if(getJSamplerHome() == null) return false;
177                            user().remove(JSAMPLER_HOME);
178                            return true;
179                    } else if(!home.equals(getJSamplerHome())) {
180                            user().put(JSAMPLER_HOME, home);
181                            return true;
182                    }
183                    return false;
184            }
185            
186            /**
187           * Gets the LinuxSampler address.           * Gets the LinuxSampler address.
188           * @return The LinuxSampler address.           * @return The LinuxSampler address.
189           */           */
# Line 191  public class Prefs { Line 218  public class Prefs {
218                  if(port == -1) user().remove(LS_PORT);                  if(port == -1) user().remove(LS_PORT);
219                  else if(port != getLSPort()) user().putInt(LS_PORT, port);                  else if(port != getLSPort()) user().putInt(LS_PORT, port);
220          }          }
           
         /**  
          * Gets the orchestras' content (in XML format).  
          * @return The orchestras' content (in XML format).  
          */  
         public static String  
         getOrchestras() { return user().get(ORCHESTRAS, DEF_ORCHESTRAS); }  
           
         /**  
          * Sets the orchestras' content (in XML format).  
          * @param s The orchestras' content (in XML format).  
          */  
         public static void  
         setOrchestras(String s) {  
                 if(s == null) {  
                         user().remove(ORCHESTRAS);  
                         return;  
                 }  
                 if(s.equals(getOrchestras())) return;  
                   
                 user().put(ORCHESTRAS, s);  
         }  
221  }  }

Legend:
Removed from v.911  
changed lines
  Added in v.1329

  ViewVC Help
Powered by ViewVC