Monday, April 1, 2013

Re: GWT UI widgets auto-alignment inside different Panels proper solution needed.

i had sorted these issues by using 

Basically letting the CSS do the aligning. 

its dependent on your app of-course!

HTH,
Subhro.



On Mon, Apr 1, 2013 at 8:04 PM, BM <bhushan.madan@gmail.com> wrote:
We use GWT inside every other panels like VerticalPanel, HorizontalPanel, DockLayoutPanel, etc.

The thing I feel it is cumbersome in assigning alignment (both horizontal and vertical) for each elements in those panels. 

One way is :
<g:HorizontalPanel width="100%" height="100%" horizontalAlignment="ALIGN_CENTER" verticalAlignment="ALIGN_MIDDLE">
    <g:Label>Hello Center</g:Label>
    <g:TextBox ui:field="firstNameTxtBox" />

</g:HorizontalPanel>

The problem is that if we have several UI binder template files, this get hard-coded inside the XML file. Plus if there is a pretty good chance of forgetting to apply alignment when we are dealing with several template files.

I would like to have a better way to create my UI through UI Binder by having alignment center and middle already taken care of. Some kind of template wherein I can just insert GWT UI elements (Textbox, Radio, Checkboxes, ListBox, etc) and labels. Since our views can use DockLayoutPanel, Or HorizontalPanel and VerticalPanel inside DockLayoutPanel, there is no constant source of template how all my UI (basically UI entry form) should look like consistently)


One way I thought would be to use custom CellPanel (Not Cell List) but not sure if it is the best way.

xmlns:i="urn:import:com.project.client.widgets.input"

<g:HorizontalPanel width="100%" height="100%" >
    <i:properAlignmentCell>
        <g:Label>Hello Center</g:Label>
    </i: properAlignmentCell>

    <i: properAlignmentCell>    
        <g:TextBox ui:field="firstNameTxtBox" />
    </i: properAlignmentCell>

</g:HorizontalPanel>

Where properAlignmentCell extends Cell and it contains horizontalAlignment="ALIGN_CENTER" verticalAlignment="ALIGN_MIDDLE" declared inside programmatically. 

What other ways anyone can recommend? 



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment