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 booleanWhether the task has been prematurelyterminatedby 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 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 task failed.Tries to locate thelog filein thelogs directoryrelative to the.invalid reference
configuration directoryvoidregisterListener(@NonNull Task.TaskListener<Boolean> listener) Adds a subscriber that is interested in status updates of the action's progress.booleanremoveListener(@NonNull Task.TaskListener<Boolean> listener) Removes a subscriber that was previously added to receive status updates of the action's progress.voidrun()Sends the user's request to the developersvia e-mail.private voidstarted()Notifies allsubscribersthat the e-mail sending process has begun.private voidNotifies allsubscribersthat 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.nulluntil the task has finished. -
isCancelled
private boolean isCancelledWhether the task has been prematurelyterminatedby outside intervention.
-
-
Constructor Details
-
SubmitTask
private SubmitTask()
-
-
Method Details
-
started
private void started()Notifies allsubscribersthat the e-mail sending process has begun. -
failed
private void failed()Notifies allsubscribersthat the task failed. -
succeeded
private void succeeded()Notifies allsubscribersthat the task was completed successfully. -
cancelled
private void cancelled()Notifies allsubscribersthat 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:
registerListenerin 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:
removeListenerin 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:
trueif the subscriber was removed,falseif 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 filein thelogs directoryrelative to the.invalid 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:
getResultin 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.
-