[Patch][gui] BoundedRangeModel and DefaultBoundedRangeModel
Michael Koch
konqueror@gmx.de
Fri Dec 31 16:28:00 GMT 2004
Hi list,
I just commited the attached patch to cleanup some stuff in
javax.swing.BoundedRangeModel and
javax.swing.DefaultBoundedRangeModel.
Michael
2004-12-31 Michael Koch <konqueror@gmx.de>
* javax/swing/DefaultBoundedRangeModel.java:
Fixed javadocs all over.
(fireStateChanged): Simplified.
* javax/swing/BoundedRangeModel.java:
Reformatted.
-------------- next part --------------
Index: javax/swing/DefaultBoundedRangeModel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/DefaultBoundedRangeModel.java,v
retrieving revision 1.5.8.3
diff -u -r1.5.8.3 DefaultBoundedRangeModel.java
--- javax/swing/DefaultBoundedRangeModel.java 27 Dec 2004 11:25:00 -0000 1.5.8.3
+++ javax/swing/DefaultBoundedRangeModel.java 31 Dec 2004 16:23:37 -0000
@@ -47,7 +47,7 @@
import javax.swing.event.EventListenerList;
/**
- * A default implementation of BoundedRangeModel.
+ * A default implementation of <code>BoundedRangeModel</code>.
*
* @author <a href="mailto:aselkirk@sympatico.ca">Andrew Selkirk</a>
* @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
@@ -67,7 +67,7 @@
* when the state of this range model has changed.
*
* <p>The event object is created on demand, the first time it
- * is actually needed.
+ * is actually needed.</p>
*
* @see #fireStateChanged()
*/
@@ -155,7 +155,7 @@
* @param maximum the initial maximal value of the range model.
*
* @throws IllegalArgumentException if the following condition is
- * not satisfied: <code>minimum <= value <= value + extent <=
+ * not satisfied: <code>minimum <= value <= value + extent <=
* maximum</code>.
*/
public DefaultBoundedRangeModel(int value, int extent, int minimum,
@@ -176,6 +176,8 @@
/**
* Returns a string with all relevant properties of this range
* model.
+ *
+ * @return a string representing the object
*/
public String toString()
{
@@ -193,6 +195,8 @@
* Returns the current value of this bounded range model. In a
* scroll bar visualization of a {@link BoundedRangeModel}, the
* <code>value</code> is displayed as the position of the thumb.
+ *
+ * @return the value
*/
public int getValue()
{
@@ -206,6 +210,8 @@
* <code>value</code> is displayed as the position of the thumb;
* changing the <code>value</code> of a scroll bar's model
* thus moves the thumb to a different position.
+ *
+ * @param value the value
*/
public void setValue(int value)
{
@@ -226,6 +232,8 @@
* a number greater than or equal to zero. In a scroll bar
* visualization of a {@link BoundedRangeModel}, the
* <code>extent</code> is displayed as the size of the thumb.
+ *
+ * @return the extent
*/
public int getExtent()
{
@@ -282,6 +290,8 @@
/**
* Returns the current maximal value of this bounded range model.
+ *
+ * @return the maximum
*/
public int getMaximum()
{
@@ -313,7 +323,7 @@
* around; when the mouse is relased, they set the property to
* <code>false</code> and post a final {@link ChangeEvent}.
*
- * @returns <code>true</code> if the value will change soon again;
+ * @return <code>true</code> if the value will change soon again;
* <code>false</code> if the value will probably not change soon.
*/
public boolean getValueIsAdjusting()
@@ -344,7 +354,7 @@
/**
- * setRangeProperties
+ * Sets all properties.
*
* @param value the new value of the range model. In a scroll bar
* visualization of a {@link BoundedRangeModel}, the
@@ -422,16 +432,13 @@
*/
protected void fireStateChanged()
{
- Object[] listeners;
+ ChangeListener[] listeners = getChangeListeners();
+
+ if (changeEvent == null)
+ changeEvent = new ChangeEvent(this);
- listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2)
- if (listeners[i] == ChangeListener.class)
- {
- if (changeEvent == null)
- changeEvent = new ChangeEvent(this);
- ((ChangeListener) listeners[i + 1]).stateChanged(changeEvent);
- }
+ for (int i = listeners.length; i >= 0; --i)
+ listeners[i].stateChanged(changeEvent);
}
Index: javax/swing/BoundedRangeModel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/BoundedRangeModel.java,v
retrieving revision 1.3
diff -u -r1.3 BoundedRangeModel.java
--- javax/swing/BoundedRangeModel.java 9 Jan 2004 10:18:47 -0000 1.3
+++ javax/swing/BoundedRangeModel.java 31 Dec 2004 16:23:37 -0000
@@ -35,103 +35,134 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package javax.swing;
import javax.swing.event.ChangeListener;
/**
- * BoundedRangeModel
- * @author Andrew Selkirk
- * @version 1.0
+ * @author Andrew Selkirk
*/
-public interface BoundedRangeModel {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getValue
- * @returns int
- */
- int getValue();
-
- /**
- * setValue
- * @param value TODO
- */
- void setValue(int value);
-
- /**
- * getMinimum
- * @returns int
- */
- int getMinimum();
-
- /**
- * setMinimum
- * @param minimum TODO
- */
- void setMinimum(int minimum);
-
- /**
- * getMaximum
- * @returns int
- */
- int getMaximum();
-
- /**
- * setMaximum
- * @param maximum TODO
- */
- void setMaximum(int maximum);
-
- /**
- * getValueIsAdjusting
- * @returns boolean
- */
- boolean getValueIsAdjusting();
-
- /**
- * setValueIsAdjusting
- * @param adjusting TODO
- */
- void setValueIsAdjusting(boolean adjusting);
-
- /**
- * getExtent
- * @returns int
- */
- int getExtent();
-
- /**
- * setExtent
- * @param extent TODO
- */
- void setExtent(int extent);
-
- /**
- * setRangeProperties
- * @param value TODO
- * @param extent TODO
- * @param min TODO
- * @param max TODO
- * @param adjusting TODO
- */
- void setRangeProperties(int value, int extent, int min,
- int max, boolean adjusting);
-
- /**
- * addChangeListener
- * @param listener TODO
- */
- void addChangeListener(ChangeListener listener);
-
- /**
- * removeChangeListener
- * @param listener TODO
- */
- void removeChangeListener(ChangeListener listener);
-
-
-} // BoundedRangeModel
+public interface BoundedRangeModel
+{
+ /**
+ * getValue
+ *
+ * @return int
+ *
+ * @see #setValue(int)
+ */
+ int getValue();
+
+ /**
+ * setValue
+ *
+ * @param value the value
+ *
+ * @see #getValue()
+ */
+ void setValue(int value);
+
+ /**
+ * getMinimum
+ *
+ * @return int
+ *
+ * @see #setMinimum(int)
+ */
+ int getMinimum();
+
+ /**
+ * setMinimum
+ *
+ * @param minimum the minimum value
+ *
+ * @see #getMinimum()
+ */
+ void setMinimum(int minimum);
+
+ /**
+ * getMaximum
+ *
+ * @return int
+ *
+ * @see #setMaximum(int)
+ */
+ int getMaximum();
+
+ /**
+ * setMaximum
+ *
+ * @param maximum the maximum value
+ *
+ * @see #getMaximum()
+ */
+ void setMaximum(int maximum);
+
+ /**
+ * Returns the value of the <code>valueIsAdjusting</code> property.
+ *
+ * @return <code>true</code> if value is adjusting,
+ * otherwise <code>false</code>
+ *
+ * @see setValueIsAdjusting(boolean)
+ */
+ boolean getValueIsAdjusting();
+
+ /**
+ * setValueIsAdjusting
+ *
+ * @param adjusting <code>true</code> if adjusting,
+ * <code>false</code> otherwise
+ *
+ * @see #getValueIsAdjusting()
+ */
+ void setValueIsAdjusting(boolean adjusting);
+
+ /**
+ * Returns the current extent.
+ *
+ * @return the extent
+ *
+ * @see #setExtent(int)
+ */
+ int getExtent();
+
+ /**
+ * setExtent
+ *
+ * @param extent the extent
+ *
+ * @see #getExtent()
+ */
+ void setExtent(int extent);
+
+ /**
+ * setRangeProperties
+ * @param value the value
+ * @param extent the extent
+ * @param minnimum the minimum value
+ * @param maximum the maximum value
+ * @param adjusting TODO
+ */
+ void setRangeProperties(int value, int extent, int minimum, int maximum,
+ boolean adjusting);
+
+ /**
+ * Adds a <code>ChangeListener</code> to this object.
+ *
+ * @param listener the listener to add
+ *
+ * @see #removeChangeListener(javax.swing.event.ChangeListener)
+ */
+ void addChangeListener(ChangeListener listener);
+
+ /**
+ * Removes a <code>ChangeListener</code> from this object.
+ *
+ * @param listener the listener to remove
+ *
+ * @see #addChangeListener(javax.swing.event.ChangeListener)
+ */
+ void removeChangeListener(ChangeListener listener);
+}
More information about the Java-patches
mailing list