posted 22 years ago
Hi everyone,
I have followed the MVC discussions with great interest especially the differening views of Mark and Eugene.
Im my current application i have followed the hook methods describes by Mark and have kept my model and view relatively uncoupled. I now have a GUI with a JTree on one side and alternating panels on the other side displaying differing details depending on the types of node selected in the Tree.
What i am wondering is if people have tended to use a Controller for each area of the GUI or have one overall Controller. Currently i have implemented a Controller for each area of the GUI (i.e one for the Tree Panel and one each for the various panels that can be displayed on the rhs). However what this mean is that i am often moving between the specific controller and the main controller in order to handle user events. E.g if a user adds a node to the tree i can add the node to the tree model from the Tree Panel controller buti then have to call a method in the main controller to get the correct information displayed on the rhs. I am wondering if this is the correct way to do this??
If i had a single controller for all GUI components then this controller class would be very large. I would have to add listeners for each GUI component on each of the different panels. I would then have a very large number of event handling methods in the controller. I could need an event handler method for 15 different text fields ( if i had 3 panels with an average of 5 text fields each. I am sure i could write a dynamic class to display node information but i do not have the time right now ). Also there would be event handler methods for the various kinds of mouse clicks on the GUI. So the result would be a very large(busy) class.
I am wondering if i should be prepared to increase the size of my controller class to prevent passing events up and down a controller hierarchy? What is the most appropriate solution.
Thanks,
John
[ August 29, 2002: Message edited by: John Ryan ]