Table component is used for representing data or components in pageable and selectable table.
3.0
Inheritance Path. java.lang.Object-> com.itmill.toolkit.ui.AbstractComponent -> com.itmill.toolkit.ui.AbstractField -> com.itmill.toolkit.ui.Select -> com.itmill.toolkit.ui.Table
Row caption mode: Item captions are explicitly specified, but if the
caption is missing, the item id objects
toString()
is used
instead.
Row caption mode: Index of the item is used as item caption. * The index mode can only be used with the containers implementing Container.Indexed interface.
Parameters
actionHandler
the new handler to be added.
Registers a new action handler for this container
Parameters
propertyId
Id of the proprty
type
The class of the property
defaultValue
The default value given for all existing items
Adds a new property to the table and show it as a visible column.
Parameters
propertyId
Id of the proprty
type
The class of the property
defaultValue
The default value given for all existing items
columnHeader
Explicit header of the column. If explicit header is not needed, this should be set null.
columnIcon
Icon of the column. If icon is not needed, this should be set null.
columnAlignment
Alignment of the column. Null implies align left.
Adds a new property to the table and show it as a visible column.
Parameters
cells
Object array that is used for filling the visible cells new row. The types must be settable to visible column property types.
itemId
Id the new row. If null, a new id is automatically assigned. If given, the table cant already have a item with given id.
Returns item id for the new row. Returns null if operation fails.
Add new row to table and fill the visible cells with given values.
Parameters
previousItemId
Id of the previous item in ordered container.
Returns item id the the created new item or null if the operation fails.
addItemAfter(java.lang.Object)
Add new item after the given item.
Adding an item after null item adds the item as first item of the ordered container.
Parameters
previousItemId
Id of the previous item in ordered container.
newItemId
Id of the new item to be added.
Returns new item or null if the operation fails.
Add new item after the given item.
Adding an item after null item adds the item as first item of the ordered container.
attach()
Parameters
event
Variable change event containing the information about the changed variable.
Invoked when the value of a variable has changed.
Container datasource item set change. Table must flush its buffers on change.
Container datasource property set change. Table must flush its buffers on change.
attach()
Parameters
ID of the first Item in the Container
firstItemId()
Gets the ID of the first Item in the Container.
Exceptions
UnsupportedOperationException
if invoked.
focus()
Focusing to this component is not supported.
Parameters
propertyId
the propertyID identifying the column.
the specified column's alignment if it as one; null otherwise.
Gets the specified column's alignment.
Parameters
Column alignments array.
Get array of column alignments.
The items in the array must match the properties identified by
getVisibleColumns()
. The possible values for the
alignments include:
ALIGN_LEFT
: Left alignment
ALIGN_CENTER
: Centered
ALIGN_RIGHT
: Right alignment
The alignments default to
ALIGN_LEFT
: any null values are
rendered as align lefts.
Parameters
propertyId
the propertyId indentifying the column.
the header for the specifed column if it has one.
Gets the header for the specified column.
Parameters
Value of property columnHeaderMode.
Getter for property columnHeaderMode.
Parameters
Array of column headers.
Get the headers of the columns.
The headers match the property id:s given my the set visible column
headers. The table must be set in either
ROW_HEADER_MODE_EXPLICIT
or
ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID
mode to show the
headers. In the defaults mode any nulls in the headers array are replaced
with id.toString() outputs when rendering.
Parameters
propertyId
the propertyId indentifying the column.
the icon for the specified column; null if the column has no icon set, or if the column is not visible.
Gets the icon Resource for the specified column.
Parameters
Array of icons that match the
getVisibleColumns()
.
Get the icons of the columns.
The icons in headers match the property id:s given my the set visible
column headers. The table must be set in either
ROW_HEADER_MODE_EXPLICIT
or
ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID
mode to show the
headers with icons.
Parameters
Value of property currentPageFirstItem.
Getter for property currentPageFirstItem.
Parameters
Value of property currentPageFirstItem.
Getter for property currentPageFirstItem.
Parameters
FieldFactory used to create the Field instances.
isEditable()
Get the FieldFactory that is used to create editor for table cells. The FieldFactory is only used if the Table is editable.
Parameters
height of the object in units specified by heightUnits property.
Get height of the object. Negative number implies unspecified size (terminal is free to set the size).
Parameters
units used in height property.
getHeightUnits()
Get height property units.
Parameters
Lenght of one page.
Get the page length.
Setting page length 0 disables paging.
Parameters
The sortable field ids.
Get the container property IDs, which can be used to sort the item.
Parameters
Container property id of the currently sorted column.
Get the currently sorted column property ID.
Parameters
Value of property availableColumns.
Get the array of visible column property id:s.
The columns are show in the order of their appearance in this array
Parameters
width of the object in units specified by widthUnits property.
Get width of the object. Negative number implies unspecified size (terminal is free to set the size).
Parameters
units used in width property.
getWidthUnits()
Get width property units.
Parameters
propertyId
the propertyID identifying the column.
true if the column is collapsed; false otherwise;
Checks if the specified column is collapsed.
Parameters
true if columns can be collapsed; false otherwise.
Check if column collapsing is allowed.
Parameters
true if columns can be reordered; false otherwise.
Check if column reordering is allowed.
Parameters
true if table is editable, false oterwise.
Is table editable. If table is editable a editor of type Field is created for each table cell. The assigned FieldFactory is used to create the instances. To provide custom editors for table cells create a class implementins the FieldFactory interface, and assign it to table, and set the editable property to true.
Parameters
itemId
ID of an Item in the Container
true
if the Item is first in the Container,
false
if not
isFirstId(java.lang.Object)
Tests if the Item corresponding to the given Item ID is the first Item in the Container.
Parameters
true
if the Item is last in the Container,
false
if not
isLastId(java.lang.Object)
Tests if the Item corresponding to the given Item ID is the last Item in the Container.
Parameters
Value of property pageBuffering.
Getter for property pageBuffering.
Parameters
Value of property selectable.
Getter for property selectable.
The table is not selectable by default.
Parameters
true
if ascending,
false
if
descending
Is the table currently sorted in ascending order.
Parameters
True iff sorting is disabled.
Is sorting disabled alltogether. True iff no sortable columns are given even in the case where datasource would support this.
Parameters
ID of the last Item in the Container
lastItemId()
Gets the ID of the last Item in the Container..
Parameters
itemId
ID of an Item in the Container
ID of the next Item or
null
nextItemId(java.lang.Object)
Gets the ID of the Item following the Item that corresponds to
itemId
. If the given Item is the last or not found in
the Container,
null
is returned.
Parameters
target
Paint target.
Exceptions
PaintException
The paint operation failed.
Paint the content of this component.
Parameters
itemId
ID of an Item in the Container
ID of the previous Item or
null
prevItemId(java.lang.Object)
Gets the ID of the Item preceding the Item that corresponds to
itemId
. If the given Item is the first or not found
in the Container,
null
is returned.
Refresh the current page contents. If the page buffering is turned off, it is not necessary to call this explicitely.
Parameters
actionHandler
the handler to be removed
Remove a previously registered action handler for the contents of this container.
removeAllItems()
removeItem(java.lang.Object)
Parameters
propertyId
the propertyID identifying the column.
alignment
the desired alignment.
Sets the specified column's alignment.
Throws IllegalArgumentException if the alignment is not one of the following: ALIGN_LEFT, ALIGN_CENTER or ALIGN_RIGHT
Parameters
columnAlignments
Column alignments array.
Set the column alignments.
The items in the array must match the properties identified by
getVisibleColumns()
. The possible values for the
alignments include:
ALIGN_LEFT
: Left alignment
ALIGN_CENTER
: Centered
ALIGN_RIGHT
: Right alignment
The alignments default to
ALIGN_LEFT
Parameters
propertyId
the propertyID identifying the column.
collapsed
the desired collapsedness.
Sets whether the specified column is collapsed or not.
Parameters
collapsingAllowed
specifies whether column collapsing is allowed.
Sets whether column collapsing is allowed or not.
Parameters
propertyId
the propertyId indentifying the column.
header
the header to set.
Sets column header for the specified column;
Parameters
columnHeaderMode
New value of property columnHeaderMode.
Setter for property columnHeaderMode.
Parameters
columnHeaders
Array of column headers that match the
getVisibleColumns()
.
Set the headers of the columns.
The headers match the property id:s given my the set visible column
headers. The table must be set in either
ROW_HEADER_MODE_EXPLICIT
or
ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID
mode to show the
headers. In the defaults mode any nulls in the headers array are replaced
with id.toString() outputs when rendering.
Parameters
propertyId
the propertyId identifying the column.
icon
the icon Resource to set.
Sets the icon Resource for the specified column.
Throws IllegalArgumentException if the specified column is not visible.
Parameters
columnIcons
Array of icons that match the
getVisibleColumns()
.
Set the icons of the columns.
The icons in headers match the property id:s given my the set visible
column headers. The table must be set in either
ROW_HEADER_MODE_EXPLICIT
or
ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID
mode to show the
headers with icons.
Parameters
reorderingAllowed
specifies whether column reordering is allowed.
Sets whether column reordering is allowed or not.
Parameters
currentPageFirstItem
New value of property currentPageFirstItem.
Setter for property currentPageFirstItem.
Parameters
newIndex
New value of property currentPageFirstItem.
Setter for property currentPageFirstItem.
Parameters
editable
true if table should be editable by user.
Set the editable property. If table is editable a editor of type Field is created for each table cell. The assigned FieldFactory is used to create the instances. To provide custom editors for table cells create a class implementins the FieldFactory interface, and assign it to table, and set the editable property to true.
Parameters
fieldFactory
The field factory to set
Set the FieldFactory that is used to create editor for table cells. The FieldFactory is only used if the Table is editable. By default the BaseFieldFactory is used.
Parameters
height
The height to set
Sets the height in pixels. Use negative value to let the client decide the height.
setHeightUnits(int)
Set height units. Table supports only Sizeable.UNITS_PIXELS. Setting to any other throws IllegalArgumentException.
Table does not support lazy options loading mode. Setting this true will throw UnsupportedOperationException.
Exceptions
UnsupportedOperationException
if set to true.
setNewItemsAllowed(boolean)
Adding new items is not supported.
Parameters
pageBuffering
New value of property pageBuffering.
Setter for property pageBuffering.
Parameters
Lenght
of one page.
Set the page length.
Setting page length 0 disables paging. The page length defaults to 0 (no paging).
Parameters
mode
One of the modes listed above.
Set the row header mode.
The mode can be one of the following ones:
ROW_HEADER_MODE_HIDDEN
: The row captions are hidden.
ROW_HEADER_MODE_ID
: Items Id-objects
toString()
is used as row caption.
ROW_HEADER_MODE_ITEM
: Item-objects
toString()
is used as row caption.
ROW_HEADER_MODE_PROPERTY
: Property set with
setItemCaptionPropertyId()
is used as row header.
ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID
: Items
Id-objects
toString()
is used as row header. If caption is
explicitly specified, it overrides the id-caption.
ROW_HEADER_MODE_EXPLICIT
: The row headers must be
explicitly specified.
ROW_HEADER_MODE_INDEX
: The index of the item is used
as row caption. The index mode can only be used with the containers
implementing
Container.Indexed
interface.
The default value is
ROW_HEADER_MODE_HIDDEN
Parameters
selectable
New value of property selectable.
Setter for property selectable.
The table is not selectable by default.
Parameters
ascending
true
if ascending,
false
if
descending
Set the table in ascending order.
Parameters
propertyId
Container property id of the currently sorted column.
Set the currently sorted column property id.
Parameters
sortDisabled
True iff sorting is disabled
Disable sorting alltogether. To disable sorting alltogether, set to true. In this case no sortable columns are given even in the case where datasource would support this.
Parameters
availableColumns
Array of shown property id:s.
Set the array of visible column property id:s.
The columns are show in the order of their appearance in this array
Parameters
width
The width to set
Sets the width in pixels. Use negative value to allow the client decide the width.
setWidthUnits(int)
Set width units. Tabel supports only Sizeable.UNITS_PIXELS and Sizeable.UNITS_PERCENTAGE. Setting to any other throws IllegalArgumentException.
Exceptions
UnsupportedOperationException
if the container data source does not implement Container.Sortable
Sort table by currently selected sorting column.
Exceptions
UnsupportedOperationException
if the container data source does not implement Container.Sortable
sort(java.lang.Object[], boolean[])
Sort table.