01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings;
14:
15: import javax.swing.*;
16:
17: /**
18: * Default implementation of {@link SBoundedRangeModel}
19: *
20: * @author <a href="mailto:armin.haaf@mercatis.de">Armin Haaf</a>
21: * @see javax.swing.BoundedRangeModel
22: * @see SList
23: * @see STable
24: */
25: public class SDefaultBoundedRangeModel extends DefaultBoundedRangeModel
26: implements SBoundedRangeModel {
27:
28: /**
29: * indicates if we should fire event immediately when they arise, or if we
30: * should collect them for a later delivery
31: */
32: private boolean delayEvents = false;
33:
34: /**
35: * got a delayed Event?
36: */
37: protected boolean gotDelayedEvent = false;
38:
39: public SDefaultBoundedRangeModel() {
40: super ();
41: }
42:
43: public SDefaultBoundedRangeModel(int value, int extent, int min,
44: int max) {
45: super (value, extent, min, max);
46: }
47:
48: public boolean getDelayEvents() {
49: return delayEvents;
50: }
51:
52: public void setDelayEvents(boolean b) {
53: delayEvents = b;
54: }
55:
56: /**
57: * fire event with isValueIsAdjusting true
58: */
59: public void fireDelayedIntermediateEvents() {
60: }
61:
62: public void fireDelayedFinalEvents() {
63: if (!delayEvents && gotDelayedEvent) {
64: fireStateChanged();
65: gotDelayedEvent = false;
66: }
67: }
68:
69: protected void fireStateChanged() {
70: if (delayEvents) {
71: gotDelayedEvent = true;
72: } else {
73: super.fireStateChanged();
74: }
75: }
76:
77: }
|