When using UiBinder, what is the preferred way to create a simple layout like this?
FlowPanel:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> <ui:style> .outer { display: table; height: 100%; width: 100%; } .inner { background: #DDD; display: table-cell; vertical-align: middle; } </ui:style> <g:FlowPanel styleName="{style.outer}"> <g:FlowPanel styleName="{style.inner}"> <g:Label ui:field="someLabel"/> </g:FlowPanel> </g:FlowPanel> </ui:UiBinder>
HTMLPanel:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> <ui:style> .outer { display: table; height: 100%; width: 100%; } .inner { background: #DDD; display: table-cell; vertical-align: middle; } </ui:style> <g:HTMLPanel styleName="{style.outer}"> <div class="{style.inner}"> <g:Label ui:field="someLabel"/> </div> </g:HTMLPanel> </ui:UiBinder>
Edit: I know that they create the same html when rendering, I wonder if there is an excuse for using one style over another.
javadocs says that FlowPanel is the easiest panel, but at what point the use of HTMLPanel becomes preferred. eg.
<FlowPanel> <FlowPanel> <Widget> </FlowPanel> <FlowPanel> <Widget> </FlowPanel> </FlowPanel>
against.
<HTMLPanel> <div> <Widget> </div> <div> <Widget> </div> </HTMLPanel>
Thanks.
UiBinder - HTMLPanel vs. div is a pretty similar question, but asks for the use of div and HTMLPanel.
source share