You want to put all of your logic into the presenter without putting
any of the widget code in that would prevent tests from running.

For the ListBox you want to declare a ChangeHandler on it in the
Presenter.  To do that you have the View return back the ListBox as an
interface of HasChangeHandler.

@UiHandler ListBox fooItems;

public HasChangeHandler getHasChangeHandler() {
  return fooItems;
}

You will also have to have the View return back the selected item
since I don't see any interfaces you can return to do that.

public String getItem() {
  return fooItems.getItemText(fooItems.getSelectedIndex());
}

Finally the view can return back the TextBox has a HasEnabled
interface so the presenter can disable it.

@UiBinder TextBox textBox;

public HasEnabled getHasEnabled() {
  return textBox;
}

Now the presenter can call these to get the item when selected and
disable the text box if needed.

view.getHasChangeHandler().addChangeHandler(new ChangeHandler() {
    @Override
    public void onChange(ChangeEvent event) {
      view.getItem();
      view.getHasEnabled().setEnabled(false);
    }
  }
);



On Jan 13, 2:05 am, Qrunk <kapil2ka...@gmail.com> wrote:
> Hi ,
>
> Im a bit confused as in what does UI handling is meant 
> inhttp://code.google.com/webtoolkit/articles/mvp-architecture.html,  which is
> to be handled by the presenter.
>
> Say I have a case where when I change my combo box , I want a UI
> widget(Text Box ) to be disabled. Now here there are two things:
>
> 1. I have to check through the data which I clicked inside the combo Box,
> which I believe should make my event to be handled by the presenter as my
> UI shouldn't be aware of my data part(Models)
> 2. As i want to make an UI related change in my page, this event should be
> handled by the View class.
>
> Please let me know where and how should I delegate the event to event
> handlers on selection of the combo box item.
> Should it be handled within Presenter, which cant happen because the
> presenter doesn't has any knowledge of the View component(in our case the
> Text Box that is to be disabled) or it should be handled within the View
> class, but this shouldn't happen as the View should be unaware of the Data
> part.and want some inputs on Request factory 
> alsohttp://tbroyer.posterous.com/gwt-211-requestfactory-part-ii

-- 
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-toolkit@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.

Reply via email to