Package java.util.prefs

Examples of java.util.prefs.Preferences.sync()


    public void testCreateAndSetDouble() throws BackingStoreException
    {
        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
        Preferences testNode = prefs.node( "testNode" );
        testNode.putDouble( "cn", 3.14 );
        testNode.sync();
        testNode = prefs.node( "testNode" );
        assertTrue( 3.14 == testNode.getDouble( "cn", 9.20 ) );
    }

View Full Code Here


    public void testCreateAndSetFloat() throws BackingStoreException
    {
        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
        Preferences testNode = prefs.node( "testNode" );
        testNode.putFloat( "cn", ( float ) 9.20 );
        testNode.sync();
        testNode = prefs.node( "testNode" );
        assertTrue( ( float ) 9.20 == testNode.getFloat( "cn", ( float ) 9.20 ) );
    }

View Full Code Here

    public void testCreateAndSetInt() throws BackingStoreException
    {
        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
        Preferences testNode = prefs.node( "testNode" );
        testNode.putInt( "cn", 345 );
        testNode.sync();
        testNode = prefs.node( "testNode" );
        assertTrue( 345 == testNode.getInt( "cn", 345 ) );
    }

View Full Code Here

    public void testCreateAndSetLong() throws BackingStoreException
    {
        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
        Preferences testNode = prefs.node( "testNode" );
        testNode.putLong( "cn", 75449559185447L );
        testNode.sync();
        testNode = prefs.node( "testNode" );
        assertTrue( 75449559185447L == testNode.getLong( "cn", 75449559185447L ) );
    }

View Full Code Here

        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
        Preferences testNode = prefs.node( "testNode" );

        testNode.put( "cn", "testNodeValue" );
        testNode.putInt( "roomNumber", 345 );
        testNode.sync();

        testNode = prefs.node( "testNode" );
        assertEquals( 345, testNode.getInt( "roomNumber", 87 ) );
        testNode.remove( "cn" );
        testNode.remove( "roomNumber" );
View Full Code Here

        testNode = prefs.node( "testNode" );
        assertEquals( 345, testNode.getInt( "roomNumber", 87 ) );
        testNode.remove( "cn" );
        testNode.remove( "roomNumber" );
        testNode.sync();

        assertEquals( "no value", testNode.get( "cn", "no value" ) );
        assertEquals( "no value", testNode.get( "roomNumber", "no value" ) );
    }
}
View Full Code Here

        p.addNodeChangeListener(null);
        p.addPreferenceChangeListener(null);
        p.removeNodeChangeListener(null);
        p.removePreferenceChangeListener(null);
        try {
            p.sync();
        } catch (BackingStoreException e3) {
        }
        p.toString();
    }
View Full Code Here

  public static void putLastSaveFilePath(String path) {
    try {
      Preferences prefs = getPreferences();
      prefs.put(KEY_LAST_SAVE_FILE_PATH, path);
      prefs.sync();
    } catch (Exception anyEx) {
      /* do nothing, no preferences */
    }
  }

 
View Full Code Here

  public static void putFlattenPackage(boolean value) {
    try {
      Preferences prefs = getPreferences();
      prefs.putBoolean(KEY_FLATTEN_PACKAGE, value);
      prefs.sync();
    } catch (Exception anyEx) {
      /* do nothing, no preferences */
    }
  }

 
View Full Code Here

  public static void putLastOpenFilePath(String path) {
    try {
      Preferences prefs = getPreferences();
      prefs.put(KEY_LAST_OPEN_FILE_PATH, path);
      prefs.sync();
    } catch (Exception anyEx) {
      /* do nothing, no preferences */
    }
  }

 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.