java.lang.Object
org.jhotdraw8.fxbase.concurrent.SimpleWorkState<V>
- Type Parameters:
V- the type of the result value
- All Implemented Interfaces:
javafx.concurrent.Worker<V>,WorkState<V>
A simple implementation of the
WorkState interface.
This implementation requires that the FX Application Thread is running.
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ReadOnlyObjectProperty<Throwable> javafx.beans.property.ReadOnlyStringPropertyjavafx.beans.property.ReadOnlyDoublePropertyjavafx.beans.property.ReadOnlyBooleanPropertyjavafx.beans.property.ReadOnlyObjectProperty<javafx.concurrent.Worker.State> javafx.beans.property.ReadOnlyStringPropertyjavafx.beans.property.ReadOnlyDoublePropertyjavafx.beans.property.ReadOnlyObjectProperty<V> javafx.beans.property.ReadOnlyDoubleProperty -
Nested Class Summary
Nested classes/interfaces inherited from interface javafx.concurrent.Worker
javafx.concurrent.Worker.State -
Field Summary
Fields inherited from interface org.jhotdraw8.fxbase.concurrent.WorkState
EXCEPTION_PROPERTY, MESSAGE_PROPERTY, PROGRESS_PROPERTY, RUNNING_PROPERTY, STATE_PROPERTY, TITLE_PROPERTY, TOTAL_WORK_PROPERTY, VALUE_PROPERTY, WORK_DONE_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.SimpleWorkState(@Nullable String title) Creates a new instance with the specified title. -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel()javafx.beans.property.ReadOnlyObjectProperty<Throwable> Gets the value of theexceptionproperty.@Nullable StringGets the value of themessageproperty.doubleGets the value of theprogressproperty.javafx.concurrent.Worker.StategetState()Gets the value of thestateproperty.@Nullable StringgetTitle()Gets the value of thetitleproperty.doubleGets the value of thetotalWorkproperty.@Nullable VgetValue()Gets the value of thevalueproperty.doubleGets the value of theworkDoneproperty.booleanReturns true if the worker associated to this work state should cancel.booleanGets the value of therunningproperty.javafx.beans.property.ReadOnlyStringPropertyjavafx.beans.property.ReadOnlyDoublePropertyjavafx.beans.property.ReadOnlyBooleanPropertyjavafx.beans.property.ReadOnlyObjectProperty<javafx.concurrent.Worker.State> javafx.beans.property.ReadOnlyStringPropertyjavafx.beans.property.ReadOnlyDoublePropertyvoidupdateException(@Nullable Throwable value) Asynchronously updates the current exception of the work state.voidupdateMessage(@Nullable String value) Asynchronously updates the current message of the work state.voidupdateProgress(double newValue) This method may be called on any thread.voidupdateRunning(boolean value) Asynchronously updates the current running state of the work state.voidupdateState(@Nullable javafx.concurrent.Worker.State value) Asynchronously updates the current state of the work state.voidupdateTitle(String value) Asynchronously updates the current title of the work state.voidupdateTotalWork(double newValue) This method may be called on any thread.voidupdateValue(@Nullable V newValue) This method may be called on any thread.voidupdateWorkDone(double newValue) This method may be called on any thread.javafx.beans.property.ReadOnlyObjectProperty<V> javafx.beans.property.ReadOnlyDoubleProperty
-
Property Details
-
value
- Specified by:
valuePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
valuePropertyin interfaceWorkState<V>- See Also:
-
workDone
public javafx.beans.property.ReadOnlyDoubleProperty workDoneProperty- Specified by:
workDonePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
workDonePropertyin interfaceWorkState<V>- See Also:
-
totalWork
public javafx.beans.property.ReadOnlyDoubleProperty totalWorkProperty- Specified by:
totalWorkPropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
totalWorkPropertyin interfaceWorkState<V>- See Also:
-
progress
public javafx.beans.property.ReadOnlyDoubleProperty progressProperty- Specified by:
progressPropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
progressPropertyin interfaceWorkState<V>- See Also:
-
message
public javafx.beans.property.ReadOnlyStringProperty messageProperty- Specified by:
messagePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
messagePropertyin interfaceWorkState<V>- See Also:
-
title
public javafx.beans.property.ReadOnlyStringProperty titleProperty- Specified by:
titlePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
titlePropertyin interfaceWorkState<V>- See Also:
-
state
public javafx.beans.property.ReadOnlyObjectProperty<javafx.concurrent.Worker.State> stateProperty- Specified by:
statePropertyin interfacejavafx.concurrent.Worker<V>- See Also:
-
exception
- Specified by:
exceptionPropertyin interfacejavafx.concurrent.Worker<V>- See Also:
-
running
public javafx.beans.property.ReadOnlyBooleanProperty runningProperty- Specified by:
runningPropertyin interfacejavafx.concurrent.Worker<V>- See Also:
-
-
Constructor Details
-
SimpleWorkState
public SimpleWorkState()Creates a new instance. -
SimpleWorkState
Creates a new instance with the specified title.- Parameters:
title- a title
-
-
Method Details
-
updateValue
This method may be called on any thread.- Specified by:
updateValuein interfaceWorkState<V>- Parameters:
newValue- the new value
-
getValue
Gets the value of thevalueproperty. -
valueProperty
- Specified by:
valuePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
valuePropertyin interfaceWorkState<V>- Returns:
- the
valueproperty - See Also:
-
updateWorkDone
public void updateWorkDone(double newValue) This method may be called on any thread.- Parameters:
newValue- the new value
-
getWorkDone
public double getWorkDone()Gets the value of theworkDoneproperty.- Specified by:
getWorkDonein interfacejavafx.concurrent.Worker<V>- Specified by:
getWorkDonein interfaceWorkState<V>- Property description:
- Returns:
- the value of the
workDoneproperty - See Also:
-
workDoneProperty
public javafx.beans.property.ReadOnlyDoubleProperty workDoneProperty()- Specified by:
workDonePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
workDonePropertyin interfaceWorkState<V>- Returns:
- the
workDoneproperty - See Also:
-
updateTotalWork
public void updateTotalWork(double newValue) This method may be called on any thread.- Parameters:
newValue- the new value
-
getTotalWork
public double getTotalWork()Gets the value of thetotalWorkproperty.- Specified by:
getTotalWorkin interfacejavafx.concurrent.Worker<V>- Specified by:
getTotalWorkin interfaceWorkState<V>- Property description:
- Returns:
- the value of the
totalWorkproperty - See Also:
-
totalWorkProperty
public javafx.beans.property.ReadOnlyDoubleProperty totalWorkProperty()- Specified by:
totalWorkPropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
totalWorkPropertyin interfaceWorkState<V>- Returns:
- the
totalWorkproperty - See Also:
-
updateProgress
public void updateProgress(double newValue) This method may be called on any thread.- Specified by:
updateProgressin interfaceWorkState<V>- Parameters:
newValue- the new value
-
getProgress
public double getProgress()Gets the value of theprogressproperty.- Specified by:
getProgressin interfacejavafx.concurrent.Worker<V>- Specified by:
getProgressin interfaceWorkState<V>- Property description:
- Returns:
- the value of the
progressproperty - See Also:
-
progressProperty
public javafx.beans.property.ReadOnlyDoubleProperty progressProperty()- Specified by:
progressPropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
progressPropertyin interfaceWorkState<V>- Returns:
- the
progressproperty - See Also:
-
getMessage
Gets the value of themessageproperty.- Specified by:
getMessagein interfacejavafx.concurrent.Worker<V>- Specified by:
getMessagein interfaceWorkState<V>- Property description:
- Returns:
- the value of the
messageproperty - See Also:
-
messageProperty
public javafx.beans.property.ReadOnlyStringProperty messageProperty()- Specified by:
messagePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
messagePropertyin interfaceWorkState<V>- Returns:
- the
messageproperty - See Also:
-
getTitle
Gets the value of thetitleproperty. -
titleProperty
public javafx.beans.property.ReadOnlyStringProperty titleProperty()- Specified by:
titlePropertyin interfacejavafx.concurrent.Worker<V>- Specified by:
titlePropertyin interfaceWorkState<V>- Returns:
- the
titleproperty - See Also:
-
updateMessage
Description copied from interface:WorkStateAsynchronously updates the current message of the work state.Calls to this method are coalesced and run later on the FX application thread, so calls to this method, even from the FX Application thread, may not necessarily result in immediate updates to the property, and intermediate values may be coalesced to save on event notifications.
- Specified by:
updateMessagein interfaceWorkState<V>- Parameters:
value- the new value
-
updateState
public void updateState(@Nullable javafx.concurrent.Worker.State value) Description copied from interface:WorkStateAsynchronously updates the current state of the work state.Calls to this method are coalesced as described in
WorkState.updateMessage(String).- Specified by:
updateStatein interfaceWorkState<V>- Parameters:
value- the new value
-
updateException
Description copied from interface:WorkStateAsynchronously updates the current exception of the work state.Calls to this method are coalesced as described in
WorkState.updateMessage(String).- Specified by:
updateExceptionin interfaceWorkState<V>- Parameters:
value- the new value
-
updateRunning
public void updateRunning(boolean value) Description copied from interface:WorkStateAsynchronously updates the current running state of the work state.Calls to this method are coalesced as described in
WorkState.updateMessage(String).- Specified by:
updateRunningin interfaceWorkState<V>- Parameters:
value- the new value
-
updateTitle
Description copied from interface:WorkStateAsynchronously updates the current title of the work state.Calls to this method are coalesced as described in
WorkState.updateMessage(String).- Specified by:
updateTitlein interfaceWorkState<V>- Parameters:
value- the new value
-
isCancelled
public boolean isCancelled()Description copied from interface:WorkStateReturns true if the worker associated to this work state should cancel.- Specified by:
isCancelledin interfaceWorkState<V>- Returns:
- true if cancelled
-
cancel
public boolean cancel()- Specified by:
cancelin interfacejavafx.concurrent.Worker<V>
-
getState
public javafx.concurrent.Worker.State getState()Gets the value of thestateproperty.- Specified by:
getStatein interfacejavafx.concurrent.Worker<V>- Property description:
- Returns:
- the value of the
stateproperty - See Also:
-
stateProperty
public javafx.beans.property.ReadOnlyObjectProperty<javafx.concurrent.Worker.State> stateProperty()- Specified by:
statePropertyin interfacejavafx.concurrent.Worker<V>- Returns:
- the
stateproperty - See Also:
-
getException
Gets the value of theexceptionproperty.- Specified by:
getExceptionin interfacejavafx.concurrent.Worker<V>- Property description:
- Returns:
- the value of the
exceptionproperty - See Also:
-
exceptionProperty
- Specified by:
exceptionPropertyin interfacejavafx.concurrent.Worker<V>- Returns:
- the
exceptionproperty - See Also:
-
isRunning
public boolean isRunning()Gets the value of therunningproperty.- Specified by:
isRunningin interfacejavafx.concurrent.Worker<V>- Property description:
- Returns:
- the value of the
runningproperty - See Also:
-
runningProperty
public javafx.beans.property.ReadOnlyBooleanProperty runningProperty()- Specified by:
runningPropertyin interfacejavafx.concurrent.Worker<V>- Returns:
- the
runningproperty - See Also:
-