com.tecnick.jwtm
Class VFlowLayout

java.lang.Object
  extended by java.awt.FlowLayout
      extended by com.tecnick.jwtm.VFlowLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.io.Serializable

public class VFlowLayout
extends java.awt.FlowLayout

Title: VFlowLayout

Description: A Vertical Flow Layout extends FlowLayout. This class arranges components in a top-to-bottom flow. This layout lets each component assume its natural (preferred) size.


Copyright (c) 2002-2006 Tecnick.com S.r.l (www.tecnick.com) Via Ugo Foscolo n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com - info@tecnick.com
Project homepage: http://jxhtmledit.sourceforge.net
License: http://www.gnu.org/copyleft/gpl.html GPL 2

Version:
1.1.003
Author:
Nicola Asuni [www.tecnick.com].
See Also:
Serialized Form

Field Summary
static int BOTTOM
          This value indicates that each column of components should be vertical aligned to the bottm.
static int CENTER
          This value indicates that each row of components should be centered.
private  int halign
          align is the property that determines how each row distributes empty space.
private  int hgap
          The flow layout manager allows a seperation of components with gaps.
static int LEFT
          This value indicates that each row of components should be left-justified.
static int MIDDLE
          This value indicates that each column of components should be vertical aligned to the middle.
private  int orientation
          orientation is the property that determines the component orientation (LTR or RTL).
static int RIGHT
          This value indicates that each row of components should be right-justified.
private static long serialVersionUID
          serialVersionUID
static int TOP
          This value indicates that each column of components should be vertical aligned to the top.
private  int valign
          valign is the property that determines how each column distributes empty space.
private  int vgap
          The flow layout manager allows a seperation of components with gaps.
 
Fields inherited from class java.awt.FlowLayout
LEADING, TRAILING
 
Constructor Summary
VFlowLayout()
          Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap.
VFlowLayout(int halign, int valign)
          Constructs a new FlowLayout with the specified alignment and a default 5-unit horizontal and vertical gap.
VFlowLayout(int halign, int valign, int hgap, int vgap)
          Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.
 
Method Summary
 int getHAlignment()
          Gets the horizontal alignment for this layout.
 int getHgap()
          Gets the horizontal gap between components.
 int getVAlignment()
          Gets the verical alignment for this layout.
 int getVgap()
          Gets the vertical gap between components.
 void layoutContainer(java.awt.Container target)
          Lays out the container.
 java.awt.Dimension minimumLayoutSize(java.awt.Container target)
          Returns the minimum dimensions needed to layout the visible components contained in the specified target container.
private  void moveComponents(java.awt.Container target, int x, int y, int width, int height, int colStart, int colEnd, boolean ltr)
          Centers the elements in the specified column, if there is any slack.
 java.awt.Dimension preferredLayoutSize(java.awt.Container target)
          Returns the preferred dimensions for this layout given the visible components in the specified target container.
 void setHAlignment(int halign)
          Sets the horizontal alignment for this layout.
 void setHgap(int hgap)
          Sets the horizontal gap between components.
 void setorientation(int o)
          Sets the component orientation.
 void setVAlignment(int valign)
          Sets the vertical alignment for this layout.
 void setVgap(int vgap)
          Sets the vertical gap between components.
 
Methods inherited from class java.awt.FlowLayout
addLayoutComponent, getAlignment, removeLayoutComponent, setAlignment, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
serialVersionUID

See Also:
Constant Field Values

LEFT

public static final int LEFT
This value indicates that each row of components should be left-justified.

See Also:
Constant Field Values

CENTER

public static final int CENTER
This value indicates that each row of components should be centered.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
This value indicates that each row of components should be right-justified.

See Also:
Constant Field Values

TOP

public static final int TOP
This value indicates that each column of components should be vertical aligned to the top.

See Also:
Constant Field Values

MIDDLE

public static final int MIDDLE
This value indicates that each column of components should be vertical aligned to the middle.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
This value indicates that each column of components should be vertical aligned to the bottm.

See Also:
Constant Field Values

halign

private int halign
align is the property that determines how each row distributes empty space. It can be one of the following values:


valign

private int valign
valign is the property that determines how each column distributes empty space. It can be one of the following values:


hgap

private int hgap
The flow layout manager allows a seperation of components with gaps. The horizontal gap will specify the space between components.

See Also:
getHgap(), setHgap(int)

vgap

private int vgap
The flow layout manager allows a seperation of components with gaps. The vertical gap will specify the space between rows.

See Also:
getHgap(), setHgap(int)

orientation

