Central interface which provides support for tabular data presentation.
ImplementsInheritance Hierarchy

Remarks

This interface supports a presentation of data where the nodes of a diagram are organized in a tabular way, i.e., where each node is associated with a specific row and column in the grid-like structure of a table. The ITable together with its associated interfaces IColumn and IRow represents the model for the tabular presentation (or table, for short). It also provides means for altering the model, in particular creation (createChildColumn and createChildRow) and removal of columns and rows but also changing their size or appearance.

The table structure is backed by a group node. As a consequence, the nodes which should be presented in a tabular fashion need to be set up as children of this group node. Using a group node to hold the content nodes has several advantages: For example, when the group node is moved, the child nodes move accordingly, thus maintaining the visual clue that they are contained in the table group node.

Since an ITable is typically only rendered as an implementation detail of a node visualization (e.g., via the TableNodeStyle), the table is not aware of the IGraph or any visualization component. This means that changing a property, even if done via the methods provided by ITable will not automatically trigger a repainting of the visualizations. Instead, developers should call invalidateDisplays or invalidate the displays directly to see the updated visualization after making a change.

Note that the table structure and its content nodes are only loosely coupled: the node's center coordinates determine the row and column that it belongs to.

Associating an ITable instance with its backing group node can most conveniently be done by setting a TableNodeStyle instance as style of the associated group node. This style manages the visualization of the individual rows and columns. It also associates its table with the group node by decorating its lookup to return the table instance.

User interaction is supported by the TableEditorInputMode which provides support for interactively resizing rows and columns, re-parenting them, or editing their labels.

See Also

The table model with all relevant types and their relationships is presented in detail in the section Tables.

Developer's Guide

API

IStripe, IColumn, IRow, Table, TableEditorInputMode

Members

Show:

Properties

Returns the accumulated padding for the table.
Gets or sets the defaults for Columns.
The settings that are obtained from the instance influence newly created elements only. Setting different defaults later does not influence existing elements.
abstract

See Also

Developer's Guide

Implemented in

Table.columnDefaults
Gets a TableDecorator instance for use with this table.
Gets the layout of the table, relative to an owner node.
readonlyabstract

Implemented in

Table.layout
Gets or sets the padding for this table.
This padding is applied in addition to any implicit padding provided by the child stripes.
abstractconversion

See Also

Developer's Guide

Implemented in

Table.padding
Gets the virtual root of the column hierarchy
This column should not be queried except for the parentColumn and the associated table
readonlyabstract

See Also

API
setParent, createChildColumn

Implemented in

Table.rootColumn
Gets the virtual root of the row hierarchy
This row should not be queried except for the parentRow and the associated table
readonlyabstract

See Also

API
setParent, createChildRow

Implemented in

Table.rootRow
Gets or sets the defaults for rows.
The settings that are obtained from the instance influence newly created elements only. Setting different defaults later does not influence existing elements.
abstract

See Also

Developer's Guide

Implemented in

Table.rowDefaults

Methods

Add a label to the given owner using the text as the initial label text and label model parameter and style.
abstract

Parameters

owner: IStripe
The owner to add the label to.
text: string
The initial text of the label
layoutParameter?: ILabelModelParameter
The label model parameter instance to use.
style?: ILabelStyle
The style to use for the label
preferredSize?: Size
The initial values to use for the preferredSize.
tag?: ILabel['tag']
The initial tag to assign.

Return Value

ILabel
The newly created label

See Also

Developer's Guide
API
setLabelText, setLabelLayoutParameter, setStyle

Implemented in

Table.addLabel
Adjusts the preferredSize property of a label to fit the suggested size of its ILabelStyleRenderer.
This implementation uses the style's renderer for the label to determine the preferred rendering size. This is useful after the label's content or style have been changed.

Parameters

label: ILabel
The label to adjust the size for.

See Also

API
autoAdjustPreferredSize
Calculates the preferred size of a label with the given properties.

Parameters

stripe: IStripe
The item that will own the label.
style: ILabelStyle
The label style.
layoutParameter: ILabelModelParameter
The label model parameter.
text: string
The text.
tag: ILabel['tag']
The tag for the label.

Return Value

Size
The size as calculated by the ILabelStyleRenderer.
Removes all stripes from a table.
All existing rows and columns are cleared from table.
Create a new column as the indexth child of parent with the given parameters.
abstract

