Class Table

Table component is used for representing data or components in pageable and selectable table.

Table()

Create new empty table

Table(String)

Create new empty table with caption.

Table(String, Container)

Create new table with caption and connect it to a Container.

ALIGN_CENTER

Center column alignment.

ALIGN_LEFT

Left column alignment. This is the default behaviour.

ALIGN_RIGHT

Right column alignment.

COLUMN_HEADER_MODE_EXPLICIT

Column header mode: Column headers are explicitly specified with setColumnHeaders()

COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID

Column header mode: Column headers are explicitly specified with setColumnHeaders()

COLUMN_HEADER_MODE_HIDDEN

Column header mode: Column headers are hidden. This is the default behaviour.

COLUMN_HEADER_MODE_ID

Column header mode: Property ID:s are used as column headers.

ROW_HEADER_MODE_EXPLICIT

Row caption mode: Item captions are explicitly specified.

ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID

Row caption mode: Item captions are explicitly specified, but if the caption is missing, the item id objects toString() is used instead.

ROW_HEADER_MODE_HIDDEN

Row caption mode: The row headers are hidden. This is the default mode.

ROW_HEADER_MODE_ICON_ONLY

Row caption mode: Only icons are shown, the captions are hidden.

ROW_HEADER_MODE_ID

Row caption mode: Items Id-objects toString() is used as row caption.

ROW_HEADER_MODE_INDEX

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.

ROW_HEADER_MODE_ITEM

Row caption mode: Item-objects toString() is used as row caption.

ROW_HEADER_MODE_PROPERTY

Row caption mode: Item captions are read from property specified with setItemCaptionPropertyId .

addActionHandler(Action.Handler)

Parameters

actionHandler

the new handler to be added.

Description copied from interface: addActionHandler

Registers a new action handler for this container

addContainerProperty(Object, Class, Object)

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.

addContainerProperty(Object, Class, Object, String, Resource, String)

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.

addItem(Object[], Object)

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.

return

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.

addItemAfter(Object)

Parameters

previousItemId

Id of the previous item in ordered container.

return

Returns item id the the created new item or null if the operation fails.

Description copied from interface: addItemAfter

Add new item after the given item.

Adding an item after null item adds the item as first item of the ordered container.

addItemAfter(Object, Object)

Parameters

previousItemId

Id of the previous item in ordered container.

newItemId

Id of the new item to be added.

return

Returns new item or null if the operation fails.

Description copied from interface: addItemAfter

Add new item after the given item.

Adding an item after null item adds the item as first item of the ordered container.

attach()

See Also
attach()

changeVariables(Object, Map)

Parameters

event

Variable change event containing the information about the changed variable.

Invoked when the value of a variable has changed.

containerItemSetChange(Container.ItemSetChangeEvent)

Container datasource item set change. Table must flush its buffers on change.

containerPropertySetChange(Container.PropertySetChangeEvent)

Container datasource property set change. Table must flush its buffers on change.

detach()

See Also
attach()

firstItemId()

Parameters

return

ID of the first Item in the Container

See Also
firstItemId()
Description copied from interface: firstItemId

Gets the ID of the first Item in the Container.

focus()

Exceptions

UnsupportedOperationException

if invoked.

See Also
focus()

Focusing to this component is not supported.

getColumnAlignment(Object)

Parameters

propertyId

the propertyID identifying the column.

return

the specified column's alignment if it as one; null otherwise.

Gets the specified column's alignment.

getColumnAlignments()

Parameters

return

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.

getColumnHeader(Object)

Parameters

propertyId

the propertyId indentifying the column.

return

the header for the specifed column if it has one.

Gets the header for the specified column.

getColumnHeaderMode()

Parameters

return

Value of property columnHeaderMode.

Getter for property columnHeaderMode.

getColumnHeaders()

Parameters

return

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.

getColumnIcon(Object)

Parameters

propertyId

the propertyId indentifying the column.

return

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.

getColumnIcons()

Parameters

return

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.

getCurrentPageFirstItemId()

Parameters

return

Value of property currentPageFirstItem.

Getter for property currentPageFirstItem.

getCurrentPageFirstItemIndex()

Parameters

return

Value of property currentPageFirstItem.

Getter for property currentPageFirstItem.

getFieldFactory()

Parameters

return

FieldFactory used to create the Field instances.

See Also
isEditable()

Get the FieldFactory that is used to create editor for table cells. The FieldFactory is only used if the Table is editable.

getHeight()

Parameters

return

height of the object in units specified by heightUnits property.

Description copied from interface: getHeight

Get height of the object. Negative number implies unspecified size (terminal is free to set the size).

getHeightUnits()

Parameters

return

units used in height property.

Description copied from interface: getHeightUnits

Get height property units.

getPageLength()

Parameters

return

Lenght of one page.

Get the page length.

Setting page length 0 disables paging.

getRowHeaderMode()

Parameters

return

Row header mode.

Get the row header mode.

getSortableContainerPropertyIds()

Parameters

return

The sortable field ids.

Description copied from interface: getSortableContainerPropertyIds

Get the container property IDs, which can be used to sort the item.

getSortContainerPropertyId()

Parameters

return

Container property id of the currently sorted column.

Get the currently sorted column property ID.

getTag()

Parameters

return

UIDL tag as string.

Get UIDL tag corresponding to component.

getVisibleColumns()

Parameters

return

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

getVisibleItemIds()

Return list of items on the current page

getWidth()

Parameters

return

width of the object in units specified by widthUnits property.

Description copied from interface: getWidth

Get width of the object. Negative number implies unspecified size (terminal is free to set the size).

getWidthUnits()

Parameters

return

units used in width property.

Description copied from interface: getWidthUnits

Get width property units.

isColumnCollapsed(Object)

Parameters

propertyId

the propertyID identifying the column.

return

true if the column is collapsed; false otherwise;

Checks if the specified column is collapsed.

isColumnCollapsingAllowed()

Parameters

return

true if columns can be collapsed; false otherwise.

Check if column collapsing is allowed.

isColumnReorderingAllowed()

Parameters

return

true if columns can be reordered; false otherwise.

Check if column reordering is allowed.

isEditable()

Parameters

return

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.

isFirstId(Object)

Parameters

itemId

ID of an Item in the Container

return

true if the Item is first in the Container, false if not

Description copied from interface: isFirstId

Tests if the Item corresponding to the given Item ID is the first Item in the Container.

isLastId(Object)

Parameters

return

true if the Item is last in the Container, false if not

Description copied from interface: isLastId

Tests if the Item corresponding to the given Item ID is the last Item in the Container.

isPageBufferingEnabled()

Parameters

return

Value of property pageBuffering.

Getter for property pageBuffering.

isSelectable()

Parameters

return

Value of property selectable.

Getter for property selectable.

The table is not selectable by default.

isSortAscending()

Parameters

return

true if ascending, false if descending

Is the table currently sorted in ascending order.

isSortDisabled()

Parameters

return

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.

lastItemId()

Parameters

return

ID of the last Item in the Container

See Also
lastItemId()
Description copied from interface: lastItemId

Gets the ID of the last Item in the Container..

nextItemId(Object)

Parameters

itemId

ID of an Item in the Container

return

ID of the next Item or null

Description copied from interface: nextItemId

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.

paintContent(PaintTarget)

Parameters

target

Paint target.

Exceptions

PaintException

The paint operation failed.

Paint the content of this component.

prevItemId(Object)

Parameters

itemId

ID of an Item in the Container

return

ID of the previous Item or null

Description copied from interface: prevItemId

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.

refreshCurrentPage()

Refresh the current page contents. If the page buffering is turned off, it is not necessary to call this explicitely.

removeActionHandler(Action.Handler)

Parameters

actionHandler

the handler to be removed

Description copied from interface: removeActionHandler

Remove a previously registered action handler for the contents of this container.

removeAllItems()

removeContainerProperty(Object)

removeItem(Object)

setColumnAlignment(Object, String)

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

setColumnAlignments(String[])

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

setColumnCollapsed(Object, boolean)

Parameters

propertyId

the propertyID identifying the column.

collapsed

the desired collapsedness.

Sets whether the specified column is collapsed or not.

setColumnCollapsingAllowed(boolean)

Parameters

collapsingAllowed

specifies whether column collapsing is allowed.

Sets whether column collapsing is allowed or not.

setColumnHeader(Object, String)

Parameters

propertyId

the propertyId indentifying the column.

header

the header to set.

Sets column header for the specified column;

setColumnHeaderMode(int)

Parameters

columnHeaderMode

New value of property columnHeaderMode.

Setter for property columnHeaderMode.

setColumnHeaders(String[])

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.

setColumnIcon(Object, Resource)

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.

setColumnIcons(Resource[])

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.

setColumnReorderingAllowed(boolean)

Parameters

reorderingAllowed

specifies whether column reordering is allowed.

Sets whether column reordering is allowed or not.

setContainerDataSource(Container)

setCurrentPageFirstItemId(Object)

Parameters

currentPageFirstItem

New value of property currentPageFirstItem.

Setter for property currentPageFirstItem.

setCurrentPageFirstItemIndex(int)

Parameters

newIndex

New value of property currentPageFirstItem.

Setter for property currentPageFirstItem.

setEditable(boolean)

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.

setFieldFactory(FieldFactory)

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.

setHeight(int)

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.

setLazyLoading(boolean)

Table does not support lazy options loading mode. Setting this true will throw UnsupportedOperationException.

setNewItemsAllowed(boolean)

Exceptions

UnsupportedOperationException

if set to true.

Adding new items is not supported.

setPageBufferingEnabled(boolean)

Parameters

pageBuffering

New value of property pageBuffering.

Setter for property pageBuffering.

setPageLength(int)

Parameters

Lenght

of one page.

Set the page length.

Setting page length 0 disables paging. The page length defaults to 0 (no paging).

setRowHeaderMode(int)

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

setSelectable(boolean)

Parameters

selectable

New value of property selectable.

Setter for property selectable.

The table is not selectable by default.

setSortAscending(boolean)

Parameters

ascending

true if ascending, false if descending

Set the table in ascending order.

setSortContainerPropertyId(Object)

Parameters

propertyId

Container property id of the currently sorted column.

Set the currently sorted column property id.

setSortDisabled(boolean)

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.

setVisibleColumns(Object[])

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

setWidth(int)

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.

sort()

Exceptions

UnsupportedOperationException

if the container data source does not implement Container.Sortable

Sort table by currently selected sorting column.

sort(Object[], boolean[])

Exceptions

UnsupportedOperationException

if the container data source does not implement Container.Sortable

Sort table.

valueChange(Property.ValueChangeEvent)