net.ctdp.rfdynhud.properties
Class IntProperty

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
      extended by net.ctdp.rfdynhud.properties.IntProperty
Direct Known Subclasses:
DelayProperty, FactoredIntProperty

public class IntProperty
extends Property

The IntProperty serves for customizing a primitive int value.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
IntProperty(java.lang.String name, int defaultValue)
           
IntProperty(java.lang.String name, int defaultValue, boolean readonly)
           
IntProperty(java.lang.String name, int defaultValue, int minValue, int maxValue)
           
IntProperty(java.lang.String name, java.lang.String nameForDisplay, int defaultValue)
           
IntProperty(java.lang.String name, java.lang.String nameForDisplay, int defaultValue, boolean readonly)
           
IntProperty(java.lang.String name, java.lang.String nameForDisplay, int defaultValue, int minValue, int maxValue, boolean readonly)
           
 
Method Summary
protected  int fixValue(int value)
          Fixes the value to stick to the limits.
 java.lang.Integer getDefaultValue()
          Gets the default (initial) value fo this property.
 float getFloatValue()
          Gets the current value as a float.
 int getIntValue()
          Gets the current value.
 int getMaxValue()
          Gets the maximum value.
 int getMinValue()
          Gets the minimum value.
 java.lang.Integer 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.Integer oldValue, int newValue)
          Invoked when the value has changed.
 boolean setIntValue(int value)
          Sets the property's value.
protected  boolean setIntValue(int 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

IntProperty

public IntProperty(java.lang.String name,
                   java.lang.String nameForDisplay,
                   int defaultValue,
                   int minValue,
                   int 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?

IntProperty

public IntProperty(java.lang.String name,
                   java.lang.String nameForDisplay,
                   int 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?

IntProperty

public IntProperty(java.lang.String name,
                   java.lang.String nameForDisplay,
                   int 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

IntProperty

public IntProperty(java.lang.String name,
                   int 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?

IntProperty

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

IntProperty

public IntProperty(java.lang.String name,
                   int defaultValue,
                   int minValue,
                   int 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.Integer 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 int getMinValue()
Gets the minimum value.

Returns:
the minimum value.

getMaxValue

public final int getMaxValue()
Gets the maximum value.

Returns:
the maximum value.

fixValue

protected int fixValue(int 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.Integer oldValue,
                              int newValue)
Invoked when the value has changed.

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

setIntValue

protected final boolean setIntValue(int value,
                                    boolean firstTime)
Sets the property's value.

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

setIntValue

public final boolean setIntValue(int value)
Sets the property's value.

Parameters:
value - the new value
Returns:
changed?

getIntValue

public final int getIntValue()
Gets the current value.

Returns:
the current value.

getFloatValue

public final float getFloatValue()
Gets the current value as a float.

Returns:
the current value as a float.

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.Integer 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