I’m back in business, and this time I have to build a prototype to convince my enterprise of using ITMill as the default web framework…
Well, my basic idea of the page layout is to get a GridLayout and separate it in two columns, the first column on the left will be a width fixed menu, and my second column on the right would be a floating width column that depends on the screen resolution or browser width. In each column there are Panels, so the panel on the right would always have the width of the remaining space.
How can it be done? I already tried to use the ExpandLayout, but I got nothing.
thanks for your help, this project is getting better each day.
Here is another solution, using SplitPanel to achieve the same:
public void init() {
Window main = new Window("SplitPanel example");
setMainWindow(main);
SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
sp.setSplitPosition(150, SplitPanel.UNITS_PIXELS);
// optional, if you want the split position to be locked:
// sp.setLocked(true);
main.setLayout(sp);
OrderedLayout menuLayout = new OrderedLayout();
menuLayout.setMargin(true); // optional
menuLayout.addComponent(new Button("Menu stuff"));
sp.addComponent(menuLayout);
OrderedLayout rightLayout = new OrderedLayout();
rightLayout.setMargin(true); // optional
sp.addComponent(rightLayout);
Panel somePanel = new Panel("A panel");
rightLayout.addComponent(somePanel);
somePanel = new Panel("Another panel");
rightLayout.addComponent(somePanel);
}
Sylvain, you’ll need two ExpandLayouts to achieve this.
[code]
Label a = new Label(“A”);
Label b = new Label(“B”);
Label c = new Label(“C”);
ExpandLayout ex1 = new ExpandLayout(); // This will be the vertical one, containing A and following ExpandLayout
ExpandLayout ex2 = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL); // This is the horizontal one, containing B and C
ex2.addComponent(b);
ex2.addComponent(c);
// No need to call ‘expand’, since ExpandLayout will expand the first component by default
[/code]That should work.