Package com.nomagic.task
Interface ProgressStatus
- All Known Implementing Classes:
EmptyProgressStatus
,SimpleProgressStatus
@OpenApiAll
public interface ProgressStatus
Progress status interface.
Usually used when performing long task to show task progress status.
Can be implemented in various ways, represented in GUI.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
ThrowCanceledException
when progress has been canceled.long
Get current progress value.Get progress description.long
getMax()
Get progress maximum value.long
getMin()
Get progress minimum value.int
Get completed percentage.void
increase()
Increment progress current value.void
Initialize progress.void
Initialize progress.void
Initialize progress.boolean
isCancel()
boolean
Checks if progress status completed.boolean
Checks if progres status is indeterminate,boolean
isLocked()
Check if progress status is locked.void
reset()
Reset progress status.void
setCancel
(boolean cancel) Call this when want current operation be canceled.void
setCurrent
(long current) Set progress current value.void
setDescription
(String description) Set progress description.void
setIndeterminate
(boolean indeterminate) Set progress status as indeterminate.void
setLocked
(boolean lock) Lock the progress status.void
setMax
(long max) Set progress maximum value.void
setMin
(long min) Set progress minimum value.
-
Method Details
-
setMin
void setMin(long min) Set progress minimum value.- Parameters:
min
- minimum value
-
setMax
void setMax(long max) Set progress maximum value.- Parameters:
max
- maximum value
-
setCurrent
void setCurrent(long current) Set progress current value.- Parameters:
current
- current value
-
setDescription
Set progress description.- Parameters:
description
- progress description
-
getPercentage
int getPercentage()Get completed percentage.- Returns:
- completed percentage
-
getMin
long getMin()Get progress minimum value.- Returns:
- minimum value
-
getMax
long getMax()Get progress maximum value.- Returns:
- maximum value
-
getCurrent
long getCurrent()Get current progress value.- Returns:
- current value
-
getDescription
String getDescription()Get progress description.- Returns:
- progress description
-
reset
void reset()Reset progress status. -
increase
void increase()Increment progress current value. -
init
Initialize progress.- Parameters:
description
- progress description.min
- minimum value.max
- maximum value.current
- current value.
-
init
Initialize progress.- Parameters:
description
- progress description.min
- minimum value.max
- maximum value.
-
init
Initialize progress.- Parameters:
description
- progress description.max
- maximum value.
-
isCompleted
boolean isCompleted()Checks if progress status completed.- Returns:
true
when progress status completed
-
setIndeterminate
void setIndeterminate(boolean indeterminate) Set progress status as indeterminate.- Parameters:
indeterminate
-true
for progress status as indeterminate.
-
isIndeterminate
boolean isIndeterminate()Checks if progres status is indeterminate,- Returns:
true
when progress status as indeterminate.
-
setLocked
void setLocked(boolean lock) Lock the progress status. Locked status does not change progress value.- Parameters:
lock
-true
for progress status locking.
-
isLocked
boolean isLocked()Check if progress status is locked.- Returns:
true
when progress status is locked.
-
setCancel
void setCancel(boolean cancel) Call this when want current operation be canceled. Actual operation can not support cancel.- Parameters:
cancel
- new cancel value.
-
isCancel
boolean isCancel()- Returns:
- true if current operation is requested to be canceled.
-
cancelIfCanceled
default void cancelIfCanceled()ThrowCanceledException
when progress has been canceled.
-