Hello,

The DialogBox API (http://google-web-toolkit.googlecode.com/svn/
javadoc/2.0/com/google/gwt/user/client/ui/DialogBox.html) notes that a
DialogBox can be defined as a UIBinder template as follows:

 <g:DialogBox autoHide="true" modal="true">
   <g:caption><b>Caption text</b></g:caption>
   <g:HTMLPanel>
     Body text
     <g:Button ui:field='cancelButton'>Cancel</g:Button>
     <g:Button ui:field='okButton'>Okay</g:Button>
   </g:HTMLPanel>
 </g:DialogBox>

What is the proper way of using this definition from Java code?
Supposing that the above definition is contained in
NotificationWindow.ui.xml, the following naive approach to
NotificationWindow.java does not work:

public class NotificationWindow extends Composite {
        private static NotificationWindowUiBinder uiBinder =
GWT.create(NotificationWindowUiBinder.class);
        interface NotificationWindowUiBinder extends UiBinder<Widget,
NotificationWindow> {}

        @UiField DialogBox dialogBox;

        public NotificationWindow() {
                initWidget(uiBinder.createAndBindUi(this));
        }

        public void show() {
            dialogBox.show();
    }
}

If the EntryPoint-derived class calls:

(new NotificationWindow()).show();

then the following exception is logged:

java.lang.IllegalStateException: This widget's parent does not
implement HasWidgets

How is the <g:DialogBox> definition from the DialogBox API used
correctly from Java code?

Best regards,
Ovidiu

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

Reply via email to