Project

General

Profile

Download (3.23 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.draw2d;
12

    
13
import java.beans.PropertyChangeListener;
14

    
15
/**
16
 * This interface represents a range of possible values as well as the current
17
 * values. There is a minumum and maximum value, a current value, and the
18
 * extent. One use for a RangeModel is a scrollbar. There is a minimum value
19
 * (the top of the scrollbar), a maximum value (the bottom of the scrollbar), a
20
 * current value (the top of the thumb), and an extent (the length of the
21
 * thumb).
22
 */
23
public interface RangeModel {
24

    
25
	/** Value property name */
26
	String PROPERTY_VALUE = "value"; //$NON-NLS-1$
27
	/** Extent property name */
28
	String PROPERTY_EXTENT = "extent"; //$NON-NLS-1$
29
	/** Minimum property name */
30
	String PROPERTY_MINIMUM = "minimum"; //$NON-NLS-1$
31
	/** Maximum property name */
32
	String PROPERTY_MAXIMUM = "maximum"; //$NON-NLS-1$
33

    
34
	/**
35
	 * Registers listener as a PropertyChangeListener of this RangeModel.
36
	 * Listeners will be notified of changes to {@link #PROPERTY_VALUE value},
37
	 * {@link #PROPERTY_EXTENT extent}, {@link #PROPERTY_MINIMUM minimum} and
38
	 * {@link #PROPERTY_MAXIMUM maximum} properties.
39
	 * 
40
	 * @param listener
41
	 *            The listener to add
42
	 */
43
	void addPropertyChangeListener(PropertyChangeListener listener);
44

    
45
	/**
46
	 * Returns the extent.
47
	 * 
48
	 * @return The extent
49
	 */
50
	int getExtent();
51

    
52
	/**
53
	 * Returns the maximum value in the range.
54
	 * 
55
	 * @return The maximum value
56
	 */
57
	int getMaximum();
58

    
59
	/**
60
	 * Returns the minimum value in the range.
61
	 * 
62
	 * @return The minimum value
63
	 */
64
	int getMinimum();
65

    
66
	/**
67
	 * Returns the current value.
68
	 * 
69
	 * @return The current value
70
	 */
71
	int getValue();
72

    
73
	/**
74
	 * Returns <code>true</code> if this RangeModel is enabled.
75
	 * 
76
	 * @return <code>true</code> if this Rangel Model is enabled
77
	 */
78
	boolean isEnabled();
79

    
80
	/**
81
	 * Removes the given listener from this RangeModel's list of
82
	 * PropertyChangeListeners.
83
	 * 
84
	 * @param listener
85
	 *            The listener to remove
86
	 */
87
	void removePropertyChangeListener(PropertyChangeListener listener);
88

    
89
	/**
90
	 * Sets min, extent, and max all at once.
91
	 * 
92
	 * @param min
93
	 *            the new mininum
94
	 * @param extent
95
	 *            the new extent
96
	 * @param max
97
	 *            the new maximum
98
	 */
99
	void setAll(int min, int extent, int max);
100

    
101
	/**
102
	 * Sets the extent.
103
	 * 
104
	 * @param extent
105
	 *            The extent
106
	 */
107
	void setExtent(int extent);
108

    
109
	/**
110
	 * Sets the maximum value of the range.
111
	 * 
112
	 * @param max
113
	 *            The maximum value
114
	 */
115
	void setMaximum(int max);
116

    
117
	/**
118
	 * Sets the minimum value of the range.
119
	 * 
120
	 * @param min
121
	 *            The minimum value
122
	 */
123
	void setMinimum(int min);
124

    
125
	/**
126
	 * Sets the current value.
127
	 * 
128
	 * @param value
129
	 *            The current value
130
	 */
131
	void setValue(int value);
132

    
133
}
(126-126/171)