net.ctdp.rfdynhud.properties
Class ImagePropertyWithTexture

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
      extended by net.ctdp.rfdynhud.properties.StringProperty
          extended by net.ctdp.rfdynhud.properties.ImageProperty
              extended by net.ctdp.rfdynhud.properties.ImagePropertyWithTexture

public class ImagePropertyWithTexture
extends ImageProperty

The ImagePropertyWithTexture serves for customizing an image and provides a TextureImage2D instance with a given size.

Author:
Marvin Froehlich (CTDP)

Field Summary
 
Fields inherited from class net.ctdp.rfdynhud.properties.ImageProperty
DEFAULT_NO_IMAGE_ALOWED
 
Constructor Summary
ImagePropertyWithTexture(java.lang.String name, java.lang.String defaultValue)
           
ImagePropertyWithTexture(java.lang.String name, java.lang.String defaultValue, boolean readonly)
           
ImagePropertyWithTexture(java.lang.String name, java.lang.String nameForDisplay, java.lang.String defaultValue)
           
ImagePropertyWithTexture(java.lang.String name, java.lang.String nameForDisplay, java.lang.String defaultValue, boolean readonly, boolean noImageAllowed)
           
 
Method Summary
 TextureImage2D getTexture()
          Gets the scaled texture.
 boolean hasTexture()
          Gets whether this property keeps a scaled texture instance.
protected  void onValueChanged(java.lang.String oldValue, java.lang.String newValue)
          Invoked when the property's value has changed.
 TextureImage2D updateSize(int width, int height, boolean isEditorMode)
          Updates the stored TextureImage2D to the given size and returns the texture.
 
Methods inherited from class net.ctdp.rfdynhud.properties.ImageProperty
getImage, getImageName, getNoImageAllowed, isNoImage, loadValue, setImageName
 
Methods inherited from class net.ctdp.rfdynhud.properties.StringProperty
getStringValue, getValue, onKeeperSet, setStringValue, setStringValue, setValue
 
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
 

Constructor Detail

ImagePropertyWithTexture

public ImagePropertyWithTexture(java.lang.String name,
                                java.lang.String nameForDisplay,
                                java.lang.String defaultValue,
                                boolean readonly,
                                boolean noImageAllowed)
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?
noImageAllowed - allow "no image" for this property?

ImagePropertyWithTexture

public ImagePropertyWithTexture(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

ImagePropertyWithTexture

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

ImagePropertyWithTexture

public ImagePropertyWithTexture(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

updateSize

public TextureImage2D updateSize(int width,
                                 int height,
                                 boolean isEditorMode)
Updates the stored TextureImage2D to the given size and returns the texture.

Parameters:
width - the new width
height - the new height
isEditorMode - is rendering in editor?
Returns:
the scaled texture.

getTexture

public final TextureImage2D getTexture()
Gets the scaled texture. Make sure to call updateSize(int, int, boolean) before.

Returns:
the scaled texture.

hasTexture

public final boolean hasTexture()
Gets whether this property keeps a scaled texture instance.

Returns:
whether this property keeps a scaled texture instance.

onValueChanged

protected void onValueChanged(java.lang.String oldValue,
                              java.lang.String newValue)
Invoked when the property's value has changed.

Overrides:
onValueChanged in class StringProperty
Parameters:
oldValue - the old value
newValue - the new value