45 |
*/ |
*/ |
46 |
public interface SpinnerModel |
public interface SpinnerModel |
47 |
{ |
{ |
48 |
void setValue (Object value); |
|
49 |
public Object getValue (); |
/** |
50 |
public Object getNextValue (); |
* Sets the current value of the model to that specified. |
51 |
public Object getPreviousValue (); |
* Implementations can choose to refuse to accept the value |
52 |
void addChangeListener (ChangeListener listener); |
* and throw an exception instead. For example, a date model |
53 |
void removeChangeListener (ChangeListener listener); |
* may throw invalid dates, or a list model may throw out |
54 |
|
* values which don't exist in the underlying list. Models |
55 |
|
* may also throw out unusual values, such as null. The decision |
56 |
|
* is left to the discretion of the implementator. If the |
57 |
|
* operation succeeds, the implementation should also notify |
58 |
|
* any registered <code>ChangeListener</code>s. |
59 |
|
* |
60 |
|
* @param value The new value of the model. |
61 |
|
* @throws IllegalArgumentException if the model does not accept |
62 |
|
* the given value. |
63 |
|
*/ |
64 |
|
void setValue(Object value); |
65 |
|
|
66 |
|
/** |
67 |
|
* Returns the current value of the model. |
68 |
|
* |
69 |
|
* @return The current value. |
70 |
|
*/ |
71 |
|
public Object getValue(); |
72 |
|
|
73 |
|
/** |
74 |
|
* Returns the next value from the model. If the model is bounded, |
75 |
|
* this method may return null when the upper bound is met. |
76 |
|
* The current value is not changed. |
77 |
|
* |
78 |
|
* @return The next value, or null if there are no more values |
79 |
|
* to retrieve. |
80 |
|
*/ |
81 |
|
public Object getNextValue(); |
82 |
|
|
83 |
|
/** |
84 |
|
* Returns the previous value from the model. If the model is |
85 |
|
* bounded, this method may return null when the lower bound is |
86 |
|
* met. The current value is not changed. |
87 |
|
* |
88 |
|
* @return The previous value, or null if there are no more |
89 |
|
* values to retrieve. |
90 |
|
*/ |
91 |
|
public Object getPreviousValue(); |
92 |
|
|
93 |
|
/** |
94 |
|
* Adds a <code>ChangeListener</code> to the list of registered |
95 |
|
* listeners. Each listener is notified when the current value |
96 |
|
* is changed. |
97 |
|
* |
98 |
|
* @param listener The new listener to register. |
99 |
|
*/ |
100 |
|
void addChangeListener(ChangeListener listener); |
101 |
|
|
102 |
|
/** |
103 |
|
* Removes a given <code>ChangeListener</code> from the list |
104 |
|
* of registered listeners. |
105 |
|
* |
106 |
|
* @param listener The listener to remove. |
107 |
|
*/ |
108 |
|
void removeChangeListener(ChangeListener listener); |
109 |
|
|
110 |
} |
} |