/[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 910 by iliev, Thu Mar 16 18:08:34 2006 UTC revision 911 by iliev, Mon Aug 7 18:25:58 2006 UTC
# Line 32  import java.util.prefs.Preferences; Line 32  import java.util.prefs.Preferences;
32  public class Prefs {  public class Prefs {
33          private final static String prefNode = "org.jsampler";          private final static String prefNode = "org.jsampler";
34                    
         private final static String WINDOW_SIZE_AND_LOCATION = "Mainframe.sizeAndLocation";  
         private final static String DEF_WINDOW_SIZE_AND_LOCATION = null;  
           
         private final static String WINDOW_MAXIMIZED = "Mainframe.maximized";  
         private final static boolean DEF_WINDOW_MAXIMIZED = false;  
           
         private final static String SAVE_WINDOW_PROPERTIES = "Mainframe.saveProperties";  
         private final static boolean DEF_SAVE_WINDOW_PROPERTIES = true;  
           
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                    
# Line 59  public class Prefs { Line 50  public class Prefs {
50          private final static String LS_PORT = "LinuxSampler.port";          private final static String LS_PORT = "LinuxSampler.port";
51          private final static int DEF_LS_PORT = 8888;          private final static int DEF_LS_PORT = 8888;
52                    
53            private final static String ORCHESTRAS = "Orchestras";
54            private final static String DEF_ORCHESTRAS = null;
55                    
56                            
57          private static Preferences userPrefs = Preferences.userRoot().node(prefNode);          private static Preferences userPrefs = Preferences.userRoot().node(prefNode);
58                    
59          /**          /**
# Line 70  public class Prefs { Line 63  public class Prefs {
63          private static Preferences          private static Preferences
64          user() { return userPrefs; }          user() { return userPrefs; }
65                    
         /**  
          * Gets a string representation of the main window's size and location.  
          * The string representation is a comma-separated list  
          * of x and y coordinates, and width and height of the window.  
          * @return A string representation of the main window's size and location,  
          * or <code>null</code> if the value is not set.  
          */  
         public static String  
         getWindowSizeAndLocation() {  
                 return user().get(WINDOW_SIZE_AND_LOCATION, DEF_WINDOW_SIZE_AND_LOCATION);  
         }  
           
         /**  
          * Sets the main window's size and location.  
          * Use <code>null</code> to remove the current value.  
          * @param s A string representation of the main window's size and location.  
          */  
         public static void  
         setWindowSizeAndLocation(String s) {  
                 if(s == null) {  
                         user().remove(WINDOW_SIZE_AND_LOCATION);  
                         return;  
                 }  
                   
                 user().put(WINDOW_SIZE_AND_LOCATION, s);  
         }  
           
         /**  
          * Determines whether the main window should be maximized.  
          * @return <code>true</code> if the main window should be maximized,  
          * <code>false</code> otherwise.  
          */  
         public static boolean  
         getWindowMaximized() {  
                 return user().getBoolean(WINDOW_MAXIMIZED, DEF_WINDOW_MAXIMIZED);  
         }  
           
         /**  
          * Sets whether the main window should be maximized.  
          * @param b If <code>true</code> the main window should be maximized.  
          */  
         public static void  
         setWindowMaximized(boolean b) {  
                 if(b == getWindowMaximized()) return;  
                 user().putBoolean(WINDOW_MAXIMIZED, b);  
         }  
           
         /**  
          * Determines whether the window properties (like size and location) should be saved.  
          * @return <code>true</code> if the window properties should be saved,  
          * <code>false</code> otherwise.  
          */  
         public static boolean  
         getSaveWindowProperties() {  
                 return user().getBoolean(SAVE_WINDOW_PROPERTIES, DEF_SAVE_WINDOW_PROPERTIES);  
         }  
           
         /**  
          * Sets whether the window properties (like size and location) should be saved.  
          * @param b If <code>true</code> the window properties will be saved.  
          */  
         public static void  
         setSaveWindowProperties(boolean b) {  
                 if(b == getSaveWindowProperties()) return;  
                 user().putBoolean(SAVE_WINDOW_PROPERTIES, b);  
         }  
66                    
67  // VIEW  // VIEW
68          /**          /**
# Line 264  public class Prefs { Line 191  public class Prefs {
191                  if(port == -1) user().remove(LS_PORT);                  if(port == -1) user().remove(LS_PORT);
192                  else if(port != getLSPort()) user().putInt(LS_PORT, port);                  else if(port != getLSPort()) user().putInt(LS_PORT, port);
193          }          }
194            
195            /**
196             * Gets the orchestras' content (in XML format).
197             * @return The orchestras' content (in XML format).
198             */
199            public static String
200            getOrchestras() { return user().get(ORCHESTRAS, DEF_ORCHESTRAS); }
201            
202            /**
203             * Sets the orchestras' content (in XML format).
204             * @param s The orchestras' content (in XML format).
205             */
206            public static void
207            setOrchestras(String s) {
208                    if(s == null) {
209                            user().remove(ORCHESTRAS);
210                            return;
211                    }
212                    if(s.equals(getOrchestras())) return;
213                    
214                    user().put(ORCHESTRAS, s);
215            }
216  }  }

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

  ViewVC Help
Powered by ViewVC