public class TextModeLayout extends Layout
This is a special case layout specifically designed for InputComponent
.
When the on top mode of text layout is used this layout acts exactly like a table layout and uses the
given constraints. When this mode is false it uses a regular box Y layout mode and orders the elements one
on top of the other.
One important difference between this layout and the default table layout is that the vertical alignment
here is set to TOP
so the error label below doesn't break component alignment if two components
are on the same row and only one has an error message.
The following code demonstrates a simple set of inputs and validation as it appears in iOS, Android and with validation errors
Modifier and Type | Field and Description |
---|---|
TableLayout |
table
The underlying table layout can be used freely to create constraints on the fly
|
Constructor and Description |
---|
TextModeLayout(int rows,
int columns)
The constructor works like the standard table layout constructor and will behave as such with the on
top mode
|
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(Object value,
Component comp,
Container c)
Some layouts can optionally track the addition of elements with meta-data
that allows the user to "hint" on object positioning.
|
TableLayout.Constraint |
cc()
Creates a new Constraint instance to add to the layout
|
TableLayout.Constraint |
cc(int row,
int column)
Creates a new Constraint instance to add to the layout
|
Object |
cloneConstraint(Object constraint) |
TableLayout.Constraint |
createConstraint()
Creates a new Constraint instance to add to the layout
|
TableLayout.Constraint |
createConstraint(int row,
int column)
Creates a new Constraint instance to add to the layout
|
Object |
getComponentConstraint(Component comp)
Returns the optional component constraint
|
Dimension |
getPreferredSize(Container parent)
Returns the container preferred size
|
boolean |
isAutoGrouping()
Automatically invokes the
InputComponent.group(com.codename1.ui.Component...)
method on the text components in a BoxY layout scenario |
boolean |
isConstraintTracking()
If this method returns true, the addLayoutComponent method will be called when replacing a
layout for every component within the container
|
boolean |
isOverlapSupported()
This method returns true if the Layout allows Components to
Overlap.
|
void |
layoutContainer(Container parent)
Layout the given parent container children
|
boolean |
obscuresPotential(Container parent)
Some layout managers can obscure their child components in some cases this
returns true if the basic underpinnings are in place for that.
|
void |
removeLayoutComponent(Component comp)
Removes the component from the layout this operation is only useful if the
layout maintains references to components within it
|
void |
setAutoGrouping(boolean autoGrouping)
Automatically invokes the
InputComponent.group(com.codename1.ui.Component...)
method on the text components in a BoxY layout scenario |
equals, getChildrenInTraversalOrder, hashCode, overridesTabIndices, updateTabIndices
public final TableLayout table
public TextModeLayout(int rows, int columns)
rows
- the number of rowscolumns
- the number of columns;public void addLayoutComponent(Object value, Component comp, Container c)
addLayoutComponent
in class Layout
value
- optional meta data information, like alignment orientationcomp
- the added component to the layoutc
- the parent containerpublic Object cloneConstraint(Object constraint)
cloneConstraint
in class Layout
public Object getComponentConstraint(Component comp)
getComponentConstraint
in class Layout
comp
- the component whose constraint should be returnedpublic boolean isConstraintTracking()
isConstraintTracking
in class Layout
public boolean isOverlapSupported()
isOverlapSupported
in class Layout
public boolean obscuresPotential(Container parent)
obscuresPotential
in class Layout
parent
- parent containerpublic void removeLayoutComponent(Component comp)
removeLayoutComponent
in class Layout
comp
- the removed component from layoutpublic void layoutContainer(Container parent)
layoutContainer
in class Layout
parent
- the given parent containerpublic Dimension getPreferredSize(Container parent)
getPreferredSize
in class Layout
parent
- the parent containerpublic TableLayout.Constraint createConstraint()
public TableLayout.Constraint cc()
public TableLayout.Constraint createConstraint(int row, int column)
row
- the row for the table starting with 0column
- the column for the table starting with 0public TableLayout.Constraint cc(int row, int column)
row
- the row for the table starting with 0column
- the column for the table starting with 0public boolean isAutoGrouping()
InputComponent.group(com.codename1.ui.Component...)
method on the text components in a BoxY layout scenariopublic void setAutoGrouping(boolean autoGrouping)
InputComponent.group(com.codename1.ui.Component...)
method on the text components in a BoxY layout scenarioautoGrouping
- the autoGrouping to set