prefuse.action
Class CompositeAction

java.lang.Object
  extended by prefuse.activity.Activity
      extended by prefuse.action.Action
          extended by prefuse.action.CompositeAction
Direct Known Subclasses:
ActionList, ActionSwitch

public abstract class CompositeAction
extends Action

Abstract base class for Action implementations that hold a collection of subclasses.

Author:
jeffrey heer

Field Summary
protected  CopyOnWriteArrayList m_actions
           
 
Fields inherited from class prefuse.action.Action
m_vis
 
Fields inherited from class prefuse.activity.Activity
DEFAULT_STEP_TIME, INFINITY
 
Constructor Summary
CompositeAction()
          Creates a new run-once CompositeAction.
CompositeAction(long duration)
          Creates a new CompositeAction of specified duration and default step time of 20 milliseconds.
CompositeAction(long duration, long stepTime)
          Creates a new CompositeAction of specified duration and step time.
CompositeAction(Visualization vis)
          Creates a new run-once CompositeAction that processes the given Visualization.
CompositeAction(Visualization vis, long duration)
          Creates a new CompositeAction of specified duration and default step time of 20 milliseconds that processes the given Visualization.
 
Method Summary
 void add(Action a)
          Adds an Action to the end of the composite list.
 void add(int i, Action a)
          Adds an Action at the given index.
 Action get(int i)
          Returns the Action at the specified index.
 boolean remove(Action a)
          Removes a given Action from the composite.
 Action remove(int i)
          Removes the Action at the specified index.
 void setVisualization(Visualization vis)
          Set the Visualization processed by this Action.
 int size()
          Returns the number of Actions in the composite.
 
Methods inherited from class prefuse.action.Action
getVisualization, run, run
 
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_actions

protected CopyOnWriteArrayList m_actions
Constructor Detail

CompositeAction

public CompositeAction()
Creates a new run-once CompositeAction.


CompositeAction

public CompositeAction(Visualization vis)
Creates a new run-once CompositeAction that processes the given Visualization.

Parameters:
vis - the Visualization processed by this Action

CompositeAction

public CompositeAction(long duration)
Creates a new CompositeAction of specified duration and default step time of 20 milliseconds.

Parameters:
duration - the duration of this Activity, in milliseconds

CompositeAction

public CompositeAction(Visualization vis,
                       long duration)
Creates a new CompositeAction of specified duration and default step time of 20 milliseconds that processes the given Visualization.

Parameters:
vis - the Visualization processed by this Action
duration - the duration of this Activity, in milliseconds

CompositeAction

public CompositeAction(long duration,
                       long stepTime)
Creates a new CompositeAction of specified duration and step time.

Parameters:
duration - the duration of this Activity, in milliseconds
stepTime - the time to wait in milliseconds between executions of the action list
Method Detail

setVisualization

public void setVisualization(Visualization vis)
Set the Visualization processed by this Action. This also calls Action.setVisualization(Visualization) on all Action instances contained within this composite.

Overrides:
setVisualization in class Action
Parameters:
vis - the Visualization to process

size

public int size()
Returns the number of Actions in the composite.

Returns:
the size of this composite

add

public void add(Action a)
Adds an Action to the end of the composite list.

Parameters:
a - the Action instance to add

add

public void add(int i,
                Action a)
Adds an Action at the given index.

Parameters:
i - the index at which to add the Action
a - the Action instance to add

get

public Action get(int i)
Returns the Action at the specified index.

Parameters:
i - the index
Returns:
the requested Action

remove

public boolean remove(Action a)
Removes a given Action from the composite.

Parameters:
a - the Action to remove
Returns:
true if the Action was found and removed, false otherwise

remove

public Action remove(int i)
Removes the Action at the specified index.

Parameters:
i - the index
Returns:
the removed Action


Copyright © 2007 Regents of the University of California