1 package edu.psu.geovista.app.spreadsheet.tools;
2
3 /*
4 * Description:
5 * Date: Mar 20, 2003
6 * Time: 10:27:10 PM
7 * @author Jin Chen
8 */
9
10 import edu.psu.geovista.app.spreadsheet.table.SSTableModel;
11
12 import javax.swing.*;
13 import java.awt.event.ActionListener;
14 import java.awt.event.ActionEvent;
15
16 import edu.psu.geovista.app.spreadsheet.table.SSTable;
17
18 public class Sort implements ActionListener{
19 public static final int CLEAR=0;
20 public static final int ASCEND=1;
21 public static final int DESCEND=2;
22
23 int action;
24 SSTableModel tbm;
25 SSTable tb;
26 public Sort(SSTable tb,int action) {
27 this.tb=tb;
28 tbm=(SSTableModel)tb.getModel();
29 //tbm=(SSTableModel) SSTableModel.getInstance() ;
30 this.action =action;
31
32 }
33
34 public void actionPerformed (ActionEvent e){
35 int col=tb.getSelectedColumn() ;
36 if (this.action ==DESCEND) { //0
37 //tb.sortTable(col,false);
38 tb.sort(false);
39 }
40 else if (this.action ==ASCEND){//1
41 //tb.sortTable(col,true);
42 tb.sort(true) ;
43 }
44 else if(this.action ==CLEAR){
45 tb.clearSort() ;
46 }
47 else{
48 tb.sort(false);
49 }
50
51 }
52 }
This page was automatically generated by Maven