net.ctdp.rfdynhud.properties
Class BackgroundProperty

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
      extended by net.ctdp.rfdynhud.properties.BackgroundProperty

public class BackgroundProperty
extends Property

The BackgroundProperty unites ColorProperty and ImageProperty to select something for a Widget's background.

Author:
Marvin Froehlich (CTDP)

Nested Class Summary
static class BackgroundProperty.BackgroundType
           
 
Field Summary
static java.lang.String COLOR_INDICATOR
           
static java.lang.String IMAGE_INDICATOR
           
 
Constructor Summary
BackgroundProperty(java.lang.String name, java.lang.String defaultValue)
           
BackgroundProperty(java.lang.String name, java.lang.String nameForDisplay, java.lang.String defaultValue)
           
 
Method Summary
 BackgroundProperty.BackgroundType getBackgroundType()
          Gets the current type of this background.
 ColorProperty getColorProperty()
          Gets the encapsulated ColorProperty.
 java.awt.Color getColorValue()
          Gets the Color from this BackgroundProperty.
 ImageProperty getImageProperty()
          Gets the encapsulated ImageProperty.
 ImageTemplate getImageValue()
          Gets the Color from this BackgroundProperty.
 java.lang.String 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(BackgroundProperty.BackgroundType oldBGType, BackgroundProperty.BackgroundType newBGType, java.lang.String oldValue, java.lang.String newValue)
          Invoked when the value has changed.
 boolean setColorValue(java.lang.String value)
          Sets this property to a color of the given value.
 boolean setImageValue(java.lang.String value)
          Sets this property to an image of the given value.
 void setValue(java.lang.Object value)
          Sets the new value for this property.
 void setValues(BackgroundProperty.BackgroundType type, java.lang.String colorValue, java.lang.String imageValue)
          Sets the current value.
 
Methods inherited from class net.ctdp.rfdynhud.properties.Property
getButtonText, getButtonTooltip, getDocumentationSource, getEditorType, getKeeper, getName, getNameForDisplay, getValueForConfigurationFile, isMatchingKey, isReadOnly, onButtonClicked, quoteValueInConfigurationFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COLOR_INDICATOR

public static final java.lang.String COLOR_INDICATOR
See Also:
Constant Field Values

IMAGE_INDICATOR

public static final java.lang.String IMAGE_INDICATOR
See Also:
Constant Field Values
Constructor Detail

BackgroundProperty

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

BackgroundProperty

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

getBackgroundType

public final BackgroundProperty.BackgroundType getBackgroundType()
Gets the current type of this background.

Returns:
the current type of this background.

onKeeperSet

protected void onKeeperSet()

Overrides:
onKeeperSet in class Property

onValueChanged

protected void onValueChanged(BackgroundProperty.BackgroundType oldBGType,
                              BackgroundProperty.BackgroundType newBGType,
                              java.lang.String oldValue,
                              java.lang.String newValue)
Invoked when the value has changed.

Parameters:
oldBGType - the old background type
newBGType - thew new background type
oldValue - the old value
newValue - the new value

getColorProperty

public final ColorProperty getColorProperty()
Gets the encapsulated ColorProperty.

Returns:
the encapsulated ColorProperty.

getImageProperty

public final ImageProperty getImageProperty()
Gets the encapsulated ImageProperty.

Returns:
the encapsulated ImageProperty.

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

setColorValue

public boolean setColorValue(java.lang.String value)
Sets this property to a color of the given value.

Parameters:
value - the new color value/name
Returns:
changed?

setImageValue

public boolean setImageValue(java.lang.String value)
Sets this property to an image of the given value.

Parameters:
value - the new image name
Returns:
changed?

setValues

public void setValues(BackgroundProperty.BackgroundType type,
                      java.lang.String colorValue,
                      java.lang.String imageValue)
Sets the current value.

Parameters:
type -
colorValue -
imageValue -

getValue

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

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

getColorValue

public final java.awt.Color getColorValue()
Gets the Color from this BackgroundProperty. The result is only valid, if the BackgroundProperty.BackgroundType (getBackgroundType()) is BackgroundProperty.BackgroundType.COLOR.

Returns:
the Color from this BackgroundProperty.

getImageValue

public final ImageTemplate getImageValue()
Gets the Color from this BackgroundProperty. The result is only valid, if the BackgroundProperty.BackgroundType (getBackgroundType()) is BackgroundProperty.BackgroundType.COLOR.

Returns:
the Color from this BackgroundProperty.

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