Hello all,

I'm a newbie in GWT and I am struggling to create a dialog box using
UIBinder. I'm sorry if this has already been discussed but I couldn't find
it.

This is the graphical result of my dialog :-(
[image: Screenshot.png]

The code that I'm doing is the following.
First, the java code for the view:

public class DebtorCreationDialog extends DialogBox {

    @UiTemplate("DebtorCreationDialog.ui.xml")
    interface DebtorCreationDialogUiBinder extends
            UiBinder<Widget, DebtorCreationDialog> {
    }

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

    @UiField TextBox debtorSurname;

    @UiField TextBox debtorGivenName;

    public DebtorCreationDialog() {
        uiBinder.createAndBindUi(this);
        setSize("400px","300px");
    }

    public String getDebtorSurname() {
        return debtorSurname.getText();
    }


    public void setDebtorSurname(String surname) {
        debtorSurname.setText(surname);
    }


    public String getDebtorGivenName() {
        return debtorGivenName.getText();
    }

    public void setDebtorGivenName(String givenName) {
        debtorGivenName.setText(givenName);
    }
}


Here, the UI XML code for the binder:

<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <g:HTMLPanel>
        <g:DialogBox autoHide="true" modal="true" animationEnabled="true"
glassEnabled="true">
            <g:caption>
                <b><ui:msg key="debtorCreationDialog.caption">Insertion de
nouveau débiteur</ui:msg></b>
            </g:caption>
            <g:HTMLPanel>
                <g:HorizontalSplitPanel>
                    <!-- Left column -->
                    <g:VerticalPanel>
                        <g:Label><ui:msg key="mandates.debtorSurname">Nom du
débiteur</ui:msg></g:Label>
                        <g:TextBox name="debtorSurname" maxLength="60"
ui:field="debtorSurname" />
                    </g:VerticalPanel>

                    <!-- Right column -->
                    <g:VerticalPanel>
                        <g:Label><ui:msg
key="mandates.debtorGivenName">Prénom du débiteur</ui:msg></g:Label>
                        <g:TextBox name="debtorGivenName" maxLength="60"
ui:field="debtorGivenName"/>
                    </g:VerticalPanel>
                </g:HorizontalSplitPanel>
            </g:HTMLPanel>
        </g:DialogBox>
    </g:HTMLPanel>
</ui:UiBinder>


Does anyone have any idea of what am I doing wrong?

Two other questions I'd like to ask, if I manage to solve the main problem
above:

   - Must I do the setSize in the java code for the dialog not to be tiny? I
   tried adding the attributes length and width to g:DialogBox but that didn't
   work.
   - Can't I center the dialog by setting some attribute in the XML? I saw
   the center() method, but I'd rather do it in the XML if possible.


Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

<<Screenshot.png>>

Reply via email to