Inheritance diagram for code::AlgorithmControl:
How the algorithm reacts to the control is up to it.
AlgorithmControl::instance().addActionListener(myControlListener);Notification is made by calling the listener's actionPerformed() method with a ControlEvent.
Public Member Functions | |
virtual | ~AlgorithmControl () |
void | copyListenersFrom (const ActionSource &other) |
copy all the listeners from the other source (replacing our own) | |
size_t | getNumListeners () const |
returns the number of listeners linked to this source. | |
std::string | getDir () |
Returns a source-specific disk directory. | |
void | addActionListener (SmartPtr< ActionListener > lstnr) |
Subscribe lstnr such that it receives all events from this ActionSource. | |
void | addActionListener (const std::string &event_type, SmartPtr< ActionListener > lstnr) |
Subscribe lstnr such that it receives only this event type from this ActionSource. | |
void | removeActionListener (SmartPtr< ActionListener > lstner) |
Unsubscribe lstnr such that it no longer receives events from this ActionSource. | |
void | removeActionListener (const std::string &eventType, SmartPtr< ActionListener > lstner) |
Unsubscribe the listener so that it does not respond to the the event type noted. | |
void | fireActionPerformed (const ActionEvent &e) |
Convenience function for subclasses to notify ActionListeners of events. | |
void | fireActionPerformed (const ActionEvent *e) |
Convenience function for subclasses to notify ActionListeners of events. | |
void | fireActionPerformed (const std::string &type) |
Convenience function for subclasses to notify ActionListeners of events. | |
Static Public Member Functions | |
static AlgorithmControl & | instance () |
return this process' current controller. | |
static void | setAlgorithmControl (SmartPtr< AlgorithmControl > newControl) |
Use newControl as this process' controller. | |
static void | setAlgorithmControl (const URL &url) |
Protected Member Functions | |
void | notify (const std::string &xmlContent) |
The content should be XML with tagname "control" or having children with that tagname. | |
void | notify (const XML::Element &e) |
The content should be XML with tagname "control" or having children with that tagname. | |
virtual SmartPtr< AlgorithmControl > | createAlgorithmControl (const URL &url) |
subclasses should over-ride this method, acting as a prototype factory, returning another object of your type. | |
AlgorithmControl () | |
Classes | |
class | ControlEvent |
The ActionEvent passed to an AlgorithmControl listener's actionPerformed() method. More... |
virtual code::AlgorithmControl::~AlgorithmControl | ( | ) | [inline, virtual] |
code::AlgorithmControl::AlgorithmControl | ( | ) | [inline, protected] |
void code::ActionSource::addActionListener | ( | const std::string & | event_type, | |
SmartPtr< ActionListener > | lstnr | |||
) | [inline, inherited] |
Subscribe lstnr such that it receives only this event type from this ActionSource.
evt_type | the event type we are subscribing to | |
lstnr | the action listener to be subscribed. |
void code::ActionSource::addActionListener | ( | SmartPtr< ActionListener > | lstnr | ) | [inline, inherited] |
Subscribe lstnr such that it receives all events from this ActionSource.
l | the action listener to be subscribed. |
void code::ActionSource::copyListenersFrom | ( | const ActionSource & | other | ) | [inline, inherited] |
copy all the listeners from the other source (replacing our own)
virtual SmartPtr<AlgorithmControl> code::AlgorithmControl::createAlgorithmControl | ( | const URL & | url | ) | [protected, virtual] |
subclasses should over-ride this method, acting as a prototype factory, returning another object of your type.
Reimplemented in code::ControlLB.
void code::ActionSource::fireActionPerformed | ( | const std::string & | type | ) | [inline, inherited] |
Convenience function for subclasses to notify ActionListeners of events.
type | the type of the ActionEvent to be passed along to the action listeners. |
void code::ActionSource::fireActionPerformed | ( | const ActionEvent * | e | ) | [inline, inherited] |
Convenience function for subclasses to notify ActionListeners of events.
actionEvent | the event to be passed along to the action listeners. |
void code::ActionSource::fireActionPerformed | ( | const ActionEvent & | e | ) | [inline, inherited] |
Convenience function for subclasses to notify ActionListeners of events.
actionEvent | the event to be passed along to the action listeners. |
std::string code::ActionSource::getDir | ( | ) | [inline, inherited] |
Returns a source-specific disk directory.
Default implementation does nothing --- this should be overridden.
size_t code::ActionSource::getNumListeners | ( | ) | const [inline, inherited] |
returns the number of listeners linked to this source.
static AlgorithmControl& code::AlgorithmControl::instance | ( | ) | [static] |
return this process' current controller.
void code::AlgorithmControl::notify | ( | const XML::Element & | e | ) | [protected] |
The content should be XML with tagname "control" or having children with that tagname.
void code::AlgorithmControl::notify | ( | const std::string & | xmlContent | ) | [protected] |
The content should be XML with tagname "control" or having children with that tagname.
void code::ActionSource::removeActionListener | ( | const std::string & | eventType, | |
SmartPtr< ActionListener > | lstner | |||
) | [inline, inherited] |
Unsubscribe the listener so that it does not respond to the the event type noted.
This works only if the listener was added via addActionListener( type, SmartPtr )
type | The event type | |
lstnr | The listener to remove |
void code::ActionSource::removeActionListener | ( | SmartPtr< ActionListener > | lstner | ) | [inline, inherited] |
Unsubscribe lstnr such that it no longer receives events from this ActionSource.
lstnr | the action listener to be unsubscribed. |
static void code::AlgorithmControl::setAlgorithmControl | ( | const URL & | url | ) | [static] |
static void code::AlgorithmControl::setAlgorithmControl | ( | SmartPtr< AlgorithmControl > | newControl | ) | [static] |
Use newControl as this process' controller.
Any existing control is removed after its listeners are transferred over, so the change of control is transparent to existing listeners.