Package com.tagtraum.beatunes.songinfo
Class Rating.DefaultRatingModel
- java.lang.Object
-
- com.tagtraum.beatunes.songinfo.Rating.DefaultRatingModel
-
- All Implemented Interfaces:
Rating.RatingModel
- Enclosing class:
- Rating
public static class Rating.DefaultRatingModel extends Object implements Rating.RatingModel
-
-
Field Summary
Fields Modifier and Type Field Description protected EventListenerListlistenerListThe list of ChangeListeners for this model.
-
Constructor Summary
Constructors Constructor Description DefaultRatingModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddActionListener(ActionListener l)voidaddChangeListener(ChangeListener l)Adds a ChangeListener to the model's listener list.protected voidfireActionPerformed(ActionEvent e)Notifies all listeners that have registered interest for notification on this event type.protected voidfireStateChanged()Run each ChangeListeners stateChanged() method.ActionListener[]getActionListeners()Returns an array of all the action listeners registered on thisDefaultButtonModel.ChangeListener[]getChangeListeners()Returns an array of all theChangeListeners added to this AbstractSpinnerModel with addChangeListener().<T extends EventListener>
T[]getListeners(Class<T> listenerType)Return an array of all the listeners of the given type that were added to this model.intgetValue()booleanisAdjusting()voidremoveActionListener(ActionListener l)voidremoveChangeListener(ChangeListener l)Removes a ChangeListener from the model's listener list.voidsetAdjusting(boolean adjusting)voidsetValue(int v)
-
-
-
Field Detail
-
listenerList
protected EventListenerList listenerList
The list of ChangeListeners for this model. Subclasses may store their own listeners here.
-
-
Method Detail
-
isAdjusting
public boolean isAdjusting()
- Specified by:
isAdjustingin interfaceRating.RatingModel
-
setAdjusting
public void setAdjusting(boolean adjusting)
- Specified by:
setAdjustingin interfaceRating.RatingModel
-
getValue
public int getValue()
- Specified by:
getValuein interfaceRating.RatingModel
-
setValue
public void setValue(int v)
- Specified by:
setValuein interfaceRating.RatingModel
-
addChangeListener
public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the model's listener list. The ChangeListeners must be notified when the models value changes.- Specified by:
addChangeListenerin interfaceRating.RatingModel- Parameters:
l- the ChangeListener to add- See Also:
removeChangeListener(javax.swing.event.ChangeListener),SpinnerModel.addChangeListener(javax.swing.event.ChangeListener)
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the model's listener list.- Specified by:
removeChangeListenerin interfaceRating.RatingModel- Parameters:
l- the ChangeListener to remove- See Also:
addChangeListener(javax.swing.event.ChangeListener),SpinnerModel.removeChangeListener(javax.swing.event.ChangeListener)
-
getChangeListeners
public ChangeListener[] getChangeListeners()
Returns an array of all theChangeListeners added to this AbstractSpinnerModel with addChangeListener().- Returns:
- all of the
ChangeListeners added or an empty array if no listeners have been added - Since:
- 1.4
-
fireStateChanged
protected void fireStateChanged()
Run each ChangeListeners stateChanged() method.- See Also:
setValue(int),EventListenerList
-
getListeners
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
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:myAbstractSpinnerModel.getListeners(ChangeListener.class);
- Parameters:
listenerType- the type of listeners to return, e.g. ChangeListener.class- Returns:
- all of the objects receiving listenerType notifications from this model
-
addActionListener
public void addActionListener(ActionListener l)
- Specified by:
addActionListenerin interfaceRating.RatingModel
-
removeActionListener
public void removeActionListener(ActionListener l)
- Specified by:
removeActionListenerin interfaceRating.RatingModel
-
getActionListeners
public ActionListener[] getActionListeners()
Returns an array of all the action listeners registered on thisDefaultButtonModel.- Returns:
- all of this model's
ActionListeners or an empty array if no action listeners are currently registered - Since:
- 1.4
- See Also:
addActionListener(java.awt.event.ActionListener),removeActionListener(java.awt.event.ActionListener)
-
fireActionPerformed
protected void fireActionPerformed(ActionEvent e)
Notifies all listeners that have registered interest for notification on this event type.- Parameters:
e- theActionEventto deliver to listeners- See Also:
EventListenerList
-
-