Package com.biglybt.ui.swt.config
Class SwtConfigParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE>
- java.lang.Object
-
- com.biglybt.ui.swt.config.SwtConfigParameterValueProcessor<PARAMTYPE,VALUETYPE>
-
- All Implemented Interfaces:
ParameterListener
,SwtParameterValueProcessor<PARAMTYPE,VALUETYPE>
public class SwtConfigParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE> extends java.lang.Object implements SwtParameterValueProcessor<PARAMTYPE,VALUETYPE>, ParameterListener
ASwtParameterValueProcessor
that stores/retrieves one setting fromCOConfigurationManager
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
changedExternally
private int
changingCount
private static int
CHANGINGCOUNT_BREAKER
private SwtParameter
owner
private static java.lang.Class<?>[]
VALID_CLASSES
private java.lang.Class<VALUETYPE>
valueType
-
Constructor Summary
Constructors Modifier Constructor Description protected
SwtConfigParameterValueProcessor(SwtParameter owner, java.lang.String configID, java.lang.Class<VALUETYPE> valueType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose(PARAMTYPE p)
Clean up after yourself, yoVALUETYPE
getDefaultValue(PARAMTYPE p)
Return the default value.VALUETYPE
getValue(PARAMTYPE p)
Return the value for Parameter pboolean
isDefaultValue(PARAMTYPE p)
Whether the Parameter is currently set to the default value.void
parameterChanged(java.lang.String parameterName)
Called, when a parameter has changed.boolean
resetToDefault(PARAMTYPE p)
Reset key to default valueboolean
setValue(PARAMTYPE p, VALUETYPE value)
New value for Parameter p.
-
-
-
Field Detail
-
CHANGINGCOUNT_BREAKER
private static final int CHANGINGCOUNT_BREAKER
- See Also:
- Constant Field Values
-
valueType
private final java.lang.Class<VALUETYPE> valueType
-
owner
private final SwtParameter owner
-
changingCount
private int changingCount
-
changedExternally
private boolean changedExternally
-
VALID_CLASSES
private static final java.lang.Class<?>[] VALID_CLASSES
-
-
Constructor Detail
-
SwtConfigParameterValueProcessor
protected SwtConfigParameterValueProcessor(SwtParameter owner, java.lang.String configID, java.lang.Class<VALUETYPE> valueType)
-
-
Method Detail
-
parameterChanged
public void parameterChanged(java.lang.String parameterName)
Description copied from interface:ParameterListener
Called, when a parameter has changed. The listener could only react if the parameter name is relevant. Or the listener can just read all parameters again.- Specified by:
parameterChanged
in interfaceParameterListener
- Parameters:
parameterName
- the name of the parameter that has changed
-
getValue
public VALUETYPE getValue(PARAMTYPE p)
Description copied from interface:SwtParameterValueProcessor
Return the value for Parameter p- Specified by:
getValue
in interfaceSwtParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE>
-
setValue
public boolean setValue(PARAMTYPE p, VALUETYPE value)
Description copied from interface:SwtParameterValueProcessor
New value for Parameter p. Handle things like storing value.- Specified by:
setValue
in interfaceSwtParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE>
- Returns:
- Whether the value changed from stored value. Returning true will trigger change listeners, and typically refresh UI controls
-
isDefaultValue
public boolean isDefaultValue(PARAMTYPE p)
Description copied from interface:SwtParameterValueProcessor
Whether the Parameter is currently set to the default value. This may be used to enable ui related to reseting value- Specified by:
isDefaultValue
in interfaceSwtParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE>
-
getDefaultValue
public VALUETYPE getDefaultValue(PARAMTYPE p)
Description copied from interface:SwtParameterValueProcessor
Return the default value.
This may be used to enable ui related to reseting value, or to show the default value to the user- Specified by:
getDefaultValue
in interfaceSwtParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE>
-
resetToDefault
public boolean resetToDefault(PARAMTYPE p)
Description copied from interface:SwtParameterValueProcessor
Reset key to default value- Specified by:
resetToDefault
in interfaceSwtParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE>
- Returns:
- Whether the value was reset. Returning true will trigger change listeners, and typically refresh UI controls
-
dispose
public void dispose(PARAMTYPE p)
Description copied from interface:SwtParameterValueProcessor
Clean up after yourself, yo- Specified by:
dispose
in interfaceSwtParameterValueProcessor<PARAMTYPE extends SwtParameter<VALUETYPE>,VALUETYPE>
-
-