Class RowSorterEvent
java.lang.Object
java.util.EventObject
javax.swing.event.RowSorterEvent
- All Implemented Interfaces:
Serializable
RowSorterEvent
provides notification of changes to
a RowSorter
. Two types of notification are possible:
Type.SORT_ORDER_CHANGED
: indicates the sort order has changed. This is typically followed by a notification of:Type.SORTED
: indicates the contents of the model have been transformed in some way. For example, the contents may have been sorted or filtered.
- Since:
- 1.6
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration of the types ofRowSorterEvent
s. -
Field Summary
Fields declared in class EventObject
source
-
Constructor Summary
ConstructorsConstructorDescriptionRowSorterEvent
(RowSorter<?> source) Creates aRowSorterEvent
of typeSORT_ORDER_CHANGED
.RowSorterEvent
(RowSorter<?> source, RowSorterEvent.Type type, int[] previousRowIndexToModel) Creates aRowSorterEvent
. -
Method Summary
Modifier and TypeMethodDescriptionint
convertPreviousRowIndexToModel
(int index) Returns the location ofindex
in terms of the model prior to the sort.int
Returns the number of rows before the sort.RowSorter
<?> Returns the source of the event as aRowSorter
.getType()
Returns the type of event.Methods declared in class EventObject
toString
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
RowSorterEvent
Creates aRowSorterEvent
of typeSORT_ORDER_CHANGED
.- Parameters:
source
- the source of the change- Throws:
IllegalArgumentException
- ifsource
isnull
-
RowSorterEvent
Creates aRowSorterEvent
.- Parameters:
source
- the source of the changetype
- the type of eventpreviousRowIndexToModel
- the mapping from model indices to view indices prior to the sort, may benull
- Throws:
IllegalArgumentException
- if source ortype
isnull
-
-
Method Details
-
getSource
Returns the source of the event as aRowSorter
.- Overrides:
getSource
in classEventObject
- Returns:
- the source of the event as a
RowSorter
-
getType
-
convertPreviousRowIndexToModel
public int convertPreviousRowIndexToModel(int index) Returns the location ofindex
in terms of the model prior to the sort. This method is only useful for events of typeSORTED
. This method will return -1 if the index is not valid, or the locations prior to the sort have not been provided.- Parameters:
index
- the index in terms of the view- Returns:
- the index in terms of the model prior to the sort, or -1 if the location is not valid or the mapping was not provided.
-
getPreviousRowCount
public int getPreviousRowCount()Returns the number of rows before the sort. This method is only useful for events of typeSORTED
and if the last locations have not been provided will return 0.- Returns:
- the number of rows in terms of the view prior to the sort
-