eu.webtoolkit.jwt
Class WTable

java.lang.Object
  extended by eu.webtoolkit.jwt.WObject
      extended by eu.webtoolkit.jwt.WWidget
          extended by eu.webtoolkit.jwt.WWebWidget
              extended by eu.webtoolkit.jwt.WInteractWidget
                  extended by eu.webtoolkit.jwt.WTable

public class WTable
extends WInteractWidget

A container widget which provides layout of children in a table grid.

A WTable arranges its children in a table.

To insert or access contents, use getElementAt() to access the cell at a particular location in the table. The WTable expands automatically to create the indexed (row, column) as necessary.

It is possible to insert and delete entire rows or columns from the table using the insertColumn(), insertRow(), deleteColumn(), or deleteRow() methods.

You may indicate a number of rows and columns that act as headers using setHeaderCount(). Header cells are rendered as <th> instead of <td> elements. By default, no rows or columns are configured as headers.

WTable is displayed as a block.

CSS

The widget corresponds to the HTML <table> tag and does not provide styling. It can be styled using inline or external CSS as appropriate.

See Also:
WTableCell, WTableRow, WTableColumn

Constructor Summary
WTable()
          Creates an empty table.
WTable(WContainerWidget parent)
          Creates an empty table.
 
Method Summary
 void clear()
          Clears the entire table.
 void deleteColumn(int column)
          Delete a column and all its contents.
 void deleteRow(int row)
          Deletes a row and all its contents.
 WTableColumn getColumnAt(int column)
          Returns the column object for the given column.
 int getColumnCount()
          Returns the number of columns in the table.
 WTableCell getElementAt(int row, int column)
          Accesses the table element at the given row and column.
 int getHeaderCount()
          Returns the number of header rows or columns.
 int getHeaderCount(Orientation orientation)
          Returns the number of header rows or columns.
 WTableRow getRowAt(int row)
          Returns the row object for the given row.
 int getRowCount()
          Returns the number of rows in the table.
 WTableColumn insertColumn(int column)
          Inserts an empty column.
 WTableRow insertRow(int row)
          Inserts an empty row.
 void moveColumn(int from, int to)
          Move a table column from its original position to a new position.
 void moveRow(int from, int to)
          Move a table row from its original position to a new position.
 void remove()
          Deletes the table and its entire contents.
 void removeCell(int row, int column)
          Deletes the table cell at the given position.
 void removeCell(WTableCell item)
          Deletes a table cell and its contents.
 void setHeaderCount(int count)
          Sets the number of header rows or columns.
 void setHeaderCount(int count, Orientation orientation)
          Sets the number of header rows or columns.
 
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted
 
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, callJavaScriptMember, childrenChanged, doJavaScript, domCanBeSaved, enableAjax, escapeText, escapeText, escapeText, escapeText, find, getAttributeValue, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isVisible, jsStringLiteral, jsStringLiteral, refresh, removeScript, removeStyleClass, render, resize, setAttributeValue, setClearSides, setDecorationStyle, setDisabled, setFloatSide, setHidden, setHiddenKeepsGeometry, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPopup, setPositionScheme, setSelectable, setStyleClass, setTabIndex, setToolTip, setVerticalAlignment, updateSignalConnection
 
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
 
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getObjectName, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WTable

public WTable(WContainerWidget parent)
Creates an empty table.


WTable

public WTable()
Creates an empty table.

Calls this((WContainerWidget)null)

Method Detail

remove

public void remove()
Deletes the table and its entire contents.

Overrides:
remove in class WInteractWidget
See Also:
WContainerWidget.removeWidget(WWidget widget)

getElementAt

public WTableCell getElementAt(int row,
                               int column)
Accesses the table element at the given row and column.

If the row/column is beyond the current table dimensions, then the table is expanded automatically.


getRowAt

public WTableRow getRowAt(int row)
Returns the row object for the given row.

Like with getElementAt() , the table expands automatically when the row is beyond the current table dimensions.

See Also:
getElementAt(int row, int column), getColumnAt(int column)

getColumnAt

public WTableColumn getColumnAt(int column)
Returns the column object for the given column.

Like with getElementAt() , the table expands automatically when the column is beyond the current table dimensions.

See Also:
getElementAt(int row, int column), getRowAt(int row)

removeCell

public void removeCell(WTableCell item)
Deletes a table cell and its contents.

The table cell at that position is recreated.


removeCell

public void removeCell(int row,
                       int column)
Deletes the table cell at the given position.

See Also:
removeCell(WTableCell item)

insertRow

public WTableRow insertRow(int row)
Inserts an empty row.


deleteRow

public void deleteRow(int row)
Deletes a row and all its contents.

Rows below the given row are shifted up.


insertColumn

public WTableColumn insertColumn(int column)
Inserts an empty column.


deleteColumn

public void deleteColumn(int column)
Delete a column and all its contents.


clear

public void clear()
Clears the entire table.

This method clears the entire table: all cells and their contents are deleted.


getRowCount

public int getRowCount()
Returns the number of rows in the table.


getColumnCount

public int getColumnCount()
Returns the number of columns in the table.


setHeaderCount

public void setHeaderCount(int count,
                           Orientation orientation)
Sets the number of header rows or columns.

The default values are 0.

Note: This must be set before the initial rendering and cannot be changed later.


setHeaderCount

public final void setHeaderCount(int count)
Sets the number of header rows or columns.

Calls setHeaderCount(count, Orientation.Horizontal)


getHeaderCount

public int getHeaderCount(Orientation orientation)
Returns the number of header rows or columns.

See Also:
setHeaderCount(int count, Orientation orientation)

getHeaderCount

public final int getHeaderCount()
Returns the number of header rows or columns.

Returns getHeaderCount(Orientation.Horizontal)


moveRow

public void moveRow(int from,
                    int to)
Move a table row from its original position to a new position.

The table expands automatically when the to row is beyond the current table dimensions.

See Also:
moveColumn(int from, int to)

moveColumn

public void moveColumn(int from,
                       int to)
Move a table column from its original position to a new position.

The table expands automatically when the to column is beyond the current table dimensions.

See Also:
moveRow(int from, int to)