Class ContactController.OpenContactReplyDialogTask
java.lang.Object
page.codeberg.friedolyn.util.Task<ContactMethods>
page.codeberg.friedolyn.gui.controllers.ContactController.OpenContactReplyDialogTask
- All Implemented Interfaces:
Runnable
- Enclosing class:
ContactController
Displays the
contact reply method dialog to the user.-
Nested Class Summary
Nested classes/interfaces inherited from class page.codeberg.friedolyn.util.Task
Task.CancelListener, Task.FailureListener<ResultType>, Task.ProgressListener, Task.SuccessListener<ResultType>, Task.TaskListener<ResultType> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether the task has been prematurelyterminatedby outside intervention.private final @NonNull HashSet<Task.TaskListener<ContactMethods>> The subscribers that will be notified about any status changes and progress updates of this task.private ContactMethodsThe result of the task.private BooleanWhether the task has been executed successfully. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Prematurely terminates the action.private voidNotifies allsubscribersthat the task was terminated prematurely by outside intervention.private voidfailed()Notifies allsubscribersthat the contact reply dialog was closed unsuccessfully.@NonNull Optional<Result<ContactMethods>> voidregisterListener(@NonNull Task.TaskListener<ContactMethods> listener) Adds a subscriber that is interested in status updates of the action's progress.booleanremoveListener(@NonNull Task.TaskListener<ContactMethods> listener) Removes a subscriber that was previously added to receive status updates of the action's progress.voidrun()Opens the contact reply dialog window and waits for the user to close it.private voidstarted()Notifies allsubscribersthat the contact reply dialog has been opened.private voidNotifies allsubscribersthat the fetching process finished successfully.Methods inherited from class page.codeberg.friedolyn.util.Task
setOnCancelled, setOnFailed, setOnProgressUpdate, setOnSucceeded
-
Field Details
-
LISTENERS
The subscribers that will be notified about any status changes and progress updates of this task. -
result
The result of the task.nulluntil the task has finished. -
success
Whether the task has been executed successfully.nulluntil the task has finished. -
isCancelled
private boolean isCancelledWhether the task has been prematurelyterminatedby outside intervention.
-
-
Constructor Details
-
OpenContactReplyDialogTask
private OpenContactReplyDialogTask()
-
-
Method Details
-
registerListener
Adds a subscriber that is interested in status updates of the action's progress. Does NOT remove or replace any existing listeners.- Specified by:
registerListenerin classTask<ContactMethods>- Parameters:
listener- The subscriber that wants to be informed about the progress of the action.- See Also:
-
removeListener
Removes a subscriber that was previously added to receive status updates of the action's progress.- Specified by:
removeListenerin classTask<ContactMethods>- Parameters:
listener- The subscriber that no longer wants to be informed about the progress of the action. Must be the exact same reference that was previously registered.- Returns:
trueif the subscriber was removed,falseif it hadn't been registered in the first place.- See Also:
-
started
private void started()Notifies allsubscribersthat the contact reply dialog has been opened. -
failed
private void failed()Notifies allsubscribersthat the contact reply dialog was closed unsuccessfully. -
succeeded
private void succeeded()Notifies allsubscribersthat the fetching process finished successfully. Does nothing ifresultisnull. -
cancelled
private void cancelled()Notifies allsubscribersthat the task was terminated prematurely by outside intervention. -
cancel
public void cancel()Prematurely terminates the action. The action will be stopped as soon as possible, but it may not be immediate, depending on the implementation.- Specified by:
cancelin classTask<ContactMethods>
-
run
public void run()Opens the contact reply dialog window and waits for the user to close it. The result is then stored inresult,ContactController.contactMethodsandContactController.configuration.- Specified by:
runin interfaceRunnable- Specified by:
runin classTask<ContactMethods>
-
getResult
- Specified by:
getResultin classTask<ContactMethods>- Returns:
- The end product generated by the action. Empty if the action has not finished yet.
The presence of
Result.getResult()does NOT indicate success. OnlyResult.getSuccess()can be used to determine success or failure.
-