90 91 /** 92 * The block increment adjustment type. 93 */ 94 @Native public static final int BLOCK_INCREMENT = 4; 95 96 /** 97 * The absolute tracking adjustment type. 98 */ 99 @Native public static final int TRACK = 5; 100 101 /** 102 * The adjustable object that fired the event. 103 * 104 * @serial 105 * @see #getAdjustable 106 */ 107 Adjustable adjustable; 108 109 /** 110 * <code>value</code> will contain the new value of the 111 * adjustable object. This value will always be in a 112 * range associated adjustable object. 113 * 114 * @serial 115 * @see #getValue 116 */ 117 int value; 118 119 /** 120 * The <code>adjustmentType</code> describes how the adjustable 121 * object value has changed. 122 * This value can be increased/decreased by a block or unit amount 123 * where the block is associated with page increments/decrements, 124 * and a unit is associated with line increments/decrements. 125 * 126 * @serial 127 * @see #getAdjustmentType 128 */ 129 int adjustmentType; 130 131 132 /** 133 * The <code>isAdjusting</code> is true if the event is one 134 * of the series of multiple adjustment events. 135 * 136 * @since 1.4 137 * @serial 138 * @see #getValueIsAdjusting 139 */ 140 boolean isAdjusting; 141 142 143 /* 144 * JDK 1.1 serialVersionUID 145 */ 146 private static final long serialVersionUID = 5700290645205279921L; 147 148 149 /** 150 * Constructs an <code>AdjustmentEvent</code> object with the 151 * specified <code>Adjustable</code> source, event type, 152 * adjustment type, and value. 153 * <p> This method throws an 154 * <code>IllegalArgumentException</code> if <code>source</code> 155 * is <code>null</code>. 156 * 157 * @param source The <code>Adjustable</code> object where the 158 * event originated 159 * @param id An integer indicating the type of event. 160 * For information on allowable values, see 161 * the class description for {@link AdjustmentEvent} 162 * @param type An integer indicating the adjustment type. 163 * For information on allowable values, see 164 * the class description for {@link AdjustmentEvent} 165 * @param value The current value of the adjustment 166 * @throws IllegalArgumentException if <code>source</code> is null 167 * @see #getSource() 168 * @see #getID() 169 * @see #getAdjustmentType() 170 * @see #getValue() 171 */ 172 public AdjustmentEvent(Adjustable source, int id, int type, int value) { 173 this(source, id, type, value, false); 174 } 175 176 /** 177 * Constructs an <code>AdjustmentEvent</code> object with the 178 * specified Adjustable source, event type, adjustment type, and value. 179 * <p> This method throws an 180 * <code>IllegalArgumentException</code> if <code>source</code> 181 * is <code>null</code>. 182 * 183 * @param source The <code>Adjustable</code> object where the 184 * event originated 185 * @param id An integer indicating the type of event. 186 * For information on allowable values, see 187 * the class description for {@link AdjustmentEvent} 188 * @param type An integer indicating the adjustment type. 189 * For information on allowable values, see 190 * the class description for {@link AdjustmentEvent} 191 * @param value The current value of the adjustment 192 * @param isAdjusting A boolean that equals <code>true</code> if the event is one 193 * of a series of multiple adjusting events, 194 * otherwise <code>false</code> 195 * @throws IllegalArgumentException if <code>source</code> is null 196 * @since 1.4 197 * @see #getSource() 198 * @see #getID() 199 * @see #getAdjustmentType() 200 * @see #getValue() 201 * @see #getValueIsAdjusting() 202 */ 203 public AdjustmentEvent(Adjustable source, int id, int type, int value, boolean isAdjusting) { 204 super(source, id); 205 adjustable = source; 206 this.adjustmentType = type; 207 this.value = value; 208 this.isAdjusting = isAdjusting; 209 } 210 211 /** 212 * Returns the <code>Adjustable</code> object where this event originated. 213 * 214 * @return the <code>Adjustable</code> object where this event originated 215 */ 216 public Adjustable getAdjustable() { 217 return adjustable; 218 } 219 220 /** 221 * Returns the current value in the adjustment event. 222 * 223 * @return the current value in the adjustment event 224 */ 225 public int getValue() { 226 return value; 227 } 228 229 /** 230 * Returns the type of adjustment which caused the value changed 231 * event. It will have one of the following values: 232 * <ul> 233 * <li>{@link #UNIT_INCREMENT} 234 * <li>{@link #UNIT_DECREMENT} 235 * <li>{@link #BLOCK_INCREMENT} 236 * <li>{@link #BLOCK_DECREMENT} 237 * <li>{@link #TRACK} 238 * </ul> 239 * @return one of the adjustment values listed above 240 */ 241 public int getAdjustmentType() { 242 return adjustmentType; 243 } 244 245 /** 246 * Returns <code>true</code> if this is one of multiple 247 * adjustment events. 248 * 249 * @return <code>true</code> if this is one of multiple 250 * adjustment events, otherwise returns <code>false</code> 251 * @since 1.4 252 */ 253 public boolean getValueIsAdjusting() { 254 return isAdjusting; 255 } 256 257 public String paramString() { 258 String typeStr; 259 switch(id) { 260 case ADJUSTMENT_VALUE_CHANGED: 261 typeStr = "ADJUSTMENT_VALUE_CHANGED"; 262 break; 263 default: 264 typeStr = "unknown type"; 265 } 266 String adjTypeStr; 267 switch(adjustmentType) { 268 case UNIT_INCREMENT: 269 adjTypeStr = "UNIT_INCREMENT"; 270 break; | 90 91 /** 92 * The block increment adjustment type. 93 */ 94 @Native public static final int BLOCK_INCREMENT = 4; 95 96 /** 97 * The absolute tracking adjustment type. 98 */ 99 @Native public static final int TRACK = 5; 100 101 /** 102 * The adjustable object that fired the event. 103 * 104 * @serial 105 * @see #getAdjustable 106 */ 107 Adjustable adjustable; 108 109 /** 110 * {@code value} will contain the new value of the 111 * adjustable object. This value will always be in a 112 * range associated adjustable object. 113 * 114 * @serial 115 * @see #getValue 116 */ 117 int value; 118 119 /** 120 * The {@code adjustmentType} describes how the adjustable 121 * object value has changed. 122 * This value can be increased/decreased by a block or unit amount 123 * where the block is associated with page increments/decrements, 124 * and a unit is associated with line increments/decrements. 125 * 126 * @serial 127 * @see #getAdjustmentType 128 */ 129 int adjustmentType; 130 131 132 /** 133 * The {@code isAdjusting} is true if the event is one 134 * of the series of multiple adjustment events. 135 * 136 * @since 1.4 137 * @serial 138 * @see #getValueIsAdjusting 139 */ 140 boolean isAdjusting; 141 142 143 /* 144 * JDK 1.1 serialVersionUID 145 */ 146 private static final long serialVersionUID = 5700290645205279921L; 147 148 149 /** 150 * Constructs an {@code AdjustmentEvent} object with the 151 * specified {@code Adjustable} source, event type, 152 * adjustment type, and value. 153 * <p> This method throws an 154 * {@code IllegalArgumentException} if {@code source} 155 * is {@code null}. 156 * 157 * @param source The {@code Adjustable} object where the 158 * event originated 159 * @param id An integer indicating the type of event. 160 * For information on allowable values, see 161 * the class description for {@link AdjustmentEvent} 162 * @param type An integer indicating the adjustment type. 163 * For information on allowable values, see 164 * the class description for {@link AdjustmentEvent} 165 * @param value The current value of the adjustment 166 * @throws IllegalArgumentException if {@code source} is null 167 * @see #getSource() 168 * @see #getID() 169 * @see #getAdjustmentType() 170 * @see #getValue() 171 */ 172 public AdjustmentEvent(Adjustable source, int id, int type, int value) { 173 this(source, id, type, value, false); 174 } 175 176 /** 177 * Constructs an {@code AdjustmentEvent} object with the 178 * specified Adjustable source, event type, adjustment type, and value. 179 * <p> This method throws an 180 * {@code IllegalArgumentException} if {@code source} 181 * is {@code null}. 182 * 183 * @param source The {@code Adjustable} object where the 184 * event originated 185 * @param id An integer indicating the type of event. 186 * For information on allowable values, see 187 * the class description for {@link AdjustmentEvent} 188 * @param type An integer indicating the adjustment type. 189 * For information on allowable values, see 190 * the class description for {@link AdjustmentEvent} 191 * @param value The current value of the adjustment 192 * @param isAdjusting A boolean that equals {@code true} if the event is one 193 * of a series of multiple adjusting events, 194 * otherwise {@code false} 195 * @throws IllegalArgumentException if {@code source} is null 196 * @since 1.4 197 * @see #getSource() 198 * @see #getID() 199 * @see #getAdjustmentType() 200 * @see #getValue() 201 * @see #getValueIsAdjusting() 202 */ 203 public AdjustmentEvent(Adjustable source, int id, int type, int value, boolean isAdjusting) { 204 super(source, id); 205 adjustable = source; 206 this.adjustmentType = type; 207 this.value = value; 208 this.isAdjusting = isAdjusting; 209 } 210 211 /** 212 * Returns the {@code Adjustable} object where this event originated. 213 * 214 * @return the {@code Adjustable} object where this event originated 215 */ 216 public Adjustable getAdjustable() { 217 return adjustable; 218 } 219 220 /** 221 * Returns the current value in the adjustment event. 222 * 223 * @return the current value in the adjustment event 224 */ 225 public int getValue() { 226 return value; 227 } 228 229 /** 230 * Returns the type of adjustment which caused the value changed 231 * event. It will have one of the following values: 232 * <ul> 233 * <li>{@link #UNIT_INCREMENT} 234 * <li>{@link #UNIT_DECREMENT} 235 * <li>{@link #BLOCK_INCREMENT} 236 * <li>{@link #BLOCK_DECREMENT} 237 * <li>{@link #TRACK} 238 * </ul> 239 * @return one of the adjustment values listed above 240 */ 241 public int getAdjustmentType() { 242 return adjustmentType; 243 } 244 245 /** 246 * Returns {@code true} if this is one of multiple 247 * adjustment events. 248 * 249 * @return {@code true} if this is one of multiple 250 * adjustment events, otherwise returns {@code false} 251 * @since 1.4 252 */ 253 public boolean getValueIsAdjusting() { 254 return isAdjusting; 255 } 256 257 public String paramString() { 258 String typeStr; 259 switch(id) { 260 case ADJUSTMENT_VALUE_CHANGED: 261 typeStr = "ADJUSTMENT_VALUE_CHANGED"; 262 break; 263 default: 264 typeStr = "unknown type"; 265 } 266 String adjTypeStr; 267 switch(adjustmentType) { 268 case UNIT_INCREMENT: 269 adjTypeStr = "UNIT_INCREMENT"; 270 break; |