Class ContactController.SubmitTask
java.lang.Object
page.codeberg.friedolyn.util.Task<Boolean>
page.codeberg.friedolyn.gui.controllers.ContactController.SubmitTask
- All Implemented Interfaces:
Runnable
- Enclosing class:
ContactController
Sends the user's request to the developers
via e-mail
.-
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<Boolean>> The subscribers that will be notified about any status changes and progress updates of this 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 task failed.Tries to locate thelog file
in thelogs directory
relative to theinvalid reference
configuration directory
void
registerListener
(@NonNull Task.TaskListener<Boolean> listener) Adds a subscriber that is interested in status updates of the action's progress.boolean
removeListener
(@NonNull Task.TaskListener<Boolean> listener) Removes a subscriber that was previously added to receive status updates of the action's progress.void
run()
Sends the user's request to the developersvia e-mail
.private void
started()
Notifies allsubscribers
that the e-mail sending process has begun.private void
Notifies allsubscribers
that the task was completed 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. -
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
-
SubmitTask
private SubmitTask()
-
-
Method Details
-
started
private void started()Notifies allsubscribers
that the e-mail sending process has begun. -
failed
private void failed()Notifies allsubscribers
that the task failed. -
succeeded
private void succeeded()Notifies allsubscribers
that the task was completed successfully. -
cancelled
private void cancelled()Notifies allsubscribers
that the task was terminated prematurely by outside intervention. -
cancel
-
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<Boolean>
- 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<Boolean>
- 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:
-
run
public void run()Sends the user's request to the developersvia e-mail
. The user's message is encrypted using thedeveloper's OpenPGP public key
. -
loadLogFile
Tries to locate thelog file
in thelogs directory
relative to theinvalid reference
configuration directory
- Returns:
- The log file. Empty if the log file could not be found, is not a file or cannot be read.
-
getResult
- Specified by:
getResult
in classTask<Boolean>
- 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.
-