Re: Design issue in swing application
Fencer wrote:
MVC, hmm. Ok, so imagine WelcomePanel is a view and instead of knowing
about the CenteredGroup class directly it knows about an interface for a Controller.
Normally you'd do it the other way around - the controller knows about the
view, but the view doesn't know about the controller.
When the user presses the button "Open BioModel" the view
informs the controller about this. What should happen now is that a file
This is where the controller knows the view. The central view method returns
a value, and takes arguments, that the controller understands. The view types
know nothing about how the arguments are created or the return values are used.
selection dialog should appear where the user can select a biomodel file
which is then processed. But who should display this file selection dialog?
The view under the direction of the controller.
Maybe WelcomePanel should do that and then inform the controller that
Calling it a welcome "panel" already locks down implementation too far. The
fact that it's a panel is almost certainly irrelevant to the controller.
this event has occurred and this biomodel file was choosen and the
controller would then proceed from there?
The controller knows when to ask for the "Welcome Interaction" (or "Screen" or
whatever application-domain concept you use), what to pass to it, and what to
do with the result, i.e., to where to navigate based on the return value and
what data to pass to the model or behaviors to invoke on it.
References (be sure to follow links from these as well):
<http://en.wikipedia.org/wiki/Model_2>
<http://en.wikipedia.org/wiki/Model-View-Controller>
<http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html>
<http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier5.html>
--
Lew