prefuse.action
Class Action

java.lang.Object
  extended by prefuse.activity.Activity
      extended by prefuse.action.Action
Direct Known Subclasses:
CompositeAction, GroupAction, QualityControlAnimator, RepaintAction

public abstract class Action
extends Activity

Actions are building blocks that perform any number of operations on a Visualization, typically processing VisualItems to set various visual attributes. This class is a base implementation for Action instances. Developers can subclass this class and implement the run method to create their own custom Actions.

After instantiating an Action, you should register it with a particular Visualization before running it. Use the Visualization.putAction(String, Action) to do this. This will ensure that the Action is configured to use that Visualization. If an Action is part of an ActionList or ActionSwitch, it is sufficient to only register that CompositeAction with the Visualization -- all contained Action instances will be configured appropriately. You can then run the Actions using the Visualization.run(String) method and other similar methods of the Visualization class.

As a subclass of Activity, Actions can be of two kinds. Run-once action lists have a duration value of zero, and simply run once when scheduled. Actions with a duration greater than zero can be executed multiple times, waiting a specified step time between each execution until the activity has run for its full duration. A duration of Activity.INFINITE will result in a continually re-running Action.

Author:
jeffrey heer

Field Summary
protected  Visualization m_vis
          A reference to the visualization processed by this Action.
 
Fields inherited from class prefuse.activity.Activity
DEFAULT_STEP_TIME, INFINITY
 
Constructor Summary
Action()
          Creates an action instance with zero duration.
Action(long duration)
          Create a new Action with a specified duration.
Action(long duration, long stepTime)
          Create a new Action with a specified duration and step time.
Action(Visualization vis)
          Create a new Action with a specified Visualization and zero duration.
Action(Visualization vis, long duration)
          Create a new Action with a specified Visualization and duration.
Action(Visualization vis, long duration, long stepTime)
          Create a new Action with a specified Visualization, duration and step time.
 
Method Summary
 Visualization getVisualization()
          Return the Visualization processed by this Action.
abstract  void run(double frac)
          Runs this Action, triggering whatever processing this Action performs.
protected  void run(long elapsedTime)
          Runs this Action (as an Activity).
 void setVisualization(Visualization vis)
          Set the Visualization processed by this Action.
 
Methods inherited from class prefuse.activity.Activity
addActivityListener, alwaysRunAfter, cancel, fireActivityCancelled, fireActivityFinished, fireActivityScheduled, fireActivityStarted, fireActivityStepped, getDuration, getNextTime, getPace, getPacingFunction, getStartTime, getStepTime, getStopTime, isEnabled, isRunning, isScheduled, removeActivityListener, run, runAfter, runAt, setDuration, setEnabled, setPacingFunction, setStartTime, setStepTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_vis

protected Visualization m_vis
A reference to the visualization processed by this Action.

Constructor Detail

Action

public Action()
Creates an action instance with zero duration. This Action will only run once if invoked.


Action

public Action(long duration)
Create a new Action with a specified duration.

Parameters:
duration - the Action duration in milliseconds

Action

public Action(long duration,
              long stepTime)
Create a new Action with a specified duration and step time.

Parameters:
duration - the Action duration in milliseconds
stepTime - the time to wait between invocation of the Action

Action

public Action(Visualization vis)
Create a new Action with a specified Visualization and zero duration.

Parameters:
vis - the Visualization this Action should process. If this Action is registered with another Visualization, this value will be overwritten.

Action

public Action(Visualization vis,
              long duration)
Create a new Action with a specified Visualization and duration.

Parameters:
vis - the Visualization this Action should process. If this Action is registered with another Visualization, this value will be overwritten.
duration - the Action duration in milliseconds

Action

public Action(Visualization vis,
              long duration,
              long stepTime)
Create a new Action with a specified Visualization, duration and step time.

Parameters:
vis - the Visualization this Action should process. If this Action is registered with another Visualization, this value will be overwritten.
duration - the Action duration in milliseconds
stepTime - the time to wait between invocation of the Action
Method Detail

run

public abstract void run(double frac)
Runs this Action, triggering whatever processing this Action performs. Subclass this method to create custom Actions.

Parameters:
frac - the fraction of this Action's duration that has elapsed.

run

protected void run(long elapsedTime)
Runs this Action (as an Activity). Called by the Activity super-class.

Specified by:
run in class Activity
Parameters:
elapsedTime - the time elapsed since the start of the activity.
See Also:
Activity.run(long)

getVisualization

public Visualization getVisualization()
Return the Visualization processed by this Action.

Returns:
the Visualization instance.

setVisualization

public void setVisualization(Visualization vis)
Set the Visualization processed by this Action.

Parameters:
vis - the Visualization to process.


Copyright © 2007 Regents of the University of California