net.ctdp.rfdynhud.properties
Class FloatProperty

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
      extended by net.ctdp.rfdynhud.properties.FloatProperty
Direct Known Subclasses:
FactoredFloatProperty

public class FloatProperty
extends Property

The FloatProperty serves for customizing a primitive float value.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
FloatProperty(java.lang.String name, float defaultValue)
           
FloatProperty(java.lang.String name, float defaultValue, boolean readonly)
           
FloatProperty(java.lang.String name, float defaultValue, float minValue, float maxValue)
           
FloatProperty(java.lang.String name, java.lang.String nameForDisplay, float defaultValue)
           
FloatProperty(java.lang.String name, java.lang.String nameForDisplay, float defaultValue, boolean readonly)
           
FloatProperty(java.lang.String name, java.lang.String nameForDisplay, float defaultValue, float minValue, float maxValue, boolean readonly)
           
 
Method Summary
protected  float fixValue(float value)
          Fixes the value to stick to the limits.
 java.lang.Float getDefaultValue()
          Gets the default (initial) value fo this property.
 float getFloatValue()
          Gets the property's current value.
 int getIntValue()
          Gets the property's current value as a floored int.
 int getIntValue(boolean round)
          Gets the property's current value as an int.
 float getMaxValue()
          Gets the maximum value.
 float getMinValue()
          Gets the minimum value.
 java.lang.Float getValue()
          Gets the current value fo this property.
 void loadValue(PropertyLoader loader, java.lang.String value)
          Loads the value from the configuration file.
protected  void onKeeperSet()
          
protected  void onValueChanged(java.lang.Float oldValue, float newValue)
          Invoked when the value has changed.
 boolean setFloatValue(float value)
          Sets the property's value.
protected  boolean setFloatValue(float value, boolean firstTime)
          Sets the property's value.
 void setValue(java.lang.Object value)
          Sets the new value for this property.
 
Methods inherited from class net.ctdp.rfdynhud.properties.Property
getButtonText, getButtonTooltip, getDocumentationSource, getEditorType, getKeeper, getName, getNameForDisplay, getValueForConfigurationFile, hasDefaultValue, isMatchingKey, isReadOnly, onButtonClicked, quoteValueInConfigurationFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FloatProperty

public FloatProperty(java.lang.String name,
                     java.lang.String nameForDisplay,
                     float defaultValue,
                     float minValue,
                     float maxValue,
                     boolean readonly)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
defaultValue - the default value
minValue - the minimum value
maxValue - the maximum value
readonly - read only property?

FloatProperty

public FloatProperty(java.lang.String name,
                     java.lang.String nameForDisplay,
                     float defaultValue,
                     boolean readonly)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
defaultValue - the default value
readonly - read only property?

FloatProperty

public FloatProperty(java.lang.String name,
                     java.lang.String nameForDisplay,
                     float defaultValue)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
defaultValue - the default value

FloatProperty

public FloatProperty(java.lang.String name,
                     float defaultValue,
                     boolean readonly)
Parameters:
name - the technical name used internally. See Property.getName(). 'nameForDisplay' is set to the same value.
defaultValue - the default value
readonly - read only property?

FloatProperty

public FloatProperty(java.lang.String name,
                     float defaultValue)
Parameters:
name - the technical name used internally. See Property.getName(). 'nameForDisplay' is set to the same value.
defaultValue - the default value

FloatProperty

public FloatProperty(java.lang.String name,
                     float defaultValue,
                     float minValue,
                     float maxValue)
Parameters:
name - the technical name used internally. See Property.getName(). 'nameForDisplay' is set to the same value.
defaultValue - the default value
minValue - the minimum value
maxValue - the maximum value
Method Detail

getDefaultValue

public java.lang.Float getDefaultValue()
Gets the default (initial) value fo this property.

Specified by:
getDefaultValue in class Property
Returns:
the default value fo this property.

getMinValue

public final float getMinValue()
Gets the minimum value.

Returns:
the minimum value.

getMaxValue

public final float getMaxValue()
Gets the maximum value.

Returns:
the maximum value.

fixValue

protected float fixValue(float value)
Fixes the value to stick to the limits.

Parameters:
value - the unfixed value
Returns:
the fixed value.

onKeeperSet

protected void onKeeperSet()

Overrides:
onKeeperSet in class Property

onValueChanged

protected void onValueChanged(java.lang.Float oldValue,
                              float newValue)
Invoked when the value has changed.

Parameters:
oldValue - the old value
newValue - the new value

setFloatValue

protected final boolean setFloatValue(float value,
                                      boolean firstTime)
Sets the property's value.

Parameters:
value - the new value
firstTime -
Returns:
changed?

setFloatValue

public final boolean setFloatValue(float value)
Sets the property's value.

Parameters:
value - the new value
Returns:
changed?

getFloatValue

public final float getFloatValue()
Gets the property's current value.

Returns:
the property's current value.

getIntValue

public final int getIntValue(boolean round)
Gets the property's current value as an int.

Parameters:
round - if true the value is rounded, otherwise it is floored.
Returns:
the property's current value as an int.

getIntValue

public final int getIntValue()
Gets the property's current value as a floored int.

Returns:
the property's current value as a floored int.

setValue

public void setValue(java.lang.Object value)
Sets the new value for this property.

Specified by:
setValue in class Property
Parameters:
value - the new value

getValue

public java.lang.Float getValue()
Gets the current value fo this property.

Specified by:
getValue in class Property
Returns:
the current value fo this property.

loadValue

public void loadValue(PropertyLoader loader,
                      java.lang.String value)
Loads the value from the configuration file.

Specified by:
loadValue in class Property
Parameters:
loader - the loader
value - the value to load