Trull

edu.luc.cs.trull.demo.task
Class TimerDemo

java.lang.Object
  extended by edu.luc.cs.trull.EmptyComponent
      extended by edu.luc.cs.trull.TerminatingComponent
          extended by edu.luc.cs.trull.AbstractComponent
              extended by edu.luc.cs.trull.EmitComponent
                  extended by edu.luc.cs.trull.demo.task.TimerDemo
All Implemented Interfaces:
Component, EventLabels, PropertyChangeSource, Startable, Suspendable, Terminating, java.beans.PropertyChangeListener, java.util.EventListener

public class TimerDemo
extends EmitComponent
implements EventLabels

This example demonstrates how a Swing timer can be placed under the control of a suitable Trull component.


Field Summary
static java.lang.String DEFAULT_LABEL
           
private  java.lang.String label
           
private  java.awt.event.ActionListener listener
           
private  int max
           
private  int min
           
private  javax.swing.Timer timer
           
 
Fields inherited from interface edu.luc.cs.trull.demo.task.EventLabels
PROGRESS, RESUME, START, STOP, SUSPEND
 
Constructor Summary
TimerDemo(int min, int max)
           
TimerDemo(int min, int max, java.lang.String label)
           
 
Method Summary
static void main(java.lang.String[] args)
           
 void resume()
          Resumes this suspendable component.
 void setRandomDelay()
           
 void start(java.beans.PropertyChangeEvent incoming)
          Starts this startable component.
 void stop()
          Stops this startable component.
 void suspend()
          Suspends this suspendable component.
 
Methods inherited from class edu.luc.cs.trull.EmitComponent
eventEmitter, eventEmitterCached, eventEmitterUncached, scheduleEvent, scheduleEvent, scheduleEvent
 
Methods inherited from class edu.luc.cs.trull.AbstractComponent
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getExternalListeners, getPropertyChangeListeners, removePropertyChangeListener
 
Methods inherited from class edu.luc.cs.trull.TerminatingComponent
fireTermination, getParent, getTermEvent, scheduleTermination, setTerminationListener
 
Methods inherited from class edu.luc.cs.trull.EmptyComponent
getTerminationListener, propertyChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LABEL

public static final java.lang.String DEFAULT_LABEL
See Also:
Constant Field Values

label

private final java.lang.String label

listener

private final java.awt.event.ActionListener listener

max

private int max

min

private int min

timer

private final javax.swing.Timer timer
Constructor Detail

TimerDemo

public TimerDemo(int min,
                 int max)

TimerDemo

public TimerDemo(int min,
                 int max,
                 java.lang.String label)
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

resume

public void resume()
Description copied from interface: Suspendable
Resumes this suspendable component.

Specified by:
resume in interface Suspendable
Overrides:
resume in class EmitComponent

setRandomDelay

public void setRandomDelay()

start

public void start(java.beans.PropertyChangeEvent incoming)
Description copied from interface: Startable
Starts this startable component.

Specified by:
start in interface Startable
Overrides:
start in class EmitComponent
Parameters:
incoming - the event that triggered the invocation of this method. May be null.

stop

public void stop()
Description copied from interface: Startable
Stops this startable component.

Specified by:
stop in interface Startable
Overrides:
stop in class EmitComponent

suspend

public void suspend()
Description copied from interface: Suspendable
Suspends this suspendable component.

Specified by:
suspend in interface Suspendable
Overrides:
suspend in class EmitComponent

Trull

http://www.cs.luc.edu/trull/