2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2003, The Institute for Genomic Research (TIGR). |
2 |
26 Feb 07 |
jari |
All rights reserved. |
2 |
26 Feb 07 |
jari |
4 |
*/ |
2 |
26 Feb 07 |
jari |
5 |
/* |
2 |
26 Feb 07 |
jari |
* $RCSfile: DefaultAction.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.4 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/02/23 20:59:41 $ |
2 |
26 Feb 07 |
jari |
* $Author: caliente $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
11 |
*/ |
2 |
26 Feb 07 |
jari |
12 |
package org.tigr.microarray.mev.action; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
15 |
|
2 |
26 Feb 07 |
jari |
16 |
import javax.swing.AbstractAction; |
2 |
26 Feb 07 |
jari |
17 |
import javax.swing.Action; |
2 |
26 Feb 07 |
jari |
18 |
import javax.swing.ImageIcon; |
2 |
26 Feb 07 |
jari |
19 |
|
2 |
26 Feb 07 |
jari |
20 |
public class DefaultAction extends AbstractAction { |
2 |
26 Feb 07 |
jari |
21 |
|
2 |
26 Feb 07 |
jari |
22 |
private ActionManager manager; |
2 |
26 Feb 07 |
jari |
23 |
|
2 |
26 Feb 07 |
jari |
24 |
/** |
2 |
26 Feb 07 |
jari |
* Constructs <code>DefaultAction</code> with a specified name |
2 |
26 Feb 07 |
jari |
* and an action command. |
2 |
26 Feb 07 |
jari |
27 |
*/ |
2 |
26 Feb 07 |
jari |
28 |
public DefaultAction(ActionManager manager, String name, String command) { |
2 |
26 Feb 07 |
jari |
29 |
this(manager, name, command, null); |
2 |
26 Feb 07 |
jari |
30 |
} |
2 |
26 Feb 07 |
jari |
31 |
|
2 |
26 Feb 07 |
jari |
32 |
/** |
2 |
26 Feb 07 |
jari |
* Constructs <code>DefaultAction</code> with a specified name, |
2 |
26 Feb 07 |
jari |
* an action command and a small icon. |
2 |
26 Feb 07 |
jari |
35 |
*/ |
2 |
26 Feb 07 |
jari |
36 |
public DefaultAction(ActionManager manager, String name, String command, ImageIcon smallIcon) { |
2 |
26 Feb 07 |
jari |
37 |
this.manager = manager; |
2 |
26 Feb 07 |
jari |
38 |
putValue(Action.NAME, name); |
2 |
26 Feb 07 |
jari |
39 |
putValue(Action.SHORT_DESCRIPTION, name); |
2 |
26 Feb 07 |
jari |
40 |
putValue(Action.ACTION_COMMAND_KEY, command); |
2 |
26 Feb 07 |
jari |
41 |
putValue(Action.SMALL_ICON, smallIcon); |
2 |
26 Feb 07 |
jari |
42 |
} |
2 |
26 Feb 07 |
jari |
43 |
|
2 |
26 Feb 07 |
jari |
44 |
/** |
2 |
26 Feb 07 |
jari |
* Constructs <code>DefaultAction</code> with a specified name, |
2 |
26 Feb 07 |
jari |
* an action command, small and large icons. |
2 |
26 Feb 07 |
jari |
47 |
*/ |
2 |
26 Feb 07 |
jari |
48 |
public DefaultAction(ActionManager manager, String name, String command, ImageIcon smallIcon, ImageIcon largeIcon) { |
2 |
26 Feb 07 |
jari |
49 |
this(manager, name, command, smallIcon); |
2 |
26 Feb 07 |
jari |
50 |
putValue(ActionManager.LARGE_ICON, largeIcon); |
2 |
26 Feb 07 |
jari |
51 |
} |
2 |
26 Feb 07 |
jari |
52 |
|
2 |
26 Feb 07 |
jari |
53 |
/** |
2 |
26 Feb 07 |
jari |
* Delegates this invokation to a wrapped action manager. |
2 |
26 Feb 07 |
jari |
* @see ActionManager |
2 |
26 Feb 07 |
jari |
56 |
*/ |
2 |
26 Feb 07 |
jari |
57 |
public void actionPerformed(ActionEvent e) { |
2 |
26 Feb 07 |
jari |
58 |
manager.forwardAction(new ActionEvent(this, e.getID(), (String)getValue(Action.ACTION_COMMAND_KEY))); |
2 |
26 Feb 07 |
jari |
59 |
} |
2 |
26 Feb 07 |
jari |
60 |
} |