Frustration with Vaadin layouts

Yay! Finally some small progress on this topic. Thanks Imran, for being loud enough :slight_smile:

The margin/border/padding ticket was created already earlier:
#6342

UPDATE: and yes, anyone can create tickets, you just need to register to the Trac (the vaadin.com account won’t work there unfortunately). Click the “Register” link in the top.

With pure GWT layouts can build much faster, but the Vaadin have interesting components.

It’s slow build layouts with Vaadin.

Vaadin Grid layout comes with big headache ,especially if you compare it to Silverlight easily grid usage, I want to make something simple and I can’t get it work ,

I want to make a Grid 3x3 , with a menu bar that will fill the whole first row

final GridLayout grid = new GridLayout(3, 3);
final MenuBar up = new MenuBar();
grid.addComponent(up, ? , ? , ? , ?); 

How I do it , I looked at book/sampler , I just getting error exceptions , bounds etc when trying replacing the numbers instead the ?

Hi,

Well, if you haven’t added anything to the first row except that menubar yet then this piece of code should work.

  private void testGrid() {
    final GridLayout layout = new GridLayout(3, 3);
    layout.setSizeFull();
    layout.addComponent(new MenuBar(), 0, 0, 2, 0);
    mainWindow.setContent(layout);
  }

If you did - you will get an OverlapsException, because components should not overlap obviously.

Best Regards,
Alexander.

thx , it worked , but now If I’m inserting another component into the next row , I get

javax.servlet.ServletException: com.vaadin.ui.GridLayout$OverlapsException: com.vaadin.ui.MenuBar@2cb750e5( type = com.vaadin.ui.MenuBar) is already added to 0,0,0,0(column1, column2, row1, row2).

(column1, column2, row1, row2) shouldn’t be (column1, row1, column2, row2) ?

public class WelcomePage extends VerticalLayout implements Navigator.View{

	public WelcomePage()
	{
		
		final GridLayout layout = new GridLayout(3, 3);
		layout.setSizeFull();
		 MenuBar up = new MenuBar();
		 up.setWidth("100%");
		 layout.addComponent(up, 0, 0, 2, 0);
		   addComponent(layout);
		   Login x = new Login();
		   layout.addComponent(x, 1, 0);
}

Hi,

Everything is correct. You add the menubar so it covers the whole first row (row with index zero and columns with indices 0-2). Then You add the component to the column with index 1 and row index 0, which is the first row. Consequence - the exception!
The docs say that the first parameter in the method is the column index, the second - is row index. Swapping the values of the parameters passed would make the thing.

Best Regards,
Alexander.

Hi friends,
I am vaadin lover but whenever I do layouting i feel my love is one sided.I never got expected result it seems like I am working in a blackhole.How can I use CSSLayout , VerticalLayout and HorizontalLaoyout with ease.
Is there any technique when to use setSizefull and setSizeUndefine method.In first look its easy to do layouting but its not.
Most of the time I am buzy with it.Does vaadin has introduced something new or I can use twitter bootstrap with vaadin.
Please reply.

Regards,
Mohit