hmm... not quite the question I was asking.

I presume there would be a dirty flag. My question is about the screens in the viewstack. I am trying to come up with a clean repeatable model for how a screen knows it should recall the server to grab more data.

As an example, consider that all the screens have data that is dependent on a field called "channel". When the user changes the channel, all the screens change, but I dont want them all to immediately run off and call the server when it might never be needed.

So I am thinking that each screen would have to have its own copy of the data or some "last changed at" marker so that an individual screen can know that "oh the channel changed because the current channge is not what it was last time the user opened me". With this knowledge, the screen can trigger a call to update by refreshing data that the screen needs.

It just seems like this kind of thing screams for some kind or structured template/design pattern. But part of what I am seeing is that when you get into the mxml world it kinda encourages a sloppiness. You just stick a variable somewhere and throw a tag there. I am trying to figure out how to make the mxml for this clean templatable and readable, and while I can make the code work, the mxml piece is just ugly. It doesnt seem to lend itself to the kind of beautiful code I can do in AS2/3. Or perhaps I just dont really know what I am doing yet:)

Anyway, I am just trying to figure out how to do this relatively simple thing in an elegant way.

Regards
Hank

On 7/11/06, JesterXL < [EMAIL PROTECTED]> wrote:
We use a dirty flag.  We set it to true whenever some data changes.  This data change is detected by registering for control events that change data (focusOut for TextInput, selectedDate != null for DateChooser, etc.).  These events change the data if applicable, and set the dirty flag.
 
Other components can bind to the dirty flag and take appropriate actions, whether via a getter / setter or the binding tag.
 
----- Original Message -----
Sent: Tuesday, July 11, 2006 9:20 AM
Subject: [flexcoders] viewstack design pattern issue

I have a viewstack (actually a tabnavigator) that has screens with data that comes from a server.

I want to trigger the screen to go out and get new data only when:
   1. the user enters the specific viewstack sub screen, and
   2. when the data for that screen is dirty, based on some bound data that has triggered a change

So as I see it, the screen needs to keep track of when the bound field has changed which should cause a call to get fresh data. This means that the screen must keep track of whether it is dirty.

This seems like it must be a common scenario, and I am curious about how other people handle it. My first instinct was to create a base screen class from which all my screens could inherit. But I am curious whether cairngorm already handles this or whether this is even part of the scope of what it tries to cover. I am not using cairngorm right now, but may in the future. But understanding what is and isnt in its scope is important for me to start to understand.

So anyway, this is a 2 part question.

1. how do people handle this situation
2. does cairngorm have some pre-packaged solution to this issue.


Hank


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to