1 22 23 package gnu.mail.treeutil; 24 25 import java.util.*; 26 27 33 public class StatusEvent 34 extends EventObject 35 { 36 37 public static final int OPERATION_START = 0; 38 39 public static final int OPERATION_UPDATE = 1; 40 41 public static final int OPERATION_END = 2; 42 43 public static final int UNKNOWN = -1; 44 45 protected int type; 46 47 protected String operation; 48 49 protected int minimum = UNKNOWN; 50 51 protected int maximum = UNKNOWN; 52 53 protected int value = UNKNOWN; 54 55 58 public StatusEvent(Object source, int type, String operation) 59 { 60 super(source); 61 switch (type) 62 { 63 case OPERATION_START: 64 case OPERATION_UPDATE: 65 case OPERATION_END: 66 this.type = type; 67 break; 68 default: 69 throw new IllegalArgumentException ("Illegal event type: "+type); 70 } 71 this.operation = operation; 72 } 73 74 77 public StatusEvent(Object source, int type, String operation, int minimum, int maximum, int value) 78 { 79 super(source); 80 switch (type) 81 { 82 case OPERATION_START: 83 case OPERATION_UPDATE: 84 case OPERATION_END: 85 this.type = type; 86 break; 87 default: 88 throw new IllegalArgumentException ("Illegal event type: "+type); 89 } 90 this.operation = operation; 91 this.minimum = minimum; 92 this.maximum = maximum; 93 this.value = value; 94 } 95 96 99 public int getType() 100 { 101 return type; 102 } 103 104 107 public String getOperation() 108 { 109 return operation; 110 } 111 112 115 public int getMinimum() 116 { 117 return minimum; 118 } 119 120 123 public int getMaximum() 124 { 125 return maximum; 126 } 127 128 131 public int getValue() 132 { 133 return value; 134 } 135 136 } 137 | Popular Tags |