Module java.desktop

Class RowSorterEvent

java.lang.Object
java.util.EventObject
javax.swing.event.RowSorterEvent
所有已实现的接口:
Serializable

public class RowSorterEvent extends EventObject
RowSorterEvent提供了对RowSorter更改的通知。可能有两种类型的通知:
  • Type.SORT_ORDER_CHANGED: 表示排序顺序已更改。通常会跟随以下通知:
  • Type.SORTED: 表示模型的内容已以某种方式转换。例如,内容可能已经被排序或过滤。
自版本:
1.6
参见:
  • Constructor Details

    • RowSorterEvent

      public RowSorterEvent(RowSorter<?> source)
      创建一个类型为SORT_ORDER_CHANGEDRowSorterEvent
      参数:
      source - 更改的源
      抛出:
      IllegalArgumentException - 如果sourcenull
    • RowSorterEvent

      public RowSorterEvent(RowSorter<?> source, RowSorterEvent.Type type, int[] previousRowIndexToModel)
      创建一个RowSorterEvent
      参数:
      source - 更改的源
      type - 事件的类型
      previousRowIndexToModel - 在排序之前从模型索引到视图索引的映射,可能为null
      抛出:
      IllegalArgumentException - 如果源或typenull
  • Method Details

    • getSource

      public RowSorter<?> getSource()
      返回事件的源作为RowSorter
      覆盖:
      getSource 在类 EventObject
      返回:
      事件的源作为RowSorter
    • getType

      public RowSorterEvent.Type getType()
      返回事件的类型。
      返回:
      事件的类型
    • convertPreviousRowIndexToModel

      public int convertPreviousRowIndexToModel(int index)
      返回在排序之前模型中index的位置。此方法仅适用于类型为SORTED的事件。如果索引无效或排序之前的位置未提供,此方法将返回-1。
      参数:
      index - 以视图为单位的索引
      返回:
      以排序之前模型为单位的索引,如果位置无效或未提供映射,则返回-1。
    • getPreviousRowCount

      public int getPreviousRowCount()
      返回在排序之前的行数。此方法仅适用于类型为SORTED的事件,如果未提供最后的位置,则返回0。
      返回:
      以视图为单位在排序之前的行数