# Class ComponentAnimation.UIMutation

java.lang.Object
com.codename1.ui.animations.ComponentAnimation
com.codename1.ui.animations.ComponentAnimation.UIMutation

Enclosing class:
  `ComponentAnimation`

public static class ComponentAnimation.UIMutation extends ComponentAnimation

A special kind of ComponentAnimation that encapsulates a mutation of the user interface. This class used internally to allow compatible UI mutation animations to run concurrently. Two UI mutations are compatible if the containers that they mutate reside in separate branches of the UI tree. I.e. As long as neither container contains the other, their mutations are compatible.

##### Since

7.0

##### See also

- AnimationManager#addUIMutation(com.codename1.ui.Container, com.codename1.ui.animations.ComponentAnimation)

- AnimationManager#addUIMutation(com.codename1.ui.Container, com.codename1.ui.animations.ComponentAnimation, java.lang.Runnable)

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class ComponentAnimation

  `ComponentAnimation.UIMutation`
  Modifier and Type
  Class
  Description
  `static class`
  `ComponentAnimation.UIMutation`
  A special kind of ComponentAnimation that encapsulates a mutation of the user interface.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UIMutation(Container cnt, ComponentAnimation anim)`
  Creates a new UIMutation which mutates the given container with the provided animation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(Container cnt, ComponentAnimation anim)`
  Tries to add another mutation to this UIMutation.
  `void`
  `flush()`
  Flushes the animation immediately, this will be called if the form is de-initialized
  `int`
  `getMaxSteps()`
  The total number of steps in this animation.
  `boolean`
  `isInProgress()`
  Indicates if the animation is in progress
  `boolean`
  `isLocked()`
  Checks if this mutation is locked.
  `void`
  `setStep(int step)`
  Sets the current animation step to a value between 0 and maxSteps
  `protected void`
  `updateState()`
  Updates the animation state

  ### Methods inherited from class ComponentAnimation

  `addOnCompleteCall, compoundAnimation, getStep, isStepModeSupported, sequentialAnimation, setNotifyLock, setOnCompletion, updateAnimationState`
  Modifier and Type
  Method
  Description
  `void`
  `addOnCompleteCall(Runnable r)`
  Invokes the runnable just as the animation finishes thus allowing cleanup of the UI for the upcoming animations, this is useful when running a complex sequence
  `static ComponentAnimation`
  `compoundAnimation(ComponentAnimation... anims)`
  Allows us to create an animation that compounds several separate animations so they appear as a single animation to the system and process in parallel
  `int`
  `getStep()`
  `boolean`
  `isStepModeSupported()`
  Step mode allows stepping thru an animation one frame at a time, e.g.
  `static ComponentAnimation`
  `sequentialAnimation(ComponentAnimation... anims)`
  Allows us to create an animation that places several separate animations in a sequence so they appear as a single animation to the system and process one after the other
  `final void`
  `setNotifyLock(Object l)`
  This method is used internally by the addAnimationAndBlock method of AnimationManager and shouldn't be used outside of that.
  `final void`
  `setOnCompletion(Runnable r)`
  This method is used internally by the addAnimation method of AnimationManager and shouldn't be used outside of that.
  `final void`
  `updateAnimationState()`
  Invoked by the animation manager internally

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### UIMutation

    public UIMutation(Container cnt, ComponentAnimation anim)

    Creates a new UIMutation which mutates the given container with the provided animation.

    ###### Parameters

    - `cnt`: The container that is being mutated.

    - `anim`: The animation.

- ## Method Details

  - ### add

    public boolean add(Container cnt, ComponentAnimation anim)

    Tries to add another mutation to this UIMutation.

    ###### Parameters

    - `cnt`: The container that is being mutated.

    - `anim`: The animation

    ###### Returns

    Returns:
      True if it was successfully added. False otherwise. This will return false if `#isLocked()` returns true (i.e. the animation has already stared), or if the mutation is incompatible with any of the existing mutations in this mutation.

  - ### isLocked

    public boolean isLocked()
    Checks if this mutation is locked. Once a mutation animation has started, it becomes locked, and cannot have any further mutations added to it.

  - ### updateState

    protected void updateState()
    Description copied from class: `ComponentAnimation`
    Updates the animation state

  - ### isInProgress

    public boolean isInProgress()
    Description copied from class: `ComponentAnimation`

    Indicates if the animation is in progress

    ###### Returns

    true if in progress

    Specified by:
      `isInProgress` in class `ComponentAnimation`

  - ### flush

    public void flush()
    Description copied from class: `ComponentAnimation`
    Flushes the animation immediately, this will be called if the form is de-initialized
    Overrides:
      `flush` in class `ComponentAnimation`

  - ### getMaxSteps

    public int getMaxSteps()
    Description copied from class: `ComponentAnimation`

    The total number of steps in this animation.

    ###### Returns

    the number of steps

    Overrides:
      `getMaxSteps` in class `ComponentAnimation`

  - ### setStep

    public void setStep(int step)
    Description copied from class: `ComponentAnimation`

    Sets the current animation step to a value between 0 and maxSteps

    ###### Parameters

    - `step`: the current step
    Overrides:
      `setStep` in class `ComponentAnimation`