private int orientation
orientation is the property that determines the component orientation (LTR or RTL). It can be one of the following values:

Constructor Detail

VFlowLayout

public VFlowLayout()
Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap.


VFlowLayout

public VFlowLayout(int halign,
                   int valign)
Constructs a new FlowLayout with the specified alignment and a default 5-unit horizontal and vertical gap. The value of the alignment argument must be one of FlowLayout.LEFT, FlowLayout.RIGHT, or FlowLayout.CENTER.

Parameters:
halign - the horizontal alignment value
valign - the vertical alignment value

VFlowLayout

public VFlowLayout(int halign,
                   int valign,
                   int hgap,
                   int vgap)
Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.

The value of the horizontal alignment argument must be one of VFlowLayout.LEFT, VFlowLayout.RIGHT, or VFlowLayout.CENTER. The value of the vertical alignment argument must be one of VFlowLayout.TOP, VFlowLayout.MIDDLE, VFlowLayout.BOTTOM.

Parameters:
halign - horizontal alignment value
valign - vertical alignment value
hgap - the horizontal gap between components
vgap - the vertical gap between components
Method Detail

getVAlignment

public int getVAlignment()
Gets the verical alignment for this layout. Possible values are VFlowLayout.TOP, VFlowLayout.MIDDLE, VFlowLayout.BOTTOM,

Returns:
the alignment value for this layout

setVAlignment

public void setVAlignment(int valign)
Sets the vertical alignment for this layout. Possible values are VFlowLayout.TOP, VFlowLayout.MIDDLE, VFlowLayout.BOTTOM.

Parameters:
valign - vertical alignment

getHAlignment

public int getHAlignment()
Gets the horizontal alignment for this layout. Possible values are VFlowLayout.LEFT, VFlowLayout.RIGHT, VFlowLayout.CENTER,

Returns:
the alignment value for this layout

setHAlignment

public void setHAlignment(int halign)
Sets the horizontal alignment for this layout. Possible values are VFlowLayout.TOP, VFlowLayout.MIDDLE, VFlowLayout.BOTTOM,

Parameters:
halign - vertical alignment

setorientation

public void setorientation(int o)
Sets the component orientation. Possible values are VFlowLayout.LEFT, VFlowLayout.RIGHT.

Parameters:
o - orientation

getHgap

public int getHgap()
Gets the horizontal gap between components.

Overrides:
getHgap in class java.awt.FlowLayout
Returns:
the horizontal gap between components

setHgap

public void setHgap(int hgap)
Sets the horizontal gap between components.

Overrides:
setHgap in class java.awt.FlowLayout
Parameters:
hgap - the horizontal gap between components

getVgap

public int getVgap()
Gets the vertical gap between components.

Overrides:
getVgap in class java.awt.FlowLayout
Returns:
the vertical gap between components

setVgap

public void setVgap(int vgap)
Sets the vertical gap between components.

Overrides:
setVgap in class java.awt.FlowLayout
Parameters:
vgap - the vertical gap between components

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container target)
Returns the preferred dimensions for this layout given the visible components in the specified target container.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Overrides:
preferredLayoutSize in class java.awt.FlowLayout
Parameters:
target - the component which needs to be laid out
Returns:
the preferred dimensions to lay out the subcomponents of the specified container
See Also:
Container, minimumLayoutSize(java.awt.Container), Container.getPreferredSize()

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container target)
Returns the minimum dimensions needed to layout the visible components contained in the specified target container.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Overrides:
minimumLayoutSize in class java.awt.FlowLayout
Parameters:
target - the component which needs to be laid out
Returns:
the minimum dimensions to lay out the subcomponents of the specified container
See Also:
preferredLayoutSize(java.awt.Container), Container, Container.doLayout()

moveComponents

private void moveComponents(java.awt.Container target,
                            int x,
                            int y,
                            int width,
                            int height,
                            int colStart,
                            int colEnd,
                            boolean ltr)
Centers the elements in the specified column, if there is any slack.

Parameters:
target - the component which needs to be moved
x - the x coordinate
y - the y coordinate
width - the width dimensions
height - the height dimensions
colStart - the beginning of the column
colEnd - the the ending of the column
ltr - orientation

layoutContainer

public void layoutContainer(java.awt.Container target)
Lays out the container. This method lets each component take its preferred size by reshaping the components in the target container in order to satisfy the alignment of this FlowLayout object.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Overrides:
layoutContainer in class java.awt.FlowLayout
Parameters:
target - the specified component being laid out
See Also:
Container, Container.doLayout()