java ee - Can't adapt gridlayout to screen size (Vaadin 6.7.4) -


i have problem gridlayout adapted user screen size ,i want create gridlayout 3 columns , 2 rows , first row contain menu , seconde row body using panel , , first column x seconde row contain tree . cant result want , code show panel not full size here's code cant found why doesnt work !!

@override public void init() {       window main = new window("my app");     main.setsizefull();             setmainwindow(main);              verticallayout root = new verticallayout();     main.setcontent(root);     main.getcontent().setsizefull();      gridlayout grid = new gridlayout(3, 2);      main.addcomponent(grid);      grid.setcolumnexpandratio(0, 0.13f);     grid.setcolumnexpandratio(1, 0.86f);     grid.setcolumnexpandratio(2, 0.0f);       grid.setheight(100, sizeable.units_percentage);     grid.setwidth(100,sizeable.units_percentage);               grid.addcomponent(new label("menu"), 0, 0, 0, 1);             grid.addcomponent(new label("tree"), 1, 0, 1, 0);              panel pan = new panel();     pan.setwidth(100, sizeable.units_percentage);     pan.setheight(100, sizeable.units_percentage);      verticallayout body = new verticallayout();     body.setsizefull();      body.addcomponent(pan);      grid.addcomponent(body, 1, 1, 1, 1);           } 

before going specifics of question wanted leave tool can understand how components expanding in vaadin:

  • add "?debug" end of address use run application (eg localhost/app/?debug")
  • little window appear buttons on top.
  • press c clear , al analyse layout
  • a tree of components appear result. can browse tree pressing plus signs
  • every time press component (label, panel, etc) component highlighted on screen.

with can see code below has layout expands entire screen, panel expands on 2 last cells of grid , labels expanding width

the debug mode documented on book of vaadin

i believe components expanding correctly in wrong places. check how gridlayout works in book of vaadin. following code changes coordinates , adds label show panel indeed taking right cells of grid. seemed more logical add verticallayout panel alignment other way around:

@override public void init() {       window main = new window("my app");     main.setsizefull();             setmainwindow(main);              verticallayout root = new verticallayout();     main.setcontent(root);     main.getcontent().setsizefull();      gridlayout grid = new gridlayout(3, 2);      main.addcomponent(grid);      grid.setcolumnexpandratio(0, 0.13f);     grid.setcolumnexpandratio(1, 0.86f);     grid.setcolumnexpandratio(2, 0.0f);       grid.setheight(100, sizeable.units_percentage);     grid.setwidth(100,sizeable.units_percentage);               grid.addcomponent(new label("menu"), 0, 0, 2, 0);              grid.addcomponent(new label("tree"), 0, 1);              panel pan = new panel();     pan.setwidth(100, sizeable.units_percentage);     pan.setheight(100, sizeable.units_percentage);         verticallayout body = new verticallayout();     body.setsizefull();     pan.addcomponent(body);      label bodylabel= new label("body panel taking 2 columns of last row");     bodylabel.setsizeundefined();       body.addcomponent(bodylabel);     body.setcomponentalignment(bodylabel, alignment.middle_center);      grid.addcomponent(pan, 1,1 , 2, 1);           } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -