org.wings
Class SGridLayout

java.lang.Object
  extended by org.wings.SAbstractLayoutManager
      extended by org.wings.SGridLayout
All Implemented Interfaces:
Serializable, Renderable, SConstants, SLayoutManager

public class SGridLayout
extends SAbstractLayoutManager

Swing-like grid layout.

Author:
Armin Haaf
See Also:
Serialized Form

Field Summary
protected  int border
           
protected  int cols
           
protected  ArrayList components
           
protected  int hgap
          The horizontal gap (in pixels) specifiying the space between columns.
protected  boolean renderFirstLineAsHeader
           
protected  int rows
           
protected  int vgap
          The vertical gap (in pixels) which specifiying the space between rows.
 
Fields inherited from class org.wings.SAbstractLayoutManager
cg, container, preferredSize
 
Fields inherited from interface org.wings.SConstants
BASELINE, BLOCK_ALIGN, BOTTOM, BOTTOM_ALIGN, CENTER, CENTER_ALIGN, HORIZONTAL, JUSTIFY, LEFT, LEFT_ALIGN, NO_ALIGN, RIGHT, RIGHT_ALIGN, TOP, TOP_ALIGN, UID_DIVIDER, VERTICAL
 
Constructor Summary
SGridLayout()
          creates a new grid layout with 1 row and 1 column extent
SGridLayout(int cols)
          creats a new grid layout with the given number of columns
SGridLayout(int rows, int cols)
          creats a new grid layout with the given number of columns and rows
SGridLayout(int rows, int cols, int hgap, int vgap)
          creats a new grid layout with the given number of columns and rows and the given gaps
 
Method Summary
 void addComponent(SComponent c, Object constraint, int index)
          Adds a component to the layout manager
 int getBorder()
          Typical PLAFs will render this layout as invisible table (border = 0).
 int getColumns()
          returns the number of columns
 List getComponents()
          returns a list of all components
 int getHgap()
          Gets the horizontal gap between components in pixel.
 boolean getRenderFirstLineAsHeader()
          setRenderFirstLineAsHeader(boolean)
 int getRows()
          returns the number of rows
 int getVgap()
          Gets the vertical gap between components in pixel.
 void removeComponent(SComponent c)
          Removes a component from the layout manager
 void setBorder(int borderWidth)
          Typical PLAFs will render this layout as invisible table (border = 0).
 void setColumns(int c)
          sets the number of columns
 void setHgap(int hgap)
          Sets the horizontal gap between components to the specified value in pixe.
 void setRenderFirstLineAsHeader(boolean renderAsTH)
          Renders the first line as HTML <th> instead regular <tr>.
 void setRows(int r)
          sets the number of rows
 void setVgap(int vgap)
          Sets the vertical gap between components to the specified value in pixel.
 
Methods inherited from class org.wings.SAbstractLayoutManager
getCG, getContainer, getPreferredSize, setCG, setContainer, setPreferredSize, updateCG, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

components

protected ArrayList components

rows

protected int rows

cols

protected int cols

border

protected int border

renderFirstLineAsHeader

protected boolean renderFirstLineAsHeader

hgap

protected int hgap
The horizontal gap (in pixels) specifiying the space between columns. They can be changed at any time. This should be a non-negative integer.


vgap

protected int vgap
The vertical gap (in pixels) which specifiying the space between rows. They can be changed at any time. This should be a non negative integer.

Constructor Detail

SGridLayout

public SGridLayout()
creates a new grid layout with 1 row and 1 column extent


SGridLayout

public SGridLayout(int cols)
creats a new grid layout with the given number of columns

Parameters:
cols - number of columns

SGridLayout

public SGridLayout(int rows,
                   int cols)
creats a new grid layout with the given number of columns and rows

Parameters:
rows - number of rows
cols - number of columns

SGridLayout

public SGridLayout(int rows,
                   int cols,
                   int hgap,
                   int vgap)
creats a new grid layout with the given number of columns and rows and the given gaps

Parameters:
rows - number of rows
cols - number of columns
hgap - horizontal gap
vgap - vertical gap
Method Detail

setColumns

public void setColumns(int c)
sets the number of columns

Parameters:
c - number of columns

getColumns

public int getColumns()
returns the number of columns

Returns:
number of columns

setRows

public void setRows(int r)
sets the number of rows

Parameters:
r - number of rows

getRows

public int getRows()
returns the number of rows

Returns:
number of rows

addComponent

public void addComponent(SComponent c,
                         Object constraint,
                         int index)
Description copied from interface: SLayoutManager
Adds a component to the layout manager

Parameters:
c - The new component
constraint - A (sometimes optional) constraint object

removeComponent

public void removeComponent(SComponent c)
Description copied from interface: SLayoutManager
Removes a component from the layout manager

Parameters:
c - The new component

getComponents

public List getComponents()
returns a list of all components

Returns:
all components

getHgap

public int getHgap()
Gets the horizontal gap between components in pixel. Rendered half as margin left and margin right Some PLAFs might ignore this property.

Returns:
the horizontal gap between components

setHgap

public void setHgap(int hgap)
Sets the horizontal gap between components to the specified value in pixe. Rendered half as margin left and margin right Some PLAFs might ignore this property.

Parameters:
hgap - the horizontal gap between components

getVgap

public int getVgap()
Gets the vertical gap between components in pixel. Rendered half as margin top and margin bottom Some PLAFs might ignore this property.

Returns:
the vertical gap between components

setVgap

public void setVgap(int vgap)
Sets the vertical gap between components to the specified value in pixel. Rendered half as margin top and margin bottom. Some PLAFs might ignore this property.

Parameters:
vgap - the vertical gap between components

setBorder

public void setBorder(int borderWidth)
Typical PLAFs will render this layout as invisible table (border = 0). Use this property to make it visible

Specified by:
setBorder in interface SLayoutManager
Overrides:
setBorder in class SAbstractLayoutManager
Parameters:
borderWidth - The rendered border with in pixel

getBorder

public int getBorder()
Typical PLAFs will render this layout as invisible table (border = 0). Use this property to make it visible

Specified by:
getBorder in interface SLayoutManager
Overrides:
getBorder in class SAbstractLayoutManager
Returns:
The rendered border with in pixel

setRenderFirstLineAsHeader

public void setRenderFirstLineAsHeader(boolean renderAsTH)
Renders the first line as HTML <th> instead regular <tr>.

Parameters:
renderAsTH - true if first line should be rendered as header

getRenderFirstLineAsHeader

public boolean getRenderFirstLineAsHeader()
setRenderFirstLineAsHeader(boolean)



wingS Swings ;-)