In Java, you have components with Actions (such as PressedAction for a UI button); you have other components that are Listeners that you must explicit connect to those actions. When the action is triggered, each connected Listener is told of this and they can take any necessary steps if they need do. In the above model, for the dynamic display during processing, you'd trigger an "InProgressAction", which then any InProgressListeners, including your progress display, respond to; the process display can be anything that responds to such; maybe as simple as a LED-style light that toggles state on each triggered action; maybe a status line that prints a text-bit that is sent, maybe a status bar that fills to 100%. You could also probably make a more specific FibonaciProgressIndicator that does something more interesting in your case. Since the triggered Actions can send out derivable events, you can overload these with extra that that you might want FibonaciProgressIndicator to respond to, but 'standard' ProgressIndicators have no idea what to do with. So unless you want speciality from the basic classes, there's no need to have strong 'interfaces' between your progress display and the underlying model.
(Another possiblity is a more general Broadcasters/Subscribers model, in which only one event engine class exists, which all broadcasters and subscribers are registered to; when a broadcaster sends out an event, the engine class sends it to subscribers which decide if they want to do anything with it. You can do some further optimization by having registeration flags to indicate which event to look for by subscribers, or what type of events will come in from Broadcasters, but this is a good type to use when you cannot completely encapsulate the event tree for a given operation into a single set of MVC classes. )
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
It's not what you know, but knowing how to find it if you don't know that's important
In reply to Re: How realistic is separation of computation from it's display?
by Masem
in thread How realistic is separation of computation from it's display?
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |