Trull

edu.luc.cs.trull.demo.counter
Class Counter

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.counter.Counter
All Implemented Interfaces:
Component, EventLabels, PropertyChangeSource, Startable, Suspendable, VisualComponent, Terminating, java.beans.PropertyChangeListener, java.util.EventListener

public class Counter
extends EmitComponent
implements VisualComponent, EventLabels

A bounded counter implemented as a JavaBean with Trull support only for event emission. The current value of the counter is visualized as the position of a button in a rectangle whose height is the maximum value times the height of the button. The counter emits OUCH when the maximum value is reached and PRESSED when the button is pressed.

view Triveni source


Field Summary
private  javax.swing.JButton b
           
private  java.lang.String buttonName
           
private  int height
           
private  int numSteps
           
private  javax.swing.JPanel panel
           
private  int position
           
private  int width
           
 
Fields inherited from interface edu.luc.cs.trull.demo.counter.EventLabels
DOWN, OUCH, OVERFLOW, PRESSED, RESET, TICK, UP
 
Constructor Summary
Counter(java.lang.String buttonName, int numSteps, int width, int height)
           
 
Method Summary
 javax.swing.JComponent getView()
          Returns the Swing component associated with this Trull component.
(package private)  void lowerButton()
           
(package private)  void placeButton()
           
 void propertyChange(java.beans.PropertyChangeEvent event)
           
(package private)  void raiseButton()
           
(package private)  void resetButton()
           
 
Methods inherited from class edu.luc.cs.trull.EmitComponent
eventEmitter, eventEmitterCached, eventEmitterUncached, resume, scheduleEvent, scheduleEvent, scheduleEvent, start, stop, suspend
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.luc.cs.trull.PropertyChangeSource
addPropertyChangeListener, getPropertyChangeListeners, removePropertyChangeListener
 
Methods inherited from interface edu.luc.cs.trull.Startable
start, stop
 
Methods inherited from interface edu.luc.cs.trull.Suspendable
resume, suspend
 
Methods inherited from interface edu.luc.cs.trull.Terminating
getTerminationListener, setTerminationListener
 

Field Detail

b

private javax.swing.JButton b

buttonName

private java.lang.String buttonName

height

private int height

numSteps

private int numSteps

panel

private javax.swing.JPanel panel

position

private int position

width

private int width
Constructor Detail

Counter

public Counter(java.lang.String buttonName,
               int numSteps,
               int width,
               int height)
Method Detail

getView

public javax.swing.JComponent getView()
Description copied from interface: VisualComponent
Returns the Swing component associated with this Trull component.

Specified by:
getView in interface VisualComponent
Returns:
the associated Swing component.

lowerButton

void lowerButton()

placeButton

void placeButton()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class EmptyComponent

raiseButton

void raiseButton()

resetButton

void resetButton()

Trull

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