开发者

Using UIBinder to create a Widget to go into a Dialog

开发者 https://www.devze.com 2023-03-26 04:24 出处:网络
I found this; which allows me to create the widget in the code: Why is the dialog size so small with this GWT DockLayoutPanel?

I found this; which allows me to create the widget in the code: Why is the dialog size so small with this GWT DockLayoutPanel?

but what I want is to use UIBinder.

when I do use it, I get the widget taking up infinite space and hanging below the dialog caption bar. (obviously not what I want)

for example:

the UIBinder code:

<g:DockLayoutPanel unit='EM'>
  <g:north size='4'>
    <g:Label>Header</g:Label>
  </g:north>

  <g:west size='8'>
    <g:Label>Navigation</g:Label>
  </g:west>

  <g:center size="10">
    <g:ScrollPanel>
      <g:Label>Content Area</g:Label>
    </g:ScrollPanel>
  </g:center>
</g:DockLayoutPanel>

and if the widget is called WizardPanel;

then the code would be:

Dialog mydialog = new Dialog();
mydialog.add(new WizardPanel);
mydialog.show();

I've also tried putting the line in:

WizardPanel wp = new WizardPanel();
wp.se开发者_开发百科tSize("100em", "100em");

before adding it to mydialog, it doesn't make any difference.

I eventually may want to use LayoutPanel; but for now DockLayoutPanel seems sufficient.

thanks!


In a DockLayoutPanel you're not supposed to set the size for the center. The center just takes whatever is left over from the other elements. Other than that I don't see anything wrong with your code.


I think all LayoutPanels need an unbroken chain of LayoutPanels all the way up to the RootLayoutPanel. The Dialog is a "normal" Panel so you must specify the LayoutPanels dimensions explicitly.

See section "Using a LayoutPanel without RootLayoutPanel" in the LayoutPanel Recipes

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号