Class WTable
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.WWidget
-
- eu.webtoolkit.jwt.WWebWidget
-
- eu.webtoolkit.jwt.WInteractWidget
-
- 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 thecellat 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:
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_, noDefault
-
Fields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS
-
-
Constructor Summary
Constructors Constructor Description WTable()Creates an empty table.WTable(WContainerWidget parentContainer)Creates an empty table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the entire table.protected WTableCellcreateCell(int row, int column)Creates a table cell.protected WTableColumncreateColumn(int column)Creates a table column.protected DomElementcreateDomElement(WApplication app)Create DOM element for widget.protected WTableRowcreateRow(int row)Creates a table row.WTableColumngetColumnAt(int column)Returns the column object for the given column.intgetColumnCount()Returns the number of columns in the table.protected voidgetDomChanges(java.util.List<DomElement> result, WApplication app)Get DOM changes for this widget.WTableCellgetElementAt(int row, int column)Accesses the table element at the given row and column.intgetHeaderCount()Returns the number of header rows or columns.intgetHeaderCount(Orientation orientation)Returns the number of header rows or columns.WTableRowgetRowAt(int row)Returns the row object for the given row.intgetRowCount()Returns the number of rows in the table.WTableColumninsertColumn(int column)Inserts an empty column.WTableColumninsertColumn(int column, WTableColumn tableColumn)Inserts an empty column.WTableRowinsertRow(int row)Inserts a row.WTableRowinsertRow(int row, WTableRow tableRow)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.WTableColumnremoveColumn(int column)Remove a column and all its contents.WTableRowremoveRow(int row)Removes a row.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, unsetDraggable
-
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, 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, hideToolTip, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, 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, widgetRemoved
-
Methods 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, tr
-
Methods inherited from class eu.webtoolkit.jwt.WObject
getObjectName, setFormData
-
-
-
-
Constructor Detail
-
WTable
public WTable(WContainerWidget parentContainer)
Creates an empty table.
-
WTable
public WTable()
Creates an empty table.
-
-
Method Detail
-
remove
public void remove()
Deletes the table and its entire contents.- Overrides:
removein classWInteractWidget- See Also:
WWidget.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.
-
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.
-
removeCell
public void removeCell(WTableCell item)
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
public final WTableRow insertRow(int row)
Inserts a row.Returns
insertRow(row, null)
-
removeRow
public WTableRow removeRow(int row)
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
public WTableColumn insertColumn(int column, WTableColumn tableColumn)
Inserts an empty column.
-
insertColumn
public final WTableColumn insertColumn(int column)
Inserts an empty column.Returns
insertColumn(column, null)
-
removeColumn
public WTableColumn removeColumn(int column)
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
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.
-
getHeaderCount
public int getHeaderCount(Orientation orientation)
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
torow 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
tocolumn is beyond the current table dimensions.- See Also:
moveRow(int from, int to)
-
createCell
protected WTableCell createCell(int row, int column)
Creates a table cell.You may want to override this method if you want your table to contain specialized cells.
-
createRow
protected WTableRow createRow(int row)
Creates a table row.You may want to override this method if you want your table to contain specialized rows.
-
createColumn
protected WTableColumn createColumn(int column)
Creates a table column.You may want to override this method if you want your table to contain specialized columns.
-
createDomElement
protected DomElement createDomElement(WApplication app)
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
protected void getDomChanges(java.util.List<DomElement> result, WApplication app)
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
protected void iterateChildren(HandleWidgetMethod method)
- Overrides:
iterateChildrenin classWWebWidget
-
-