KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > SDefaultBoundedRangeModel


1 /*
2  * $Id: SDefaultBoundedRangeModel.java,v 1.3 2004/12/01 07:54:07 hengels Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings;
15
16 import javax.swing.*;
17
18
19 /**
20  * @author <a HREF="mailto:armin.haaf@mercatis.de">Armin Haaf</a>
21  * @version $Revision: 1.3 $
22  * @see javax.swing.BoundedRangeModel
23  * @see SList
24  * @see STable
25  */

26 public class SDefaultBoundedRangeModel
27         extends DefaultBoundedRangeModel
28         implements SBoundedRangeModel {
29
30     /**
31      * indicates if we should fire event immediately when they arise, or if we
32      * should collect them for a later delivery
33      */

34     private boolean delayEvents = false;
35
36     /**
37      * got a delayed Event?
38      */

39     protected boolean gotDelayedEvent = false;
40
41     public SDefaultBoundedRangeModel() {
42         super();
43     }
44
45     public SDefaultBoundedRangeModel(int value, int extent, int min, int max) {
46         super(value, extent, min, max);
47     }
48
49     public boolean getDelayEvents() {
50         return delayEvents;
51     }
52
53     public void setDelayEvents(boolean b) {
54         delayEvents = b;
55     }
56
57     /**
58      * fire event with isValueIsAdjusting true
59      */

60     public void fireDelayedIntermediateEvents() {}
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 }
78
79
80
Popular Tags