Hi,
What do you try to archive?
At the end you are building a web page. There is nothing wrong in
using CSS :)
If by your top Panel was just for having 20px around the inner Panel,
then you can archive the same goal using .panel { margin: 20px; }. And
changing the style with p.setStyleName("panel").
> - How can I set the vertical size for the menubar container to match
> its real height?
> It is hardcoded ("100").
Short answer: You can't with LayoutPanels. They always try to expand
to take all the available space, or the one you force them to take.
You can use EM units, that are relative to the font size.
> - When I add a child panel to the inner DockLayoutPanel (p):
> How can I make them centered horizontally and vertically?
> (I tried an intermediary LayoutPanel as you did at the outer
> DockLayoutPanel)
I think by default it will take all the space of the container. So you
need to restrict it and center it using CSS. { float: left; align:
center }
Regards
/Fran
>
> Thanks
> Magnus
>
> On Jun 5, 8:22 pm, fmod <[email protected]> wrote:
>
>
>
> > If you want to have nested Layout Panels, they need to be inside the
> > "Layout" family. Otherwise they will not render well.
> > So instead of using a SimplePanel, if u expect to attach another
> > Layout use LayoutPanel.
>
> > Note the LayoutPanel middle...
>
> > public class TestLayout implements EntryPoint {
>
> > public void onModuleLoad() {
> > DockLayoutPanel pnl = new DockLayoutPanel(Unit.PX);
> > pnl.setSize("100%", "100%");
> > pnl.addNorth(createPanel("#f00"), 20);
> > pnl.addSouth(createPanel("#ff0"), 20);
> > pnl.addWest(createPanel("#fff"), 20);
> > pnl.addEast(createPanel("#0f0"), 20);
>
> > LayoutPanel middle = new LayoutPanel();
> > pnl.add(middle);
>
> > MenuBar mnb = new MenuBar(true);
> > mnb.addItem("Test", new Command() {
> > public void execute() {
> > System.out.println("test");
> > }
> > });
> > DockLayoutPanel p = new DockLayoutPanel(Unit.PX);
> > p.addNorth(mnb, 100); // 100 is hardcoded = unwanted
> > p.addSouth(createPanel("#0ff"), 20);
> > p.addWest(createPanel("#00f"), 20);
> > p.addEast(createPanel("#f0f"), 20);
> > middle.add(p);
> > RootLayoutPanel root = RootLayoutPanel.get();
> > root.add(pnl);
> > }
>
> > SimplePanel createPanel(String color) {
> > SimplePanel panel = new SimplePanel();
> > panel.getElement().getStyle().setBackgroundColor(color);
> > return panel;
> > }
>
> > }
>
> > On Jun 5, 7:47 pm, Magnus <[email protected]> wrote:
>
> > > Hi,
>
> > > I am new to GWT and I expected to get methods to build nice web 2.0
> > > guis. However, I am somewhat disappointed. I try to build a gui with
> > > the different layouts, nested and combined them, but nothing really
> > > works, i. e. nothing does what I am expecting it to do.
>
> > > The following is just an example:
>
> > > I would like an outer DockLayoutPanel, which occupies the whole
> > > window:
>
> > > DockLayoutPanel pnl = new DockLayoutPanel (Unit.PX);
> > > pnl.setSize ("100%","100%");
> > > pnl.addNorth (new SimplePanel (),20);
> > > pnl.addSouth (new SimplePanel (),20);
> > > pnl.addWest (new SimplePanel (),20);
> > > pnl.addEast (new SimplePanel (),20);
>
> > > Then, I would like an inner DockLayoutPanel, which has a MenuBar at
> > > its north, and the main content in its center:
>
> > > MenuBar mnb = new MenuBar (true);
> > > mnb.add ...
>
> > > DockLayoutPanel p = new DockLayoutPanel (Unit.PX);
> > > p.addNorth (mnb,100); // 100 is hardcoded = unwanted
> > > p.addSouth (new SimplePanel (),mtr_Border);
> > > p.addWest (new SimplePanel (),mtr_Border);
> > > p.addEast (new SimplePanel (),mtr_Border);
>
> > > pnl.add(p);
>
> > > RootLayoutPanel root = RootLayoutPanel.get();
> > > root.add (pnl);
>
> > > This does not work: The MenuBar is not visible.
>
> > > It seems that a DockLayoutPanel never works within another panel.
>
> > > Well, nothing works. So GWT does not make any fun.
> > > Please help me!
>
> > > Magnus
--
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.