public class LinearLayout extends Object implements LayoutManager
Modifier and Type | Class and Description |
---|---|
static class |
LinearLayout.Alignment
This enum type will decide the alignment of a component on the counter-axis, meaning the horizontal alignment on
vertical
LinearLayout s and vertical alignment on horizontal LinearLayout s. |
Constructor and Description |
---|
LinearLayout()
Default constructor, creates a vertical
LinearLayout |
LinearLayout(Direction direction)
Standard constructor that creates a
LinearLayout with a specified direction to position the components on |
Modifier and Type | Method and Description |
---|---|
static LayoutData |
createLayoutData(LinearLayout.Alignment alignment)
Creates a
LayoutData for LinearLayout that assigns a component to a particular alignment on its
counter-axis, meaning the horizontal alignment on vertical LinearLayout s and vertical alignment on
horizontal LinearLayout s. |
void |
doLayout(TerminalSize area,
List<Component> components)
Given a size constraint, update the location and size of each component in the component list by laying them out
in the available area.
|
TerminalSize |
getPreferredSize(List<Component> components)
This method returns the dimensions it would prefer to have to be able to layout all components while giving all
of them as much space as they are asking for.
|
int |
getSpacing()
Returns the amount of empty space to put in between components.
|
boolean |
hasChanged()
Returns true if the internal state of this LayoutManager has changed since the last call to doLayout.
|
LinearLayout |
setSpacing(int spacing)
Sets the amount of empty space to put in between components.
|
public LinearLayout()
LinearLayout
public LinearLayout(Direction direction)
LinearLayout
with a specified direction to position the components ondirection
- Direction for this Direction
public static LayoutData createLayoutData(LinearLayout.Alignment alignment)
LayoutData
for LinearLayout
that assigns a component to a particular alignment on its
counter-axis, meaning the horizontal alignment on vertical LinearLayout
s and vertical alignment on
horizontal LinearLayout
s.alignment
- Alignment to store in the LayoutData
objectLayoutData
object created for LinearLayout
s with the specified alignmentLinearLayout.Alignment
public LinearLayout setSpacing(int spacing)
spacing
- Spacing between components, either in number of columns or rows depending on the directionpublic int getSpacing()
public TerminalSize getPreferredSize(List<Component> components)
LayoutManager
getPreferredSize
in interface LayoutManager
components
- List of componentspublic boolean hasChanged()
LayoutManager
hasChanged
in interface LayoutManager
true
if this layout manager's internal state has changed since the last call to doLayout
public void doLayout(TerminalSize area, List<Component> components)
LayoutManager
setPosition(..)
and setSize(..)
on the Components.doLayout
in interface LayoutManager
area
- Size available to this layout manager to lay out the components oncomponents
- List of components to lay outCopyright © 2016. All rights reserved.