Forgot to copy/past this "no-so-necessary" peace of working code:

Note, onLoad is used so calls to setSize will be delayed and
onResize() would have more chance to be called (I didn't check).


public class test implements EntryPoint {

  private class Menu extends Composite {
    public Menu() {
      FlowPanel panel = new FlowPanel();
      panel.add( new HTML( "menu" ) );
      initWidget( panel );
    }
  };

  private class Application extends Composite implements
RequiresResize, ProvidesResize {
    private DockLayoutPanel indexPanel;
    private DecoratorPanel appDecorator;

    public Application() {
      indexPanel = new DockLayoutPanel( Unit.PX );
      indexPanel.addNorth( new HTML("north blah"), 100 );
      indexPanel.addWest( new HTML("west blah"), 100 );
      indexPanel.addEast( new HTML("east blah"), 100 );
      indexPanel.add( new Menu() );
      //indexPanel.setSize( "100%", "100%" );
      //indexPanel.setSize( "100%", "300px" );

      appDecorator = new DecoratorPanel();
      appDecorator.setWidget( indexPanel );
      appDecorator.setStylePrimaryName( "custom_decorator" );
      //appDecorator.setSize( "100%", "100%" );
      initWidget( appDecorator );
    }

    public void onResize() {
      indexPanel.onResize();
    }

    public void onLoad()
    {
      indexPanel.setSize( "100%", "300px" );
      appDecorator.setSize( "100%", "100%" );
    }
  };

  public void onModuleLoad() {
    RootLayoutPanel.get().add( new Application() );
  }
}



On Jul 21, 3:05 pm, Thomas Broyer <[email protected]> wrote:
> On 20 juil, 14:00, Jean-luc Chasseriau <[email protected]> wrote:
>
>
>
>
>
>
>
>
>
> > Hi all,
>
> > I'm getting the same behavior, only the north part of the DockLayoutPanel is
> > displayed.
> > Need to set DockLayoutPanel's height in pixel to make it work.
>
> > Running gwt 2.1.0 M2, here is the structure:
>
> > Menu extends Composite
> >   Menu() {
> >     panel = new FlowPanel();
> >     panel.add( new HTML( "menu" ) );
> >     initWidget( panel );
> >   }
>
> > Application extends Composite
> >   Application() {
> >     indexPanel = new DockLayoutPanel( PX );
> >     indexPanel.addNorth( new HTML("north blah"), 50 );
> >     indexPanel.addWest( new HTML("west blah"), 50 );
> >     indexPanel.addEast( new HTML("east blah"), 50 );
> >     indexPanel.add( new Menu() );
>
> >     appDecorator = new DecoratorPanel();
> >     appDecorator.setWidget( indexPanel );
> >     appDecorator.setStylePrimaryName( "custom_decorator" );
>
> >     initWidget( appDecorator );
> >   }
>
> > RootLayoutPanel.get().add( new Application() );
>
> > Few tests:
> > 1) this code, not more: the custom_decorator is displayed, without "center",
> > with "north" overwriting in the borders.
>
> > 2) adding: appDecorator.setSize( "100%", "100%" );
> >     the decorator is properly rendered, and the center is 100%,100%, but,
> > only "north" is displayed from the DockLayoutPanel
>
> > 3) adding: indexPanel.setSize( "100%", "100%" ); AND appDecorator.setSize(
> > "100%", "100%" ); => same as (2)
>
> > 4) adding: indexPanel.setHeight( "100%"); AND appDecorator.setSize( "100%",
> > "100%" ); => same as (2)
>
> > 5) adding: indexPanel.setSize( "300px", "300px" ); AND appDecorator.setSize(
> > "100%", "100%" );
> >     finally! DockLayoutPanel is rendered!
>
> > Conclusion:
> > Need to fix the height in PIXEL to get it work properly.
>
> > GWT team?
>
> http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideUiPan...
> Search for "Using a LayoutPanel without RootLayoutPanel", then look
> for "RequiresResize and ProvidesResize", which says:
> """The purpose of these two interfaces is to form an unbroken
> hierarchy between all widgets that implement RequiresResize and the
> RootLayoutPanel, which listens for any changes (such as the browser
> window resizing) that could affect the size of widgets in the
> hierarchy."""
> => keywords: "unbroken hierarchy"
>
> In your case, maybe you could just implement RequiresResize on your
> Application composite to delegate to indexPanel.onResize(), and give
> both your widgets a size of 100%.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to