Hi, I have a problem with BorderLayout add-on when I try to expand one or more areas; this is the code I use.
public class BorderLayoutComposer extends VerticalLayout {
private Application application;
private Window mainWindow;
private static BorderLayout bl;
public BorderLayoutComposer(Application app) {
application = app;
mainWindow = application.getMainWindow();
Collection collectionListeners = mainWindow.getListeners(CloseEvent.class);
mainWindow.removeListener((CloseListener) collectionListeners.iterator().next());
mainWindow.addListener(new CloseListener() {
@Override
public void windowClose(CloseEvent e) {
redirect(new MainCenterComposer(application));
}
});
createLayout();
}
private void createLayout() {
bl = new BorderLayout();
bl.addStyleName(Reindeer.LAYOUT_WHITE);
addComponent(bl);
setExpandRatio(bl, 1);
bl.setHeight("100%");
bl.setHeight(100, Sizeable.UNITS_PERCENTAGE);
bl.setWidth("100%");
bl.setWidth(100, Sizeable.UNITS_PERCENTAGE);
bl.addComponent(new NorthLayoutCreator(application), BorderLayout.Constraint.NORTH);
bl.addComponent(new MainCenterComposer(application), BorderLayout.Constraint.CENTER);
bl.addComponent(new MainEastComposer(application, 0, 0, 0), BorderLayout.Constraint.EAST);
bl.addComponent(new SouthLayoutCreator(application), BorderLayout.Constraint.SOUTH);
bl.setExpandRatio(bl.getComponent(BorderLayout.Constraint.CENTER), 2);
bl.setExpandRatio(bl.getComponent(BorderLayout.Constraint.EAST), 1);
}
public static void redirect(Component c) {
bl.replaceComponent(bl.getComponent(BorderLayout.Constraint.CENTER), c);
}
}
All the components added to “BorderLayout bl” are classes that extend “VerticalLayout”.
When I run my application I have this error: “Component must be added to layout before using setExpandRatio()”.
If I comment the “setExpandRatio” rows, all works fine but I can’t modify the size of any areas.
I also try “setMinmumXXXXWidth” method and it seems to do anything.
Bye, thanks