1 |
14 |
jlechner |
/* BoundedRangeModel.java --
|
2 |
|
|
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is part of GNU Classpath.
|
5 |
|
|
|
6 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
9 |
|
|
any later version.
|
10 |
|
|
|
11 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
12 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
|
|
General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
18 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 |
|
|
02110-1301 USA.
|
20 |
|
|
|
21 |
|
|
Linking this library statically or dynamically with other modules is
|
22 |
|
|
making a combined work based on this library. Thus, the terms and
|
23 |
|
|
conditions of the GNU General Public License cover the whole
|
24 |
|
|
combination.
|
25 |
|
|
|
26 |
|
|
As a special exception, the copyright holders of this library give you
|
27 |
|
|
permission to link this library with independent modules to produce an
|
28 |
|
|
executable, regardless of the license terms of these independent
|
29 |
|
|
modules, and to copy and distribute the resulting executable under
|
30 |
|
|
terms of your choice, provided that you also meet, for each linked
|
31 |
|
|
independent module, the terms and conditions of the license of that
|
32 |
|
|
module. An independent module is a module which is not derived from
|
33 |
|
|
or based on this library. If you modify this library, you may extend
|
34 |
|
|
this exception to your version of the library, but you are not
|
35 |
|
|
obligated to do so. If you do not wish to do so, delete this
|
36 |
|
|
exception statement from your version. */
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
package javax.swing;
|
40 |
|
|
|
41 |
|
|
import javax.swing.event.ChangeEvent;
|
42 |
|
|
import javax.swing.event.ChangeListener;
|
43 |
|
|
|
44 |
|
|
/**
|
45 |
|
|
* The data model that represents a <i>range</i> that is constrained to fit
|
46 |
|
|
* within specified <i>bounds</i>. The range is defined as <code>value</code>
|
47 |
|
|
* to <code>value + extent</code>, where both <code>value</code> and
|
48 |
|
|
* <code>extent</code> are integers, and <code>extent >= 0</code>. The bounds
|
49 |
|
|
* are defined by integers <code>minimum</code> and <code>maximum</code>.
|
50 |
|
|
* <p>
|
51 |
|
|
* This type of model is used in components that display a range of values,
|
52 |
|
|
* like {@link JProgressBar} and {@link JSlider}.
|
53 |
|
|
*
|
54 |
|
|
* @author Andrew Selkirk
|
55 |
|
|
*/
|
56 |
|
|
public interface BoundedRangeModel
|
57 |
|
|
{
|
58 |
|
|
/**
|
59 |
|
|
* Returns the current value for the model.
|
60 |
|
|
*
|
61 |
|
|
* @return The current value for the model.
|
62 |
|
|
*
|
63 |
|
|
* @see #setValue(int)
|
64 |
|
|
*/
|
65 |
|
|
int getValue();
|
66 |
|
|
|
67 |
|
|
/**
|
68 |
|
|
* Sets the value for the model and sends a {@link ChangeEvent} to
|
69 |
|
|
* all registered listeners. The new value must satisfy the constraint
|
70 |
|
|
* <code>min <= value <= value + extent <= max</code>.
|
71 |
|
|
*
|
72 |
|
|
* @param value the value
|
73 |
|
|
*
|
74 |
|
|
* @see #getValue()
|
75 |
|
|
*/
|
76 |
|
|
void setValue(int value);
|
77 |
|
|
|
78 |
|
|
/**
|
79 |
|
|
* Returns the lower bound for the model. The start of the model's range
|
80 |
|
|
* (see {@link #getValue()}) cannot be less than this lower bound.
|
81 |
|
|
*
|
82 |
|
|
* @return The lower bound for the model.
|
83 |
|
|
*
|
84 |
|
|
* @see #setMinimum(int)
|
85 |
|
|
* @see #getMaximum()
|
86 |
|
|
*/
|
87 |
|
|
int getMinimum();
|
88 |
|
|
|
89 |
|
|
/**
|
90 |
|
|
* Sets the lower bound for the model and sends a {@link ChangeEvent} to all
|
91 |
|
|
* registered listeners. The new minimum must be less than or equal to the
|
92 |
|
|
* start value of the model's range (as returned by {@link #getValue()}).
|
93 |
|
|
*
|
94 |
|
|
* @param minimum the minimum value
|
95 |
|
|
*
|
96 |
|
|
* @see #getMinimum()
|
97 |
|
|
*/
|
98 |
|
|
void setMinimum(int minimum);
|
99 |
|
|
|
100 |
|
|
/**
|
101 |
|
|
* Returns the upper bound for the model. This sets an upper limit for the
|
102 |
|
|
* end value of the model's range ({@link #getValue()} +
|
103 |
|
|
* {@link #getExtent()}).
|
104 |
|
|
*
|
105 |
|
|
* @return The upper bound for the model.
|
106 |
|
|
*
|
107 |
|
|
* @see #setMaximum(int)
|
108 |
|
|
* @see #getMinimum()
|
109 |
|
|
*/
|
110 |
|
|
int getMaximum();
|
111 |
|
|
|
112 |
|
|
/**
|
113 |
|
|
* Sets the upper bound for the model and sends a {@link ChangeEvent} to all
|
114 |
|
|
* registered listeners. The new maximum must be greater than or equal to the
|
115 |
|
|
* end value of the model's range (as returned by {@link #getValue()} +
|
116 |
|
|
* {@link #getExtent()}).
|
117 |
|
|
*
|
118 |
|
|
* @param maximum the maximum value
|
119 |
|
|
*
|
120 |
|
|
* @see #getMaximum()
|
121 |
|
|
*/
|
122 |
|
|
void setMaximum(int maximum);
|
123 |
|
|
|
124 |
|
|
/**
|
125 |
|
|
* Returns the value of the <code>valueIsAdjusting</code> property.
|
126 |
|
|
*
|
127 |
|
|
* @return <code>true</code> if value is adjusting,
|
128 |
|
|
* otherwise <code>false</code>
|
129 |
|
|
*
|
130 |
|
|
* @see #setValueIsAdjusting(boolean)
|
131 |
|
|
*/
|
132 |
|
|
boolean getValueIsAdjusting();
|
133 |
|
|
|
134 |
|
|
/**
|
135 |
|
|
* Sets the <code>valueIsAdjusting</code> property.
|
136 |
|
|
*
|
137 |
|
|
* @param adjusting <code>true</code> if adjusting,
|
138 |
|
|
* <code>false</code> otherwise
|
139 |
|
|
*
|
140 |
|
|
* @see #getValueIsAdjusting()
|
141 |
|
|
*/
|
142 |
|
|
void setValueIsAdjusting(boolean adjusting);
|
143 |
|
|
|
144 |
|
|
/**
|
145 |
|
|
* Returns the current extent.
|
146 |
|
|
*
|
147 |
|
|
* @return the extent
|
148 |
|
|
*
|
149 |
|
|
* @see #setExtent(int)
|
150 |
|
|
*/
|
151 |
|
|
int getExtent();
|
152 |
|
|
|
153 |
|
|
/**
|
154 |
|
|
* Sets the extent, which is the length of the model's range, and sends a
|
155 |
|
|
* {@link ChangeEvent} to all registered listeners.
|
156 |
|
|
*
|
157 |
|
|
* @param extent the extent
|
158 |
|
|
*
|
159 |
|
|
* @see #getExtent()
|
160 |
|
|
*/
|
161 |
|
|
void setExtent(int extent);
|
162 |
|
|
|
163 |
|
|
/**
|
164 |
|
|
* Sets all the properties for the model in a single call.
|
165 |
|
|
*
|
166 |
|
|
* @param value the value
|
167 |
|
|
* @param extent the extent
|
168 |
|
|
* @param minimum the minimum value
|
169 |
|
|
* @param maximum the maximum value
|
170 |
|
|
* @param adjusting a flag that indicates the model is being adjusted
|
171 |
|
|
* continuously.
|
172 |
|
|
*/
|
173 |
|
|
void setRangeProperties(int value, int extent, int minimum, int maximum,
|
174 |
|
|
boolean adjusting);
|
175 |
|
|
|
176 |
|
|
/**
|
177 |
|
|
* Adds a <code>ChangeListener</code> to this object.
|
178 |
|
|
*
|
179 |
|
|
* @param listener the listener to add
|
180 |
|
|
*
|
181 |
|
|
* @see #removeChangeListener(ChangeListener)
|
182 |
|
|
*/
|
183 |
|
|
void addChangeListener(ChangeListener listener);
|
184 |
|
|
|
185 |
|
|
/**
|
186 |
|
|
* Removes a <code>ChangeListener</code> from this object.
|
187 |
|
|
*
|
188 |
|
|
* @param listener the listener to remove
|
189 |
|
|
*
|
190 |
|
|
* @see #addChangeListener(ChangeListener)
|
191 |
|
|
*/
|
192 |
|
|
void removeChangeListener(ChangeListener listener);
|
193 |
|
|
}
|