com.extjs.gxt.ui.client.widget.layout
Class TableLayout

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.Layout
          extended by com.extjs.gxt.ui.client.widget.layout.TableLayout
All Implemented Interfaces:
Observable
Direct Known Subclasses:
TableRowLayout

public class TableLayout
extends Layout

TableLayout allows you to easily render content into an HTML table. The total number of columns can be specified.

Rather than explicitly creating and nesting rows and columns as you would in HTML, you simply specify the total column count and start adding widgets in their natural order from left to right, top to bottom. The layout will automatically figure out, based on the column count how to position each panel within the table.


Field Summary
protected  Style.HorizontalAlignment cellHorizontalAlign
           
protected  java.util.List<java.util.List<java.lang.Boolean>> cells
           
protected  Style.VerticalAlignment cellVerticalAlign
           
protected  int currentColumn
           
protected  int currentRow
           
protected  com.google.gwt.dom.client.TableElement table
           
protected  com.google.gwt.user.client.Element tbody
           
 
Fields inherited from class com.extjs.gxt.ui.client.widget.Layout
activeItem, componentStyleName, container, monitorResize, renderHidden, target, targetStyleName
 
Constructor Summary
TableLayout()
          Creates a new table layout.
TableLayout(int columns)
          Creates a new table layout.
 
Method Summary
 int getBorder()
          Returns the border width.
 Style.HorizontalAlignment getCellHorizontalAlign()
          Returns the cell horizontal alignment.
 int getCellPadding()
          Returns the table cell's padding.
 Style.VerticalAlignment getCellVerticalAlign()
          Returns the cell's vertical alignment.
 int getColumns()
          Returns the number of columns.
 java.lang.String getHeight()
          Returns the table's height.
 boolean getInsertSpacer()
          Returns true if spacers are being inserted.
protected  com.google.gwt.user.client.Element getNextCell(Component widget)
           
protected  int[] getNextNonSpan(int colIndex, int rowIndex)
           
protected  El getRow(int index)
           
 java.lang.String getTableStyle()
          Returns the table style.
 java.lang.String getWidth()
          Returns the table's width.
protected  boolean isValidParent(com.google.gwt.user.client.Element elem, com.google.gwt.user.client.Element parent)
           
protected  void onLayout(Container<?> container, El target)
           
protected  void renderComponent(Component component, int index, El target)
           
 void setBorder(int border)
          Sets the table's border property (defaults to 0).
 void setCellHorizontalAlign(Style.HorizontalAlignment cellHorizontalAlign)
          Sets the cell's horizontal alignment.
 void setCellPadding(int padding)
          Sets the amount that will be applied to each table cell.
 void setCellSpacing(int spacing)
          Sets the table's cell spacing.
 void setCellVerticalAlign(Style.VerticalAlignment cellVerticalAlign)
          Sets the cell's vertical alignment.
 void setColumns(int columns)
          Sets the number of columns (defaults to 1).
 void setHeight(java.lang.String height)
          Sets the table's height.
 void setInsertSpacer(boolean insertSpacer)
          True to insert a spacer cell into each row with 100% width so that all other cells are right aligned (defaults to false).
 void setTableStyle(java.lang.String tableStyle)
          Custom CSS styles to be applied to the table in the format expected by El.applyStyles(java.lang.String).
protected  void setupList(int rowIndex)
           
 void setWidth(java.lang.String width)
          Sets the table's width.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Layout
applyMargins, applyPadding, callLayout, fly, fly, getExtraStyle, getLayoutData, getResizeDelay, getSideMargins, initTarget, isLayoutExecuted, isLayoutNeeded, isRenderHidden, isRunning, layout, layoutContainer, onAdd, onComponentHide, onComponentShow, onRemove, onResize, renderAll, setBounds, setContainer, setExtraStyle, setLayoutData, setLayoutNeeded, setLayoutOnChange, setPosition, setRenderHidden, setResizeDelay, setSize
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected com.google.gwt.dom.client.TableElement table

tbody

