|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.frag.umlplugin.guilayout.FlexLayout
public abstract class FlexLayout
FlexLayout is a layout manager, that behaves similarly to GridBagLayout,
but is much simpler to use and a little bit less flexible. Complex
GUI designs must not be constructed by using FlexLayout directly, but
can be created by using the LayoutBuilder. There are two main types of
FlexLayout: horizontal and vertical arrangement of components.
A FlexLayout is constructed by calling one of the factory methods
createHorizontalLayout
and createVerticalLayout
.
Then components are filled into a unregularly rectangular raster with
each component associated to a FlexConstraint object, that describes how
to arrange and resize the corresponding component.
FlexConstraints
,
LayoutBuilder
Nested Class Summary | |
---|---|
protected class |
FlexLayout.Element
An Element is a component and its associated FlexConstraints object. |
protected static interface |
FlexLayout.SizeGetter
A SizeGetter gets size information from a component and is a simple hook to get different size information in the same way (minimum size, maximum size and preferred size). |
Field Summary | |
---|---|
protected int |
columns
|
protected java.util.List<FlexLayout.Element> |
components
|
protected int |
rows
|
Constructor Summary | |
---|---|
protected |
FlexLayout()
Protected constructor to prevend it from being called directly. |
Method Summary | |
---|---|
void |
addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
Add one more component to the layouter. |
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
Add a component to the layouter using default FlexConstraints. |
protected abstract FlexLayout.Element[][] |
createGrid()
Create a grid of elements with respect to the type of layouter (horizontal or vertical). |
static FlexLayout |
createHorizontalLayout(int columns)
Create a new horizontal arranging FlexLayout manager. |
static FlexLayout |
createVerticalLayout(int rows)
Create a new vertical arranging FlexLayout manager. |
float |
getLayoutAlignmentX(java.awt.Container target)
|
float |
getLayoutAlignmentY(java.awt.Container target)
|
protected java.awt.Dimension |
getLayoutSize(java.awt.Container target,
FlexLayout.SizeGetter getter)
Generic layout size calculator to compute values for minimum size, maximum size and preferred size. |
FlexConstraints |
getParentConstraints()
Get the constraints, that should be used to add a container with this layouter to a parent container, that uses FlexLayout, too. |
void |
invalidateLayout(java.awt.Container target)
|
void |
layoutContainer(java.awt.Container parent)
Compute the layout for all components, that reside within the container with respect to the bounds of the parent container. |
java.awt.Dimension |
maximumLayoutSize(java.awt.Container target)
Get the maximum size of the target container. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
Get the minimum size of the target container. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
Get the preferred size of the target container. |
void |
removeLayoutComponent(java.awt.Component comp)
Remove the given component from the layouter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.List<FlexLayout.Element> components
protected int columns
protected int rows
Constructor Detail |
---|
protected FlexLayout()
createHorizontalLayout
and createVerticalLayout
.
Method Detail |
---|
public static FlexLayout createHorizontalLayout(int columns)
columns
- number of columns
public static FlexLayout createVerticalLayout(int rows)
rows
- number of rows
public void addLayoutComponent(@NotNull java.awt.Component comp, @NotNull java.lang.Object constraints)
addLayoutComponent
in interface java.awt.LayoutManager2
comp
- component to addconstraints
- layout constraints for the given component. This
must be of type FlexConstraints.public void addLayoutComponent(@NotNull java.lang.String name, @NotNull java.awt.Component comp)
addLayoutComponent
in interface java.awt.LayoutManager
name
- name of the component (will be ignored)comp
- component to addpublic void removeLayoutComponent(@NotNull java.awt.Component comp)
removeLayoutComponent
in interface java.awt.LayoutManager
comp
- component to removepublic float getLayoutAlignmentX(@NotNull java.awt.Container target)
getLayoutAlignmentX
in interface java.awt.LayoutManager2
public float getLayoutAlignmentY(@NotNull java.awt.Container target)
getLayoutAlignmentY
in interface java.awt.LayoutManager2
public void invalidateLayout(@NotNull java.awt.Container target)
invalidateLayout
in interface java.awt.LayoutManager2
@NotNull public FlexConstraints getParentConstraints()
@NotNull protected abstract FlexLayout.Element[][] createGrid()
@NotNull protected java.awt.Dimension getLayoutSize(@NotNull java.awt.Container target, @NotNull FlexLayout.SizeGetter getter)
target
- container to compute layout size forgetter
- size getter to get size information of a component
@NotNull public java.awt.Dimension maximumLayoutSize(@NotNull java.awt.Container target)
maximumLayoutSize
in interface java.awt.LayoutManager2
target
- container to compute maximum size for
@NotNull public java.awt.Dimension minimumLayoutSize(@NotNull java.awt.Container parent)
minimumLayoutSize
in interface java.awt.LayoutManager
parent
- container to compute minimum size for
@NotNull public java.awt.Dimension preferredLayoutSize(@NotNull java.awt.Container parent)
preferredLayoutSize
in interface java.awt.LayoutManager
parent
- container to compute preferred size for
public void layoutContainer(@NotNull java.awt.Container parent)
layoutContainer
in interface java.awt.LayoutManager
parent
- parent container information
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |