Tuesday, August 31, 2010

Re: what is the appropriate MVP way of doing this?

That's great! Thanks Thomas.

I've got another question (well, a set of questions) - say you have a
text field in the view that you want to reference - to receive click
events as well as key up events.

1) Would you reference the text field as HasText and cast to the event
handlers?
2) Would you create some modified interface that extends from all of
the desired interfaces?
3) Or, would you do something completely different?

Again, thank you very much for the help.

Joe

On Aug 31, 11:47 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On 31 août, 17:00, Joe Hudson <joe...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > If I have a presenter that needs to populate a view that contains a
> > FlowPanel which a list of custom widgets that contain some text and a
> > hyperlink can anyone help me understand the best way of properly
> > interfacing this out in the view?
>
> > For example:
>
> > public class MyPresenter {
> >     public interface View {
> >         // what interface method should I have to deal with a list of
> > composite elements?
> >     }
>
> > }
>
> > I'm thinking I need to make a new interface like HasLinkAndText and
> > something like that but even with that I still need to deal with a
> > list of these interface types.  If this question makes sense, I'd
> > appreciate some help with this.  Thanks.
>
> I'd use a CellList or CellTable in the view, so all you'd have to do
> is to give the view the data and a ValueUpdater.
> If you're not using GWT 2.1, I'd nevertheless follow this approach:
> i.e. give the view a list of things to display, and a callback/
> delegate to be informed when the user clicked a link, provided you
> want to be notified back in this case (it could also take the form of
> getting a HasSelectionHandlers from the view and listening to
> SelectionEvents, it depends how you're "doing MVP").

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment