net.ctdp.rfdynhud.properties
Class ImagePropertyWithTransTexture

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

public class ImagePropertyWithTransTexture
extends ImageProperty

The ImagePropertyWithTransTexture serves for customizing an image and provides a TransformableTexture 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
ImagePropertyWithTransTexture(java.lang.String name, java.lang.String defaultValue)
           
ImagePropertyWithTransTexture(java.lang.String name, java.lang.String defaultValue, boolean readonly)
           
ImagePropertyWithTransTexture(java.lang.String name, java.lang.String nameForDisplay, java.lang.String defaultValue)
           
ImagePropertyWithTransTexture(java.lang.String name, java.lang.String nameForDisplay, java.lang.String defaultValue, boolean readonly, boolean noImageAllowed)
           
 
Method Summary
 TransformableTexture 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.
 TransformableTexture updateSize(int width, int height, boolean isEditorMode)
          Updates the stored TransformableTexture to the given size and returns the texture.
 TransformableTexture updateSize(int width, int height, boolean isEditorMode, boolean[] changeInfo)
          Updates the stored TransformableTexture 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
getDefaultValue, getStringValue, getValue, onKeeperSet, setStringValue, setStringValue, setValue
 
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

ImagePropertyWithTransTexture

public ImagePropertyWithTransTexture(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?

ImagePropertyWithTransTexture

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

ImagePropertyWithTransTexture

public ImagePropertyWithTransTexture(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?

ImagePropertyWithTransTexture

public ImagePropertyWithTransTexture(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 TransformableTexture updateSize(int width,
                                       int height,
                                       boolean isEditorMode,
                                       boolean[] changeInfo)
Updates the stored TransformableTexture to the given size and returns the texture.

Parameters:
width - the new width
height - the new height
isEditorMode - is rendering in editor?
changeInfo - if non null the first element tells you, whether 'possibleResult' has been recycled and the second element, whether the texture has been (re)drawn
Returns:
the scaled texture.

updateSize

public final TransformableTexture updateSize(int width,
                                             int height,
                                             boolean isEditorMode)
Updates the stored TransformableTexture 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 TransformableTexture 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