[flexcoders] Re: Cairngorm - what's you best practice on handling inital data from the server

2007-11-19 Thread mydarkspoon
Nick, thanks, that's just what I was looking for, and apparently tried
to use incorrectly previously.

I think that now on. I'll use this technique for binding to
information that shouldn't be changed during the app lifetime, and
curly braces to pass the binded value from the model to the helper
function for situations where real binding is needed.

My concerns are style related only (hopefully it'll stay that way
during the development of this app) as it's my second day with
Cairngorm and I wish not to currupt my mind just so early:)

Good night for me, and best regards,
Almog Kurtser.


hopefully 

--- In flexcoders@yahoogroups.com, "Uber_Nick" <[EMAIL PROTECTED]> wrote:
>
> Hi Almog,
> 
> I see your concern now.  You're right in that the logic for creation
> of the view stack should remain in the view code, not the command or
> in some other binding.
> 
> Here's how we handle that situation.  On the component's
> creationComplete, we call init():
> 
> private function init():void
> {
>Changewatcher.watch(_model, servicesList, createViewStack)
> }
> 
> private function createViewStack(event:PropertyChangeEvent):void
> {
>   //do view stack creation logic here
> }
> 
> This way, your view logic is in one place and built off the model.  In
> terms of the redundant dispatching of events, it will fire once or
> twice on startup will a null value, but after that it should only fire
> the one time your property is set.  That's how all binding works and
> it's nothing to worry about.  Are your concerns performance-related,
> or more about style/elegance?
> 
> -Nick Matelli
> Amentra, Inc
> 
> --- In flexcoders@yahoogroups.com, "mydarkspoon"  wrote:
> >
> > Hi Nick,
> > Thanks for the help, the reasons why I'm not satisfied with #5 are
> > like that: The tabs naming is one operation that takes place, another
> > one is creating a ViewStack object to correspond those tabs.
> > Obviously, the view stack Can be built upon setting the TabBar
> > dataProvider, however, I think it's not readable beacuse when I open
> > an mxml component in search for a specific view control, the viewstack
> > in this example, I would look first at the  tag
> > instead, not at the TabBar, which should have nothing to do with the
> > ViewStack leaving it to be loosely coupled as much as possible.
> > Actually, this brings me the idea which I'll have to implement anyway,
> > to bind the ViewStack object's selectedIndex to the model using a
> > local helper function to get the selectedIndex, null checking the
> > model for the config file, and eventually returning an index.
> > This is not perfect but more elegant I think, yet I'd like to adapt
> > best practices dealing with such issues so feel about it :)
> > 
> > I almost forgot, my second drawback from the curly braces metjod is
> > the dispatching of redundant event, which is the reason that causes
> > the null checking to be essential.
> > 
> > 
> > Thanks and best regards,
> > 
> > Almog Kurtser.
>




[flexcoders] Re: Cairngorm - what's you best practice on handling inital data from the server

2007-11-19 Thread Uber_Nick
Hi Almog,

I see your concern now.  You're right in that the logic for creation
of the view stack should remain in the view code, not the command or
in some other binding.

Here's how we handle that situation.  On the component's
creationComplete, we call init():

private function init():void
{
   Changewatcher.watch(_model, servicesList, createViewStack)
}

private function createViewStack(event:PropertyChangeEvent):void
{
  //do view stack creation logic here
}

This way, your view logic is in one place and built off the model.  In
terms of the redundant dispatching of events, it will fire once or
twice on startup will a null value, but after that it should only fire
the one time your property is set.  That's how all binding works and
it's nothing to worry about.  Are your concerns performance-related,
or more about style/elegance?

-Nick Matelli
Amentra, Inc

--- In flexcoders@yahoogroups.com, "mydarkspoon" <[EMAIL PROTECTED]> wrote:
>
> Hi Nick,
> Thanks for the help, the reasons why I'm not satisfied with #5 are
> like that: The tabs naming is one operation that takes place, another
> one is creating a ViewStack object to correspond those tabs.
> Obviously, the view stack Can be built upon setting the TabBar
> dataProvider, however, I think it's not readable beacuse when I open
> an mxml component in search for a specific view control, the viewstack
> in this example, I would look first at the  tag
> instead, not at the TabBar, which should have nothing to do with the
> ViewStack leaving it to be loosely coupled as much as possible.
> Actually, this brings me the idea which I'll have to implement anyway,
> to bind the ViewStack object's selectedIndex to the model using a
> local helper function to get the selectedIndex, null checking the
> model for the config file, and eventually returning an index.
> This is not perfect but more elegant I think, yet I'd like to adapt
> best practices dealing with such issues so feel about it :)
> 
> I almost forgot, my second drawback from the curly braces metjod is
> the dispatching of redundant event, which is the reason that causes
> the null checking to be essential.
> 
> 
> Thanks and best regards,
> 
> Almog Kurtser.




[flexcoders] Re: Cairngorm - what's you best practice on handling inital data from the server

