- I
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
Properties
Returns the accumulated padding for the table.
Gets or sets the defaults for Columns.
See Also
Developer's Guide
Implemented in
Table.columnDefaultsGets a TableDecorator instance for use with this table.
Gets the layout of the table, relative to an owner node.
Implemented in
Table.layoutGets or sets the padding for this table.
See Also
Developer's Guide
Implemented in
Table.paddingGets the virtual root of the column hierarchy
See Also
Implemented in
Table.rootColumnGets the virtual root of the row hierarchy
See Also
Implemented in
Table.rootRowGets or sets the defaults for rows.
See Also
Developer's Guide
Implemented in
Table.rowDefaultsMethods
Add a label to the given owner using the text as the initial label text and label model parameter and style.
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.addLabelAdjusts the preferredSize property of a label to fit the suggested size of its ILabelStyleRenderer.
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.
createChildColumn
(width?: numberminWidth?: numbertag?: IColumn['tag']index?: number): IColumnabstractCreate a new column as the indexth child of parent with the given parameters.
createChildColumn
(indexth child of parent with the given parameters.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
Implemented in
Table.createChildColumnCreate a new row as the indexth child of parent with the given parameters.
indexth child of parent with the given parameters.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.createChildRowCreates and returns a column as last child of table.
table.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
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.
table to obtain the parameter instance.Parameters
Return Value
- ILabelModelParameter
- The default label model parameter to use for newly created labels at the item.
See Also
Creates an instance of the default label style for the given stripe.
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.
table.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
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.
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.
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
column and row must reside in the provided table instance. Otherwise, an ArgumentError is thrown.Parameters
Return Value
- Rect
- The relative bounds of the cell determined by
columnandrow
Throws
- Exception ({ name: 'ArgumentError' })
- If
columnandroware part of a different table instance.
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.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.lookupRemoves the given label from its owner.
Parameters
- label: ILabel
- The label to remove
Implemented in
Table.removeRemoves stripe from its parent container.
stripe from its parent container.stripe to the parent of the stripe.Parameters
- stripe: IStripe
- The stripe to remove
See Also
Developer's Guide
Implemented in
Table.removeParameters
- stripe: IStripe
- The stripe to remove.
See Also
Developer's Guide
Sets the label model parameter for the given label.
Parameters
- label: ILabel
- The label.
- layoutParameter: ILabelModelParameter
- The new parameter.
Throws
- Exception ({ name: 'ArgumentError' })
- If the parameter cannot be used for this label.
Implemented in
Table.setLabelLayoutParameterSets the label text of the given label.
Parameters
- label: ILabel
- The label to modify
- text: string
- The new text of the label
See Also
API
- text
Implemented in
Table.setLabelTextSets the minimum size of stripe.
stripe.stripe.Parameters
- stripe: IStripe
- The stripe to change
- minimumSize: number
- The new minimum size of the stripe
Implemented in
Table.setMinimumSizeindex in the child list of the new parent.Parameters
Implemented in
Table.setParentindex in the child list of the new parent.Parameters
Implemented in
Table.setParentSets the actual size of stripe.
stripe.stripe.Parameters
- stripe: IStripe
- The stripe to change
- size: number
- The new size of the stripe
See Also
Developer's Guide
Implemented in
Table.setSizeAssigns the given style instance by reference to the label.
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.setStyleSets the style of stripe.
stripe.Parameters
- stripe: IStripe
- The stripe to change
- style: IStripeStyle
- The new style of the stripe
See Also
Developer's Guide
Implemented in
Table.setStyleEvents
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-addedOccurs 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-changedOccurs 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-removedOccurs 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
Implemented in
Table.stripe-changedOccurs when a stripe has been added.
Properties of
ItemEventArgs<IStripe>- item: T
- Gets the item that is the subject of the event.
See Also
Implemented in
Table.stripe-createdOccurs 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-removedStatic Methods
Finds a stripe underneath a certain point.
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.
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.
column and row must live in the same ITable instance that is also present in the tableNode's ILookup. Otherwise, an ArgumentError is thrown.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
columnandrow
Throws
Parameters
- node: INode
Return Value
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.
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
nodeshould also be made part oftableNode's grouping hierarchy if it is not yet contained in it. - alwaysMove?: boolean
- Whether
nodeshould be moved even if it is already placed in the cell.