KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > action > ActionList


1 package prefuse.action;
2
3 import java.util.logging.Logger JavaDoc;
4
5 import prefuse.Visualization;
6 import prefuse.activity.Activity;
7 import prefuse.util.StringLib;
8
9
10 /**
11  * <p>The ActionList represents a chain of Actions that process VisualItems.
12  * ActionList also implements the Action interface, so ActionLists can be placed
13  * within other ActionList or {@link ActionSwitch} instances,
14  * allowing recursive composition of different sets of Actions.</p>
15  *
16  * @author <a HREF="http://jheer.org">jeffrey heer</a>
17  * @see prefuse.activity.Activity
18  * @see prefuse.action.Action
19  */

20 public class ActionList extends CompositeAction {
21
22     private static final Logger JavaDoc s_logger =
23         Logger.getLogger(ActionList.class.getName());
24     
25     /**
26      * Creates a new run-once ActionList.
27      */

28     public ActionList() {
29         super(0);
30     }
31     
32     /**
33      * Creates a new run-once ActionList that processes the given
34      * Visualization.
35      * @param vis the {@link prefuse.Visualization} to process.
36      */

37     public ActionList(Visualization vis) {
38         super(vis);
39     }
40     
41     /**
42      * Creates a new ActionList of specified duration and default
43      * step time of 20 milliseconds.
44      * @param duration the duration of this Activity, in milliseconds
45      */

46     public ActionList(long duration) {
47         super(duration, Activity.DEFAULT_STEP_TIME);
48     }
49     
50     /**
51      * Creates a new ActionList which processes the given Visualization
52      * and has the specified duration and a default step time of 20
53      * milliseconds.
54      * @param vis the {@link prefuse.Visualization} to process.
55      * @param duration the duration of this Activity, in milliseconds
56      */

57     public ActionList(Visualization vis, long duration) {
58         super(vis, duration);
59     }
60     
61     /**
62      * Creates a new ActionList of specified duration and step time.
63      * @param duration the duration of this Activity, in milliseconds
64      * @param stepTime the time to wait in milliseconds between executions
65      * of the action list
66      */

67     public ActionList(long duration, long stepTime) {
68         super(duration, stepTime);
69     }
70
71     /**
72      * @see prefuse.action.Action#run(double)
73      */

74     public void run(double frac) {
75         Object JavaDoc[] actions = m_actions.getArray();
76         for ( int i=0; i<actions.length; ++i ) {
77             Action a = (Action)actions[i];
78             try {
79                 if ( a.isEnabled() ) a.run(frac);
80             } catch ( Exception JavaDoc e ) {
81                 s_logger.warning(e.getMessage() + '\n'
82                         + StringLib.getStackTrace(e));
83             }
84         }
85     }
86
87 } // end of class ActionList
88
Popular Tags