org.zaval.lw
Class LwRasterLayout
java.lang.Object
|
+--org.zaval.lw.LwRasterLayout
- All Implemented Interfaces:
- LwLayout
- public class LwRasterLayout
- extends java.lang.Object
- implements LwLayout
This class implements layout manager interface. The layout manager uses original
locations (that have been set using setLocation method) and original
sizes (that have been set using setSize method) or preferred sizes to layout
child components. It is possible to align child components sizes according to the
parent component area, in this case the child component will be sized to have right bottom
corner in the right bottom corner of the parent container.
|
Field Summary |
static int |
H_BY_PARENT
Defines child heights alignment by the parent component. |
static int |
USE_PS_SIZE
Defines children preferred sizes usage as the child sizes. |
static int |
W_BY_PARENT
Defines child widths alignment by the parent component. |
|
Constructor Summary |
LwRasterLayout()
Constructs the layout manager that uses child components locations and sizes to layout its.
|
LwRasterLayout(int f)
Constructs the layout manager with the specified layout flag. |
|
Method Summary |
java.awt.Dimension |
calcPreferredSize(LayoutContainer c)
Calculates the preferred size dimensions for the layout container.
|
void |
componentAdded(java.lang.Object id,
Layoutable lw,
int index)
Invoked when the specified layoutable component is added to the layout container
(that uses the layout manager). |
void |
componentRemoved(Layoutable lw,
int index)
Invoked when the specified layoutable component is removed from the layout
container, that uses the layout manager. |
void |
layout(LayoutContainer c)
Lays out the child layoutable components inside the layout container.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
W_BY_PARENT
public static final int W_BY_PARENT
- Defines child widths alignment by the parent component.
H_BY_PARENT
public static final int H_BY_PARENT
- Defines child heights alignment by the parent component.
USE_PS_SIZE
public static final int USE_PS_SIZE
- Defines children preferred sizes usage as the child sizes.
LwRasterLayout
public LwRasterLayout()
- Constructs the layout manager that uses child components locations and sizes to layout its.
This layout is analog of
null layout for Java AWT Library.
LwRasterLayout
public LwRasterLayout(int f)
- Constructs the layout manager with the specified layout flag. The flag defines
what how the child components should be sized. The following constants (or its
combination) can be used as the flag value:
-
W_BY_PARENT - to align child components widths by parent size.
-
H_BY_PARENT - to align child components heights by parent size.
-
USE_PS_SIZE - to use preferred sizes as the child components sizes.
- Parameters:
f - the specified layout flag.
componentAdded
public void componentAdded(java.lang.Object id,
Layoutable lw,
int index)
- Invoked when the specified layoutable component is added to the layout container
(that uses the layout manager). The specified constraints, layoutable component
and child index are passed as arguments into the method.
- Specified by:
componentAdded in interface LwLayout
- Parameters:
id - the layoutable component constraints.lw - the layoutable component.index - the child index.
componentRemoved
public void componentRemoved(Layoutable lw,
int index)
- Invoked when the specified layoutable component is removed from the layout
container, that uses the layout manager.
- Specified by:
componentRemoved in interface LwLayout
- Parameters:
lw - the layoutable component to be removedindex - the child index.
calcPreferredSize
public java.awt.Dimension calcPreferredSize(LayoutContainer c)
- Calculates the preferred size dimensions for the layout container.
The method calculates "pure" preferred size, it means that an insets
of the container is not considered as a part of the size. The layout
manager calculates the preferred size as maximal location of the right
bound for a visible child component.
- Specified by:
calcPreferredSize in interface LwLayout
- Parameters:
c - the layout container.
layout
public void layout(LayoutContainer c)
- Lays out the child layoutable components inside the layout container.
The layout algorithm just sizes child components if the layout flag indicates
to use preferred sizes or align child sizes and moves location of children using an offset that
is provided by
getLayoutOffset method of the container.
- Specified by:
layout in interface LwLayout
- Parameters:
c - the layout container that needs to be laid out.
|