Class WTable
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(int column), or deleteRow(int row) 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:
-
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_, noDefaultFields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS -
Constructor Summary
ConstructorsConstructorDescriptionWTable()Creates an empty table.WTable(WContainerWidget parentContainer) Creates an empty table. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the entire table.protected WTableCellcreateCell(int row, int column) Creates a table cell.protected WTableColumncreateColumn(int column) Creates a table column.protected DomElementCreate DOM element for widget.protected WTableRowcreateRow(int row) Creates a table row.getColumnAt(int column) Returns the column object for the given column.intReturns the number of columns in the table.protected voidgetDomChanges(List<DomElement> result, WApplication app) Get DOM changes for this widget.getElementAt(int row, int column) Accesses the table element at the given row and column.final intReturns the number of header rows or columns.intgetHeaderCount(Orientation orientation) Returns the number of header rows or columns.getRowAt(int row) Returns the row object for the given row.intReturns the number of rows in the table.final WTableColumninsertColumn(int column) Inserts an empty column.insertColumn(int column, WTableColumn tableColumn) Inserts an empty column.final WTableRowinsertRow(int row) Inserts a row.Inserts a row.protected voiditerateChildren(HandleWidgetMethod method) voidmoveColumn(int from, int to) Move a table column from its original position to a new position.voidmoveRow(int from, int to) Move a table row from its original position to a new position.voidremove()Deletes the table and its entire contents.voidremoveCell(int row, int column) Deletes the table cell at the given position.voidremoveCell(WTableCell item) Deletes a table cell and its contents.removeColumn(int column) Remove a column and all its contents.removeRow(int row) Removes a row.final voidsetHeaderCount(int count) Sets the number of header rows or columns.voidsetHeaderCount(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, render, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggableMethods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, doJavaScript, enableAjax, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, formDataChanged, 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, hideToolTip, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, resendFormData, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemovedMethods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, trMethods inherited from class eu.webtoolkit.jwt.WObject
getObjectName, setFormData
-
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:
removein classWInteractWidget- See Also:
-
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.- See Also:
-
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.- See Also:
-
removeCell
Deletes a table cell and its contents.The table cell at that position is recreated.
- See Also:
-
removeCell
public void removeCell(int row, int column) Deletes the table cell at the given position.- See Also:
-
insertRow
Inserts a row. -
insertRow
Inserts a row.Returns
insertRow(row, null) -
removeRow
Removes a row.Rows below the given row are shifted up. Returns a
WTableRowthat is not associated with aWTable. UnlinkeremoveColumn(), the cells in the row will not be deleted, because they are owned by theWTableRow. -
insertColumn
Inserts an empty column. -
insertColumn
Inserts an empty column.Returns
insertColumn(column, null) -
removeColumn
Remove a column and all its contents.The contents of the column will be deleted, because a
WTableColumndoes not own its cells. -
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.- See Also:
-
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
torow is beyond the current table dimensions.- See Also:
-
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
tocolumn is beyond the current table dimensions.- See Also:
-
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:WWebWidgetCreate DOM element for widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
createDomElementin classWWebWidget
-
getDomChanges
Description copied from class:WWebWidgetGet DOM changes for this widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
getDomChangesin classWWebWidget
-
iterateChildren
- Overrides:
iterateChildrenin classWWebWidget
-