I am currently on a Problem. I have an RMI Server with a Model and want to update the View on the Client side based on the Changes of the Model, a typical MVC Structure. My Problem now is if I want to call Methods from the Server that update the View on the Client, the Server needs a Reference to the View. If the View is referenced in any Class given to the Server the View gets send to the Server, which I don't want to do and which I can't because the View uses the not Serializable GroupLayout.
Is there any Way to update the View based on the Model Changes without the need of polling and/or the need to send the View?
Thanks in advance.
edit: Seems like there is no one yet able to answer my Question. So here are a little more Details of my Thought Process. Imagine three Classes, one View, one Model and one Controller. The Controller acts as a bridge between Model and View. So the Controller has a Reference to the Model and to the View. The View has a Reference to the Controller. The Controller implements the PropertyChangeListener Interface and registers itself as such on the Model. Everytime a Property is change in the Model it calls the firePropertyChange Method and the controller propagates the Event to the view, which acts accordingly. Sadly since the Controller on the Server has a Reference to the View on the Client, the View will be serialized, which is not possible with a GroupLayout used by Matisse. GroupLayout is not implementing Serializable. Subclassing Grouplayout does not work because GroupLayout has not default Constructor. Hope that makes my Problem clear enough for you all to go out there and try that construct for yourself and give me a possible Solution on that. ;)
edit:Seems like there is no Possibility to enable the MVC Architecture with RMI with Visible Components without serializing the View itself. So I have to poll the Model on the Server to check if a Property has changed and change the View on the Client appropriately. This Solution kinda sucks(excuse my Words), because it is the Opposite of Resource saving and the MVC Architecture. Next negative Aspect is that the View is and will never be updated in real Time.
So i searched around and did some Questioning in other Forums etc. I finally found a Solution for all of you struggling with something similar. The Answer is the so called RMI Callback. The Client has to export a stub of his own to send to the Server and the Server uses that stub to perform the callback.
Here is the Example that brought me on the right Track: h**p://www.javaworld.com/javaworld/javaqa/1999-04/05-rmicallback.html
It is a little old but it covers the Basics.
Have Fun Coding!