Trull

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

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.AbstractCombinator
                  extended by edu.luc.cs.trull.Composite
                      extended by edu.luc.cs.trull.demo.counter.CounterComponent
All Implemented Interfaces:
Combinator, Component, EventLabels, PropertyChangeSource, Startable, Suspendable, VisualComponent, Terminating, java.beans.PropertyChangeListener, java.util.EventListener

public class CounterComponent
extends Composite
implements VisualComponent, EventLabels

A bounded counter implemented fully in Trull as a complex component. 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.

view Triveni source


Nested Class Summary
 
Nested classes/interfaces inherited from class edu.luc.cs.trull.Composite
Composite.CompositeTerminationListener, Composite.ForwardListener
 
Nested classes/interfaces inherited from class edu.luc.cs.trull.AbstractCombinator
AbstractCombinator.DefaultTerminationListener
 
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 class edu.luc.cs.trull.AbstractCombinator
components
 
Fields inherited from interface edu.luc.cs.trull.demo.counter.EventLabels
DOWN, OUCH, OVERFLOW, PRESSED, RESET, TICK, UP
 
Constructor Summary
CounterComponent(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()
           
(package private)  void raiseButton()
           
(package private)  void resetButton()
           
 
Methods inherited from class edu.luc.cs.trull.Composite
addComponent, getChildTerminationListener, propertyChange, removeComponent, resume, start, stop, suspend
 
Methods inherited from class edu.luc.cs.trull.AbstractCombinator
addComponent, addComponent, getComponent, getComponentCount, getComponents, removeAllComponents, removeComponent
 
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

CounterComponent

public CounterComponent(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()

raiseButton

void raiseButton()

resetButton

void resetButton()

Trull

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