class ZeroColumnLayout.StackedModeVariables
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) double |
bottomCurrentHeight
Maximal height of widget in current row in bottom part of layout.
|
(package private) double |
extraBottomSpaces
Extra spaces to insert between widgets for bottom part of layout.
|
(package private) double |
extraTopSpaces
Extra spaces to insert between widgets for top of layout.
|
private java.util.List<Label<O>> |
labelList
List of labels in current row.
|
private java.util.Map<Label<O>,LabeledWidget<O>> |
labelMap
Map of side-labels to their associated side-widget.
|
(package private) double |
nextBottomCol
Next free column in bottom part of layout.
|
(package private) double |
nextBottomRow
Next free row in bottom part of layout.
|
private int |
nextBottomX
Next widget bottom part Y coordinate calculated in pixels.
|
private int |
nextBottomY
Next widget bottom part Y coordinate calculated in pixels.
|
(package private) double |
nextTopCol
Next free column in top part of layout.
|
(package private) double |
nextTopRow
Next free row in top part of layout.
|
private int |
nextTopX
Next widget top part Y coordinate calculated in pixels.
|
private int |
nextTopY
Next widget top part Y coordinate calculated in pixels.
|
(package private) double |
startColumn
Initial column for new row.
|
(package private) double |
topCurrentHeight
Maximal height of widget in current row in top part of layout.
|
(package private) double |
width
Maximal width of resulting layout.
|
Constructor and Description |
---|
StackedModeVariables(double width)
Construct an variable bundle.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addLabel(Label<O> label,
LabeledWidget<O> widget)
Add label into list of current row labels.
|
(package private) void |
adjustBottom(Dimension bottom)
Adjust bottom part dimension according to current variables.
|
(package private) void |
adjustDimensions(Dimension top,
Dimension bottom)
Adjust provided instances of
Dimension with calculated top
and bottom parts of layout. |
(package private) void |
adjustTop(Dimension top)
Adjust top part dimension according to current variables.
|
(package private) void |
clear()
Clear variables and prepare them for real size calculation/relocation.
|
(package private) void |
finalizeHeight()
Finalize height calculations.
|
(package private) void |
fixLabelsRow()
Finalize label placement.
|
private void |
incrementNextBottomRow(double height)
Increment bottom row calculated in character cells and in pixels.
|
private void |
incrementNextTopRow(double height)
Increment top row calculated in character cells and in pixels.
|
(package private) boolean |
isSkipOrWrap(int i,
double len)
Check for possible wrapping.
|
(package private) boolean |
needSpaceStacked(int i,
double col)
Check if next component requires space before it for stacked mode.
|
(package private) void |
processBottom(int i,
double len,
int sh1,
boolean place,
double sh2)
Process widget in the bottom part of layout: adjust variables and place widget if
requested.
|
(package private) void |
processFixed(int i,
Point location,
double len,
java.lang.String text)
Process fixed widget coordinates for both, top and bottom parts of
layout.
|
(package private) void |
processFixedBottom(Point location)
Process fixed widget coordinates in bottom part of layout.
|
(package private) void |
processFixedTop(Point location)
Process fixed widget coordinates in top part of layout.
|
(package private) void |
processSkip(int i)
Process SKIP widget.
|
(package private) void |
processSpace(int i)
Process SPACE widget.
|
(package private) void |
processTop(int i,
double len,
Dimension top)
Update top part of layout with specified widget and then adjust passed
Dimension
instance. |
(package private) void |
resetHeaderStart()
Reset start column for header widgets, because they always start at
column 0, regardless from the ATTR-SPACE attribute.
|
(package private) void |
setNextBottomCol(double nextBottomCol)
Sets the next column to be filled on the bottom side.
|
(package private) void |
setNextTopCol(double nextTopCol)
Sets the next column to be filled on the top side.
|
double startColumn
double nextTopRow
double nextBottomRow
double nextTopCol
double nextBottomCol
double topCurrentHeight
double bottomCurrentHeight
double extraTopSpaces
double extraBottomSpaces
double width
private int nextTopY
private int nextTopX
private int nextBottomY
private int nextBottomX
private java.util.List<Label<O extends OutputManager<?>>> labelList
private java.util.Map<Label<O extends OutputManager<?>>,LabeledWidget<O extends OutputManager<?>>> labelMap
StackedModeVariables(double width)
width
- Container width.void addLabel(Label<O> label, LabeledWidget<O> widget)
label
- Label to add.widget
- The associated side-widget.void fixLabelsRow()
void clear()
boolean needSpaceStacked(int i, double col)
i
- Index of component to check.col
- Expected new column for the widget.true
if next component requires space before it.void adjustTop(Dimension top)
top
- The Dimension
instance to adjust.void adjustBottom(Dimension bottom)
bottom
- The Dimension
instance to adjust.boolean isSkipOrWrap(int i, double len)
i
- Index of component to check.len
- Component length.true
if wrapping occurs.void finalizeHeight()
private void incrementNextBottomRow(double height)
height
- Increment height in character cells.private void incrementNextTopRow(double height)
height
- Increment height in character cells.void processSkip(int i)
i
- Index of component to process.void processSpace(int i)
i
- Index of component to process.void processFixedBottom(Point location)
location
- The widget location.void processBottom(int i, double len, int sh1, boolean place, double sh2)
As a side-effect, when this method exits, the nextBottomCol
should be incremented
at least by len
. If the next component (if it exists) needs extra space,
nextBottomCol
will be incremented by 1. If this widget is marked with
ATTR-SPACE
, the nextBottomCol
will be additionally incremented by 1. The
extraBottomSpaces
will keep the count of the extra spaces added.
In any case, the nextBottomCol
and extraBottomSpaces
must match the
top-line correspondents (that is nextTopCol
and extraTopSpaces
,
respectively), in order to keep the layout consistent (the next widget and its label to
be aligned at the same column).
i
- Index of component to process.len
- Widget length.sh1
- Widget column shift for space calculation.place
- Perform widget placement.sh2
- Widget column shift for placement.void processTop(int i, double len, Dimension top)
Dimension
instance.
As a side-effect, when this method exits, the nextTopCol
should be incremented at
least by len
. If the next component (if it exists) needs extra space,
nextTopCol
will be incremented by 1. If this widget is marked with
ATTR-SPACE
, the nextTopCol
will be additionally incremented by 1. The
extraTopSpaces
will keep the count of the extra spaces added.
i
- Index of component to process.len
- Calculated widget width.top
- Instance of Dimension
to adjust.void processFixedTop(Point location)
location
- The widget location.void processFixed(int i, Point location, double len, java.lang.String text)
i
- Widget index.location
- Widget location.len
- Widget length.text
- Label text.void resetHeaderStart()
void adjustDimensions(Dimension top, Dimension bottom)
Dimension
with calculated top
and bottom parts of layout.void setNextTopCol(double nextTopCol)
nextTopCol
- The nextTopCol to set.void setNextBottomCol(double nextBottomCol)
nextBottomCol
- The nextBottomCol to set.