Parameters

parent: IColumn
The owner of the new column.
width?: number
The actual width of the column.
minWidth?: number
The minimal width of the column.
padding?: Insets
The padding of the column.
style?: IStripeStyle
The style of the column.
tag?: IColumn['tag']
The tag of the column
index?: number
The position in the child list.

Return Value

IColumn
A new column instance

See Also

Developer's Guide
Create a new row as the indexth child of parent with the given parameters.
abstract

Parameters

parent: IRow
The owner of the new row.
height?: number
The actual height of the row.
minHeight?: number
The minimal height of the row.
padding?: Insets
The padding of the row.
style?: IStripeStyle
The style of the row.
tag?: IRow['tag']
The tag of the row
index?: number
The position in the child list.

Return Value

IRow
A new row instance

See Also

Developer's Guide

Implemented in

Table.createChildRow
Creates and returns a column as last child of table.
The column will be a part of this table after the method returns. This will trigger the corresponding events. Unspecified parameters default to rowDefaults.

Parameters

width?: number
The actual width of the column.
minWidth?: number
The minimal width of the column.
padding?: Insets
The padding of the column.
style?: IStripeStyle
The style of the column.
tag?: IColumn['tag']
The tag of the column
index?: number
The position in the child list. If omitted, the row will be positioned at the end.

Return Value

IColumn
A newly created column instance

See Also

API
stripe-created
Creates a columns x rows.
All existing rows and columns are cleared from table.

Parameters

columns: number
The number of columns to test.
rows: number
The number of rows to test.
Creates the label model parameter for a given ILabelOwner.
This implementation uses the label defaults for the table to obtain the parameter instance.

Parameters

stripe: IStripe
The item that is the owner of the label in question.

Return Value

ILabelModelParameter
The default label model parameter to use for newly created labels at the item.

See Also

API
getLayoutParameterInstance
Creates an instance of the default label style for the given stripe.
Delegates to the getStyleInstance method for the given stripe.

Parameters

stripe: IStripe
The item the newly created label will belong to.

Return Value

ILabelStyle
The style instance to use for newly created stripes.
Creates and returns a row as last child of table.
The row will be a part of this table after the method returns. This will trigger the corresponding events. Unspecified parameters default to rowDefaults.

Parameters

height?: number
The actual height of the row.
minHeight?: number
The minimal height of the row.
padding?: Insets
The padding of the row.
style?: IStripeStyle
The style of the row.
tag?: IRow['tag']
The tag of the row
index?: number
The position in the child list. If omitted, the row will be positioned at the end.

Return Value

IRow
A newly created row instance

See Also

API
stripe-created
Finds a column underneath a certain point.
The columns are tested in bottom-up order.

Parameters

node: INode
The node this table is currently bound to
location: Point
The location to test.
filter?: function(IStripe): boolean
Additional predicate to further restrict the results.

Return Value

IColumn
The topmost column that has been found for the location or null.
Finds a row underneath a certain point.
The rows are tested in bottom-up order.

Parameters

node: INode
The node this table is currently bound to
location: Point
The location to test.
filter?: function(IStripe): boolean
Additional predicate to further restrict the results.

Return Value

IRow
The topmost row that has been found for the location or null.
Finds all stripes underneath a certain point.
The stripes are always returned in bottom up, rows first order. Note that this method does not take any hitTestRadius into account.

Parameters

node: INode
The node this table is currently bound to
location: Point
The location to test.
stripeTypes: StripeTypes
An enumeration value of StripeTypes to specify the stripe type.
filter?: function(IStripe): boolean
Additional predicate to further restrict the hit test results.

Return Value

IEnumerable<IStripe>
The stripes that have been found for the location or null.

See Also

Developer's Guide
Calculates the relative bounds of a table cell that is determined by column and row
Both column and row must reside in the provided table instance. Otherwise, an ArgumentError is thrown.

Parameters

column: IColumn
The column that determines the cell
row: IRow
The row that determines the cell

Return Value

Rect
The relative bounds of the cell determined by column and row

Throws

