Hi,

Unless I don't fully understand your problem, the solution is simple.  You don't need to create 2 different models for the same data. You create the variable to hold your data on the ModelLocator (ex.: ModelLocator.messages) and then bind this variables to controls on our 2 views. First part done.

Now, when the owner logs in, you will get his messages and assign them to this variable, OR when a visitor logs in, you do exactly the same thing. You don't need 2 FrontControllers, always use one.

I think your question has more to do with controlling what a visitor can do as opposed to a owner, which has more power. Yes?

Dimitrios Gianninas

-----Original Message-----
From: flexcoders@yahoogroups.com on behalf of maxym.hryniv
Sent: Mon 5/15/2006 3:29 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Cairngorm microarchitecture. 2 instances of view with different data.

Thanx for reply Tim, but you didnt't understand my question.
If i bind "the same value object (data) to more than one
view(component)" i'll have the same information in both views, but i
must have different information.
"Before you change the view state, you dispatch the getMessages event
(to return messages based on the user's role)" - It's called HARDCODE
and it's unacceptable.
And i have to display different information at the same time in
different instances of one view thats why your suggestion will not
work. However thank you.
Btw i have different delegates for different states cause of server
side architecture. It's another one reason why it will not work.

Waiting for reply.

--- In flexcoders@yahoogroups.com, "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
>
> Ok, there are certainly more qualified people on this list
(especially
> the creators of Cairngorm) that could give you some sage advice. 
But
> let me throw out a couple of ideas and try to help you.  It's a
little
> difficult to know what your use-case is exactly without seeing the
code,
> but here is a simple scenario.  There are two things to keep in
mind.
> In Cairngorm, there is only one control class; the FrontController.
> Also, you shouldn't need to maintain two sets of data in the
> ModelLocator.  You can bind the same value object (data) to more
than
> one view (component).  For example, let's say that you have:
>
> 2 views - visitorView and ownerView (view)
> 3 events - getMessages, insertMessage, updateMessage (control -
> FrontController)
> 3 commands - getMessagesCommand, insertMessageCommand,
> updateMessageCommand (commands)
> 3 delegates - getMessagesDelegate, insertMessageDelegate,
> updateMessageDelegate (business)
> 2 valueObjects - messageVO, selectedMessage (vo and model -
> ModelLocator)
>
> The views dictate which user gestures (events) are allowed to be
> dispatched; based on the role of the user (vistor or owner)  For
> instance, both views allow the user to read messages (getMessages)
and
> post messages (insertMessage).  While only the owner view allows the
> user to edit messages (editMessage).  Before you change the view
state,
> you dispatch the getMessages event (to return messages based on the
> user's role).  The event causes the getMessagesCommand to execute,
which
> in turn instantiates the getMessagesDelegate class.  The result from
the
> service call is then cast to the messageVO, which resides in the
> modelLocator.  The messageVO can then be bound to both views, since
they
> both allow the user to read messages.  Even though the VO is bound
to
> both views, the user will only see the view that is associated with
> their role.  The same scenario can be used for posting messages,
because
> it is a common user gesture for both views.  For the gestures that
are
> unique to a view, like editing a message in the ownerView, you would
> only dispatch the appropriate event (updateMessage) that is allowed
for
> the user's role.  Simply stated, the ownerView would have an edit
button
> and the visitor view wouldn't  I know that this isn't your exact
> use-case, but hopefully it will give you some ideas.
>
> Regards,
> Tim Hoff
>
>
>
>
> --- In flexcoders@yahoogroups.com, "maxym.hryniv" <mokus@> wrote:
> >
> > Hy, coders.
> > I have a question:
> > We are creating social network portal. Any user of our network
must
> > have a possibility to create his own guestbook.
> > I have questbook control that supports 2 states: Owner and visitor
> > (created using viewstates mechanism). In owner mode you have full
> > control of your guestbook and in visitor mode you can only post
> > messages. When you open your own blog it uses one set of server
> > Delegates and when you open another person blog it uses another
set.
> > If i use standart cairngorm approach i have to create 2 different
sets
> > of data in ModelLocator for owner view and for visitor view and
then i
> > have to create 2 different control classes. Can someone suggest me
how
> > to resolve this problem, cause i want to use the same control
class.
> > I'll probably have superuser mode, and i don't want to make a
> > copy&paste.
> > Btw it's all about flex 1.5, Cairngorm 0.99.
> >
>






--
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 <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>        Computer software development <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>        Software design and development <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>       
Macromedia flex <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZI36cYzBjw>        Software development best practice <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>       

________________________________

YAHOO! GROUPS LINKS


      *      Visit your group "flexcoders <http://groups.yahoo.com/group/flexcoders> " on the web.
       
*      To unsubscribe from this group, send an email to:
      [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
       
*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .


________________________________




--
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




<<winmail.dat>>

Reply via email to