01: /*
02: * CustomColumnControlButton.java
03: *
04: * Created on May 17, 2007, 10:49:26 AM
05: *
06: * To change this template, choose Tools | Template Manager
07: * and open the template in the editor.
08: */
09:
10: package it.businesslogic.ireport.gui.table;
11:
12: import java.awt.event.ActionEvent;
13: import java.beans.PropertyChangeListener;
14: import java.util.List;
15: import javax.swing.AbstractAction;
16: import javax.swing.Action;
17: import javax.swing.Icon;
18: import org.jdesktop.swingx.JXTable;
19: import org.jdesktop.swingx.table.ColumnControlButton;
20: import org.jdesktop.swingx.table.ColumnControlPopup;
21:
22: /**
23: *
24: * @author gtoffoli
25: */
26: public class CustomColumnControlButton extends ColumnControlButton {
27:
28: private JXTable table = null;
29:
30: public CustomColumnControlButton(JXTable table, Icon icon) {
31:
32: super (table, icon);
33: this .table = table;
34:
35: ColumnControlPopup cc = null;
36: cc = getColumnControlPopup();
37: Action resetOrderAction = new AbstractAction("Reset order") {
38:
39: public void actionPerformed(ActionEvent e) {
40: resetOrder();
41: }
42: };
43:
44: List actions = new java.util.ArrayList();
45: actions.add(resetOrderAction);
46:
47: cc.addAdditionalActionItems(actions);
48:
49: }
50:
51: public void resetOrder() {
52: table.resetSortOrder();
53: }
54: }
|