public abstract class AbstractDynamicLayout<O extends OutputManager<?>>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractDynamicLayout.CellInfo
Data class for widgets grouped into columns in the individual rows.
|
protected static class |
AbstractDynamicLayout.RowInfo
Data class for widgets grouped into rows.
|
protected static class |
AbstractDynamicLayout.TNode
The class represents one node of the visual widget tree.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ADM_PAGE_FRAME_NAME
ADM page frame name
|
protected Point |
baseUnits
Base coordinate unit
|
protected DynamicLayoutConfig |
config
Dynamic layout configuration
|
protected Container<O> |
container
The container this layout instance operates on
|
protected boolean |
isAdm
Set to true when ADM UI is detected
|
private static java.util.logging.Logger |
LOG
Logger
|
protected static double |
MIN_CELL_HEIGHT
The min cell height
|
protected static double |
MIN_CELL_WIDTH
The min cell width
|
private static Dimension |
minCellSize
The minimum widgets cell dimensions
|
protected AbstractDynamicLayout.TNode |
rootNode
The root container node
|
Constructor and Description |
---|
AbstractDynamicLayout(Container<O> container)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildTree()
Builds the visual widget tree.
|
private void |
buildTree(AbstractDynamicLayout.TNode parent)
Recursively builds the visual widget tree.
|
protected boolean |
compareTrees(AbstractDynamicLayout.TNode prevNode,
AbstractDynamicLayout.TNode newNode)
Compares two widget trees.
|
abstract void |
doLayout()
Performs the actual layout.
|
protected boolean |
isDynamicWidget(AbstractDynamicLayout.TNode node)
The method determines whether the supplied widget is considered "dynamic" for the purpose of the
layout algorithm.
|
private void |
mergeCells(AbstractDynamicLayout.CellInfo source,
AbstractDynamicLayout.CellInfo target)
Merges two adjacent cells.
|
protected void |
parseColumns()
The method parses the container's widgets grouped into columns.
|
protected void |
parseRows()
The method parses the container's widgets grouped into rows.
|
protected void |
parseRows(boolean useOptimalSize)
The method parses the container's widgets grouped into rows.
|
private void |
parseRowsImpl(AbstractDynamicLayout.TNode container,
java.util.function.BiConsumer<AbstractDynamicLayout.TNode,java.util.List<AbstractDynamicLayout.RowInfo>> rowsSetter,
java.util.function.Function<AbstractDynamicLayout.TNode,com.google.common.collect.TreeMultimap<java.lang.Double,AbstractDynamicLayout.TNode>> indexF,
java.util.function.Function<Point,java.lang.Double> xLocationF,
java.util.function.Function<Dimension,java.lang.Double> widthF,
java.util.function.Function<Dimension,java.lang.Double> heightF,
java.util.function.BiConsumer<Dimension,java.lang.Double> widthSetter,
boolean useOptimalSize)
Groups widgets into rows or columns based on the input parameters.
|
protected void |
setWidgetSize(AbstractDynamicLayout.TNode node,
double width,
double height)
Sets size of the supplied widget.
|
protected static final double MIN_CELL_WIDTH
protected static final double MIN_CELL_HEIGHT
private static final Dimension minCellSize
private static final java.util.logging.Logger LOG
private static final java.lang.String ADM_PAGE_FRAME_NAME
protected DynamicLayoutConfig config
protected Container<O extends OutputManager<?>> container
protected AbstractDynamicLayout.TNode rootNode
protected final Point baseUnits
protected boolean isAdm
public abstract void doLayout()
protected void parseRows()
protected void parseRows(boolean useOptimalSize)
useOptimalSize
- The parameter instructs the parse logic to either use the the widgets' actual size or
optimal size on those widgets that do support optimal size calculation.protected void parseColumns()
protected boolean isDynamicWidget(AbstractDynamicLayout.TNode node)
node
- The widget, represented by a TNode, to be checked.true
if the widget is considered "dynamic", false
otherwise.protected void setWidgetSize(AbstractDynamicLayout.TNode node, double width, double height)
node
- The widget to adjust size on.width
- The new width.height
- The new height.protected void buildTree()
protected boolean compareTrees(AbstractDynamicLayout.TNode prevNode, AbstractDynamicLayout.TNode newNode)
prevNode
- First tree.newNode
- Second tree.true
when the trees match, false
otherwiseprivate void parseRowsImpl(AbstractDynamicLayout.TNode container, java.util.function.BiConsumer<AbstractDynamicLayout.TNode,java.util.List<AbstractDynamicLayout.RowInfo>> rowsSetter, java.util.function.Function<AbstractDynamicLayout.TNode,com.google.common.collect.TreeMultimap<java.lang.Double,AbstractDynamicLayout.TNode>> indexF, java.util.function.Function<Point,java.lang.Double> xLocationF, java.util.function.Function<Dimension,java.lang.Double> widthF, java.util.function.Function<Dimension,java.lang.Double> heightF, java.util.function.BiConsumer<Dimension,java.lang.Double> widthSetter, boolean useOptimalSize)
container
- rowsSetter
- indexF
- The widgets sorted based on the vertical locations.xLocationF
- Function for getting widget's horizontal position.widthF
- Function for getting widget's horizontal size.heightF
- Function for getting widget's vertical size.useOptimalSize
- The parameter instructs the parse logic to either use the the widgets' actual size or
optimal size on those widgets that do support optimal size calculation.private void mergeCells(AbstractDynamicLayout.CellInfo source, AbstractDynamicLayout.CellInfo target)
source
- The cell that will be merged to target.target
- The cell where the source cell will be merged.private void buildTree(AbstractDynamicLayout.TNode parent)
parent
- Widget parent.