Class ConsoleProgressBarAnimation
- java.lang.Object
-
- de.dytanic.cloudnet.console.animation.AbstractConsoleAnimation
-
- de.dytanic.cloudnet.console.animation.progressbar.ConsoleProgressBarAnimation
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
ConsoleDownloadProgressBarAnimation
public class ConsoleProgressBarAnimation extends AbstractConsoleAnimation
Represents a progress bar animation in the console that by default is updated all 10 milliseconds
-
-
Constructor Summary
Constructors Constructor Description ConsoleProgressBarAnimation(long fullLength, int startValue, char progressChar, char lastProgressChar, char emptyChar, java.lang.String prefix, java.lang.String suffix)Creates a newConsoleProgressBarAnimation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinish()protected java.lang.Stringformat(java.lang.String input, double percent)protected java.lang.StringformatCurrentValue(long currentValue)protected java.lang.StringformatLength(long length)protected java.lang.StringformatTime(long millis)protected java.lang.StringformatValue(long value)longgetCurrentValue()longgetLength()protected booleanhandleTick()voidsetCurrentValue(long currentValue)voidsetLength(int length)-
Methods inherited from class de.dytanic.cloudnet.console.animation.AbstractConsoleAnimation
addFinishHandler, addToCursor, eraseLastLine, getConsole, getName, getStartTime, getTimeElapsed, getUpdateInterval, isStaticCursor, print, run, setConsole, setCursor, setStaticCursor, setUpdateInterval
-
-
-
-
Constructor Detail
-
ConsoleProgressBarAnimation
public ConsoleProgressBarAnimation(long fullLength, int startValue, char progressChar, char lastProgressChar, char emptyChar, java.lang.String prefix, java.lang.String suffix)Creates a newConsoleProgressBarAnimation- Parameters:
fullLength- the maximum of the animationstartValue- the initial value for this animationprogressChar- theCharacterfor each percent in the animationlastProgressChar- theCharacterwhich is at the last position of the animationprefix- the prefix for this animationsuffix- the suffix for this animation
-
-
Method Detail
-
getLength
public long getLength()
-
setLength
public void setLength(int length)
-
getCurrentValue
public long getCurrentValue()
-
setCurrentValue
public void setCurrentValue(long currentValue)
-
finish
public void finish()
-
handleTick
protected boolean handleTick()
- Specified by:
handleTickin classAbstractConsoleAnimation- Returns:
- if the animation is finished and should be cancelled
-
formatCurrentValue
protected java.lang.String formatCurrentValue(long currentValue)
-
formatLength
protected java.lang.String formatLength(long length)
-
formatValue
protected java.lang.String formatValue(long value)
-
formatTime
protected java.lang.String formatTime(long millis)
-
format
protected java.lang.String format(java.lang.String input, double percent)
-
-