/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class provides the ChangeListener part of the
* SpinnerModel interface that should be suitable for most concrete SpinnerModel
* implementations. Subclasses must provide an implementation of the
* <code>setValue</code>, <code>getValue</code>, <code>getNextValue</code> and
* <code>getPreviousValue</code> methods.
*
* @see JSpinner
* @see SpinnerModel
* @see SpinnerListModel
* @see SpinnerNumberModel
* @see SpinnerDateModel
*
* @author Hans Muller
* @since 1.4
*/
{
/**
* Only one ChangeEvent is needed per model instance since the
* event's only (read-only) state is the source property. The source
* of events generated here is always "this".
*/
/**
* The list of ChangeListeners for this model. Subclasses may
* store their own listeners here.
*/
/**
* Adds a ChangeListener to the model's listener list. The
* ChangeListeners must be notified when the models value changes.
*
* @param l the ChangeListener to add
* @see #removeChangeListener
* @see SpinnerModel#addChangeListener
*/
}
/**
* Removes a ChangeListener from the model's listener list.
*
* @param l the ChangeListener to remove
* @see #addChangeListener
* @see SpinnerModel#removeChangeListener
*/
}
/**
* Returns an array of all the <code>ChangeListener</code>s added
* to this AbstractSpinnerModel with addChangeListener().
*
* @return all of the <code>ChangeListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
}
/**
* Run each ChangeListeners stateChanged() method.
*
* @see #setValue
* @see EventListenerList
*/
protected void fireStateChanged()
{
if (listeners[i] == ChangeListener.class) {
if (changeEvent == null) {
changeEvent = new ChangeEvent(this);
}
}
}
}
/**
* Return an array of all the listeners of the given type that
* were added to this model. For example to find all of the
* ChangeListeners added to this model:
* <pre>
* myAbstractSpinnerModel.getListeners(ChangeListener.class);
* </pre>
*
* @param listenerType the type of listeners to return, e.g. ChangeListener.class
* @return all of the objects receiving <em>listenerType</em> notifications
* from this model
*/
}
}