Class RowSorterEvent

java.lang.Object
java.util.EventObject
javax.swing.event.RowSorterEvent
All Implemented Interfaces:
Serializable

public class RowSorterEvent extends EventObject
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 Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enumeration of the types of RowSorterEvents.
  • Field Summary

    Fields declared in class EventObject

    source
    Modifier and Type
    Field
    Description
    protected Object
    The object on which the Event initially occurred.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a RowSorterEvent of type SORT_ORDER_CHANGED.
    RowSorterEvent(RowSorter<?> source, RowSorterEvent.Type type, int[] previousRowIndexToModel)
    Creates a RowSorterEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the location of index in terms of the model prior to the sort.
    int
    Returns the number of rows before the sort.
    Returns the source of the event as a RowSorter.
    Returns the type of event.

    Methods declared in class EventObject

    toString
    Modifier and Type
    Method
    Description
    Returns a String representation of this EventObject.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • RowSorterEvent

      public RowSorterEvent(RowSorter<?> source)
      Creates a RowSorterEvent of type SORT_ORDER_CHANGED.
      Parameters:
      source - the source of the change
      Throws:
      IllegalArgumentException - if source is null
    • RowSorterEvent

      public RowSorterEvent(RowSorter<?> source, RowSorterEvent.Type type, int[] previousRowIndexToModel)
      Creates a RowSorterEvent.
      Parameters:
      source - the source of the change
      type - the type of event
      previousRowIndexToModel - the mapping from model indices to view indices prior to the sort, may be null
      Throws:
      IllegalArgumentException - if source or type is null
  • Method Details

    • getSource

      public RowSorter<?> getSource()
      Returns the source of the event as a RowSorter.
      Overrides:
      getSource in class EventObject
      Returns:
      the source of the event as a RowSorter
    • getType

      public RowSorterEvent.Type getType()
      Returns the type of event.
      Returns:
      the type of event
    • convertPreviousRowIndexToModel

      public int convertPreviousRowIndexToModel(int index)
      Returns the location of index in terms of the model prior to the sort. This method is only useful for events of type SORTED. 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 type SORTED 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