summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-29 09:26:29 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-29 09:26:29 +0000
commitd345c79ebfffa004a1e07218908b15f98525e2af (patch)
treefd553118dbf7dedb7aaf77964f83aa6880900415 /libjava
parent01386232f62a11424a212ff30615ebf158d031e0 (diff)
downloadgcc-d345c79ebfffa004a1e07218908b15f98525e2af.tar.gz
2003-04-29 Michael Koch <konqueror@gmx.de>
* javax/swing/AbstractListModel.java, javax/swing/DefaultBoundedRangeModel.java, javax/swing/DefaultSingleSelectionModel.java: New Versions from classpath. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66212 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/javax/swing/AbstractListModel.java319
-rw-r--r--libjava/javax/swing/DefaultBoundedRangeModel.java586
-rw-r--r--libjava/javax/swing/DefaultSingleSelectionModel.java271
4 files changed, 582 insertions, 601 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index d562ba254a0..930212c7bb6 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,12 @@
2003-04-29 Michael Koch <konqueror@gmx.de>
+ * javax/swing/AbstractListModel.java,
+ javax/swing/DefaultBoundedRangeModel.java,
+ javax/swing/DefaultSingleSelectionModel.java:
+ New Versions from classpath.
+
+2003-04-29 Michael Koch <konqueror@gmx.de>
+
* java/awt/Window.java
(show): Call super.show() instead of setVisible() to avoid endless
loop.
diff --git a/libjava/javax/swing/AbstractListModel.java b/libjava/javax/swing/AbstractListModel.java
index 4f7e8271c32..4e227b4dda7 100644
--- a/libjava/javax/swing/AbstractListModel.java
+++ b/libjava/javax/swing/AbstractListModel.java
@@ -37,10 +37,11 @@ exception statement from your version. */
package javax.swing;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.io.Serializable;
+import java.util.EventListener;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListDataEvent;
/**
* AbstractListModel
@@ -53,164 +54,152 @@ public abstract class AbstractListModel
{
static final long serialVersionUID = -3285184064379168730L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * listenerList
- */
- protected EventListenerList listenerList = new EventListenerList();
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor AbstractListModel
- */
- public AbstractListModel() {
- } // AbstractListModel()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * addListDataListener
- * @param listener TODO
- */
- public void addListDataListener(ListDataListener listener) {
- listenerList.add(ListDataListener.class, (EventListener) listener);
- } // addListDataListener()
-
- /**
- * removeListDataListener
- * @param listener TODO
- */
- public void removeListDataListener(ListDataListener listener) {
- listenerList.remove(ListDataListener.class, (EventListener) listener);
- } // removeListDataListener()
-
- /**
- * fireContentsChanged
- * @param source TODO
- * @param startIndex TODO
- * @param endIndex TODO
- */
- protected void fireContentsChanged(Object source, int startIndex, int endIndex) {
-
- // Variables
- ListDataEvent event;
- EventListener[] listeners;
- ListDataListener listener;
- int index;
-
- // Create Event
- event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED,
- startIndex, endIndex);
-
- // Get Listeners
- listeners = listenerList.getListeners(ListDataListener.class);
-
- // Process Listeners
- for (index = 0; index < listeners.length; index++) {
- listener = (ListDataListener) listeners[index];
- listener.contentsChanged(event);
- } // for
-
- } // fireContentsChanged()
-
- /**
- * fireIntervalAdded
- * @param source TODO
- * @param startIndex TODO
- * @param endIndex TODO
- */
- protected void fireIntervalAdded(Object source, int startIndex, int endIndex) {
-
- // Variables
- ListDataEvent event;
- EventListener[] listeners;
- ListDataListener listener;
- int index;
-
- // Create Event
- event = new ListDataEvent(source, ListDataEvent.INTERVAL_ADDED,
- startIndex, endIndex);
-
- // Get Listeners
- listeners = listenerList.getListeners(ListDataListener.class);
-
- // Process Listeners
- for (index = 0; index < listeners.length; index++) {
- listener = (ListDataListener) listeners[index];
- listener.intervalAdded(event);
- } // for
-
- } // fireIntervalAdded()
-
- /**
- * fireIntervalRemoved
- * @param source TODO
- * @param startIndex TODO
- * @param endIndex TODO
- */
- protected void fireIntervalRemoved(Object source, int startIndex, int endIndex) {
-
- // Variables
- ListDataEvent event;
- EventListener[] listeners;
- ListDataListener listener;
- int index;
-
- // Create Event
- event = new ListDataEvent(source, ListDataEvent.INTERVAL_REMOVED,
- startIndex, endIndex);
-
- // Get Listeners
- listeners = listenerList.getListeners(ListDataListener.class);
-
- // Process Listeners
- for (index = 0; index < listeners.length; index++) {
- listener = (ListDataListener) listeners[index];
- listener.intervalRemoved(event);
- } // for
-
- } // fireIntervalRemoved()
-
- /**
- * getListeners
- * @param listenerType TODO
- * @returns EventListener[]
- */
- public EventListener[] getListeners(Class listenerType) {
- return listenerList.getListeners(listenerType);
- } // getListeners()
-
- /**
- * getListDataListeners
- */
- public ListDataListener[] getListDataListeners()
- {
- // FIXME: implement this
- return null;
- }
-
- /**
- * getElementAt
- * @param index TODO
- * @returns Object
- */
- public abstract Object getElementAt(int index);
-
- /**
- * getSize
- * @returns int
- */
- public abstract int getSize();
-
-
-} // AbstractListModel
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList = new EventListenerList ();
+
+ /**
+ * Constructor AbstractListModel
+ */
+ public AbstractListModel ()
+ {
+ }
+
+ /**
+ * addListDataListener
+ * @param listener TODO
+ */
+ public void addListDataListener(ListDataListener listener)
+ {
+ listenerList.add (ListDataListener.class, listener);
+ }
+
+ /**
+ * removeListDataListener
+ * @param listener TODO
+ */
+ public void removeListDataListener(ListDataListener listener)
+ {
+ listenerList.remove (ListDataListener.class, listener);
+ }
+
+ /**
+ * fireContentsChanged
+ * @param source TODO
+ * @param startIndex TODO
+ * @param endIndex TODO
+ */
+ protected void fireContentsChanged(Object source, int startIndex, int endIndex)
+ {
+ // Variables
+ ListDataEvent event;
+ ListDataListener[] listeners;
+ ListDataListener listener;
+ int index;
+
+ // Create Event
+ event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED,
+ startIndex, endIndex);
+
+ // Get Listeners
+ listeners = getListDataListeners ();
+
+ // Process Listeners
+ for (index = 0; index < listeners.length; index++)
+ {
+ listener = (ListDataListener) listeners[index];
+ listener.contentsChanged(event);
+ }
+ }
+
+ /**
+ * fireIntervalAdded
+ * @param source TODO
+ * @param startIndex TODO
+ * @param endIndex TODO
+ */
+ protected void fireIntervalAdded (Object source, int startIndex, int endIndex)
+ {
+ // Variables
+ ListDataEvent event;
+ ListDataListener[] listeners;
+ ListDataListener listener;
+ int index;
+
+ // Create Event
+ event = new ListDataEvent (source, ListDataEvent.INTERVAL_ADDED, startIndex,
+ endIndex);
+
+ // Get Listeners
+ listeners = getListDataListeners ();
+
+ // Process Listeners
+ for (index = 0; index < listeners.length; index++)
+ {
+ listener = listeners [index];
+ listener.intervalAdded (event);
+ }
+ }
+
+ /**
+ * fireIntervalRemoved
+ * @param source TODO
+ * @param startIndex TODO
+ * @param endIndex TODO
+ */
+ protected void fireIntervalRemoved (Object source, int startIndex,
+ int endIndex)
+ {
+ // Variables
+ ListDataEvent event;
+ ListDataListener[] listeners;
+ ListDataListener listener;
+ int index;
+
+ // Create Event
+ event = new ListDataEvent (source, ListDataEvent.INTERVAL_REMOVED,
+ startIndex, endIndex);
+
+ // Get Listeners
+ listeners = getListDataListeners ();
+
+ // Process Listeners
+ for (index = 0; index < listeners.length; index++)
+ {
+ listener = listeners [index];
+ listener.intervalRemoved (event);
+ }
+ }
+
+ /**
+ * getListeners
+ * @param listenerType TODO
+ * @returns EventListener[]
+ */
+ public EventListener[] getListeners (Class listenerType)
+ {
+ return listenerList.getListeners (listenerType);
+ }
+
+ /**
+ * getListDataListeners
+ */
+ public ListDataListener[] getListDataListeners ()
+ {
+ return (ListDataListener[]) getListeners (ListDataListener.class);
+ }
+
+ /**
+ * getElementAt
+ * @param index TODO
+ * @returns Object
+ */
+ public abstract Object getElementAt (int index);
+
+ /**
+ * getSize
+ * @returns int
+ */
+ public abstract int getSize ();
+}
diff --git a/libjava/javax/swing/DefaultBoundedRangeModel.java b/libjava/javax/swing/DefaultBoundedRangeModel.java
index c6ea1d03177..128a97a9759 100644
--- a/libjava/javax/swing/DefaultBoundedRangeModel.java
+++ b/libjava/javax/swing/DefaultBoundedRangeModel.java
@@ -37,10 +37,11 @@ exception statement from your version. */
package javax.swing;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.io.Serializable;
+import java.util.EventListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
/**
* DefaultBoundedRangeModel
@@ -52,299 +53,296 @@ public class DefaultBoundedRangeModel
{
static final long serialVersionUID = 5034068491295259790L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * changeEvent
- */
- protected transient ChangeEvent changeEvent = new ChangeEvent(this);
-
- /**
- * listenerList
- */
- protected EventListenerList listenerList = new EventListenerList();
-
- /**
- * value
- */
- private int value;
-
- /**
- * extent
- */
- private int extent;
-
- /**
- * minimum
- */
- private int minimum;
-
- /**
- * maximum
- */
- private int maximum;
-
- /**
- * isAdjusting
- */
- private boolean isAdjusting;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultBoundedRangeModel
- */
- public DefaultBoundedRangeModel() {
- setRangeProperties(0, 0, 0, 100, false);
- } // DefaultBoundedRangeModel()
-
- /**
- * Constructor DefaultBoundedRangeModel
- * @param value TODO
- * @param extent TODO
- * @param minimum TODO
- * @param maximum TODO
- */
- public DefaultBoundedRangeModel(int value, int extent,
- int minimum, int maximum) {
- setRangeProperties(value, extent, minimum, maximum, false);
- } // DefaultBoundedRangeModel()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * toString
- * @returns String
- */
- public String toString() {
- return null; // TODO
- } // toString()
-
- /**
- * getValue
- * @returns int
- */
- public int getValue() {
- return value;
- } // getValue()
-
- /**
- * setValue
- * @param value TODO
- */
- public void setValue(int value) {
-
- // Validate Constraints
- if (minimum > value || value > (value + extent) ||
- (value + extent) > maximum) {
- throw new IllegalArgumentException("Invalid value property set");
- } // if
+ /**
+ * changeEvent
+ */
+ protected transient ChangeEvent changeEvent = new ChangeEvent (this);
+
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList = new EventListenerList ();
+
+ /**
+ * value
+ */
+ private int value;
+
+ /**
+ * extent
+ */
+ private int extent;
+
+ /**
+ * minimum
+ */
+ private int minimum;
+
+ /**
+ * maximum
+ */
+ private int maximum;
+
+ /**
+ * isAdjusting
+ */
+ private boolean isAdjusting;
+
+ /**
+ * Constructor DefaultBoundedRangeModel
+ */
+ public DefaultBoundedRangeModel ()
+ {
+ setRangeProperties (0, 0, 0, 100, false);
+ }
+
+ /**
+ * Constructor DefaultBoundedRangeModel
+ * @param value TODO
+ * @param extent TODO
+ * @param minimum TODO
+ * @param maximum TODO
+ */
+ public DefaultBoundedRangeModel (int value, int extent, int minimum,
+ int maximum)
+ {
+ setRangeProperties(value, extent, minimum, maximum, false);
+ }
+
+ /**
+ * toString
+ * @returns String
+ */
+ public String toString ()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getValue
+ * @returns int
+ */
+ public int getValue ()
+ {
+ return value;
+ }
+
+ /**
+ * setValue
+ * @param value TODO
+ */
+ public void setValue (int value)
+ {
+ // Validate Constraints
+ if (minimum > value ||
+ value > (value + extent) ||
+ (value + extent) > maximum)
+ {
+ throw new IllegalArgumentException ("Invalid value property set");
+ }
- // Set Value
- this.value = value;
-
- // Notification
- fireStateChanged();
-
- } // setValue()
-
- /**
- * getExtent
- * @returns int
- */
- public int getExtent() {
- return extent;
- } // getExtent()
-
- /**
- * setExtent
- * @param extent TODO
- */
- public void setExtent(int extent) {
-
- // Validate Constraints
- if (minimum > value || value > (value + extent) ||
- (value + extent) > maximum) {
- throw new IllegalArgumentException("Invalid extent property set");
- } // if
+ // Set Value
+ this.value = value;
+
+ // Notification
+ fireStateChanged ();
+ }
+
+ /**
+ * getExtent
+ * @returns int
+ */
+ public int getExtent ()
+ {
+ return extent;
+ }
+
+ /**
+ * setExtent
+ * @param extent TODO
+ */
+ public void setExtent (int extent)
+ {
+ // Validate Constraints
+ if (minimum > value ||
+ value > (value + extent) ||
+ (value + extent) > maximum)
+ {
+ throw new IllegalArgumentException("Invalid extent property set");
+ }
+
+ // Set Extent
+ this.extent = extent;
- // Set Extent
- this.extent = extent;
+ // Notification
+ fireStateChanged ();
+ }
+
+ /**
+ * getMinimum
+ * @returns int
+ */
+ public int getMinimum ()
+ {
+ return minimum;
+ }
+
+ /**
+ * setMinimum
+ * @param minimum TODO
+ */
+ public void setMinimum (int minimum)
+ {
+ // Validate Constraints
+ if (minimum > value ||
+ value > (value + extent) ||
+ (value + extent) > maximum)
+ {
+ throw new IllegalArgumentException("Invalid minimum property set");
+ }
- // Notification
- fireStateChanged();
-
- } // setExtent()
-
- /**
- * getMinimum
- * @returns int
- */
- public int getMinimum() {
- return minimum;
- } // getMinimum()
-
- /**
- * setMinimum
- * @param minimum TODO
- */
- public void setMinimum(int minimum) {
-
- // Validate Constraints
- if (minimum > value || value > (value + extent) ||
- (value + extent) > maximum) {
- throw new IllegalArgumentException("Invalid minimum property set");
- } // if
+ // Set Minimum
+ this.minimum = minimum;
- // Set Minimum
- this.minimum = minimum;
-
- // Notification
- fireStateChanged();
-
- } // setMinimum()
-
- /**
- * getMaximum
- * @returns int
- */
- public int getMaximum() {
+ // Notification
+ fireStateChanged ();
+ }
+
+ /**
+ * getMaximum
+ * @returns int
+ */
+ public int getMaximum() {
return maximum;
- } // getMaximum()
-
- /**
- * setMaximum
- * @param maximum TODO
- */
- public void setMaximum(int maximum) {
-
- // Validate Constraints
- if (minimum > value || value > (value + extent) ||
- (value + extent) > maximum) {
- throw new IllegalArgumentException("Invalid maximum property set");
- } // if
-
- // Set Maximum
- this.maximum = maximum;
-
- // Notification
- fireStateChanged();
-
- } // setMaximum()
-
- /**
- * getValueIsAdjusting
- * @returns boolean
- */
- public boolean getValueIsAdjusting() {
- return isAdjusting;
- } // getValueIsAdjusting()
-
- /**
- * setValueIsAdjusting
- * @param isAdjusting TODO
- */
- public void setValueIsAdjusting(boolean isAdjusting) {
-
- // Set isAdjusting
- this.isAdjusting = isAdjusting;
-
- // Notification
- fireStateChanged();
-
- } // setValueIsAdjusting()
-
- /**
- * setRangeProperties
- * @param value TODO
- * @param extent TODO
- * @param minimum TODO
- * @param maximum TODO
- * @param isAdjusting TODO
- */
- public void setRangeProperties(int value, int extent, int minimum,
- int maximum, boolean isAdjusting) {
-
- // Validate Constraints
- if (minimum > value || value > (value + extent) ||
- (value + extent) > maximum) {
- throw new IllegalArgumentException("Invalid property set");
- } // if
-
- // Set Data
- this.value = value;
- this.extent = extent;
- this.minimum = minimum;
- this.maximum = maximum;
- this.isAdjusting = isAdjusting;
+ }
+
+ /**
+ * setMaximum
+ * @param maximum TODO
+ */
+ public void setMaximum (int maximum)
+ {
+ // Validate Constraints
+ if (minimum > value ||
+ value > (value + extent) ||
+ (value + extent) > maximum)
+ {
+ throw new IllegalArgumentException ("Invalid maximum property set");
+ }
+
+ // Set Maximum
+ this.maximum = maximum;
+
+ // Notification
+ fireStateChanged ();
+ }
+
+ /**
+ * getValueIsAdjusting
+ * @returns boolean
+ */
+ public boolean getValueIsAdjusting ()
+ {
+ return isAdjusting;
+ }
+
+ /**
+ * setValueIsAdjusting
+ * @param isAdjusting TODO
+ */
+ public void setValueIsAdjusting (boolean isAdjusting)
+ {
+ // Set isAdjusting
+ this.isAdjusting = isAdjusting;
+
+ // Notification
+ fireStateChanged();
+ }
+
+ /**
+ * setRangeProperties
+ * @param value TODO
+ * @param extent TODO
+ * @param minimum TODO
+ * @param maximum TODO
+ * @param isAdjusting TODO
+ */
+ public void setRangeProperties (int value, int extent, int minimum,
+ int maximum, boolean isAdjusting)
+ {
+ // Validate Constraints
+ if (minimum > value ||
+ value > (value + extent) ||
+ (value + extent) > maximum)
+ {
+ throw new IllegalArgumentException ("Invalid property set");
+ }
+
+ // Set Data
+ this.value = value;
+ this.extent = extent;
+ this.minimum = minimum;
+ this.maximum = maximum;
+ this.isAdjusting = isAdjusting;
- // Notification
- fireStateChanged();
-
- } // setRangeProperties()
-
- /**
- * addChangeListener
- * @param listener TODO
- */
- public void addChangeListener(ChangeListener listener) {
- listenerList.add(ChangeListener.class, listener);
- } // addChangeListener()
-
- /**
- * removeChangeListener
- * @param listener TODO
- */
- public void removeChangeListener(ChangeListener listener) {
- listenerList.remove(ChangeListener.class, listener);
- } // removeChangeListener()
-
- /**
- * fireStateChanged
- */
- protected void fireStateChanged() {
-
- // Variables
- ChangeListener listener;
- EventListener[] listeners;
- int index;
-
- // Get Listeners
- listeners = listenerList.getListeners(ChangeListener.class);
-
- // Process Listeners
- for (index = 0; index < listeners.length; index++) {
- listener = (ChangeListener) listeners[index];
- listener.stateChanged(changeEvent);
- } // for
-
- } // fireStateChanged()
-
- /**
- * getListeners
- * @param c TODO
- * @returns EventListener[]
- */
- public EventListener[] getListeners(Class c) {
- return listenerList.getListeners(c);
- } // getListeners()
-
- /**
- * getChangeListeners
- */
- public ChangeListener[] getChangeListeners()
- {
- // FIXME: implement this
- return null;
- }
-
-
-} // DefaultBoundedRangeModel
+ // Notification
+ fireStateChanged ();
+ }
+
+ /**
+ * addChangeListener
+ * @param listener TODO
+ */
+ public void addChangeListener (ChangeListener listener)
+ {
+ listenerList.add (ChangeListener.class, listener);
+ }
+
+ /**
+ * removeChangeListener
+ * @param listener TODO
+ */
+ public void removeChangeListener (ChangeListener listener)
+ {
+ listenerList.remove (ChangeListener.class, listener);
+ }
+
+ /**
+ * 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);
+ }
+ }
+
+ /**
+ * getListeners
+ * @param c TODO
+ * @returns EventListener[]
+ */
+ public EventListener[] getListeners (Class listenerType)
+ {
+ return listenerList.getListeners (listenerType);
+ }
+
+ /**
+ * getChangeListeners
+ */
+ public ChangeListener[] getChangeListeners ()
+ {
+ return (ChangeListener[]) getListeners (ChangeListener.class);
+ }
+}
diff --git a/libjava/javax/swing/DefaultSingleSelectionModel.java b/libjava/javax/swing/DefaultSingleSelectionModel.java
index 0f6e280c951..86e43e1ac8c 100644
--- a/libjava/javax/swing/DefaultSingleSelectionModel.java
+++ b/libjava/javax/swing/DefaultSingleSelectionModel.java
@@ -37,154 +37,141 @@ exception statement from your version. */
package javax.swing;
-// Imports
-import java.io.*;
-import java.util.*;
-import javax.swing.event.*;
+import java.io.Serializable;
+import java.util.EventListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
/**
* DefaultSingleSelectionModel
* @author Andrew Selkirk
* @version 1.0
*/
-public class DefaultSingleSelectionModel implements
- SingleSelectionModel, Serializable
+public class DefaultSingleSelectionModel
+ implements SingleSelectionModel, Serializable
{
static final long serialVersionUID = 3676229404753786004L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * changeEvent
- */
- protected transient ChangeEvent changeEvent = new ChangeEvent(this);
-
- /**
- * listenerList
- */
- protected EventListenerList listenerList= new EventListenerList();
-
- /**
- * index
- */
- private int index = -1;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultSingleSelectionModel
- */
- public DefaultSingleSelectionModel() {
- // TODO
- } // DefaultSingleSelectionModel()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getSelectedIndex
- * @returns int
- */
- public int getSelectedIndex() {
- return index;
- } // getSelectedIndex()
-
- /**
- * setSelectedIndex
- * @param index TODO
- */
- public void setSelectedIndex(int index) {
-
- // Set Data
- this.index = index;
-
- // Notify Listeners
- fireStateChanged();
-
- } // setSelectedIndex()
-
- /**
- * clearSelection
- */
- public void clearSelection() {
-
- // Set Data
- index = -1;
-
- // Notify Listeners
- fireStateChanged();
-
- } // clearSelection()
-
- /**
- * isSelected
- * @returns boolean
- */
- public boolean isSelected() {
- return (index == -1);
- } // isSelected()
-
- /**
- * addChangeListener
- * @param listener TODO
- */
- public void addChangeListener(ChangeListener listener) {
- listenerList.add(ChangeListener.class, listener);
- } // addChangeListener()
-
- /**
- * removeChangeListener
- * @param listener TODO
- */
- public void removeChangeListener(ChangeListener listener) {
- listenerList.remove(ChangeListener.class, listener);
- } // removeChangeListener()
-
- /**
- * fireStateChanged
- */
- protected void fireStateChanged() {
-
- // Variables
- ChangeListener listener;
- EventListener[] listeners;
- int index;
-
- // Get Listeners
- listeners = listenerList.getListeners(ChangeListener.class);
-
- // Process Listeners
- for (index = 0; index < listeners.length; index++) {
- listener = (ChangeListener) listeners[index];
- listener.stateChanged(changeEvent);
- } // for
-
- } // fireStateChanged()
-
- /**
- * getListeners
- * @param listenerClass TODO
- * @returns EventListener[]
- */
- public EventListener[] getListeners(Class listenerClass) {
- return listenerList.getListeners(listenerClass);
- } // getListeners()
-
- /**
- * getChangeListeners
- */
- public ChangeListener[] getChangeListeners()
- {
- // FIXME: implement this
- return null;
- }
-
-
-} // DefaultSingleSelectionModel
+ /**
+ * changeEvent
+ */
+ protected transient ChangeEvent changeEvent = new ChangeEvent (this);
+
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList= new EventListenerList ();
+
+ /**
+ * index
+ */
+ private int index = -1;
+
+ /**
+ * Constructor DefaultSingleSelectionModel
+ */
+ public DefaultSingleSelectionModel ()
+ {
+ }
+
+ /**
+ * getSelectedIndex
+ * @returns int
+ */
+ public int getSelectedIndex ()
+ {
+ return index;
+ }
+
+ /**
+ * setSelectedIndex
+ * @param index TODO
+ */
+ public void setSelectedIndex (int index)
+ {
+ // Set Data
+ this.index = index;
+
+ // Notify Listeners
+ fireStateChanged ();
+ }
+
+ /**
+ * clearSelection
+ */
+ public void clearSelection ()
+ {
+ // Set Data
+ index = -1;
+
+ // Notify Listeners
+ fireStateChanged ();
+ }
+
+ /**
+ * isSelected
+ * @returns boolean
+ */
+ public boolean isSelected ()
+ {
+ return (index == -1);
+ }
+
+ /**
+ * addChangeListener
+ * @param listener TODO
+ */
+ public void addChangeListener (ChangeListener listener)
+ {
+ listenerList.add (ChangeListener.class, listener);
+ }
+
+ /**
+ * removeChangeListener
+ * @param listener TODO
+ */
+ public void removeChangeListener (ChangeListener listener)
+ {
+ listenerList.remove (ChangeListener.class, listener);
+ }
+
+ /**
+ * 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);
+ }
+ }
+
+ /**
+ * getListeners
+ * @param listenerClass TODO
+ * @returns EventListener[]
+ */
+ public EventListener[] getListeners (Class listenerClass)
+ {
+ return listenerList.getListeners (listenerClass);
+ }
+
+ /**
+ * getChangeListeners
+ */
+ public ChangeListener[] getChangeListeners ()
+ {
+ return (ChangeListener[]) getListeners (ChangeListener.class);
+ }
+}