WUI : API


org.westofj.wui
Class WGridLayout

java.lang.Object
  extended byorg.westofj.wui.WGridLayout
All Implemented Interfaces:
WLayoutManager

public final class WGridLayout
extends Object
implements WLayoutManager

Arranges Widgetcomponents in a WContainerin a grid.

If rows are specified but the number of columns are 0, the number of columns will be calculated based on the number of widgets in the container.

If columns are specified but the number of rows are 0, the number of rows will be calculated based on the number of widgets in the container.

If both rows and columns are specified, the number of columns takes precedence.

Widgets are rendered into the grid from left to right then top to bottom.

Version:
$Revision: 1.8 $, $Date: 2004/03/14 21:27:46 $
Author:
bill

Constructor Summary
WGridLayout()
          Constructs a grid layout manager.
WGridLayout(int columns, int rows)
          Constructs a grid layout manager with the specified number of rows and columns.
 
Method Summary
 int getColumns()
          Returns the number of columns.
 WHorizontalAlignment getDefaultHorizontalAlignment()
          Returns the horizontal alignment of the layout.
 WVerticalAlignment getDefaultVerticalAlignment()
          Returns the vertical alignment of the layout.
 WHorizontalAlignment getHorizontalAlignment(int column)
          Returns the horizontal alignment of the column.
 int getRows()
          Returns the number of rows.
 void render(WContainer container, WRunner runner, WRenderContext context, PrintWriter out)
          Renders the WContainer.
 void setColumns(int columns)
          Sets the number of columns in the grid layout.
 void setDefaultHorizontalAlignment(WHorizontalAlignment alignment)
          Sets the horizontal alignment of the layout to the specified alignment.
 void setDefaultVerticalAlignment(WVerticalAlignment alignment)
          Sets the vertical alignment of the layout to the specified alignment.
 void setHorizontalAlignment(int column, WHorizontalAlignment alignment)
          Sets the horizontal alignment of the column to the specified alignment.
 void setRows(int rows)
          Sets the number of rows in the grid layout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WGridLayout

public WGridLayout()
Constructs a grid layout manager.


WGridLayout

public WGridLayout(int columns,
                   int rows)
Constructs a grid layout manager with the specified number of rows and columns.

Parameters:
columns - the number of columns in the layout, 0 indicates not specified.
rows - the number of rows in the layout, 0 indicates not specified.
Method Detail

getColumns

public final int getColumns()
Returns the number of columns.

Returns:
int the number of columns.

getDefaultHorizontalAlignment

public WHorizontalAlignment getDefaultHorizontalAlignment()
Returns the horizontal alignment of the layout.

Returns:
the horizontal alignment of the layout.

getDefaultVerticalAlignment

public WVerticalAlignment getDefaultVerticalAlignment()
Returns the vertical alignment of the layout.

Returns:
the vertical alignment of the layout.

getHorizontalAlignment

public WHorizontalAlignment getHorizontalAlignment(int column)
Returns the horizontal alignment of the column.

Returns:
the horizontal alignment of the column.

getRows

public final int getRows()
Returns the number of rows.

Returns:
int the number of rows.

render

public final void render(WContainer container,
                         WRunner runner,
                         WRenderContext context,
                         PrintWriter out)
                  throws WRenderException
Description copied from interface: WLayoutManager
Renders the WContainer.

Specified by:
render in interface WLayoutManager
Parameters:
container - the container to render.
runner - the current runner context.
out - the PrintWriterto which to render the WContainerinstance.
Throws:
WRenderException

setColumns

public final void setColumns(int columns)
Sets the number of columns in the grid layout.

Parameters:
columns - the number of columns in the layout.

setDefaultHorizontalAlignment

public void setDefaultHorizontalAlignment(WHorizontalAlignment alignment)
Sets the horizontal alignment of the layout to the specified alignment. A value of null will reset the value of the alignment to the default.

Parameters:
alignment - the horizontal alignment of the layout.

setDefaultVerticalAlignment

public void setDefaultVerticalAlignment(WVerticalAlignment alignment)
Sets the vertical alignment of the layout to the specified alignment. A value of null will reset the value of the alignment to the default.

Parameters:
alignment - the vertical alignment of the layout.

setHorizontalAlignment

public void setHorizontalAlignment(int column,
                                   WHorizontalAlignment alignment)
Sets the horizontal alignment of the column to the specified alignment. A value of null will reset the value of the alignment to the default.

Parameters:
alignment - the horizontal alignment of the layout.

setRows

public final void setRows(int rows)
Sets the number of rows in the grid layout.

Parameters:
rows - the number of rows in the layout.

Copyright (c) 2003 West of J - All rights reserved.