public final class

StateTrackableDelegate

extends Object
implements StateTrackable
java.lang.Object
   ↳ sun.java2d.StateTrackableDelegate

Class Overview

This class provides a basic pre-packaged implementation of the complete StateTrackable interface with implementations of the required methods in the interface and methods to manage transitions in the state of the object. Classes which wish to implement StateTrackable could create an instance of this class and delegate all of their implementations for StateTrackable methods to the corresponding methods of this class.

Summary

Fields
public static final StateTrackableDelegate IMMUTABLE_DELEGATE The IMMUTABLE_DELEGATE provides an implementation of the StateTrackable interface that is permanently in the IMMUTABLE state.
public static final StateTrackableDelegate UNTRACKABLE_DELEGATE The UNTRACKABLE_DELEGATE provides an implementation of the StateTrackable interface that is permanently in the UNTRACKABLE state.
Public Methods
synchronized void addDynamicAgent()
This method provides an easy way for delegating classes to manage temporarily setting the overall State of the delegate to DYNAMIC during well-defined time frames of dynamic pixel updating.
static StateTrackableDelegate createInstance(StateTrackable.State state)
Returns a StateTrackableDelegate instance with the specified initial State.
StateTrackable.State getState()
@inheritDoc
synchronized StateTracker getStateTracker()
@inheritDoc
final void markDirty()
This method provides an easy way for delegating classes to indicate that the contents have changed.
synchronized void setImmutable()
This method provides an easy way for delegating classes to change the overall State of the delegate to IMMUTABLE.
synchronized void setUntrackable()
This method provides an easy way for delegating classes to change the overall State of the delegate to UNTRACKABLE.
Protected Methods
synchronized void removeDynamicAgent()
This method provides an easy way for delegating classes to manage restoring the overall State of the delegate back to STABLE after a well-defined time frame of dynamic pixel updating.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sun.java2d.StateTrackable

Fields

public static final StateTrackableDelegate IMMUTABLE_DELEGATE

The IMMUTABLE_DELEGATE provides an implementation of the StateTrackable interface that is permanently in the IMMUTABLE state.

public static final StateTrackableDelegate UNTRACKABLE_DELEGATE

The UNTRACKABLE_DELEGATE provides an implementation of the StateTrackable interface that is permanently in the UNTRACKABLE state.

Public Methods

public synchronized void addDynamicAgent ()

This method provides an easy way for delegating classes to manage temporarily setting the overall State of the delegate to DYNAMIC during well-defined time frames of dynamic pixel updating. This method should be called once before each flow of control that might dynamically update the pixels in an uncontrolled or unpredictable fashion.

The companion method removeDynamicAgent() method should also be called once after each such flow of control has ended. Failing to call the remove method will result in this object permanently becoming DYNAMIC and therefore effectively untrackable.

This method will only change the State of the delegate if it is currently STABLE.

Throws
IllegalStateException if the current state is IMMUTABLE

public static StateTrackableDelegate createInstance (StateTrackable.State state)

Returns a StateTrackableDelegate instance with the specified initial State. If the specified State is UNTRACKABLE or IMMUTABLE then the approprirate static instance UNTRACKABLE_DELEGATE or IMMUTABLE_DELEGATE is returned.

public StateTrackable.State getState ()

@inheritDoc

Returns
  • the current state of trackability of the complex data stored in this object.

public synchronized StateTracker getStateTracker ()

@inheritDoc

Returns
  • an object implementing the StateTracker interface that tracks whether changes have been made to the complex contents of this object since it was returned.

public final void markDirty ()

This method provides an easy way for delegating classes to indicate that the contents have changed. This method will invalidate outstanding StateTracker objects so that any other agents which maintain cached information about the pixels will know to refresh their cached copies. This method should be called after every modification to the data, such as any calls to any of the setElem methods.

Note that, for efficiency, this method does not check the State of the object to see if it is compatible with being marked dirty (i.e. not IMMUTABLE). It is up to the callers to enforce the fact that an IMMUTABLE delegate is never modified.

public synchronized void setImmutable ()

This method provides an easy way for delegating classes to change the overall State of the delegate to IMMUTABLE.

Throws
IllegalStateException if the current state is UNTRACKABLE
See Also

public synchronized void setUntrackable ()

This method provides an easy way for delegating classes to change the overall State of the delegate to UNTRACKABLE. This method is typically called when references to the internal data buffers have been made public.

Throws
IllegalStateException if the current state is IMMUTABLE
See Also

Protected Methods

protected synchronized void removeDynamicAgent ()

This method provides an easy way for delegating classes to manage restoring the overall State of the delegate back to STABLE after a well-defined time frame of dynamic pixel updating. This method should be called once after each flow of control that might dynamically update the pixels in an uncontrolled or unpredictable fashion has ended.

The companion method addDynamicAgent() method should have been called at some point before each such flow of control began. If this method is called without having previously called the add method, the State of this object will become unreliable.

This method will only change the State of the delegate if the number of outstanding dynamic agents has gone to 0 and it is currently DYNAMIC.