public class DynamicLayout<O extends OutputManager<?>> extends AbstractDynamicLayout<O>
The layout algorithm detects the expandable (aka dynamic) widgets (currently only browse is considered an expandable widget), finds the available space and resizes them accordingly. It moves the widgets around the expandable widgets to offset the resize of the expandable widgets and to make more room if available. The expandable widgets are resized proportionally based on their initial sizes. There is a configurable padding that is kept between widgets or between widgets and the top-level window's edge. Inner frames are supported as well as multiple browse widgets anywhere in the widget tree.
See DynamicLayoutConfig
for the configurable layout options.
The design intentionally doesn't extend the existing layout infrastructure represented by
LayoutManager
. The reason for this is that dynamic layout works on top of the existing layout
mechanics and assumes the components are already laid out according to the legacy requirements. This
also means that the invocation points for the dynamic layout are different from the legacy layout
logic.
AbstractDynamicLayout.CellInfo, AbstractDynamicLayout.RowInfo
config, container
Constructor and Description |
---|
DynamicLayout(Container<O> container)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
doLayout()
Performs the actual layout.
|
private void |
inflateHeight()
Rearranges the container widgets to utilize the container's available vertical size.
|
private void |
inflateImpl(java.util.List<AbstractDynamicLayout.RowInfo> rows,
java.util.function.BiConsumer<Widget,java.lang.Double> locationSetter,
java.util.function.Function<Widget,java.lang.Double> locationGetter,
java.util.function.BiConsumer<Widget,java.lang.Double> dimensionSetter,
java.util.function.Function<Dimension,java.lang.Double> widthF,
double windowPadding,
double framePadding)
Rearranges the container widgets to utilize the container's available vertical or horizontal size.
|
private void |
inflateWidth()
Rearranges the container widgets to utilize the container's availble horizontal size.
|
isDynamicWidget, parseColumns, parseRows, parseRows, setWidgetSize
public void doLayout()
doLayout
in class AbstractDynamicLayout<O extends OutputManager<?>>
private void inflateWidth()
private void inflateHeight()
private void inflateImpl(java.util.List<AbstractDynamicLayout.RowInfo> rows, java.util.function.BiConsumer<Widget,java.lang.Double> locationSetter, java.util.function.Function<Widget,java.lang.Double> locationGetter, java.util.function.BiConsumer<Widget,java.lang.Double> dimensionSetter, java.util.function.Function<Dimension,java.lang.Double> widthF, double windowPadding, double framePadding)
rows
- Widgets grouped into vertical or horizontal rows.locationSetter
- Widget location setter.locationGetter
- Widget location getter.dimensionSetter
- Widget dimension setter.widthF
- Widget horizontal dimension getter.windowPadding
- Padding between frames and window egdes.framePadding
- Padding between widgets and frame edges.