----- Original Message ----- 
From: "someguy7_7" <mus...@hotmail.com>
To: <flexcoders@yahoogroups.com>
Sent: Sunday, January 04, 2009 8:23 PM
Subject: [flexcoders] Re: Cairngorm proper usage


> Can you give me some ideas on how I should setup the model? Have a
> property called tabs that just has a list of view components that I
> bind to the tabnavigator? Come to think of it I am not sure where I
> would bind that to the tabnavigator.

On reflection, your tabnavigator is doing two things - the first tab is 
displaying all the rooms, then you have additional tabs that show opened 
rooms.

Essentially, your tab navigator is driven by the content of the room list 
shown in the first tab. You can't bind a tabnavigator directly to the model 
automatically, since you need to create containers to represent each opened 
room and add them to the tab navigator and presumably remove them when the 
room is closed. Essentially, you need to listen for changes in the room 
model. You should be able to drive this from the same part of the model you 
are binding your datagrid from on the first tab.

Your view is going to need a method (function) to respond to changes in the 
room data (specifically the field that says whether a room is open or 
closed) and I thing the view can do this using BindingUtils and the 
bindSetter() method to invoke a function to manipulate that Tabnavigator 
child containers according to changes in the model.

It is going to require some work.

Paul

>
> Thanks
>
> --- In flexcoders@yahoogroups.com, "Paul Andrews" <p...@...> wrote:
>>
>>
>> ----- Original Message ----- 
>> From: "someguy7_7" <mus...@...>
>> To: <flexcoders@yahoogroups.com>
>> Sent: Sunday, January 04, 2009 6:23 PM
>> Subject: [flexcoders] Re: Cairngorm proper usage
>>
>>
>> > But how would I setup the binding in the tabnavigator so that the
>> > first tab the list of rooms never goes away? I can't just set it to a
>> > arraycollection of the rooms in the model since that will wipe out my
>> > room list that I always want to be there. The only solution I can
>> > think of is to implement a viewcontroller that listens for a an event
>> > that is fired from the command that the model has been updated with
>> > the new room which then tells the view to run through the room list
>> > and add any rooms that don't already exist. This seems like a lot of
>> > extra work. Anyone have a cleaner method?
>>
>> Your view should always reflect the model. If the view should always
> display
>> a room list make sure the model always has the list in place. Your
> problem
>> is a problem of maintaining an appropriate model, not an appropriate
> view.
>>
>> Paul
>>
>> > Thanks
>> >
>> > --- In flexcoders@yahoogroups.com, "Ralf Bokelberg"
>> > <ralf.bokelberg@> wrote:
>> >>
>> >> It would be in the spirit of Cairngorm to fire off a EnterRoom event,
>> >> which triggers a EnterRoom command. The command calls a enterRoom
>> >> method in some model.  The TabNavigator binds to this model and
>> >> updates itself, whenever the model changes
>> >>
>> >> With kind regards,
>> >> Ralf.
>> >>
>> >> On Sun, Jan 4, 2009 at 7:49 AM, someguy7_7 <muswei@> wrote:
>> >> > I am trying to determine the best way to use cairngorm for the
>> >> > following use case. I want to display a tabnavigator that only
> has 1
>> >> > child which is a component that has a list of rooms in a datagrid.
>> >> > When one of the rooms is clicked a instance of the room
> component is
>> >> > added to the tabnavigator as a child. The room component just has a
>> >> > label that says "You are in room xxxxxx". Can I just fire off a
>> >> > regular event from the room list component that the main view is
>> >> > listening for so it can add the new child to the tabnav or do I
> need
>> >> > to fire off a cairngorm event that goes through a command which
>> >> > somehow gets back to the view and tells it to add a new child
> to the
>> >> > tabnav?
>> >> >
>> >> > Any ideas on the best way to set this up so it does not violate the
>> >> > spirit/laws of cairngorm?
>> >> >
>> >> > Thanks
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>> > ------------------------------------
>> >
>> > --
>> > Flexcoders Mailing List
>> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>> > Alternative FAQ location:
>> >
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
>> > Search Archives:
>> > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
>> > Links
>> >
>> >
>> >
>>
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location: 
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
> Links
>
>
>

Reply via email to