protected com.google.gwt.user.client.Element tbody

currentColumn

protected int currentColumn

currentRow

protected int currentRow

cellHorizontalAlign

protected Style.HorizontalAlignment cellHorizontalAlign

cellVerticalAlign

protected Style.VerticalAlignment cellVerticalAlign

cells

protected java.util.List<java.util.List<java.lang.Boolean>> cells
Constructor Detail

TableLayout

public TableLayout()
Creates a new table layout.


TableLayout

public TableLayout(int columns)
Creates a new table layout.

Parameters:
columns - the number of columns
Method Detail

getBorder

public int getBorder()
Returns the border width.

Returns:
the border width

getCellHorizontalAlign

public Style.HorizontalAlignment getCellHorizontalAlign()
Returns the cell horizontal alignment.

Returns:
the cell horizontal alignment

getCellPadding

public int getCellPadding()
Returns the table cell's padding.

Returns:
the cell padding

getCellVerticalAlign

public Style.VerticalAlignment getCellVerticalAlign()
Returns the cell's vertical alignment.

Returns:
the vertical alignment

getColumns

public int getColumns()
Returns the number of columns.

Returns:
the column count

getHeight

public java.lang.String getHeight()
Returns the table's height.

Returns:
the table height

getInsertSpacer

public boolean getInsertSpacer()
Returns true if spacers are being inserted.

Returns:
the insert spacer state

getTableStyle

public java.lang.String getTableStyle()
Returns the table style.

Returns:
the table style

getWidth

public java.lang.String getWidth()
Returns the table's width.

Returns:
the table width

setBorder

public void setBorder(int border)
Sets the table's border property (defaults to 0).

Parameters:
border - the border

setCellHorizontalAlign

public void setCellHorizontalAlign(Style.HorizontalAlignment cellHorizontalAlign)
Sets the cell's horizontal alignment. If specifed, the value will be applied to all cell's without a horizontal alignment specified.

Parameters:
cellHorizontalAlign - the horizontal alignment

setCellPadding

public void setCellPadding(int padding)
Sets the amount that will be applied to each table cell. This method does not change the table's cellpadding attribute.

Parameters:
padding - the cell padding

setCellSpacing

public void setCellSpacing(int spacing)
Sets the table's cell spacing.

Parameters:
spacing - the cell spacing

setCellVerticalAlign

public void setCellVerticalAlign(Style.VerticalAlignment cellVerticalAlign)
Sets the cell's vertical alignment. If specified, the value will be applied to all cell's without a horizontal alignment specified.

Parameters:
cellVerticalAlign - the vertical alignment

setColumns

public void setColumns(int columns)
Sets the number of columns (defaults to 1).

Parameters:
columns - the number of columns

setHeight

public void setHeight(java.lang.String height)
Sets the table's height.

Parameters:
height - the table height

setInsertSpacer

public void setInsertSpacer(boolean insertSpacer)
True to insert a spacer cell into each row with 100% width so that all other cells are right aligned (defaults to false).

Parameters:
insertSpacer - true to add a spacer

setTableStyle

public void setTableStyle(java.lang.String tableStyle)
Custom CSS styles to be applied to the table in the format expected by El.applyStyles(java.lang.String).

Parameters:
tableStyle - the table style

setWidth

public void setWidth(java.lang.String width)
Sets the table's width.

Parameters:
width - the table width

getNextCell

protected com.google.gwt.user.client.Element getNextCell(Component widget)

getNextNonSpan

protected int[] getNextNonSpan(int colIndex,
                               int rowIndex)

setupList

protected void setupList(int rowIndex)

getRow

protected El getRow(int index)

isValidParent

protected boolean isValidParent(com.google.gwt.user.client.Element elem,
                                com.google.gwt.user.client.Element parent)
Overrides:
isValidParent in class Layout

onLayout

protected void onLayout(Container<?> container,
                        El target)
Overrides:
onLayout in class Layout

renderComponent

protected void renderComponent(Component component,
                               int index,
                               El target)
Overrides:
renderComponent in class Layout