So throw appropriate event to EventBus. All widgets what are interested in these events must be subscribed before. And here we go - without models our views could interact with each other.
2010/1/21 yucubby <[email protected]> > I only gives a very simple case. Thinking in a complex situation, if > there are many buttons or other widgets, and there will change their > state (become gray or not for example) according to the other widget's > action or event. Then how do we handle all of this logical in the > viewer? > > On 1月21日, 上午3时42分, Sky <[email protected]> wrote: > > "For example, one of > > a simple case is how to implement this functionality of making one > > button becoming grayed if detecting a specific button is clicked by > > twice." > > > > That's just logic that belongs in the View. There are numerous ways of > > structuring that logic and it depends on how abstract you want it to > > be. The simplest code that pops into mind immediately is to define > > your own class that extends the Button widget (say its called > > MyButton) and give it a private variable pointing to a Button and > > through a setter method you can set it to the button that is going to > > turn gray. Give a counter variable to your MyButton and add a > > MouseUpHandler that counts how many clicks have occurred. When it has > > clicked twice you set the other Button's background style property as > > you desire. > > > > I fail to see why this is a limitation of MVC. All of this kind of > > interaction should only occur in the View. The Model doesn't typically > > try to deal with how the GUI reacts to user input... the Model handles > > user data input and gives the View new or modified data to display to > > the user based on the user's input... it is the View's job to decide > > what kind of logic is needed to decided how to display the data it > > gets from the Model. > > > > At least that's my take on MVC... I'm not exactly an expert on it. > > > > On Jan 20, 9:26 am, Alexander <[email protected]> wrote: > > > > > > > > > Had you read about MVP? > > > > > 2010/1/20 [email protected] <[email protected]> > > > > > > Hi, > > > > Recently I am researching the MVC in GWT and meet a problem. > According > > > > to my understanding, in essentially, the benefits of MVC are 1) > > > > decouple the viewer and model 2) make the widgets coordinating each > > > > other. And the second point is very important to my application. So > my > > > > question is how to make several of widgets work well in a panel when > > > > there is no abstracted model under these widgets. For example, one of > > > > a simple case is how to implement this functionality of making one > > > > button becoming grayed if detecting a specific button is clicked by > > > > twice. > > > > > > In fact, it's a typical FSM problem, what we should do is building > the > > > > FSM rules and executing the FSM to update the view/widgets. so, there > > > > is no MVC model instead it is the viewer and FSM based controller > > > > model. Does any one meet the same problem or have the same solution? > > > > > > Thanks > > > > Yu > > > > > > -- > > > > You received this message because you are subscribed to the Google > Groups > > > > "Google Web Toolkit" group. > > > > To post to this group, send email to > [email protected]. > > > > To unsubscribe from this group, send email to > > > > [email protected]<google-web-toolkit%[email protected]><google-web-toolkit%2Bunsubs > [email protected]> > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/google-web-toolkit?hl=en. > > > > > -- > > > Regards, > > > Alexander > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > > > -- Regards, Alexander--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
