java.lang.Object
org.autogui.base.log.GuiLogEntryProgress
- All Implemented Interfaces:
Closeable
,AutoCloseable
,GuiLogEntry
- Direct Known Subclasses:
GuiSwingLogEntryProgress
a log-entry for progress:
[time] minimum|=========value - - - - |maximum : valueP %, message or [time] |- - - indeterminate - - - | message => [time] message [endTime] 100%
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
an exception thrown by checking-interruption -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddListener
(Consumer<GuiLogEntryProgress> listener) addValue
(int n) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
addValueP
(double p) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
void
if the current thread is equal to the thread of the progress, and the thread is interrupted, it causesGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
.void
close()
void
finish()
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
.void
notifies to listeners.int
int
getTime()
int
getValue()
double
boolean
isActive()
boolean
boolean
removeListener
(Consumer<GuiLogEntryProgress> listener) setEndTime
(Instant endTime) setIndeterminate
(boolean indeterminate) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
.setMaximum
(int maximum) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
.setMessage
(String message) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
.setMinimum
(int minimum) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
.void
copy fields of p.setValue
(int n) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
if the value is actually changed, it causes a notification to listenerssetValueP
(double p) it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
toString()
-
Field Details
-
minimum
protected int minimum -
maximum
protected int maximum -
value
protected int value -
indeterminate
protected boolean indeterminate -
message
-
time
-
endTime
-
thread
-
listeners
-
-
Constructor Details
-
GuiLogEntryProgress
public GuiLogEntryProgress()
-
-
Method Details
-
setState
copy fields of p. p can be null- Parameters:
p
- copied state
-
addListener
- Parameters:
listener
- the listener will receive the progress when its valueP is updated- Returns:
- this
-
removeListener
-
getListeners
-
fireChange
public void fireChange()notifies to listeners. this is automatically called from setter methods -
setMinimum
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
. it also causes a notification to listeners when the minimum value is actually changed.- Parameters:
minimum
- the minimum value of the progress to be set: if the value is smaller than the maximum, then the intermediate flag becomes false- Returns:
- this
-
setMaximum
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
. it also causes a notification to listeners when the maximum value is actually changed.- Parameters:
maximum
- the maximum value of the progress to be set: if the value is larger than the minimum then the intermediate flag becomes false- Returns:
- this
-
setValueP
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
- Parameters:
p
- 0 to 1.0- Returns:
- this
- See Also:
-
setValue
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
if the value is actually changed, it causes a notification to listeners- Parameters:
n
- the progress value- Returns:
- this
-
addValueP
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
- Parameters:
p
- 0 to 1.0- Returns:
- this
- See Also:
-
addValue
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
- Parameters:
n
- added value to the progress- Returns:
- this
- See Also:
-
setIndeterminate
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
. if the flag is actually changed, it causes a notification to listeners- Parameters:
indeterminate
- the intermediate flag to be set- Returns:
- this
-
setMessage
it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
. the method will never cause a notification- Parameters:
message
- the new message- Returns:
- this
-
setEndTime
-
setTime
-
isIndeterminate
public boolean isIndeterminate() -
getMaximum
public int getMaximum() -
getMinimum
public int getMinimum() -
getValue
public int getValue() -
getValueP
public double getValueP() -
getTime
-
getMessage
-
isFinished
public boolean isFinished()- Returns:
- true if endTime is set
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
finish
public void finish()it might causeGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
. endTime will be set. value becomes maximum -
getEndTime
-
setThread
-
getThread
- Returns:
- by default, the current thread of constructor sender
-
checkInterruption
public void checkInterruption()if the current thread is equal to the thread of the progress, and the thread is interrupted, it causesGuiLogEntryProgress.GuiLogEntryProgressInterruptedException
. -
isActive
public boolean isActive()- Specified by:
isActive
in interfaceGuiLogEntry
- Returns:
- true if the record is running and updating
-
toString
-