# Class InfiniteProgress

java.lang.Object
com.codename1.ui.Component
com.codename1.components.InfiniteProgress

All Implemented Interfaces:
  `Animation, Editable, StyleListener`

public class InfiniteProgress extends Component

Shows a "Washing Machine" infinite progress indication animation, to customize the image you can either use the infiniteImage theme constant or the `setAnimation` method. The image is rotated automatically so don't use an animated image or anything like that as it would fail with the rotation logic.

This class can be used in one of two ways either by embedding the component into the UI thru something like this:

    myContainer.add(new InfiniteProgress());

Notice that this can be used within a custom dialog too.

A second approach allows showing the infinite progress over the entire screen which blocks all input. This tints the background while the infinite progress rotates:

    Dialog ip = new InfiniteProgress().showInifiniteBlocking();

    // do some long operation here using invokeAndBlock or do something in a separate thread and callback later
    // when you are done just call

    ip.dispose();

- ## Field Summary

  ### Fields inherited from class Component

  `BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InfiniteProgress()`
  Default constructor to define the UIID

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `animate()`
  Updates the progress animation.
  `boolean`
  `animate(boolean force)`
  Updates the progress animation.
  `protected Dimension`
  `calcPreferredSize()`
  Calculates the preferred size based on component content.
  `protected void`
  `deinitialize()`
  Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.
  `int`
  `getAngleIncrease()`
  The angle to increase (in degrees naturally) in every tick count, reduce to 1 to make the animation perfectly slow and smooth, increase to 45 to make it fast and jumpy.
  `Image`
  `getAnimation()`

  ###### Returns

  `static int`
  `getDefaultMaterialDesignColor()`
  The default color of the current material design progress spinner
  `int`
  `getMaterialDesignColor()`
  The color of the current material design progress spinner
  `String[]`
  `getPropertyNames()`
  A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code
  `Class[]`
  `getPropertyTypes()`
  Matches the property names method (see that method for further details).
  `Object`
  `getPropertyValue(String name)`
  Returns the current value of the property name, this method is used by the GUI builder
  `int`
  `getTickCount()`
  The animation rotates with EDT ticks, but not for every tick.
  `int`
  `getTintColor()`
  The tinting color of the screen when the showInfiniteBlocking method is invoked
  `protected void`
  `initComponent()`
  Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
  `static boolean`
  `isDefaultMaterialDesignMode()`
  Indicates whether infinite progress and pull to refresh work in the material design mode by default
  `boolean`
  `isMaterialDesignMode()`
  Indicates whether this instance of infinite progress works in the material design mode by default
  `void`
  `paint(Graphics g)`
  This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
  `void`
  `setAngleIncrease(int angleIncrease)`
  The angle to increase (in degrees naturally) in every tick count, reduce to 1 to make the animation perfectly slow and smooth, increase to 45 to make it fast and jumpy.
  `void`
  `setAnimation(Image animation)`
  Allows setting the image that will be rotated as part of this effect
  `static void`
  `setDefaultMaterialDesignColor(int aDefaultMaterialDesignColor)`
  The default color of the current material design progress spinner
  `static void`
  `setDefaultMaterialDesignMode(boolean aDefaultMaterialDesignMode)`
  Indicates whether infinite progress and pull to refresh work in the material design mode by default
  `void`
  `setMaterialDesignColor(int materialDesignColor)`
  The color of the current material design progress spinner
  `void`
  `setMaterialDesignMode(boolean materialDesignMode)`
  Indicates whether this instance of infinite progress works in the material design mode by default
  `String`
  `setPropertyValue(String name, Object value)`
  Sets a new value to the given property, returns an error message if failed and null if successful.
  `void`
  `setTickCount(int tickCount)`
  The animation rotates with EDT ticks, but not for every tick.
  `void`
  `setTintColor(int tintColor)`
  The tinting color of the screen when the showInfiniteBlocking method is invoked
  `Dialog`
  `showInfiniteBlocking()`
  Shows the infinite progress over the whole screen, the blocking can be competed by calling `dispose()` on the returned `Dialog`.
  `Dialog`
  `showInifiniteBlocking()`
  Shows the infinite progress over the whole screen, the blocking can be competed by calling `dispose()` on the returned `Dialog`.

  ### Methods inherited from class Component

  `addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, cancelRepaints, clearClientProperties, contains, containsOrOwns, createStyleAnimation, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, dragInitiated, drawDraggedImage, drop, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAccessibilityText, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBottomGap, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getGridPosX, getGridPosY, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyTypeNames, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initCustomStyle, initDisabledStyle, initLaf, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyPressed, keyReleased, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, paramString, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### InfiniteProgress

    public InfiniteProgress()
    Default constructor to define the UIID

- ## Method Details

  - ### isDefaultMaterialDesignMode

    public static boolean isDefaultMaterialDesignMode()

    Indicates whether infinite progress and pull to refresh work in the material design mode by default

    ###### Returns

    the defaultMaterialDesignMode

  - ### setDefaultMaterialDesignMode

    public static void setDefaultMaterialDesignMode(boolean aDefaultMaterialDesignMode)

    Indicates whether infinite progress and pull to refresh work in the material design mode by default

    ###### Parameters

    - `aDefaultMaterialDesignMode`: the defaultMaterialDesignMode to set

  - ### getDefaultMaterialDesignColor

    public static int getDefaultMaterialDesignColor()

    The default color of the current material design progress spinner

    ###### Returns

    the defaultMaterialDesignColor

  - ### setDefaultMaterialDesignColor

    public static void setDefaultMaterialDesignColor(int aDefaultMaterialDesignColor)

    The default color of the current material design progress spinner

    ###### Parameters

    - `aDefaultMaterialDesignColor`: the defaultMaterialDesignColor to set

  - ### showInifiniteBlocking

    public Dialog showInifiniteBlocking()

    Shows the infinite progress over the whole screen, the blocking can be competed by calling `dispose()` on the returned `Dialog`.

        Dialog ip = new InfiniteProgress().showInifiniteBlocking();

        // do some long operation here using invokeAndBlock or do something in a separate thread and callback later
        // when you are done just call

        ip.dispose();

    ###### Returns

    the dialog created for the blocking effect, disposing it will return to the previous form and remove the input block.

    ###### Deprecated

    typo in method name please use `#showInfiniteBlocking()` instead

  - ### showInfiniteBlocking

    public Dialog showInfiniteBlocking()

    Shows the infinite progress over the whole screen, the blocking can be competed by calling `dispose()` on the returned `Dialog`.

        Dialog ip = new InfiniteProgress().showInifiniteBlocking();

        // do some long operation here using invokeAndBlock or do something in a separate thread and callback later
        // when you are done just call

        ip.dispose();

    ###### Returns

    the dialog created for the blocking effect, disposing it will return to the previous form and remove the input block.

  - ### initComponent

    protected void initComponent()
    Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
    Overrides:
      `initComponent` in class `Component`

  - ### deinitialize

    protected void deinitialize()
    Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initComponent() method.
    Overrides:
      `deinitialize` in class `Component`

  - ### animate

    public boolean animate()

    Updates the progress animation. This only updates if the InfiniteProgress is on the currently displayed form and is visible. If you need to update the progress animation in another context, use `#animate(boolean)`.

    ###### Returns

    true if it animated and should be repainted.

    Specified by:
      `animate` in interface `Animation`
    Overrides:
      `animate` in class `Component`

  - ### animate

    public boolean animate(boolean force)

    Updates the progress animation.

    ###### Parameters

    - `force`: @param force If false, then the animation is only updated if the progress is visible and on the current form. True will force the update.

    ###### Returns

    True if it animated and should be repainted.

    ###### Since

    7.0

  - ### calcPreferredSize

    protected Dimension calcPreferredSize()

    Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

    ###### Returns

    the calculated preferred size based on component content

    Overrides:
      `calcPreferredSize` in class `Component`

  - ### paint

    public void paint(Graphics g)

    This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

    ###### Parameters

    - `g`: the component graphics
    Specified by:
      `paint` in interface `Animation`
    Overrides:
      `paint` in class `Component`

  - ### getAnimation

    public Image getAnimation()

    ###### Returns

    the animation

  - ### setAnimation

    public void setAnimation(Image animation)

    Allows setting the image that will be rotated as part of this effect

    ###### Parameters

    - `animation`: the animation to set

  - ### getPropertyNames

    public String[] getPropertyNames()

    A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code

    ###### Returns

    the property names allowing mutation

    Overrides:
      `getPropertyNames` in class `Component`

  - ### getPropertyTypes

    public Class[] getPropertyTypes()

    Matches the property names method (see that method for further details).

    ###### Returns

    the types of the properties

    Overrides:
      `getPropertyTypes` in class `Component`

  - ### getPropertyValue

    public Object getPropertyValue(String name)

    Returns the current value of the property name, this method is used by the GUI builder

    ###### Parameters

    - `name`: the name of the property

    ###### Returns

    the value of said property

    Overrides:
      `getPropertyValue` in class `Component`

  - ### setPropertyValue

    public String setPropertyValue(String name, Object value)

    Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.

    ###### Parameters

    - `name`: the name of the property

    - `value`: new value for the property

    ###### Returns

    error message or null

    Overrides:
      `setPropertyValue` in class `Component`

  - ### getTintColor

    public int getTintColor()

    The tinting color of the screen when the showInfiniteBlocking method is invoked

    ###### Returns

    the tintColor

  - ### setTintColor

    public void setTintColor(int tintColor)

    The tinting color of the screen when the showInfiniteBlocking method is invoked

    ###### Parameters

    - `tintColor`: the tintColor to set

  - ### getTickCount

    public int getTickCount()

    The animation rotates with EDT ticks, but not for every tick. To slow down the animation increase this number and to speed it up reduce it to 1. It can't be 0 or lower.

    ###### Returns

    the tickCount

  - ### setTickCount

    public void setTickCount(int tickCount)

    The animation rotates with EDT ticks, but not for every tick. To slow down the animation increase this number and to speed it up reduce it to 1. It can't be 0 or lower.

    ###### Parameters

    - `tickCount`: the tickCount to set

  - ### getAngleIncrease

    public int getAngleIncrease()

    The angle to increase (in degrees naturally) in every tick count, reduce to 1 to make the animation perfectly slow and smooth, increase to 45 to make it fast and jumpy. Its probably best to use a number that divides well with 360 but that isn't a requirement. Valid numbers are anything between 1 and 359.

    ###### Returns

    the angleIncrease

  - ### setAngleIncrease

    public void setAngleIncrease(int angleIncrease)

    The angle to increase (in degrees naturally) in every tick count, reduce to 1 to make the animation perfectly slow and smooth, increase to 45 to make it fast and jumpy. Its probably best to use a number that divides well with 360 but that isn't a requirement. Valid numbers are anything between 1 and 359.

    ###### Parameters

    - `angleIncrease`: the angleIncrease to set

  - ### isMaterialDesignMode

    public boolean isMaterialDesignMode()

    Indicates whether this instance of infinite progress works in the material design mode by default

    ###### Returns

    the materialDesignMode

  - ### setMaterialDesignMode

    public void setMaterialDesignMode(boolean materialDesignMode)

    Indicates whether this instance of infinite progress works in the material design mode by default

    ###### Parameters

    - `materialDesignMode`: the materialDesignMode to set

  - ### getMaterialDesignColor

    public int getMaterialDesignColor()

    The color of the current material design progress spinner

    ###### Returns

    the materialDesignColor

  - ### setMaterialDesignColor

    public void setMaterialDesignColor(int materialDesignColor)

    The color of the current material design progress spinner

    ###### Parameters

    - `materialDesignColor`: the materialDesignColor to set