Exception ({ name: 'ArgumentError' })
If column and row are part of a different table instance.
Returns an instance that implements the given type or null.
Typically, this method will be called to obtain a different view or aspect of the current instance. This is quite similar to casting or using a super type or interface of this instance, but is not limited to inheritance or compile-time constraints. An instance implementing this method is not required to return non-null implementations for the types, nor does it have to return the same instance any time. Also, it depends on the type and context whether the instance returned stays up to date or needs to be re-obtained for further use.
abstract

Parameters

type: Constructor<T>
the type for which an instance shall be returned

Return Value

T
an instance that is assignable to the type or null

See Also

Developer's Guide

Defined in

ILookup.lookup
Removes the given label from its owner.
This will trigger the corresponding event.
abstract

Parameters

label: ILabel
The label to remove

Implemented in

Table.remove
Removes stripe from its parent container.
This method reparents all children of stripe to the parent of the stripe.
abstract

Parameters

stripe: IStripe
The stripe to remove

See Also

Developer's Guide

Implemented in

Table.remove
Removes stripe and all of its descendants from table.
This method does not resize any stripes, use removeRecursivelyWithResize instead.

Parameters

stripe: IStripe
The stripe to remove.

See Also

Developer's Guide
Removes the given stripe and all of its descendants from table and resizes all affected stripes so that the table size does not change if possible.

Parameters

stripe: IStripe
The stripe to remove.

See Also

Developer's Guide
Removes stripe from table and resizes all affected stripes so that the table size does not change if possible.

Parameters

stripe: IStripe
The stripe to remove.

See Also

Developer's Guide
Sets the label model parameter for the given label.
abstract

Parameters

label: ILabel
The label.
layoutParameter: ILabelModelParameter
The new parameter.

Throws

Exception ({ name: 'ArgumentError' })
If the parameter cannot be used for this label.
Sets the preferred size of the label.
abstract

Parameters

label: ILabel
The label.
preferredSize: Size
The new preferred size.

See Also

API
preferredSize
Sets the label text of the given label.
abstract

Parameters

label: ILabel
The label to modify
text: string
The new text of the label

See Also

API
text

Implemented in

Table.setLabelText
Sets the minimum size of stripe.
This method sets the minimumSize of stripe.
abstract

Parameters

stripe: IStripe
The stripe to change
minimumSize: number
The new minimum size of the stripe

Implemented in

Table.setMinimumSize
Sets parent as new parent of row, inserting row at the given index.
The row will be inserted at position index in the child list of the new parent.
abstract

Parameters

parent: IRow
row: IRow
index?: number

Implemented in

Table.setParent
Sets parent as new parent of column, inserting column at the given index.
The column will be inserted at position index in the child list of the new parent.
abstract

Parameters

parent: IColumn
column: IColumn
index?: number

Implemented in

Table.setParent
Sets the actual size of stripe.
This method sets the size of stripe.
abstract

Parameters

stripe: IStripe
The stripe to change
size: number
The new size of the stripe

See Also

Developer's Guide

Implemented in

Table.setSize
Sets the padding of stripe.
abstract

Parameters

stripe: IStripe
The stripe to change
padding: Insets
The new padding of the stripe

See Also

Developer's Guide
Assigns the given style instance by reference to the label.
Style instances can be shared.
abstract

Parameters

label: ILabel
The label that will be assigned the new style
style: ILabelStyle
The style instance that will be assigned to the label.

See Also

API
style

Implemented in

Table.setStyle
Sets the style of stripe.
abstract

Parameters

stripe: IStripe
The stripe to change
style: IStripeStyle
The new style of the stripe

See Also

Developer's Guide

Implemented in

Table.setStyle

Events

Occurs when a label has been added to this graph instance.

Properties of

ItemEventArgs<ILabel>
item: T
Gets the item that is the subject of the event.

See Also

API
addLabel

Implemented in

Table.label-added
Occurs when a label has been changed, for instance, if its style has been replaced.

Properties of

ItemEventArgs<ILabel>
item: T
Gets the item that is the subject of the event.

See Also

API
setStyle

Implemented in

Table.label-changed
Occurs when a label has been removed from this graph instance.

This event will also be triggered, prior to the removal of the owner of the label.

Implementations may choose to use the LabelEventArgs to carry additional label owner information. The owner property will be set to the owner of the label that owned it before the removal.

Properties of

LabelEventArgs
item: ILabel
Gets the item that is the subject of the event.
owner: ILabelOwner
Gets the owner of the label that owned the label before the event happened.

