org.zaval.lw
Class LwListLayout

java.lang.Object
  |
  +--org.zaval.lw.LwListLayout
All Implemented Interfaces:
LwLayout, PosInfo

public class LwListLayout
extends java.lang.Object
implements LwLayout, PosInfo

The class implements layout manager interface. Every following component is laidout under previous component. The preferred width is calculated as a maximum among children preferred size widths of the owner component.


Constructor Summary
LwListLayout()
          Constructs the layout manager.
LwListLayout(int gap)
          Constructs the layout manager with the specified gap.
 
Method Summary
 java.awt.Dimension calcPreferredSize(LayoutContainer lw)
          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.
 int getLines()
          Implements org.zaval.misc.PosInfo interface method to define number of lines.
 int getLineSize(int line)
          Implements org.zaval.misc.PosInfo interface method to define the line size.
 int getMaxOffset()
          Implements org.zaval.misc.PosInfo interface method to define max offset.
 void layout(LayoutContainer lw)
          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
 

Constructor Detail

LwListLayout

public LwListLayout()
Constructs the layout manager.

LwListLayout

public LwListLayout(int gap)
Constructs the layout manager with the specified gap. The gap is an indent between laidout components.
Parameters:
gap - the specified gap.
Method Detail

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 removed
index - the child index.

calcPreferredSize

public java.awt.Dimension calcPreferredSize(LayoutContainer lw)
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.
Specified by:
calcPreferredSize in interface LwLayout
Parameters:
lw - the layout container.

layout

public void layout(LayoutContainer lw)
Lays out the child layoutable components inside the layout container.
Specified by:
layout in interface LwLayout
Parameters:
target - the layout container that needs to be laid out.

getLineSize

public int getLineSize(int line)
Implements org.zaval.misc.PosInfo interface method to define the line size. The implementation provides ability to navigate over the layout manager owner components using org.zaval.misc.PosController class.
Specified by:
getLineSize in interface PosInfo
Parameters:
line - the line number.
Returns:
a size of the specified line. The method returns "1" as the result for every line number.

getLines

public int getLines()
Implements org.zaval.misc.PosInfo interface method to define number of lines. The implementation provides ability to navigate over the layout manager owner components using org.zaval.misc.PosController class.
Specified by:
getLines in interface PosInfo
Returns:
a number of lines. The method returns number the owner components.

getMaxOffset

public int getMaxOffset()
Implements org.zaval.misc.PosInfo interface method to define max offset. The implementation provides ability to navigate over the layout manager owner components using org.zaval.misc.PosController class.
Specified by:
getMaxOffset in interface PosInfo
Returns:
a max offset.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org