Re: Non-Anonymous UIBinding without @UIField(provided=true), How?

2010-04-13 Thread Eric


On Apr 12, 2:35 pm, Brian Reilly  wrote:
> There is one convenience that this appears to leave out, though:
> @UiHandler. These are things that MVP tells us should be in the
> presenter, yet the annotation has to live in the view class instead. I
> haven't fully worked out my thoughts on this yet, but having already
> done MVP without UiBinder, I don't feel burdened by not using
> @UiHandler. Some have talked about having the presenter register
> callbacks with the view that the view can then call from @UiHandler
> annotated methods, which seems cumbersome to me. Others have talked
> about letting the view hold a reference to the presenter to call
> specific methods (maybe defined in a presenter interface) from
> @UiHandler methods. This may not be a bad approach, but I haven't
> tried it myself yet.

I have a form that includes two date widgets and a "Save" button. One
date
represents a start date and the other represents an end date.  I
therefore
have a business requirement that the end date not precede the start
date.
I would have been willing to use two @UiHandler annotations in the
view
class to disable 'illegal' dates on each DatePicker because that's a
matter
purely internal to the panel. It turned out that I could not use
@UiHandler
for that because there are two methods in DatePicker that take a
single
ShowRangeEvent argument. At least, I couldn't do that.

On the other hand, the save button has its event handler attached
within
the presenter class.  The view should not know how it is used.

Respectfully,
Eric Jablow

-- 
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: Non-Anonymous UIBinding without @UIField(provided=true), How?

2010-04-12 Thread Brian Reilly
I don't think that there's currently a way to do this. You'd still
need to put some attribute on your "anonymous" Label so that you could
look it up, much like an HTML id attribute. Still, the lookup would
need some kind of reflection mechanism, or UiBinder would have to
gather everything in the template to provide a lookup mechanism. At
the very least, you'd lose all type safety because you would be able
to look up any type of widget.

The main thing that I wanted to mention is that you don't have to
think of the .ui.xml's corresponding .java as the presenter in an MVP
application. I instead think of it as part of the view and then
provide a separate presenter class. Yes, it is now 3 files instead of
2, but the UiBinder layout is much easier to understand than the
equivalent java. Following from that, it is OK for your views java
code to have references to concrete widget types.

There is one convenience that this appears to leave out, though:
@UiHandler. These are things that MVP tells us should be in the
presenter, yet the annotation has to live in the view class instead. I
haven't fully worked out my thoughts on this yet, but having already
done MVP without UiBinder, I don't feel burdened by not using
@UiHandler. Some have talked about having the presenter register
callbacks with the view that the view can then call from @UiHandler
annotated methods, which seems cumbersome to me. Others have talked
about letting the view hold a reference to the presenter to call
specific methods (maybe defined in a presenter interface) from
@UiHandler methods. This may not be a bad approach, but I haven't
tried it myself yet.

-Brian

On Apr 11, 10:59 pm, Andrew Hughes  wrote:
> Hi Guys,
>
> Sure, it's easy with UIBinder to add an "anonymous"/"on the fly" child
> widget without declaring  '*...@uifield Label blah;*' in the java class or 
> *'**
> ui:Field="blah"' *in the ui.xml template.
>
> For example, here there is no '*...@uifield Label blah;*' in the java class 
> and
> there is no  *'**ui:Field="blah"' *in the ui.xml template.
>
>  
>
> The problem:
> I do not want '*...@uifield Label blah;*' in the java class, this is in
> complete contradiction to the MVP pattern we're trying out best to follow.
> So, declaring these anonymously (as above is great). But at the same time,
> we don't want to just use some anonymous "Label" instance that the UIBinder
> creates for me. Can I programatically work with the UIBinder so that I can
> provide the "Label" I want it to use without '*...@uifield Label blah;*' in 
> the
> containing java (parent/widget) class?
>
> Cheers
> --AH

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



Non-Anonymous UIBinding without @UIField(provided=true), How?

2010-04-11 Thread Andrew Hughes
Hi Guys,

Sure, it's easy with UIBinder to add an "anonymous"/"on the fly" child
widget without declaring  '*...@uifield Label blah;*' in the java class or *'**
ui:Field="blah"' *in the ui.xml template.

For example, here there is no '*...@uifield Label blah;*' in the java class and
there is no  *'**ui:Field="blah"' *in the ui.xml template.

 

The problem:
I do not want '*...@uifield Label blah;*' in the java class, this is in
complete contradiction to the MVP pattern we're trying out best to follow.
So, declaring these anonymously (as above is great). But at the same time,
we don't want to just use some anonymous "Label" instance that the UIBinder
creates for me. Can I programatically work with the UIBinder so that I can
provide the "Label" I want it to use without '*...@uifield Label blah;*' in the
containing java (parent/widget) class?

Cheers
--AH

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