package com.onaro.util.jfc.grouping;
import java.util.EventListener;
import com.onaro.util.ListenerList;
/**
* Allows user to trace sorting changes.
*/
public interface SortingListener extends EventListener {
/**
* When sorting changes, tells the new sorting column and order.
* @param column the number of the sorting column
* @param ascending true if the sorting is ascending
*/
public void sortingChanged(int column, boolean ascending);
/**
* Register an event firer with the ListenerList
utility for this listener.
*/
final static FireEvent firer = new FireEvent();
}
/**
* Used for sending event to {@link SortingListener}s by the
* {@link ListenerList} utility.
*/
class FireEvent implements ListenerList.FireEvent {
FireEvent() {
ListenerList.addFireEvent(SortingListener.class, this);
}
public void fire(SortingListener listener, SortingChangedEvent event) {
listener.sortingChanged(event.getColumn(), event.isAscending());
}
}