public class InfiniteProgress

  1. Object
  2. Component
  3. InfiniteProgress

ImplementsAnimation, Editable, StyleListener

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();

Constructors

public InfiniteProgress()Default constructor to define the UIID

Methods

public static boolean isDefaultMaterialDesignMode()Indicates whether infinite progress and pull to refresh work in the material design mode by default
public static void setDefaultMaterialDesignMode(boolean aDefaultMaterialDesignMode)Indicates whether infinite progress and pull to refresh work in the material design mode by default
public static int getDefaultMaterialDesignColor()The default color of the current material design progress spinner
public static void setDefaultMaterialDesignColor(int aDefaultMaterialDesignColor)The default color of the current material design progress spinner
public Dialog showInifiniteBlocking()Deprecated Shows the infinite progress over the whole screen, the blocking can be competed by calling dispose() on the returned Dialog.
public Dialog showInfiniteBlocking()Shows the infinite progress over the whole screen, the blocking can be competed by calling dispose() on the returned Dialog.
protected void initComponent()Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state
protected void deinitialize()Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.
public boolean animate()Updates the progress animation.
public boolean animate(boolean force)Updates the progress animation.
protected Dimension calcPreferredSize()Calculates the preferred size based on component content.
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.
public Image getAnimation()
public void setAnimation(Image animation)Allows setting the image that will be rotated as part of this effect
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
public Class[] getPropertyTypes()Matches the property names method (see that method for further details).
public Object getPropertyValue(String name)Returns the current value of the property name, this method is used by the GUI builder
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.
public int getTintColor()The tinting color of the screen when the showInfiniteBlocking method is invoked
public void setTintColor(int tintColor)The tinting color of the screen when the showInfiniteBlocking method is invoked
public int getTickCount()The animation rotates with EDT ticks, but not for every tick.
public void setTickCount(int tickCount)The animation rotates with EDT ticks, but not for every tick.
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.
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.
public boolean isMaterialDesignMode()Indicates whether this instance of infinite progress works in the material design mode by default
public void setMaterialDesignMode(boolean materialDesignMode)Indicates whether this instance of infinite progress works in the material design mode by default
public int getMaterialDesignColor()The color of the current material design progress spinner
public void setMaterialDesignColor(int materialDesignColor)The color of the current material design progress spinner

Inherited fields

Inherited methods

From Component

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

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 boolean
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 int
the defaultMaterialDesignColor to set

showInifiniteBlocking

public Dialog showInifiniteBlocking()
Deprecated. typo in method name please use #showInfiniteBlocking() instead

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.

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

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.

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.

animate

public boolean animate(boolean force)
Updates the progress animation.

Parameters

force boolean
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.

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

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 Graphics
the component graphics

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 Image
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

getPropertyTypes

public Class[] getPropertyTypes()
Matches the property names method (see that method for further details).

Returns

the types of the properties

getPropertyValue

public Object getPropertyValue(String name)
Returns the current value of the property name, this method is used by the GUI builder

Parameters

name String
the name of the property

Returns

the value of said property

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 String
the name of the property
value Object
new value for the property

Returns

error message or null

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 int
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 int
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 int
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 boolean
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 int
the materialDesignColor to set