Re: about the limitation of MVC
Take a look at http://java.sun.com/j2se/1.4.2/docs/api/java/beans/PropertyChangeSupport.html On Jan 20, 7:42 am, "yu.cu...@126.com" wrote: > 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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: about the limitation of MVC
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 > 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 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 wrote: > > > > > > > > > Had you read about MVP? > > > > > 2010/1/20 yu.cu...@126.com > > > > > > 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 > google-web-tool...@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > google-web-toolkit+unsubscr...@googlegroups.com cr...@googlegroups.com> > > > > . > > > > 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 google-web-tool...@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com > . > 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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: about the limitation of MVC
Thanks for your suggestion. MVP is a closer approach, but it is still suitable because it has a model. In my case, building a model may be unnecessary or doesn't work. For example, I don't think it makes sense to build a model only for the buttons. (Assuming my application is just showing the changing of button's state) and more fatal issue is that the model concept of MVP stands for an instant state at a specific moment actually, but my application requires recording the state change or the event sequence. It's similar with FSM model which can't be described by this model in MVP or MVC. On 1月20日, 下午11时26分, Alexander wrote: > Had you read about MVP? > > 2010/1/20 yu.cu...@126.com > > > > > > > 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 google-web-tool...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com > cr...@googlegroups.com> > > . > > 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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: about the limitation of MVC
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? If that, the viewer code must be very disorder. So what my thinking is building a FSM and the event from the widgets is used to trig the state transfer in the FSM. On 1月21日, 上午3时42分, Sky 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 wrote: > > > > > Had you read about MVP? > > > 2010/1/20 yu.cu...@126.com > > > > 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 google-web-tool...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > google-web-toolkit+unsubscr...@googlegroups.com > > cr...@googlegroups.com> > > > . > > > 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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: about the limitation of MVC
"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 wrote: > Had you read about MVP? > > 2010/1/20 yu.cu...@126.com > > > > > > > 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 google-web-tool...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com > cr...@googlegroups.com> > > . > > 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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: about the limitation of MVC
Had you read about MVP? 2010/1/20 yu.cu...@126.com > 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 google-web-tool...@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com > . > 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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
about the limitation of MVC
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 google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.