Click to See Complete Forum and Search --> : OOP Design using MVC


Buck Naked
August 2nd, 1999, 03:48 PM
I'm currently designing a program in which I use the Model, View, Controller paradigm in one section of it. What I have is a class with my data (my model) called FourPt. Now, I have many different JPanels that are going to "observe" the data in FourPt (approximately 8 JPanels). I have two JPanels which are superclasses to the previously mentioned 8 JPanels. My question is:

Can I make the two JPanels which are super classes of these 8 JPanels mentioned above as observers instead of making each of the individual 8 JPanels observe the FourPt?
If so, will the observer pattern be "inherited" because the 8 JPanels are inherited from the two super JPanels?
I'm just not sure my design approach is correct. Thanks in advance!

Shannon Harvey
ssharvey@usgs.gov
http://www.athletics.usm.edu/Attack.jpg

DAVID DONG
August 3rd, 1999, 10:37 AM
would you give more details about it?

This is from david dong.

Buck Naked
August 3rd, 1999, 03:20 PM
Well, here it goes :)
Ok, well if I have a class called solutionPanel that is the 'super' class of another class called subPanel. I also have a class called outputPanel that is the super class of subPanel2. Think of it as solutionPanel and outputPanel are even with each other in the hierarchy, while subPanel and subPanel2 are even with each other.
If I make the solutionPanel and outputPanel observers (implementing the observer interface), will the subPanel and subPanel2 classes inherit this "functionality"? That is, will they themselves be Observers because they are derived from solutionPanel and outputPanel. If so, will I be able to define a 'default' update method in the solutionPanel/outputPanel?
Basically I've got a design that uses an abstract class called AbstractDataModel that all my "data types" (like the FourPt I mentioned in my previous post) will derive from. This is so I can establish some generic functionality and definitions of ANY data type I may wish to add in the future. That's my model, but as to my view, I'm trying to set up may different observers of the data types I'm using, and I'm afraid I may be going about the wrong approach here...tks!

Shannon Harvey
ssharvey@usgs.gov
http://www.athletics.usm.edu/Attack.jpg

DAVID DONG
August 5th, 1999, 11:53 AM
you can

This is from david dong.