org.jdesktop.animation.timing.interpolation
Class KeyValues<T>

java.lang.Object
  extended by org.jdesktop.animation.timing.interpolation.KeyValues<T>

public abstract class KeyValues<T>
extends java.lang.Object

Stores a list of values that correspond to the times in a KeyTimes object. These structures are then used to create a KeyFrames object, which is then used to create a PropertyRange and ObjectModifier object, for the purposes of modifying an object's property over time. At each of the times in KeyTimes, the property will take on the corresponding value in the KeyValues object. Between these times, the property will take on a value based on the interpolation information stored in the KeyFrames object.


Field Summary
protected  java.lang.Object startValue
           
protected  java.util.ArrayList<T> values
           
 
Constructor Summary
protected KeyValues()
          Callers should create KeyValues structures from the factory methods which create KeyValues subclasses based on the types of values.
protected KeyValues(double[] values)
           
protected KeyValues(float[] values)
           
protected KeyValues(int[] values)
           
protected KeyValues(java.lang.Object[] values)
          Subclasses call this constructor to account for "to" animations; this method inserts a "null" value as the first element
 
Method Summary
static KeyValues createKeyValues(java.awt.Color... values)
          Create KeyValues object with Color values
static KeyValues createKeyValues(java.awt.Dimension... values)
          Create KeyValues object with Dimension values
static KeyValues createKeyValues(double... values)
          Create KeyValues object with double values
static KeyValues createKeyValues(float... values)
          Create KeyValues object with float values
static KeyValues createKeyValues(int... values)
          Create KeyValues object with int values
static KeyValues createKeyValues(java.awt.Point... values)
          Create KeyValues object with Point values
static KeyValues createKeyValues(java.awt.Rectangle... values)
          Create KeyValues object with Rectangle values
 int getSize()
          Returns the number of values stored in this object
abstract  java.lang.Class<?> getType()
          Subclasses will override this to return the type associated with that subclass.
 void setStartValue(java.lang.Object startValue)
          Called at start of animation; sets starting value in simple "to" animations
abstract  void setValue(java.lang.Object object, java.lang.reflect.Method method, int index)
          Sets the value of the property to be the value at index.
abstract  void setValue(java.lang.Object object, java.lang.reflect.Method method, int i0, int i1, float fraction)
          Sets the value of the property with a linear interpolation of the given fraction between the values at i0 and i1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

protected java.util.ArrayList<T> values

startValue

protected java.lang.Object startValue
Constructor Detail

KeyValues

protected KeyValues()
Callers should create KeyValues structures from the factory methods which create KeyValues subclasses based on the types of values.


KeyValues

protected KeyValues(java.lang.Object[] values)
Subclasses call this constructor to account for "to" animations; this method inserts a "null" value as the first element


KeyValues

protected KeyValues(float[] values)

KeyValues

protected KeyValues(int[] values)

KeyValues

protected KeyValues(double[] values)
Method Detail

getSize

public int getSize()
Returns the number of values stored in this object


createKeyValues

public static KeyValues createKeyValues(int... values)
Create KeyValues object with int values


createKeyValues

public static KeyValues createKeyValues(float... values)
Create KeyValues object with float values


createKeyValues

public static KeyValues createKeyValues(double... values)
Create KeyValues object with double values


createKeyValues

public static KeyValues createKeyValues(java.awt.Point... values)
Create KeyValues object with Point values


createKeyValues

public static KeyValues createKeyValues(java.awt.Dimension... values)
Create KeyValues object with Dimension values


createKeyValues

public static KeyValues createKeyValues(java.awt.Rectangle... values)
Create KeyValues object with Rectangle values


createKeyValues

public static KeyValues createKeyValues(java.awt.Color... values)
Create KeyValues object with Color values


getType

public abstract java.lang.Class<?> getType()
Subclasses will override this to return the type associated with that subclass. This is used in ObjectModifier to set up the property-setting method with the appropriate type.


setStartValue

public void setStartValue(java.lang.Object startValue)
Called at start of animation; sets starting value in simple "to" animations


setValue

public abstract void setValue(java.lang.Object object,
                              java.lang.reflect.Method method,
                              int i0,
                              int i1,
                              float fraction)
Sets the value of the property with a linear interpolation of the given fraction between the values at i0 and i1. Subclasses need to override this method to calculate the value according to their type.


setValue

public abstract void setValue(java.lang.Object object,
                              java.lang.reflect.Method method,
                              int index)
Sets the value of the property to be the value at index. Subclasses need to override this method to calculate the value according to their type.