From f3bca904add8a1e256b2c245c169e8e5a69efcd7 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Sun, 16 Jan 2005 15:14:51 +0000 Subject: 2005-01-16 Andrew John Hughes Final merge of HEAD patches to generics branch All changes are listed in merged Changelog. In addition, * java/lang/System.java: (getenv()): changed Runtime.securityManager to SecurityManager.current (getenv(String)): likewise (remove(String)): pointed to SystemProperties * gnu/classpath/SystemProperties.java: (remove(String)): implemented and documented --- javax/swing/DefaultSingleSelectionModel.java | 69 +++++++++++----------------- 1 file changed, 27 insertions(+), 42 deletions(-) (limited to 'javax/swing/DefaultSingleSelectionModel.java') diff --git a/javax/swing/DefaultSingleSelectionModel.java b/javax/swing/DefaultSingleSelectionModel.java index 0b1371ed9..63611f4a0 100644 --- a/javax/swing/DefaultSingleSelectionModel.java +++ b/javax/swing/DefaultSingleSelectionModel.java @@ -47,23 +47,23 @@ import javax.swing.event.EventListenerList; /** * DefaultSingleSelectionModel - * @author Andrew Selkirk - * @version 1.0 + * + * @author Andrew Selkirk */ public class DefaultSingleSelectionModel implements SingleSelectionModel, Serializable { - static final long serialVersionUID = 3676229404753786004L; + private static final long serialVersionUID = 3676229404753786004L; /** * changeEvent */ - protected transient ChangeEvent changeEvent = new ChangeEvent (this); + protected transient ChangeEvent changeEvent = new ChangeEvent(this); /** * listenerList */ - protected EventListenerList listenerList= new EventListenerList (); + protected EventListenerList listenerList = new EventListenerList(); /** * index @@ -73,15 +73,16 @@ public class DefaultSingleSelectionModel /** * Constructor DefaultSingleSelectionModel */ - public DefaultSingleSelectionModel () + public DefaultSingleSelectionModel() { + // Do nothing. } /** * getSelectedIndex * @return int */ - public int getSelectedIndex () + public int getSelectedIndex() { return index; } @@ -90,34 +91,28 @@ public class DefaultSingleSelectionModel * setSelectedIndex * @param index TODO */ - public void setSelectedIndex (int index) + public void setSelectedIndex(int index) { - // Set Data this.index = index; - - // Notify Listeners - fireStateChanged (); + fireStateChanged(); } /** * clearSelection */ - public void clearSelection () + public void clearSelection() { - // Set Data index = -1; - - // Notify Listeners - fireStateChanged (); + fireStateChanged(); } /** * isSelected * @return boolean */ - public boolean isSelected () + public boolean isSelected() { - return (index != -1); + return index != -1; } /** @@ -125,9 +120,9 @@ public class DefaultSingleSelectionModel * * @param listener the listener to add */ - public void addChangeListener (ChangeListener listener) + public void addChangeListener(ChangeListener listener) { - listenerList.add (ChangeListener.class, listener); + listenerList.add(ChangeListener.class, listener); } /** @@ -135,30 +130,20 @@ public class DefaultSingleSelectionModel * * @param listener the listener to remove */ - public void removeChangeListener (ChangeListener listener) + public void removeChangeListener(ChangeListener listener) { - listenerList.remove (ChangeListener.class, listener); + listenerList.remove(ChangeListener.class, listener); } /** * fireStateChanged */ - protected void fireStateChanged () + protected void fireStateChanged() { - // Variables - ChangeListener listener; - ChangeListener[] listeners; - int index; - - // Get Listeners - listeners = getChangeListeners (); - - // Process Listeners - for (index = 0; index < listeners.length; index++) - { - listener = listeners [index]; - listener.stateChanged (changeEvent); - } + ChangeListener[] listeners = getChangeListeners(); + + for (int i = 0; i < listeners.length; i++) + listeners[i].stateChanged(changeEvent); } /** @@ -170,9 +155,9 @@ public class DefaultSingleSelectionModel * * @since 1.3 */ - public EventListener[] getListeners (Class listenerClass) + public EventListener[] getListeners(Class listenerClass) { - return listenerList.getListeners (listenerClass); + return listenerList.getListeners(listenerClass); } /** @@ -180,8 +165,8 @@ public class DefaultSingleSelectionModel * * @since 1.4 */ - public ChangeListener[] getChangeListeners () + public ChangeListener[] getChangeListeners() { - return (ChangeListener[]) getListeners (ChangeListener.class); + return (ChangeListener[]) getListeners(ChangeListener.class); } } -- cgit v1.2.1