com.opera.core.systems.preferences
Class OperaScopePreferences.ScopePreference

java.lang.Object
  extended by com.opera.core.systems.preferences.AbstractOperaPreferences.AbstractPreference
      extended by com.opera.core.systems.preferences.OperaScopePreferences.ScopePreference
All Implemented Interfaces:
OperaPreferences.OperaPreference
Enclosing class:
OperaScopePreferences

public static class OperaScopePreferences.ScopePreference
extends AbstractOperaPreferences.AbstractPreference

Allows setting Opera preferences in Opera in addition to keeping the local cache of preferences up to date.


Field Summary
 
Fields inherited from class com.opera.core.systems.preferences.AbstractOperaPreferences.AbstractPreference
defaultValue
 
Constructor Summary
OperaScopePreferences.ScopePreference(OperaScopePreferences parent, PrefsProtos.Pref pref)
           
 
Method Summary
 Object getDefaultValue()
          Gets the default value of the preference.
 Type getType()
          Gets the type of the preference.
 Object getValue()
          Gets the value of the preference in an idiomatic type.
 boolean isEnabled()
          Whether setting is overriden by global INI.
 void reset()
          Resets preference's value to its default value.
 void setValue(Object value)
          Sets the value of this preference.
 
Methods inherited from class com.opera.core.systems.preferences.AbstractOperaPreferences.AbstractPreference
getKey, getSection, getValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OperaScopePreferences.ScopePreference

public OperaScopePreferences.ScopePreference(OperaScopePreferences parent,
                                             PrefsProtos.Pref pref)
Method Detail

getValue

public Object getValue()
Gets the value of the preference in an idiomatic type. We fall back to String if no type is specified for this preference.

Specified by:
getValue in interface OperaPreferences.OperaPreference
Overrides:
getValue in class AbstractOperaPreferences.AbstractPreference
Returns:
the value of the string, as an idiomatic Java type

setValue

public void setValue(Object value)
Description copied from interface: OperaPreferences.OperaPreference
Sets the value of this preference.

Specified by:
setValue in interface OperaPreferences.OperaPreference
Overrides:
setValue in class AbstractOperaPreferences.AbstractPreference
Parameters:
value - the new value

getDefaultValue

public Object getDefaultValue()
Description copied from interface: OperaPreferences.OperaPreference
Gets the default value of the preference.

Specified by:
getDefaultValue in interface OperaPreferences.OperaPreference
Overrides:
getDefaultValue in class AbstractOperaPreferences.AbstractPreference
Returns:
the default value of this preference

getType

public Type getType()
Gets the type of the preference. Since Opera uses more internal field types than what is accessible to Java, we reduce the type specified by Opera (in a lossy way) to one of either Boolean, OperaColor, File, Integer or String.

Returns:
the idiomatic Java type for this preference

isEnabled

public boolean isEnabled()
Whether setting is overriden by global INI. If this value is missing, it means global INI is not supported.

Returns:
true if enabled, false otherwise

reset

public void reset()
Resets preference's value to its default value. This method is a short-hand method for doing preference.setValue(preference.getDefaultValue).



Copyright © 2012. All Rights Reserved.