Commit | Line | Data |
---|---|---|
a3b510ab NR |
1 | package com.googlecode.lanterna.gui2; |
2 | ||
3 | /** | |
4 | * Extended interface of TextGUIThread for implementations that uses a separate thread for all GUI event processing and | |
5 | * updating. | |
6 | * | |
7 | * @author Martin | |
8 | */ | |
9 | public interface AsynchronousTextGUIThread extends TextGUIThread { | |
10 | /** | |
11 | * Starts the AsynchronousTextGUIThread, typically meaning that the event processing loop will start. | |
12 | */ | |
13 | void start(); | |
14 | ||
15 | /** | |
16 | * Requests that the AsynchronousTextGUIThread stops, typically meaning that the event processing loop will exit | |
17 | */ | |
18 | void stop(); | |
19 | ||
20 | /** | |
21 | * Blocks until the GUI loop has stopped | |
22 | * @throws InterruptedException In case this thread was interrupted while waiting for the GUI thread to exit | |
23 | */ | |
24 | void waitForStop() throws InterruptedException; | |
25 | ||
26 | /** | |
27 | * Returns the current status of this GUI thread | |
28 | * @return Current status of the GUI thread | |
29 | */ | |
30 | State getState(); | |
31 | ||
32 | /** | |
33 | * Enum representing the states of the GUI thread life-cycle | |
34 | */ | |
35 | enum State { | |
36 | /** | |
37 | * The instance has been created but not yet started | |
38 | */ | |
39 | CREATED, | |
40 | /** | |
41 | * The thread has started an is running | |
42 | */ | |
43 | STARTED, | |
44 | /** | |
45 | * The thread is trying to stop but is still running | |
46 | */ | |
47 | STOPPING, | |
48 | /** | |
49 | * The thread has stopped | |
50 | */ | |
51 | STOPPED, | |
52 | ; | |
53 | } | |
54 | } |