Aidan, that was exactly my point: You lose UIBinder control over the
caption there, forcing you to create your dialog box from a mix of
Java parameters and UIBinder XML, which grates somewhat. In my
opinion, it should be either/or, not a mix.

I can see a point for making a fairly standardized dialog (like, say,
an OK/Cancel box) a subclass, and feed all information (caption and
lead text) through Java as a single (constructor) call, but with more
complex dialogs I'd like to be able to design them - and let other
people modify them - with the UIBinder system.

It seems to me there is a bit of a mismatch in the design here.

JWN

On Aug 3, 12:24 am, "Aidan O'Kelly" <aida...@gmail.com> wrote:
> You can actually just change your UiBinder java class to inherit from
> DialogBox, and call setWidget(uiBinder.createAndBind(this)) instead of
> the regular, initWidget() method of Composite.
>
> Your UiBinder template then just looks like this:
>
> <ui:UiBinder ... >
>         <g:HTMLPanel>
>                 Stuff.
>         </g:HTMLPanel>
> </ui:UiBinder>
>
> // To use:
> CustomDialog dialog = new CustomDialog();
> // etc.
>
>
>
>
>
>
>
> On Tue, Aug 2, 2011 at 8:25 PM, Brian Reilly <brian.irei...@gmail.com> wrote:
> > I've found that you can add a visible="false" attribute to the g:DialogBox
> > tag to keep it from being displayed on page load. However, I think this will
> > cause the dialog box UI to be constructed even if it's never displayed.
> > I'm guessing that the "you're not supposed to do this" comment you're
> > referring to is this comment from the PopupPanel javadocs:
>
> > A PopupPanel should not generally be added to other panels; rather, it
> > should be shown and hidden using the show() and hide() methods.
>
> > Derek's approach is the only way I can think of to use g:DialogBox in a UI
> > template without it being automatically added to another panel. However, I
> > don't like that approach because the custom dialog box does not actually
> > subclass DialogBox. This necessitates having like-named methods that proxy
> > to the DialogBox returned from UiBinder, such as center() in Derek's
> > example. Unlike cases where it makes sense to subclass Composite to hide the
> > root widget's API, the custom dialog box really is a dialog box and should
> > inherit the DialogBox API.
>
> > What I settled on was to subclass DialogBox and use UiBinder to build the
> > widget passed to DialogBox.setWidget(). My hope is that this encourages its
> > use from java code instead of a UI template. In reality, my custom dialogs
> > are no more opinionated about where they're used than GWT's own DialogBox
> > is, which has a nice harmonious feel to it.
> > -- Brian
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/google-web-toolkit/-/EuskuIZqfqkJ.
> > 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.

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