Class ObjectModifier

  extended by org.jdesktop.animation.timing.interpolation.ObjectModifier
All Implemented Interfaces:

public class ObjectModifier
extends java.lang.Object
implements TimingTarget

This class defines an Object and a PropertyRange that define how a specific property on that Object should be modified over time. An instance of this class can be supplied as a TimingTarget to TimingController to run an animation that modifies the object's property over the timing period defined by that TimingController. ObjectModifier can be subclassed if applications need to perform more operations during the begin, end, or timingEvent methods than the simple interpolation done here.

Constructor Summary
ObjectModifier(java.lang.Object object, PropertyRange propertyRange)
          Creates a new instance of ObjectModifer.
Method Summary
 void begin()
          Called by TimingController to signal that the timer is about to start.
 void end()
          Called by TimingController to signal that the timer has ended.
 void timingEvent(long cycleElapsedTime, long totalElapsedTime, float fraction)
          Called from TimingController to signal another timing event.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ObjectModifier(java.lang.Object object,
                      PropertyRange propertyRange)
Creates a new instance of ObjectModifer. Subclasses should call this constructor if they want this class to handle the usual setup of the property-setting method.

java.lang.IllegalArgumentException - if there is no method on the object with the appropriate name. Method names are derived by standard JavaBean naming conventions. For example, a property name of "location" (in the PropertyRange object) would become a method name of "setLocation". If this exception is thrown, then either the property name was wrong or there is no JavaBean-compliant set method that can be used with that property name.
java.lang.SecurityException - if the application does not have appropriate permissions to request access to the Method
Method Detail


public void begin()
Called by TimingController to signal that the timer is about to start. The only operation performed in this method is calling PropertyRange with the current value of the object's property; this accounts for "to" animations, which need to start from the current value.

Specified by:
begin in interface TimingTarget


public void end()
Called by TimingController to signal that the timer has ended. This method does nothing in ObjectModifier; subclasses may want to override it if they have any tasks to perform at this time.

Specified by:
end in interface TimingTarget


public void timingEvent(long cycleElapsedTime,
                        long totalElapsedTime,
                        float fraction)
Called from TimingController to signal another timing event. This causes ObjectModifier to invoke the property-setting method (as specified by the property name in the PropertyRange object) with the appropriate value of the property given the range of values in the PropertyRange object and the fraction of the timing cycle that has elapsed.

Specified by:
timingEvent in interface TimingTarget
cycleElapsedTime - the total time in milliseconds elapsed in the current Cycle
totalElapsedTime - the total time in milliseconds elapsed since the start of the first cycle
fraction - the fraction of completion between the start and end of the current cycle. Note that on reversing cycles (Envelope.RepeatBehavior.REVERSE) the fraction decreases from 1.0 to 0 on backwards-running cycles.
See Also:
Envelope.RepeatBehavior, TimingController.timingEvent(long, long, float)