Hi Tom,
                So, I think the hooks you're looking for are already in place.  
This is the reason that all the Pivot components specify using Pivot 
Collections classes instead of the default Java Collections.  The difference is 
that the Pivot Collections implement Listeners for changes in the data.  These 
listeners call into the Pivot Skin classes when data changes are detected and 
signal repaints, etc.
                I'm not sure if these would be sufficient to detect updates in 
one column that would affect the value in another column, though.  I think I'd 
have to see a bit more code from your application to be sure.
                But I am sure that you should be implementing the "load" and 
"store" method calls from your row editor(s) so that the data gets properly 
updated once the edit is finished.  But, I think everything beyond will just 
"work" then.  And if not, there should be ways around it using the mechanisms 
that are already in place.

HTH,
~Roger

From: Tom Coleman [mailto:t...@soaringclub.org]
Sent: Wednesday, April 20, 2016 11:10 AM
To: user@pivot.apache.org
Subject: Re: MVC application

Hi Roger

Thanks for the quick reply.  Sorry for my delayed response.

I am trying to get a handle on implementing an MVC application using Pivot.   
At this point I am seeing Pivot as the MVC "View", and am searching for hooks 
that can relate the data contained in the model to the Pivot "View".

?  View - The view renders the contents of a model. It specifies exactly how 
the model data should be presented. If the model data changes, the view must 
update its presentation as needed. This can be achieved by using a push model, 
in which the view registers itself with the model for change notifications, or 
a pull model, in which the view is responsible for calling the model when it 
needs to retrieve the most current data.
https://lkubaski.wordpress.com/2012/12/20/java-se-application-design-with-mvc-with-images/

The application is complicated by the fact that model data is interrelated.  In 
other words, if a column in a row is updated, other columns may have to be 
updated as well.  These relationships can be encoded in an "intermediate 
representation" of the model data.

I'm pretty sure Pivot has everything to do what I need to do.   After long 
involvement with synchronous systems, I'm just struggling to get a handle on 
the architecture.

Thanks!

Tom


On Apr 14, 2016, at 1:23 PM, Roger and Beth Whitcomb 
<rogerandb...@rbwhitcomb.com<mailto:rogerandb...@rbwhitcomb.com>> wrote:

Hey Tom,
   I'm not sure what you mean by a "detached MVC approach".  IMO the "store" 
method of RowEditor is the canonical place to do the update -- this is what is 
meant to happen there.
   Can you do the parse beforehand and store some intermediate representation?  
That would be my first thought, without knowing more about the whole process.

Thanks,
~Roger

On 4/14/16 9:53 AM, Tom Coleman wrote:

Can someone please share some thoughts on an MVC approach to this application 
using Pivot?

The question arises from trying to figure out how best to rewrite data changed 
by a TableViewRowEditor.

Data underlying the model is a sequence of bytes, the position and length of 
which can represent different data types.   These can be parsed and converted 
to TableData objects (the model?) which can be rendered and edited as Pivot 
ListButtons, TextInputs, and Checkboxes.
The parse is expensive and the position and length data can be stored in the 
TableData cell to facilitate the rewrite.

I can probably rewrite the data as part of the "store" process in the 
RowEditor, but can someone suggest a more detached MVC approach?

Thanks












Reply via email to