Class WTable
public class WTable extends WInteractWidget
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(int column), insertRow(int row), 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
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Field Summary
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_
-
Constructor Summary
Constructors Constructor Description WTable()
Creates an empty table.WTable(WContainerWidget parent)
Creates an empty table. -
Method Summary
Modifier and Type Method Description void
clear()
Clears the entire table.protected WTableCell
createCell(int row, int column)
Creates a table cell.protected WTableColumn
createColumn(int column)
Creates a table column.protected DomElement
createDomElement(WApplication app)
Create DOM element for widget.protected WTableRow
createRow(int row)
Creates a table row.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.protected void
getDomChanges(java.util.List<DomElement> result, WApplication app)
Get DOM changes for this widget.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.WTableColumn
insertColumn(int column, WTableColumn tableColumn)
Inserts an empty column.WTableRow
insertRow(int row)
Inserts an empty row.WTableRow
insertRow(int row, WTableRow tableRow)
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, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggable
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, blurred, callJavaScriptMember, childrenChanged, doJavaScript, enableAjax, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, jsStringLiteral, jsStringLiteral, parentResized, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, render, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, updateSignalConnection, voidEventSignal
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeChild, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setObjectName, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getObjectName, setFormData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WTable
Creates an empty table. -
WTable
public WTable()Creates an empty table.
-
-
Method Details
-
remove
public void remove()Deletes the table and its entire contents.- Overrides:
remove
in classWInteractWidget
- See Also:
WContainerWidget.removeWidget(WWidget widget)
-
getElementAt
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
Returns the row object for the given row.Like with
getElementAt()
, the table expands automatically when the row is beyond the current table dimensions. -
getColumnAt
Returns the column object for the given column.Like with
getElementAt()
, the table expands automatically when the column is beyond the current table dimensions. -
removeCell
Deletes a table cell and its contents.The table cell at that position is recreated.
- See Also:
removeCell(int row, int column)
-
removeCell
public void removeCell(int row, int column)Deletes the table cell at the given position.- See Also:
removeCell(WTableCell item)
-
insertRow
Inserts an empty row. -
insertRow
Inserts an empty row.Returns
insertRow(row, (WTableRow)null)
-
deleteRow
public void deleteRow(int row)Deletes a row and all its contents.Rows below the given row are shifted up.
-
insertColumn
Inserts an empty column. -
insertColumn
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
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. -
getHeaderCount
Returns the number of header rows or columns. -
getHeaderCount
public final int getHeaderCount()Returns the number of header rows or columns. -
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)
-
createCell
Creates a table cell.You may want to override this method if you want your table to contain specialized cells.
-
createRow
Creates a table row.You may want to override this method if you want your table to contain specialized rows.
-
createColumn
Creates a table column.You may want to override this method if you want your table to contain specialized columns.
-
createDomElement
Description copied from class:WWebWidget
Create DOM element for widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
createDomElement
in classWWebWidget
-
getDomChanges
Description copied from class:WWebWidget
Get DOM changes for this widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
getDomChanges
in classWWebWidget
-