modhelxs.simulation
Class SwingButtonClock

java.lang.Object
  extended by tesl.Clock<T>
      extended by modhelxs.simulation.DrivingClock<java.lang.Long>
          extended by modhelxs.simulation.EventFeederClock
              extended by modhelxs.simulation.SwingButtonClock
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class SwingButtonClock
extends EventFeederClock
implements java.awt.event.ActionListener

A SwingButtonClock is an event feeder clock that ticks when a Swing button is pressed.

Author:
boulange

Field Summary
private  javax.swing.JButton button_
          the swing button for this clock.
 
Fields inherited from class modhelxs.simulation.DrivingClock
listener_
 
Constructor Summary
SwingButtonClock(java.lang.String name, java.lang.String buttonName)
          Build a new SwingButton clock
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent arg0)
          Called when the button is pressed.
 void activate()
          Activate the clock: make it ready to produce a tick and notify the engine.
 javax.swing.JButton getButton()
          Get the Swing button associated to this clock.
 void wrapup()
          Disable the button when the simulation is finished.
 
Methods inherited from class modhelxs.simulation.EventFeederClock
backup, cancel, eventOccurred, newTick, removeTick, removeTick, resetClock, restore
 
Methods inherited from class modhelxs.simulation.DrivingClock
getDrivingClocks, setListener
 
Methods inherited from class tesl.Clock
affineTags, cleanUp, createMasterImplication, createSlaveImplication, filteredImplies, getClockSet, getFirstTaggedTick, getFloatingTick, getName, getNowTick, getNumberOfTicks, getTag, getTagCalculus, getTagValue, getTick, getTick, getTick, getTicks, hasFloatingTick, hasTaggedTick, hasTickNow, hasTicks, implies, impliesThroughFilter, impliesWithDelay, impliesWithDelay, isGreedy, isNow, newTick, sameTags, setClockSet, setGreedy, setNow, setTag, setTagValue, sustains, sustains, tagDifference, tagProduct, tagQuotient, tagSum, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

button_

private javax.swing.JButton button_
the swing button for this clock.

Constructor Detail

SwingButtonClock

public SwingButtonClock(java.lang.String name,
                        java.lang.String buttonName)
Build a new SwingButton clock

Parameters:
name - the name of the clock
buttonName - the name of the button
Method Detail

getButton

public javax.swing.JButton getButton()
Get the Swing button associated to this clock.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent arg0)
Called when the button is pressed. Sets the tag of tick to the current system time in milliseconds, and sets the tick to "now".

Specified by:
actionPerformed in interface java.awt.event.ActionListener

activate

public void activate()
Description copied from class: DrivingClock
Activate the clock: make it ready to produce a tick and notify the engine.

Overrides:
activate in class EventFeederClock

wrapup

public void wrapup()
Disable the button when the simulation is finished.

Overrides:
wrapup in class EventFeederClock