1 package prefuse.action; 2 3 import java.util.logging.Logger ; 4 5 import prefuse.Visualization; 6 import prefuse.activity.Activity; 7 8 36 public abstract class Action extends Activity { 37 38 private final static Logger s_logger 39 = Logger.getLogger(Action.class.getName()); 40 41 42 protected Visualization m_vis; 43 44 48 public Action() { 49 this(null); 50 } 51 52 56 public Action(long duration) { 57 super(duration, Activity.DEFAULT_STEP_TIME); 58 } 59 60 65 public Action(long duration, long stepTime) { 66 super(duration, stepTime); 67 } 68 69 75 public Action(Visualization vis) { 76 this(vis, 0); 77 } 78 79 86 public Action(Visualization vis, long duration) { 87 super(duration, Activity.DEFAULT_STEP_TIME); 88 m_vis = vis; 89 } 90 91 100 public Action(Visualization vis, long duration, long stepTime) { 101 super(duration, stepTime); 102 m_vis = vis; 103 } 104 105 107 112 public abstract void run(double frac); 113 114 118 protected void run(long elapsedTime) { 119 Visualization vis = getVisualization(); 120 if ( vis != null ) { 121 synchronized (vis) { 122 run(getPace(elapsedTime)); 123 } 124 } else { 125 s_logger.info("Running unsynchronized Action"); 126 run(getPace(elapsedTime)); 127 } 128 } 129 130 134 public Visualization getVisualization() { 135 return m_vis; 136 } 137 138 142 public void setVisualization(Visualization vis) { 143 m_vis = vis; 144 } 145 146 } | Popular Tags |