| 26 | import pcgen.util.Logging; |
| 27 | |
| 28 | public abstract class PCGenTask implements Runnable, ProgressContainer |
| 29 | { |
| 30 | private final EventListenerList listenerList = new EventListenerList(); |
| 31 | private int progress = 0; |
| 32 | private int maximum = 0; |
| 33 | private String message; |
| 34 | |
| 35 | public void addPCGenTaskListener(PCGenTaskListener listener) |
| 36 | { |
| 37 | Objects.requireNonNull(listener); |
| 38 | listenerList.add(PCGenTaskListener.class, listener); |
| 39 | } |
| 40 | |
| 41 | public void removePCGenTaskListener(PCGenTaskListener listener) |
| 42 | { |
| 43 | Objects.requireNonNull(listener); |
| 44 | listenerList.remove(PCGenTaskListener.class, listener); |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public abstract void run(); |
| 49 | |
| 50 | @Override |
| 51 | public int getMaximum() |
| 52 | { |
| 53 | return maximum; |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public int getProgress() |
| 58 | { |
| 59 | return progress; |
| 60 | } |
| 61 | |
| 62 | @Override |
| 63 | public String getMessage() |
| 64 | { |
| 65 | return message; |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public void setValues(int progress, int maximum) |
| 70 | { |
| 71 | this.progress = progress; |
| 72 | this.maximum = maximum; |
| 73 | fireProgressChangedEvent(); |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public void setValues(String message, int progress, int maximum) |
| 78 | { |
| 79 | this.progress = progress; |
| 80 | this.maximum = maximum; |
| 81 | this.message = message; |
| 82 | fireProgressChangedEvent(); |
| 83 | } |
| 84 | |
| 85 | @Override |
nothing calls this directly
no outgoing calls
no test coverage detected