See Also

API
remove

Implemented in

Table.label-removed
Occurs when a stripe has been changed, for instance, if its style has been replaced.

Properties of

StripeEventArgs
item: IStripe
Gets the item that is the subject of the event.
parentStripe: IStripe
Gets the parent of the stripe that owned the stripe before the event happened.
table: ITable
Gets the table that owned the stripe before the event happened.

See Also

API
setStyle, setStripePadding, setSize, setMinimumSize

Implemented in

Table.stripe-changed
Occurs when a stripe has been added.

Properties of

ItemEventArgs<IStripe>
item: T
Gets the item that is the subject of the event.

See Also

API
createChildRow, createChildColumn

Implemented in

Table.stripe-created
Occurs when a stripe has been removed from its parent.

Properties of

StripeEventArgs
item: IStripe
Gets the item that is the subject of the event.
parentStripe: IStripe
Gets the parent of the stripe that owned the stripe before the event happened.
table: ITable
Gets the table that owned the stripe before the event happened.

See Also

API
remove

Implemented in

Table.stripe-removed

Static Methods

Finds a stripe underneath a certain point.
static

Parameters

location: Point
The location to test.
stripeTypes: StripeTypes
An enumeration value of StripeTypes to specify the stripe type.
subregionTypes: StripeSubregionTypes
An enumeration value of StripeSubregionTypes to further restrict the stripe region.
inputModeContext: IInputModeContext
The context for hit determination, such as hitTestRadius.
filter?: function(StripeSubregion): boolean
Additional predicate to further restrict the hit test results.

Return Value

StripeSubregion
The stripe subregions that have been found for the location or null.

See Also

Developer's Guide
Used as a callback to find the items underneath a certain point.
static

Parameters

location: Point
The location to test.
stripeTypes: StripeTypes
An enumeration value of StripeTypes to specify the stripe type.
subregionTypes: StripeSubregionTypes
An enumeration value of StripeSubregionTypes to further restrict the stripe region.
inputModeContext: IInputModeContext
The context for hit determination, such as hitTestRadius.
filter?: function(StripeSubregion): boolean
Additional predicate to further restrict the hit test results.

Return Value

IEnumerable<StripeSubregion>
The stripe subregions that have been found for the location.
Calculates the absolute bounds of a table cell that is determined by column and row
Both column and row must live in the same ITable instance that is also present in the tableNode's ILookup. Otherwise, an ArgumentError is thrown.
static

Parameters

tableNode: INode
The node where a table is bound to via the node's lookup
column: IColumn
The column that determines the cell
row: IRow
The row that determines the cell

Return Value

Rect
The absolute bounds of the cell determined by column and row

Throws

Exception ({ name: 'ArgumentError' })
If no table is present in the ILookup of tableNode, or if column and row are part of a different table instance.
Gets the ITable instance associated to the given node.
A node has an associated ITable instance, if its style is a TableNodeStyle. In this case, the associated ITable instance is the TableNodeStyle's table.
static

Parameters

node: INode

Return Value

ITable
The ITable instance associated to the given node or null if there is none.
Places node in the center of the table cell determined by column and row.

Both column and row must live in the same ITable instance that is also present in the tableNode's ILookup. Otherwise, an ArgumentError is thrown. The cell bounds are determined by getCellBounds.

If reparent is true, the node is made a child node of tableNode if it is no descendant of the table node hierarchy yet. Otherwise, the grouping hierarchy is not changed.

If alwaysMove is true, the node is moved even if its center is already contained in the cell, otherwise only when the node layout center is currently outside of the cell bounds.

This method does not change the size of the target stripes if they would be too small to contain the whole node layout. Callers must increase the stripe size before or after calling this method, if necessary.

static

Parameters

graph: IGraph
The graph instance where the move should be performed
node: INode
The node that should be moved into the given cell.
tableNode: INode
The node where a table is bound to via the node's lookup
column: IColumn
The column that determines the cell
row: IRow
The row that determines the cell
reparent?: boolean
Whether node should also be made part of tableNode's grouping hierarchy if it is not yet contained in it.
alwaysMove?: boolean
Whether node should be moved even if it is already placed in the cell.

Throws

Exception ({ name: 'ArgumentError' })
If no table is present in the ILookup of tableNode, or if column and row are part of a different table instance.