1 package org.columba.core.command; 18 19 import org.columba.api.command.IStatusObservable; 20 import org.columba.api.command.IWorkerStatusController; 21 22 41 public class StatusObservableImpl implements IStatusObservable { 42 45 private IWorkerStatusController worker; 46 47 public StatusObservableImpl() { 48 } 50 51 public StatusObservableImpl(IWorkerStatusController theWorker) { 52 this.worker = theWorker; 53 } 54 55 61 public void setCurrent(int i) { 62 if (worker != null) { 63 worker.setProgressBarValue(i); 64 } 65 } 66 67 73 public void setMax(int i) { 74 if (worker != null) { 75 worker.setProgressBarMaximum(i); 76 } 77 } 78 79 83 public void resetCurrent() { 84 setCurrent(0); 85 } 86 87 93 public void setMessage(String string) { 94 if (worker != null) { 95 worker.setDisplayText(string); 96 } 97 } 98 99 102 public void clearMessage() { 103 if (worker != null) { 104 worker.clearDisplayText(); 105 } 106 } 107 108 113 public void clearMessageWithDelay() { 114 if (worker != null) { 115 worker.clearDisplayTextWithDelay(); 116 } 117 } 118 119 124 public IWorkerStatusController getWorker() { 125 return worker; 126 } 127 128 133 public void setWorker(IWorkerStatusController theWorker) { 134 this.worker = theWorker; 135 } 136 137 142 public boolean isCancelled() { 143 return worker.cancelled(); 144 } 145 146 public void cancel(boolean b) { 147 if (b) { 148 worker.cancel(); 149 } 150 } 151 152 } 153 | Popular Tags |