Comment by dygger:

BTW, I have found a workaround for the DialogBox problem.

At first I had to create a subclass for DialogBox implementing HasWidgets  
interface:

{{{
public class HasWidgetsDialogBox extends  
com.google.gwt.user.client.ui.DialogBox
         implements HasWidgets {
     @Override
     public void add(Widget w) {
         Widget widget = getWidget();
         if (widget != null && widget instanceof HasWidgets) {
             ((HasWidgets) getWidget()).add(w);
         } else {
             super.add(w);
         }
     }
}
}}}

Then goes my test Dialog (note it is the owner of its controls):

{{{
public class TestDialogBox extends HasWidgetsDialogBox {

     @UiTemplate("TestDialogBox.ui.xml")
     interface MyUiBinder extends UiBinder<TestDialogBox, TestDialogBox> {
     }

     private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

     @UiField
     Label labelTextToServer;
     @UiField
     Label labelServerResponse;
     @UiField
     Button buttonClose;

     public TestDialogBox() {
         uiBinder.createAndBindUi(this);
     }

     @UiFactory
     protected TestDialogBox createDialog() {
         return this;
     }

     @UiHandler("buttonClose")
     protected void doClose(ClickEvent event) {
         this.hide();
     }
}
}}}


And finally corresponding .ui.xml:
{{{
<gwt:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
               xmlns:gwt='urn:import:com.google.gwt.user.client.ui'
               xmlns:my='urn:import:yd.tests.gwt.client'>
     <my:TestDialogBox text="Remote Procedure Call" animationEnabled="true">
         <gwt:VerticalPanel horizontalAlignment="ALIGN_RIGHT">
             <gwt:HTML>
                 <b>Sending name to the server:</b>
             </gwt:HTML>
             <gwt:Label ui:field="labelTextToServer" />
             <gwt:HTML>
                 <br/>
                 <b>Server replies:</b>
             </gwt:HTML>
             <gwt:Label ui:field="labelServerResponse"/>
             <gwt:Button ui:field="buttonClose" text="Close"/>
         </gwt:VerticalPanel>
     </my:TestDialogBox>
</gwt:UiBinder>
}}}




For more information:
http://code.google.com/p/google-web-toolkit/wiki/UiBinder

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to