23 Jan 2013 6:07 AM #1
Answered: Layout Architecture
This is a slightly theorectical question. Our original goal was to make the entire application resizable. To do this we had a Viewport at the hightest level and inside of it were a group of BorderLayoutContainers, VerticalLayoutContainers, and HorizontalLayoutContainers (basically we were trying to do top down structuring).
The problem is that we're discovering things don't look good when they get really small. So my new task is to make everything still resizable BUT have a minimum size below which things can not shrink and scrollbars would be created like a tradition web page viewed on a monitor with poor resolution. I've spent some time trying to think of ways to do this but they've all been pretty complicated and essentially variations on the theme "draw the page, measure each component and if its pixel size is too small, force it to redraw bigger." I'm thinking I'd probably stick the minimum size on the panels rather than the widgets but I'm unclear if this is the right design pattern.
It feels like I'm trying to mix top down and bottom up layout styles which makes me wonder if I'm going down the wrong path.
I'm hoping that there's a simple solution which I'm just overlooking. If anyone else whose dealt with this issue before could tell me how they solved the problem I'd greatly appreciate it.
I THINK the remaing problem is that since BorderLayout asks its parent how big it is allowed to be and FlowLayoutContainer asks its children how big they need to be, neither one is actually telling anyone how big the page is.
Instead of FlowLC, consider something like making a SimpleContainer subclass like MinSizeContainer, and override doLayout() to check the current size before passing something down to the children.
In any case, only a parent with the css property 'overflow' set to 'auto' or 'scroll' is able to show a scrollbar. This property should be set on either the FlowLC or the hypothetical MinSizeContainer. This could either be toggled from 'visible' to 'scroll' when the browser window gets too small, or could be left on 'auto', only drawing a scrollbar when the child is bigger than there is space.