2007-11-19 Thread mydarkspoon
Hi Nick,
Thanks for the help, the reasons why I'm not satisfied with #5 are
like that: The tabs naming is one operation that takes place, another
one is creating a ViewStack object to correspond those tabs.
Obviously, the view stack Can be built upon setting the TabBar
dataProvider, however, I think it's not readable beacuse when I open
an mxml component in search for a specific view control, the viewstack
in this example, I would look first at the  tag
instead, not at the TabBar, which should have nothing to do with the
ViewStack leaving it to be loosely coupled as much as possible.
Actually, this brings me the idea which I'll have to implement anyway,
to bind the ViewStack object's selectedIndex to the model using a
local helper function to get the selectedIndex, null checking the
model for the config file, and eventually returning an index.
This is not perfect but more elegant I think, yet I'd like to adapt
best practices dealing with such issues so feel about it :)

I almost forgot, my second drawback from the curly braces metjod is
the dispatching of redundant event, which is the reason that causes
the null checking to be essential.


Thanks and best regards,

Almog Kurtser.

--- In flexcoders@yahoogroups.com, "Uber_Nick" <[EMAIL PROTECTED]> wrote:
>
> Almong,
> 
> I don't see any problem with #5.  The getTabsLabels() should contain a
> simple null check, so it will only perform an action when your
> serviceList object is populated.
> 
> Client-side manipulation of the serviceList object should take place
> within the result method of the command retrieving the list.
> 
> I'm not sure what you mean when you state "but it shouldn't be there
> as it won't be readable".  Can you clarify your concerns with this
> approach?
> 
> -Nick Matelli
> Amentra, Inc
> 
> --- In flexcoders@yahoogroups.com, "mydarkspoon"  wrote:
> >
> > Hello all,
> > 
> > I'm new with Cairngorm, trying to develop a wizard RIA with flex, and
> > I encountered an issue with data binding that went ugly:
> > In my model I have an XML doc taht describes several available search
> > services from the server. This XML is retrieved when the app start by
> > using an appropriate command that uses business delegate.
> > 
> > However, in the view I have a TabBar, that needs to manipulate the XML
> > config file from the model, meaning that it has to know when this xml
> > is retrieved.
> > I found few approaches to this:
> > 
> > 1. use a fake getter-setter binded to the model. My drawback from this
> > approach is quite obvious, I don't really need a getter here, but a
> > notification...
> > 2. custom [Bindable(event="")]. This also not the best way as it
> > introduces new complexity to the model and enforces the developer to
> > dispatch an event...
> > 
> > 3. Using a command to create the data for the TabBar in the view. I
> > think this creates a tightly coupled connection between the controller
> > and the view...
> > 
> > 4. Using Paul Williams  util. Although one might
> > think this creates a slick binding to function by hiding the fake
> > getter-setter, it actually dispatches redundant events because it
> > handler can't be compared to the source property, and thus the handler
> > is being called even when the source is null.
> > 
> > 5. using curly braces:
> > 
> > This approach also introduces redundant events as its destination is
> > not read-write enabled and it will get dispatched even when the
> > servicesList is null.
> > Moreover, I want to executes one more manipulation on the xml from the
> > model, it can be created while calling the getTabsLabels() but it
> > shouldn't be there as it won't be readable...
> > 
> > 
> > I'll be more than happy to hear your ideas.
> > 
> > Thanks a lot !
> > 
> > Almog Kurtser.
> >
>




[flexcoders] Re: Cairngorm - what's you best practice on handling inital data from the server

2007-11-19 Thread Uber_Nick
Almong,

I don't see any problem with #5.  The getTabsLabels() should contain a
simple null check, so it will only perform an action when your
serviceList object is populated.

Client-side manipulation of the serviceList object should take place
within the result method of the command retrieving the list.

I'm not sure what you mean when you state "but it shouldn't be there
as it won't be readable".  Can you clarify your concerns with this
approach?

-Nick Matelli
Amentra, Inc

--- In flexcoders@yahoogroups.com, "mydarkspoon" <[EMAIL PROTECTED]> wrote:
>
> Hello all,
> 
> I'm new with Cairngorm, trying to develop a wizard RIA with flex, and
> I encountered an issue with data binding that went ugly:
> In my model I have an XML doc taht describes several available search
> services from the server. This XML is retrieved when the app start by
> using an appropriate command that uses business delegate.
> 
> However, in the view I have a TabBar, that needs to manipulate the XML
> config file from the model, meaning that it has to know when this xml
> is retrieved.
> I found few approaches to this:
> 
> 1. use a fake getter-setter binded to the model. My drawback from this
> approach is quite obvious, I don't really need a getter here, but a
> notification...
> 2. custom [Bindable(event="")]. This also not the best way as it
> introduces new complexity to the model and enforces the developer to
> dispatch an event...
> 
> 3. Using a command to create the data for the TabBar in the view. I
> think this creates a tightly coupled connection between the controller
> and the view...
> 
> 4. Using Paul Williams  util. Although one might
> think this creates a slick binding to function by hiding the fake
> getter-setter, it actually dispatches redundant events because it
> handler can't be compared to the source property, and thus the handler
> is being called even when the source is null.
> 
> 5. using curly braces:
> 
> This approach also introduces redundant events as its destination is
> not read-write enabled and it will get dispatched even when the
> servicesList is null.
> Moreover, I want to executes one more manipulation on the xml from the
> model, it can be created while calling the getTabsLabels() but it
> shouldn't be there as it won't be readable...
> 
> 
> I'll be more than happy to hear your ideas.
> 
> Thanks a lot !
> 
> Almog Kurtser.
>