Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: PureMVC and Swing JTable  (Read 9014 times)
rite2dinesh
Newbie
*
Posts: 1


View Profile Email
« on: January 22, 2010, 12:38:44 »

Hi,
I am trying to port my application(which is in its early development stage) into pureMVC framework. I have a query with respect to the same

i)In which part of the pureMVC framework the swing components models(eg.DefaultTableModel) fit?
eg. I have a JTable and DefaultTableModel , in my opinion JTable would be part of my View Component and where does the model fit?

ii)If I am talking something which does not make any sense at all, can some one please give me an example on how to use Swing Jtable  in pureMVC framework?



Please clarify.

Thanks.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: January 22, 2010, 11:47:51 »

It would be equivalent to a value object.

It would just inherit from AbstractTableModel  or be in instance of DefaultTableModel depending on whether you need to subclass.

In a typical scenario, you might have a Proxy retrieve a TableModel from the server (or construct one from the server response) and pass it over to the Mediator for the JTable in a notification. The Mediator for the JTable simply takes it out of the note body and and passes it to its view component, which might be the JTable or a container with the JTable in it.

The JTable modifies the model, which could be a reference to the one the Proxy holds or a copy. If it's a reference, then saving is a matter of retrieving the proxy to save its data object (the TableModel). If you're working with a copy at the view, then the mediator can take the one modified by the JTable and pass it back to the Proxy, which replaces its data object with the new one and then saves it.


-=Cliff>
« Last Edit: January 22, 2010, 11:51:18 by puremvc » Logged
Pages: [1]
Print