The only usable layout for UIBinder is DockLayoutPanel, which is not
applicable for most layout requirements. Without useable layouts,
uibinder is a good demo technology but unuseable.

The Grid widget for example.
No setColumnCount nor setRowCount nor add(widget) methods.

OK, that's simple. I'll just extend Grid and provide my own
setColumnCount, setRowCount and add(widget). Or so I thought.

        static public class UIGrid
                extends Grid
        {
                public void setRowCount(int n){
                        this.numRows = n;
                }
                public void setColumnCount(int n){
                        this.numColumns = n;
                }
                public void add(Widget w){
                        int row = this.count/this.numColumns;
                        int col = this.count - row*this.numColumns ;
                        this.count++;
                        if (this.numRows<row)
                                this.setRowCount(row);
                        this.setWidget(row, col, w);
                }

                public void add(String t){
                        int row = this.count/this.numColumns;
                        int col = this.count - row*this.numColumns;
                        this.count++;
                        this.setText(row, col, t);
                }
                protected int count=0;
        }


And my ui.xml:

<z:UIGrid
         columnCount='2' rowCount='3'>
                <g:Label>Name</g:Label>
                <g:TextBox ui:field="name" width="15em"/>
                <g:Label>Password</g:Label>
                <g:TextBox ui:field="password" width="15em"/>
        <g:Button ui:field="logIn" text="login"/>
</z:UIGrid>


You know what, the uibinder attributes was not read at the start of
bind but probably after all the members have been added. Which means,
during add widget, the placement calculation encountered divide by
zero exception.

So. I had to explicitly set the sizes at the constructor.
        public UIGrid(){
                this.resize(3, 2);
        }

That is poor design strategy on my part.

Hey GWT team, help us out here by enhancing the layout policy
guys.Otherwise, using the java source code to perform layout defeats
the purpose of using uibinder!!

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