/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/FantasiaPrefs.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/fantasia/FantasiaPrefs.java

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

revision 1284 by iliev, Mon Apr 2 21:18:31 2007 UTC revision 1285 by iliev, Fri Aug 10 19:55:03 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-2006 Grigor Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 24  package org.jsampler.view.fantasia; Line 24  package org.jsampler.view.fantasia;
24    
25  import java.util.prefs.Preferences;  import java.util.prefs.Preferences;
26    
27    import org.jsampler.view.std.StdPrefs;
28    
29    
30  /**  /**
31   *   *
32   * @author Grigor Iliev   * @author Grigor Iliev
33   */   */
34  public class FantasiaPrefs {  public class FantasiaPrefs extends StdPrefs {
35          private final static String prefNode = "org.jsampler.view.fantasia";          /** Property which specifies whether to use animation effects. */
36          private final static Preferences userPrefs = Preferences.userRoot().node(prefNode);          public final static String ANIMATED = "animated";
37                    
38          private final static String WINDOW_LOCATION = "Mainframe.sizeAndLocation";          private final static String WINDOW_LOCATION = "Mainframe.sizeAndLocation";
39          private final static String DEF_WINDOW_LOCATION = null;          private final static String DEF_WINDOW_LOCATION = null;
40                    
41          private final static String ALWAYS_ON_TOP = "AlwaysOnTop";          private final static FantasiaPrefs prefs = new FantasiaPrefs();
         private final static boolean DEF_ALWAYS_ON_TOP = false;  
           
           
42                    
43                    
44          /** Forbits instantiation of <code>FantasiaPrefs</code>. */          /** Forbits instantiation of <code>FantasiaPrefs</code>. */
45          private FantasiaPrefs() {          private
46          }          FantasiaPrefs() { super("org.jsampler.view.fantasia"); }
47                    
48          public static Preferences          public static FantasiaPrefs
49          user() { return userPrefs; }          preferences() { return prefs; }
50                    
51          /**          /**
52           * Gets a string representation of the main window's location.           * Gets a string representation of the main window's location.
# Line 55  public class FantasiaPrefs { Line 55  public class FantasiaPrefs {
55           * @return A string representation of the main window's location,           * @return A string representation of the main window's location,
56           * or <code>null</code> if the value is not set.           * or <code>null</code> if the value is not set.
57           */           */
58          public static String          public String
59          getWindowLocation() {          getWindowLocation() {
60                  return user().get(WINDOW_LOCATION, DEF_WINDOW_LOCATION);                  return getStringProperty(WINDOW_LOCATION, DEF_WINDOW_LOCATION);
61          }          }
62                    
63          /**          /**
64           * Sets the main window's ocation.           * Sets the main window's location.
65           * Use <code>null</code> to remove the current value.           * Use <code>null</code> to remove the current value.
66           * @param s A string representation of the main window'socation.           * @param s A string representation of the main window'socation.
67           * @see #getWindowLocation           * @see #getWindowLocation
68           */           */
69          public static void          public void
70          setWindowLocation(String s) {          setWindowLocation(String s) {
71                  if(s == null) {                  setStringProperty(WINDOW_LOCATION, s);
                         user().remove(WINDOW_LOCATION);  
                         return;  
                 }  
                   
                 user().put(WINDOW_LOCATION, s);  
72          }          }
73                    
74          /**          public int
75           * Determines whether the main window should be always-on-top window.          getDefaultIntValue(String name) {
76           * @return <code>true</code> if the main window should be always-on-top window,                  if(name == LS_CONSOLE_BACKGROUND_COLOR) return 0x626262;
77           * <code>false</code> otherwise.                  if(name == LS_CONSOLE_TEXT_COLOR) return 0xb4b4b4;
78           */                  if(name == LS_CONSOLE_NOTIFY_COLOR) return 0x848484;
79          public static boolean                  if(name == LS_CONSOLE_WARNING_COLOR) return 0xf19e0e;
80          isAlwaysOnTop() {                  if(name == LS_CONSOLE_ERROR_COLOR) return 0xfa4a1f;
81                  return user().getBoolean(ALWAYS_ON_TOP, DEF_ALWAYS_ON_TOP);                  
82                    return super.getDefaultIntValue(name);
83          }          }
84                    
85          /**          public boolean
86           * Sets whether the main window should be always-on-top window.          getDefaultBoolValue(String name) {
87           * @param b If <code>true</code> the main window should be always-on-top window.                  if(name == ANIMATED) return true;
88           */                  
89          public static void                  return super.getDefaultBoolValue(name);
         setAlwaysOnTop(boolean b) {  
                 if(b == isAlwaysOnTop()) return;  
                 user().putBoolean(ALWAYS_ON_TOP, b);  
90          }          }
           
           
91  }  }

Legend:
Removed from v.1284  
changed lines
  Added in v.1285

  ViewVC Help
Powered by ViewVC