54 /** 55 * Indicates the sort order has changed. 56 */ 57 SORT_ORDER_CHANGED, 58 59 /** 60 * Indicates the contents have been newly sorted or 61 * transformed in some way. 62 */ 63 SORTED 64 } 65 66 /** 67 * Creates a <code>RowSorterEvent</code> of type 68 * <code>SORT_ORDER_CHANGED</code>. 69 * 70 * @param source the source of the change 71 * @throws IllegalArgumentException if <code>source</code> is 72 * <code>null</code> 73 */ 74 public RowSorterEvent(RowSorter source) { 75 this(source, Type.SORT_ORDER_CHANGED, null); 76 } 77 78 /** 79 * Creates a <code>RowSorterEvent</code>. 80 * 81 * @param source the source of the change 82 * @param type the type of event 83 * @param previousRowIndexToModel the mapping from model indices to 84 * view indices prior to the sort, may be <code>null</code> 85 * @throws IllegalArgumentException if source or <code>type</code> is 86 * <code>null</code> 87 */ 88 public RowSorterEvent(RowSorter source, Type type, 89 int[] previousRowIndexToModel) { 90 super(source); 91 if (type == null) { 92 throw new IllegalArgumentException("type must be non-null"); 93 } 94 this.type = type; 95 this.oldViewToModel = previousRowIndexToModel; 96 } 97 98 /** 99 * Returns the source of the event as a <code>RowSorter</code>. 100 * 101 * @return the source of the event as a <code>RowSorter</code> 102 */ 103 public RowSorter getSource() { 104 return (RowSorter)super.getSource(); 105 } 106 107 /** 108 * Returns the type of event. 109 * 110 * @return the type of event 111 */ 112 public Type getType() { 113 return type; 114 } 115 116 /** 117 * Returns the location of <code>index</code> in terms of the 118 * model prior to the sort. This method is only useful for events 119 * of type <code>SORTED</code>. This method will return -1 if the 120 * index is not valid, or the locations prior to the sort have not 121 * been provided. 122 * 123 * @param index the index in terms of the view | 54 /** 55 * Indicates the sort order has changed. 56 */ 57 SORT_ORDER_CHANGED, 58 59 /** 60 * Indicates the contents have been newly sorted or 61 * transformed in some way. 62 */ 63 SORTED 64 } 65 66 /** 67 * Creates a <code>RowSorterEvent</code> of type 68 * <code>SORT_ORDER_CHANGED</code>. 69 * 70 * @param source the source of the change 71 * @throws IllegalArgumentException if <code>source</code> is 72 * <code>null</code> 73 */ 74 public RowSorterEvent(RowSorter<?> source) { 75 this(source, Type.SORT_ORDER_CHANGED, null); 76 } 77 78 /** 79 * Creates a <code>RowSorterEvent</code>. 80 * 81 * @param source the source of the change 82 * @param type the type of event 83 * @param previousRowIndexToModel the mapping from model indices to 84 * view indices prior to the sort, may be <code>null</code> 85 * @throws IllegalArgumentException if source or <code>type</code> is 86 * <code>null</code> 87 */ 88 public RowSorterEvent(RowSorter<?> source, Type type, 89 int[] previousRowIndexToModel) { 90 super(source); 91 if (type == null) { 92 throw new IllegalArgumentException("type must be non-null"); 93 } 94 this.type = type; 95 this.oldViewToModel = previousRowIndexToModel; 96 } 97 98 /** 99 * Returns the source of the event as a <code>RowSorter</code>. 100 * 101 * @return the source of the event as a <code>RowSorter</code> 102 */ 103 @Override 104 public RowSorter<?> getSource() { 105 return (RowSorter)super.getSource(); 106 } 107 108 /** 109 * Returns the type of event. 110 * 111 * @return the type of event 112 */ 113 public Type getType() { 114 return type; 115 } 116 117 /** 118 * Returns the location of <code>index</code> in terms of the 119 * model prior to the sort. This method is only useful for events 120 * of type <code>SORTED</code>. This method will return -1 if the 121 * index is not valid, or the locations prior to the sort have not 122 * been provided. 123 * 124 * @param index the index in terms of the view |