|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.luc.cs.trull.EmptyComponent
edu.luc.cs.trull.TerminatingComponent
edu.luc.cs.trull.AbstractComponent
edu.luc.cs.trull.AbstractCombinator
edu.luc.cs.trull.SingleChildCombinator
edu.luc.cs.trull.Suspend
public class Suspend
A combinator for mapping sets of events to a component's lifecycle methods suspend and resume. It behaves as follows. First, the body component is executed automatically. If, before the body terminates, an event occurs whose label matches the suspend labels, then the execution of the body is suspended. If, while the body is suspended, an event occurs whose label matches the resume labels, then the execution of the body is resumed where it had been suspended.
Control,
Watching| Nested Class Summary | |
|---|---|
protected class |
Suspend.LocalListener
A dedicated listener that forwards the event to all external listeners. |
protected class |
Suspend.SuspendTerminationListener
This component terminates when its child component terminates. |
| Nested classes/interfaces inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
AbstractCombinator.DefaultTerminationListener |
| Field Summary | |
|---|---|
private java.beans.PropertyChangeListener |
internalListener
The internal listener that listens to the child component. |
private static org.apache.log4j.Logger |
logger
|
private java.beans.PropertyChangeListener |
resumeAction
An action to be invoked when a resume event is received. |
private java.util.Set |
resumeEvents
The set of triggering events for resuming this component. |
private java.beans.PropertyChangeListener |
suspendAction
An action to be invoked when a susupend event is received. |
private boolean |
suspended
The current state of this component. |
private java.util.Set |
suspendEvents
The set of triggering events for suspending this component. |
private TerminationListener |
terminationListener
The child termination listener for this component. |
| Fields inherited from class edu.luc.cs.trull.AbstractCombinator |
|---|
components |
| Constructor Summary | |
|---|---|
Suspend()
Constructs a Suspend component. |
|
Suspend(Component body)
Suspend([], [], body) |
|
Suspend(java.lang.String[] suspendLabels,
java.beans.PropertyChangeListener suspendAction,
java.lang.String[] resumeLabels,
java.beans.PropertyChangeListener resumeAction,
Component body)
Constsructs a Suspend component. |
|
Suspend(java.lang.String[] suspendLabels,
java.lang.String[] resumeLabels,
Component body)
Suspend([suspendLabel], null, [resumeLabel], null, body) |
|
Suspend(java.lang.String suspendLabel,
java.beans.PropertyChangeListener suspendAction,
java.lang.String resumeLabel,
java.beans.PropertyChangeListener resumeAction,
Component body)
Suspend([suspendLabel], suspendAction, [resumeLabel], resumeAction, body) |
|
Suspend(java.lang.String suspendLabel,
java.lang.String resumeLabel,
Component body)
Suspend([suspendLabel], [resumeLabel], body) |
|
| Method Summary | |
|---|---|
protected TerminationListener |
getChildTerminationListener()
Returns the internal listener that is notified if the child component terminates. |
protected Component |
getDefaultChild()
This method returns the default child component. |
protected java.beans.PropertyChangeListener |
getInternalListener()
Returns the internal listener that listens to the child component. |
java.beans.PropertyChangeListener |
getResumeAction()
Returns the action invoked upon receiving a resuming event. |
java.lang.String[] |
getResumeEvents()
Returns the array of resuming event labels for this component. |
java.beans.PropertyChangeListener |
getSuspendAction()
Returns the action invoked upon receiving a suspending event. |
java.lang.String[] |
getSuspendEvents()
Returns the array of suspending event labels for this component. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Forwards incoming events to the child component. |
protected void |
resumeChild(java.beans.PropertyChangeEvent incoming)
Resumes the child component. |
void |
setResumeAction(java.beans.PropertyChangeListener action)
Sets the action invoked upon receiving a resuming event. |
void |
setResumeEvent(java.lang.String label)
Sets the resuming event label for this component to the given string. |
void |
setResumeEvents(java.util.Collection evts)
Sets the resuming event labels for this component to the given collection of strings. |
void |
setResumeEvents(java.lang.String[] labels)
Sets the resuming event labels for this component to the given array of strings. |
void |
setSuspendAction(java.beans.PropertyChangeListener action)
Sets the action invoked upon receiving a suspending event. |
void |
setSuspendEvent(java.lang.String label)
Sets the suspending event label for this component to the given string. |
void |
setSuspendEvents(java.util.Collection evts)
Sets the suspending event labels for this component to the given collection of strings. |
void |
setSuspendEvents(java.lang.String[] labels)
Sets the suspending event labels for this component to the given array of strings. |
void |
start(java.beans.PropertyChangeEvent incoming)
Starts this startable component. |
protected void |
suspendChild(java.beans.PropertyChangeEvent incoming)
Suspends the child component. |
| Methods inherited from class edu.luc.cs.trull.SingleChildCombinator |
|---|
addComponent, getChild, removeComponent, resume, 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.Terminating |
|---|
getTerminationListener, setTerminationListener |
| Field Detail |
|---|
private java.beans.PropertyChangeListener internalListener
private static final org.apache.log4j.Logger logger
private java.beans.PropertyChangeListener resumeAction
private java.util.Set resumeEvents
private java.beans.PropertyChangeListener suspendAction
private boolean suspended
private java.util.Set suspendEvents
private TerminationListener terminationListener
| Constructor Detail |
|---|
public Suspend()
public Suspend(Component body)
Suspend([], [], body)
public Suspend(java.lang.String[] suspendLabels,
java.beans.PropertyChangeListener suspendAction,
java.lang.String[] resumeLabels,
java.beans.PropertyChangeListener resumeAction,
Component body)
suspendLabels - the event labels on which the body is suspended.suspendAction - the action invoked upon suspending. May be null.resumeLabels - the event labels on which the body is resumed.resumeAction - the action invoked upon resuming. May be null.body - the body of the component. If null, Nil is used.
public Suspend(java.lang.String[] suspendLabels,
java.lang.String[] resumeLabels,
Component body)
Suspend([suspendLabel], null, [resumeLabel], null, body)
public Suspend(java.lang.String suspendLabel,
java.beans.PropertyChangeListener suspendAction,
java.lang.String resumeLabel,
java.beans.PropertyChangeListener resumeAction,
Component body)
Suspend([suspendLabel], suspendAction, [resumeLabel], resumeAction, body)
public Suspend(java.lang.String suspendLabel,
java.lang.String resumeLabel,
Component body)
Suspend([suspendLabel], [resumeLabel], body)
| Method Detail |
|---|
protected TerminationListener getChildTerminationListener()
AbstractCombinator
getChildTerminationListener in class AbstractCombinatorprotected Component getDefaultChild()
SingleChildCombinator
getDefaultChild in class SingleChildCombinatorprotected java.beans.PropertyChangeListener getInternalListener()
SingleChildCombinator
getInternalListener in class SingleChildCombinatorpublic java.beans.PropertyChangeListener getResumeAction()
public java.lang.String[] getResumeEvents()
public java.beans.PropertyChangeListener getSuspendAction()
public java.lang.String[] getSuspendEvents()
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerpropertyChange in class SingleChildCombinatorevt - the event received.protected void resumeChild(java.beans.PropertyChangeEvent incoming)
incoming - the resuming event.public void setResumeAction(java.beans.PropertyChangeListener action)
action - the resume action.public void setResumeEvent(java.lang.String label)
label - the resuming event label.public void setResumeEvents(java.util.Collection evts)
evts - the resuming event labels.public void setResumeEvents(java.lang.String[] labels)
labels - the resuming event labels.public void setSuspendAction(java.beans.PropertyChangeListener action)
action - the suspend action.public void setSuspendEvent(java.lang.String label)
label - the suspending event label.public void setSuspendEvents(java.util.Collection evts)
evts - the suspending event labels.public void setSuspendEvents(java.lang.String[] labels)
labels - the suspending event labels.public void start(java.beans.PropertyChangeEvent incoming)
Startable
start in interface Startablestart in class SingleChildCombinatorincoming - the event that triggered the invocation of this method. May be null.protected void suspendChild(java.beans.PropertyChangeEvent incoming)
incoming - the suspending event.
|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||