< prev index next >
src/java.desktop/share/classes/javax/swing/DefaultListSelectionModel.java
Print this page
*** 40,50 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Philip Milne
* @author Hans Muller
* @see ListSelectionModel
--- 40,50 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Philip Milne
* @author Hans Muller
* @see ListSelectionModel
*** 126,138 ****
listenerList.remove(ListSelectionListener.class, l);
}
/**
* Returns an array of all the list selection listeners
! * registered on this <code>DefaultListSelectionModel</code>.
*
! * @return all of this model's <code>ListSelectionListener</code>s
* or an empty
* array if no list selection listeners are currently registered
*
* @see #addListSelectionListener
* @see #removeListSelectionListener
--- 126,138 ----
listenerList.remove(ListSelectionListener.class, l);
}
/**
* Returns an array of all the list selection listeners
! * registered on this {@code DefaultListSelectionModel}.
*
! * @return all of this model's {@code ListSelectionListener}s
* or an empty
* array if no list selection listeners are currently registered
*
* @see #addListSelectionListener
* @see #removeListSelectionListener
*** 163,175 ****
fireValueChanged(oldFirstChangedIndex, oldLastChangedIndex, isAdjusting);
}
/**
! * Notifies <code>ListSelectionListeners</code> that the value
! * of the selection, in the closed interval <code>firstIndex</code>,
! * <code>lastIndex</code>, has changed.
*
* @param firstIndex the first index in the interval
* @param lastIndex the last index in the interval
*/
protected void fireValueChanged(int firstIndex, int lastIndex) {
--- 163,175 ----
fireValueChanged(oldFirstChangedIndex, oldLastChangedIndex, isAdjusting);
}
/**
! * Notifies {@code ListSelectionListeners} that the value
! * of the selection, in the closed interval {@code firstIndex},
! * {@code lastIndex}, has changed.
*
* @param firstIndex the first index in the interval
* @param lastIndex the last index in the interval
*/
protected void fireValueChanged(int firstIndex, int lastIndex) {
*** 228,241 ****
* <code><em>Foo</em>Listener</code>s
* upon this model.
* <code><em>Foo</em>Listener</code>s
* are registered using the <code>add<em>Foo</em>Listener</code> method.
* <p>
! * You can specify the <code>listenerType</code> argument
* with a class literal, such as <code><em>Foo</em>Listener.class</code>.
! * For example, you can query a <code>DefaultListSelectionModel</code>
! * instance <code>m</code>
* for its list selection listeners
* with the following code:
*
* <pre>ListSelectionListener[] lsls = (ListSelectionListener[])(m.getListeners(ListSelectionListener.class));</pre>
*
--- 228,241 ----
* <code><em>Foo</em>Listener</code>s
* upon this model.
* <code><em>Foo</em>Listener</code>s
* are registered using the <code>add<em>Foo</em>Listener</code> method.
* <p>
! * You can specify the {@code listenerType} argument
* with a class literal, such as <code><em>Foo</em>Listener.class</code>.
! * For example, you can query a {@code DefaultListSelectionModel}
! * instance {@code m}
* for its list selection listeners
* with the following code:
*
* <pre>ListSelectionListener[] lsls = (ListSelectionListener[])(m.getListeners(ListSelectionListener.class));</pre>
*
*** 243,261 ****
* this method returns an empty array.
*
* @param <T> the type of {@code EventListener} class being requested
* @param listenerType the type of listeners requested;
* this parameter should specify an interface
! * that descends from <code>java.util.EventListener</code>
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s
* on this model,
* or an empty array if no such
* listeners have been added
! * @exception ClassCastException if <code>listenerType</code> doesn't
* specify a class or interface that implements
! * <code>java.util.EventListener</code>
*
* @see #getListSelectionListeners
*
* @since 1.3
*/
--- 243,261 ----
* this method returns an empty array.
*
* @param <T> the type of {@code EventListener} class being requested
* @param listenerType the type of listeners requested;
* this parameter should specify an interface
! * that descends from {@code java.util.EventListener}
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s
* on this model,
* or an empty array if no such
* listeners have been added
! * @exception ClassCastException if {@code listenerType} doesn't
* specify a class or interface that implements
! * {@code java.util.EventListener}
*
* @see #getListSelectionListeners
*
* @since 1.3
*/
*** 351,362 ****
public void setLeadAnchorNotificationEnabled(boolean flag) {
leadAnchorNotificationEnabled = flag;
}
/**
! * Returns the value of the <code>leadAnchorNotificationEnabled</code> flag.
! * When <code>leadAnchorNotificationEnabled</code> is true the model
* generates notification events with bounds that cover all the changes to
* the selection plus the changes to the lead and anchor indices.
* Setting the flag to false causes a narrowing of the event's bounds to
* include only the elements that have been selected or deselected since
* the last change. Either way, the model continues to maintain the lead
--- 351,362 ----
public void setLeadAnchorNotificationEnabled(boolean flag) {
leadAnchorNotificationEnabled = flag;
}
/**
! * Returns the value of the {@code leadAnchorNotificationEnabled} flag.
! * When {@code leadAnchorNotificationEnabled} is true the model
* generates notification events with bounds that cover all the changes to
* the selection plus the changes to the lead and anchor indices.
* Setting the flag to false causes a narrowing of the event's bounds to
* include only the elements that have been selected or deselected since
* the last change. Either way, the model continues to maintain the lead
*** 365,375 ****
* Note: It is possible for the lead or anchor to be changed without a
* change to the selection. Notification of these changes is often
* important, such as when the new lead or anchor needs to be updated in
* the view. Therefore, caution is urged when changing the default value.
*
! * @return the value of the <code>leadAnchorNotificationEnabled</code> flag
* @see #setLeadAnchorNotificationEnabled(boolean)
*/
public boolean isLeadAnchorNotificationEnabled() {
return leadAnchorNotificationEnabled;
}
--- 365,375 ----
* Note: It is possible for the lead or anchor to be changed without a
* change to the selection. Notification of these changes is often
* important, such as when the new lead or anchor needs to be updated in
* the view. Therefore, caution is urged when changing the default value.
*
! * @return the value of the {@code leadAnchorNotificationEnabled} flag
* @see #setLeadAnchorNotificationEnabled(boolean)
*/
public boolean isLeadAnchorNotificationEnabled() {
return leadAnchorNotificationEnabled;
}
*** 704,727 ****
/**
* Returns a string that displays and identifies this
* object's properties.
*
! * @return a <code>String</code> representation of this object
*/
public String toString() {
String s = ((getValueIsAdjusting()) ? "~" : "=") + value.toString();
return getClass().getName() + " " + Integer.toString(hashCode()) + " " + s;
}
/**
* Returns a clone of this selection model with the same selection.
! * <code>listenerLists</code> are not duplicated.
*
* @exception CloneNotSupportedException if the selection model does not
* both (a) implement the Cloneable interface and (b) define a
! * <code>clone</code> method.
*/
public Object clone() throws CloneNotSupportedException {
DefaultListSelectionModel clone = (DefaultListSelectionModel)super.clone();
clone.value = (BitSet)value.clone();
clone.listenerList = new EventListenerList();
--- 704,727 ----
/**
* Returns a string that displays and identifies this
* object's properties.
*
! * @return a {@code String} representation of this object
*/
public String toString() {
String s = ((getValueIsAdjusting()) ? "~" : "=") + value.toString();
return getClass().getName() + " " + Integer.toString(hashCode()) + " " + s;
}
/**
* Returns a clone of this selection model with the same selection.
! * {@code listenerLists} are not duplicated.
*
* @exception CloneNotSupportedException if the selection model does not
* both (a) implement the Cloneable interface and (b) define a
! * {@code clone} method.
*/
public Object clone() throws CloneNotSupportedException {
DefaultListSelectionModel clone = (DefaultListSelectionModel)super.clone();
clone.value = (BitSet)value.clone();
clone.listenerList = new EventListenerList();
*** 812,822 ****
* done in two steps the effect on the selection state would be the same
* but two events would be generated and the bounds around the changed
* values would be wider, including cells that had been first cleared only
* to later be set.
* <p>
! * This method can be used in the <code>mouseDragged</code> method
* of a UI class to extend a selection.
*
* @see #getLeadSelectionIndex
* @see #setAnchorSelectionIndex
*/
--- 812,822 ----
* done in two steps the effect on the selection state would be the same
* but two events would be generated and the bounds around the changed
* values would be wider, including cells that had been first cleared only
* to later be set.
* <p>
! * This method can be used in the {@code mouseDragged} method
* of a UI class to extend a selection.
*
* @see #getLeadSelectionIndex
* @see #setAnchorSelectionIndex
*/
< prev index next >