The ClientWindow has a Controller that has a reference to Client, which can be either a remote or a direct client. (The client actually has the same methods, but are invoking on a RemoteDatabase or Database object.)
The model in my case here i would want to see as the Client, since its the object getting all the data.
But I also have JTable containing data...which could be seen as a model for the ClientWindow..so do I have two separate mvcs?
Also for the ServerWindow there is only the Server, and I have skipped a controller for it...and let the ServerWindow invoke directly on it. This is no longer MVC, but a modified one, and it should be ok as long as i justify it in choices.txt, right?
... actually, talking about the mvc design pattern is not at all that what you are thinking of
MVC design pattern in the context of the Sun certification means:
1. Model: represents the application data and the business rules that govern access and modification of this data
(-> has absolutely nothing to do with client features such as JTable etc.)
2. View: renders the content of the model (roughly speaking this includes all your GUI stuff inclusively GUI event listeners)
3. Controller: defines application behavior by interpreting and mapping user gestures into actions performed by the model. (not to confuse with event listeners)
If you conform to the specifics and implications of the MVC architecture (by registering all views to the model and registering controllers to their corresponding views ...) you will achieve a real-time Client-Server application, which implicates that all clients viewing a certain piece of information (like a record) are informed in real-time of changes to that information caused by another client.
When using the term MVC be careful !
For example a very good introduction to this topic is the web based training offered by Sun (Broker Tool application).
Joined: Sep 20, 2009
Thank you Andy, but I'm not sure I'm following completely.
If I see my application as follows then:
The GUI is the view. The controller and client is the controller, and the business interface is the model.
The business model knows nothing about the GUI and i can easily create a web ui using the same model.
This is not following the mvc pattern in what ways?
About my jtable i was thinking that my customized jtablemodel was kind of a model for the table (view) and the event handler for the table model were somehow making its own little mvc pattern within the gui.
I have a MainWindow (view) which has a reference to GuiController (obviously the controller). And the controller has a reference to my business service (model). So that's similar to yours (although your controller exists of 2 classes). Added similar explanation to my choices.txt
And like you said the JTable is a little mvc itself.
When I think about it, I could actually remove the controller class and purely use my client interface as controller...just that the naming becomes different. I still want to see it as a client though. Client can be of two types, so I'd like to keep it that way.
For the server, I have a mainwindow and a reference to the server, so from the view I start the server directly. This is indeed not pure mvc, correct?
Joined: Feb 07, 2010
you were right. Sorry, my fault, didn't appreciate your considerations in detail.
My Controller has a reference to the business service, which can be the local or the network one. The Controller (nor the MainWindow) is aware of which mode (local or network) the application is running in.
My ServerWindow even doesn't have a reference. It just calls a static method from another utility class to register the server object in the rmi registry. So MVC doesn't apply here.