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, AbstractDynamicLayout.TNode
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap<Widget,Dimension> |
debugDims
Used during debugging by
checkLocations(Container) and keepLocations(Container) . |
private java.util.HashMap<Widget,Point> |
debugLocs
Used during debugging by
checkLocations(Container) and keepLocations(Container) . |
private static java.util.logging.Logger |
LOG
Logger
|
baseUnits, config, container, isAdm, MIN_CELL_HEIGHT, MIN_CELL_WIDTH, rootNode
Constructor and Description |
---|
DynamicLayout(Container<O> container)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkLocations(Container c)
A helper method used during debugging.
|
void |
doLayout()
Performs the actual layout.
|
private void |
inflateHeight()
Rearranges the container widgets to utilize the container's available vertical size.
|
private void |
inflateHeight(AbstractDynamicLayout.TNode node)
Rearranges the container widgets to utilize the container's available vertical size.
|
private void |
inflateImpl(AbstractDynamicLayout.TNode containerNode,
java.util.function.Function<AbstractDynamicLayout.TNode,java.util.List<AbstractDynamicLayout.RowInfo>> rowsF,
java.util.function.BiConsumer<AbstractDynamicLayout.TNode,java.lang.Double> locationSetter,
java.util.function.Function<Point,java.lang.Double> locationF,
java.util.function.BiConsumer<AbstractDynamicLayout.TNode,java.lang.Double> dimensionSetter,
java.util.function.Function<Dimension,java.lang.Double> widthF,
double minCellSize)
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 available horizontal size.
|
private void |
inflateWidth(AbstractDynamicLayout.TNode node)
Rearranges the container widgets to utilize the container's available horizontal size.
|
private void |
keepLocations(Container c)
A helper method used during debugging.
|
private void |
layoutAdmPageFrame(AbstractDynamicLayout.TNode container)
Layouts the supplied ADM page frame.
|
private double |
truncateToPixel(double base,
double location)
Truncates the provided location value to the nearest pixel.
|
buildTree, compareTrees, isDynamicWidget, parseColumns, parseRows, parseRows, setWidgetSize
private static final java.util.logging.Logger LOG
private java.util.HashMap<Widget,Point> debugLocs
checkLocations(Container)
and keepLocations(Container)
.private java.util.HashMap<Widget,Dimension> debugDims
checkLocations(Container)
and keepLocations(Container)
.public void doLayout()
doLayout
in class AbstractDynamicLayout<O extends OutputManager<?>>
private void inflateWidth()
private void inflateWidth(AbstractDynamicLayout.TNode node)
node
- The root node.private void inflateHeight()
private void inflateHeight(AbstractDynamicLayout.TNode node)
node
- The root node.private void inflateImpl(AbstractDynamicLayout.TNode containerNode, java.util.function.Function<AbstractDynamicLayout.TNode,java.util.List<AbstractDynamicLayout.RowInfo>> rowsF, java.util.function.BiConsumer<AbstractDynamicLayout.TNode,java.lang.Double> locationSetter, java.util.function.Function<Point,java.lang.Double> locationF, java.util.function.BiConsumer<AbstractDynamicLayout.TNode,java.lang.Double> dimensionSetter, java.util.function.Function<Dimension,java.lang.Double> widthF, double minCellSize)
containerNode
- The container node.rowsF
- Widgets grouped into vertical or horizontal rows.locationSetter
- Widget location setter.locationF
- Widget location getter.dimensionSetter
- Widget dimension setter.widthF
- Widget horizontal dimension getter.minCellSize
- Minimum cell size.private void layoutAdmPageFrame(AbstractDynamicLayout.TNode container)
container
- The ADM page frame.private double truncateToPixel(double base, double location)
base
- A pixel in character units.location
- The location value to truncate.private void keepLocations(Container c)
checkLocations(Container)
.c
- Container.private void checkLocations(Container c)
keepLocations(Container)
.c
- Container.