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 boolean
Whether the task has been prematurelyterminated
by 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 ContactMethods
The result of the task.private Boolean
Whether the task has been executed successfully. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Prematurely terminates the action.private void
Notifies allsubscribers
that the task was terminated prematurely by outside intervention.private void
failed()
Notifies allsubscribers
that the contact reply dialog was closed unsuccessfully.@NonNull Optional
<Result<ContactMethods>> void
registerListener
(@NonNull Task.TaskListener<ContactMethods> listener) Adds a subscriber that is interested in status updates of the action's progress.boolean
removeListener
(@NonNull Task.TaskListener<ContactMethods> listener) Removes a subscriber that was previously added to receive status updates of the action's progress.void
run()
Opens the contact reply dialog window and waits for the user to close it.private void
started()
Notifies allsubscribers
that the contact reply dialog has been opened.private void
Notifies allsubscribers
that 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.null
until the task has finished. -
success
Whether the task has been executed successfully.null
until the task has finished. -
isCancelled
private boolean isCancelledWhether the task has been prematurelyterminated
by 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:
registerListener
in 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:
removeListener
in 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:
true
if the subscriber was removed,false
if it hadn't been registered in the first place.- See Also:
-
started
private void started()Notifies allsubscribers
that the contact reply dialog has been opened. -
failed
private void failed()Notifies allsubscribers
that the contact reply dialog was closed unsuccessfully. -
succeeded
private void succeeded()Notifies allsubscribers
that the fetching process finished successfully. Does nothing ifresult
isnull
. -
cancelled
private void cancelled()Notifies allsubscribers
that 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:
cancel
in 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.contactMethods
andContactController.configuration
.- Specified by:
run
in interfaceRunnable
- Specified by:
run
in classTask<ContactMethods>
-
getResult
- Specified by:
getResult
in 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.
-