>  I'm in the progress of updating and old code base to standards compliant 
> mode and centering widget on the window is used all over the place.
> Before I could just set the height of a table to 100% and using 3 columns, 
> and let the browser figure out row distribution, but this no longer works 
> in standards mode.
>

Not tested in IE6/7 but should work in IE8 and all other browsers in 
standards mode:

CenterPanel.gwt.xml:

<g:HTMLPanel height="100%" width="100%">
<div style="display:table; height:100%; width:100%;">
<div style="display:table-cell; vertical-align:middle; text-align:center;">
<div style="text-align:left; display:inline-block;">
<g:FlowPanel ui:field="centeredContainer"/>
</div>
</div>
</div>
</g:HTMLPanel>

The corresponding Java file extends Composite and implements HasWidgets by 
delegating HasWidgets methods to centeredContainer. Haven't tried it but 
the first <div> inside the HTMLPanel can probably be removed if you assign 
"display:table" via CSS to the HTMLPanel.

You can then use it like

<g:SomeParentContainerWithKnownHeight> //could probably also be a 
LayoutPanel layer as it has fixed sizes.
  <my:CenterPanel>
     <g:Label>Centered text inside 
SomeParentContainerWithKnownHeight</g:Label>
  </my:CenterPanel>
</g:SomeParentContainerWithKnownHeight>



-- J.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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.


Reply via email to