1 /*
2 * Tethys: GUI Utilities
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.tethys.api.thread;
18
19 import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
20 import io.github.tonywasher.joceanus.oceanus.profile.OceanusProfile;
21 import io.github.tonywasher.joceanus.oceanus.resource.OceanusBundleId;
22
23 /**
24 * Report status.
25 */
26 public interface TethysUIThreadStatusReport {
27 /**
28 * Obtain the thread data.
29 *
30 * @return the threadData
31 */
32 Object getThreadData();
33
34 /**
35 * Initialise Task.
36 *
37 * @param pTask the task
38 * @throws OceanusException on cancellation
39 */
40 default void initTask(final OceanusBundleId pTask) throws OceanusException {
41 initTask(pTask.getValue());
42 }
43
44 /**
45 * Initialise Task.
46 *
47 * @param pTask the task
48 * @throws OceanusException on cancellation
49 */
50 void initTask(String pTask) throws OceanusException;
51
52 /**
53 * Set number of stages.
54 *
55 * @param pNumStages the number of stages
56 * @throws OceanusException on cancellation
57 */
58 void setNumStages(int pNumStages) throws OceanusException;
59
60 /**
61 * Set new stage.
62 *
63 * @param pStage the new stage
64 * @throws OceanusException on cancellation
65 */
66 void setNewStage(String pStage) throws OceanusException;
67
68 /**
69 * Set new stage.
70 *
71 * @param pStage the new stage
72 * @throws OceanusException on cancellation
73 */
74 default void setNewStage(final OceanusBundleId pStage) throws OceanusException {
75 setNewStage(pStage.getValue());
76 }
77
78 /**
79 * Set number of steps.
80 *
81 * @param pNumSteps the number of steps
82 * @throws OceanusException on cancellation
83 */
84 void setNumSteps(int pNumSteps) throws OceanusException;
85
86 /**
87 * Set steps done.
88 *
89 * @param pSteps the number of steps done
90 * @throws OceanusException on cancellation
91 */
92 void setStepsDone(int pSteps) throws OceanusException;
93
94 /**
95 * Set next step.
96 *
97 * @throws OceanusException on cancellation
98 */
99 void setNextStep() throws OceanusException;
100
101 /**
102 * Set next step.
103 *
104 * @param pStep the step to set
105 * @throws OceanusException on cancellation
106 */
107 void setNextStep(String pStep) throws OceanusException;
108
109 /**
110 * Set Completion.
111 *
112 * @throws OceanusException on cancellation
113 */
114 void setCompletion() throws OceanusException;
115
116 /**
117 * Is the task cancelled?
118 *
119 * @throws OceanusException on cancellation
120 */
121 void checkForCancellation() throws OceanusException;
122
123 /**
124 * Throw cancellation exception.
125 *
126 * @throws OceanusException on error
127 */
128 void throwCancelException() throws OceanusException;
129
130 /**
131 * Obtain the active task.
132 *
133 * @return the active task
134 */
135 OceanusProfile getActiveTask();
136 }