Packagecom.yworks.graph.model
Classpublic class Table
InheritanceTable Inheritance flash.events.EventDispatcher
Implements ITable, ICloneable, IMarkupExtensionFactory

Default implementation of the ITable interface.



Public Properties
 PropertyDefined By
  columnDefaults : IStripeDefaults
The defaults for columns.
Table
  insets : IRectangle
The insets for this stripe.
Table
  layout : IRectangle
[read-only] The relative layout of the table.
Table
  relativeLocation : IPoint
The relative location of the upper left corner of the table.
Table
  rootColumn : IColumn
[read-only] The virtual root of the column hierarchy.
Table
  rootRow : IRow
[read-only] The virtual root of the row hierarchy.
Table
  rowDefaults : IStripeDefaults
The defaults for rows.
Table
Public Methods
 MethodDefined By
  
Default constructor that creates an empty table.
Table
  
addLabel(item:IStripe, text:String, labelModelParameter:ILabelModelParameter = null, style:ILabelStyle = null, preferredSize:ISize = null, tag:Object = null):ILabel
Add a label to the given item using the text as the initial label text and label model parameter and style.
Table
  
clone():Object
Creates a clone of this instance.
Table
  
createColumn(owner:IColumn = null, index:int = -1, width:Number = -1, minWidth:Number = -1, insets:IRectangle = null, style:INodeStyle = null, tag:Object = null):IColumn
Create a new column as the indexth child of owner with the given parameters.
Table
  
Creates a markup extension that can be used instead of the original class.
Table
  
createRow(owner:IRow = null, index:int = -1, height:Number = -1, minHeight:Number = -1, insets:IRectangle = null, style:INodeStyle = null, tag:Object = null):IRow
Create a new row as the indexth child of owner with the given parameters.
Table
  
Register an IGraph instance on a concrete table instance.
Table
  
lookup(type:Class):Object
Returns an instance that implements the given type or null.
Table
  
[static] Register a dynamic IUndoSupport for use with all tables that are bound to nodes in the given graph.
Table
  
[static] Register a fixed undoSupport instance for use with all tables that are bound to nodes in graph.
Table
  
Register an IUndoSupport instance on a concrete table instance.
Table
  
remove(stripe:IStripe):void
Removes the given stripe from its parent container.
Table
  
Table
  
removeLabel(label:ILabel):void
Removes the given label from its owner.
Table
  
Remove an IUndoSupport instance that has been previously registered with registerUndoSupport.
Table
  
setInsets(stripe:IStripe, insets:IRectangle):void
Sets the insets of the given stripe.
Table
  
Sets the label model parameter for the given label.
Table
  
setLabelStyle(label:ILabel, style:ILabelStyle):void
Assigns the given style instance by reference to the label.
Table
  
setLabelText(label:ILabel, text:String):void
Sets the label text of the given label.
Table
  
setMinimumSize(stripe:IStripe, newSize:Number):void
Sets the minimum size of the given stripe.
Table
  
setParentColumn(owner:IColumn, column:IColumn, index:int):void
Sets owner as new parent of column.
Table
  
setParentRow(owner:IRow, row:IRow, index:int):void
Sets owner as new parent of row.
Table
  
setPreferredSize(label:ILabel, width:Number, height:Number):void
Sets the preferred size of the label.
Table
  
setSize(stripe:IStripe, newSize:Number):void
Sets the actual size of the given stripe.
Table
  
setStyle(stripe:IStripe, style:INodeStyle):void
Sets the style of the given stripe.
Table
  
Remove an IGraph instance that has been previously registered with decorateGraph.
Table
  
[static] Unregisters an IUndoSupport implementation that has previously been registered with registerDynamicUndoSupport.
Table
  
[static] Unregisters an IUndoSupport implementation that has previously been registered with registerStaticUndoSupport.
Table
Protected Methods
 MethodDefined By
  
Called during clone() to create a copy of the given column.
Table
  
Called during clone() to create a copy of the given defaults.
Table
  
Called during clone() to create a copy of the given row.
Table
  
Callback method that creates the column defaults.
Table
  
Factory method for the default column insets.
Table
  
Factory method that creates a ILabelModelParameter to use for a newly created column label.
Table
  
Factory method for the default column label style.
Table
  
Factory method for the default column style.
Table
  
Factory method for the default Row insets.
Table
  
Factory method that creates a ILabelModelParameter to use for a newly created row label.
Table
  
Factory method for the default row label style.
Table
  
Factory method for the default row style.
Table
  
Callback method that creates the row defaults.
Table
  
Allows to provide an own implementation of IUndoSupport for this table.
Table
  
onLabelAdded(label:ILabel):void
Called after a label has been added to a stripe.
Table
  
Called after a label has changed.
Table
  
onLabelRemoved(owner:IStripe, label:ILabel):void
Called after a label has been removed from a stripe.
Table
  
onStripeAdded(stripe:IStripe):void
Called after a stripe has been added to the table.
Table
  
onStripeChanged(owner:IStripe, stripe:IStripe):void
Callback that is invoked after a stripe has changed.
Table
  
onStripeRemoved(owner:IStripe, stripe:IStripe):void
Called after a stripe has been removed from its parent.
Table
Events
 Event Summary Defined By
  Dispatched when a new label has been added to a stripe (column or row).Table
  Dispatched when the label of a stripe (column or row) has been changed.Table
  Dispatched when a label has been removed from its stripe (column or row).Table
  Dispatched when a stripe (column or row) has been changed.Table
  Dispatched when a new stripe (column or row) is created.Table
  Dispatched when a stripe (column or row) is removed from its parent.Table
Property Detail
columnDefaultsproperty
columnDefaults:IStripeDefaults

The defaults for columns.

The settings that are obtained from the instance influence newly created elements only. Setting different defaults afterwards does not influence existing elements.


Implementation
    public function get columnDefaults():IStripeDefaults
    public function set columnDefaults(value:IStripeDefaults):void
insetsproperty 
insets:IRectangle

The insets for this stripe.

These insets are applied in addition to any implicit insets provided by the child stripes.

The default value is (0,0,0,0).


Implementation
    public function get insets():IRectangle
    public function set insets(value:IRectangle):void
layoutproperty 
layout:IRectangle  [read-only]

The relative layout of the table.

The upper left corner of the layout always coincides with relativeLocation.


Implementation
    public function get layout():IRectangle

See also

relativeLocationproperty 
relativeLocation:IPoint

The relative location of the upper left corner of the table.

The actual interpretation of this value depends on the context. If the table is bound to a node, this location is usually interpreted relative to the upper left corner of the node layout.

The default value is (0,0).


Implementation
    public function get relativeLocation():IPoint
    public function set relativeLocation(value:IPoint):void
rootColumnproperty 
rootColumn:IColumn  [read-only]

The virtual root of the column hierarchy.

This row should not be queried except for the IColumn.owner and the associated IStripe.table.


Implementation
    public function get rootColumn():IColumn
rootRowproperty 
rootRow:IRow  [read-only]

The virtual root of the row hierarchy.

This row should not be queried except for the IRow.owner and the associated IStripe.table.


Implementation
    public function get rootRow():IRow
rowDefaultsproperty 
rowDefaults:IStripeDefaults

The defaults for rows.

The settings that are obtained from the instance influence newly created elements only. Setting different defaults afterwards does not influence existing elements.


Implementation
    public function get rowDefaults():IStripeDefaults
    public function set rowDefaults(value:IStripeDefaults):void
Constructor Detail
Table()Constructor
public function Table()

Default constructor that creates an empty table.

Method Detail
addLabel()method
public function addLabel(item:IStripe, text:String, labelModelParameter:ILabelModelParameter = null, style:ILabelStyle = null, preferredSize:ISize = null, tag:Object = null):ILabel

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

Parameters

item:IStripe — The item to add the label to.
 
text:String — The initial text of the label.
 
labelModelParameter:ILabelModelParameter (default = null) — The label model parameter instance to use. If none is provided the parameter will be taken from the columnDefaults or rowDefaults.
 
style:ILabelStyle (default = null) — The style to use for the label. If none is provided the parameter will be taken from the columnDefaults or rowDefaults.
 
preferredSize:ISize (default = null) — The initial value to use for the ILabel.preferredSize. If none is provided the parameter will be taken from the columnDefaults or rowDefaults.
 
tag:Object (default = null) — The initial ITagOwner.tag to assign. May be null.

Returns
ILabel — The newly created label.
clone()method 
public function clone():Object

Creates a clone of this instance.

Returns
Object — A clone of this instance.
copyColumn()method 
protected function copyColumn(column:IColumn):IColumn

Called during clone() to create a copy of the given column.

If column implements the ICloneable interface, the column instance is cloned, otherwise, the original instance is returned unchanged.

Parameters

column:IColumn — The column that should be copied during a clone operation.

Returns
IColumn — A clone of column if possible, otherwise the original reference to column
copyDefaults()method 
protected function copyDefaults(originalDefaults:IStripeDefaults):IStripeDefaults

Called during clone() to create a copy of the given defaults.

This implementation returns an unchanged reference to originalDefaults. If you need to create a deep clone of originalDefaults, you'll have to override this method to perform the cloning yourself.

Parameters

originalDefaults:IStripeDefaults — The default settings that should be copied during a clone operation.

Returns
IStripeDefaults — The original reference to originalDefaults.
copyRow()method 
protected function copyRow(row:IRow):IRow

Called during clone() to create a copy of the given row.

If row implements the ICloneable interface, the row instance is cloned, otherwise, the original instance is returned unchanged.

Parameters

row:IRow — The row that should be copied during a clone operation.

Returns
IRow — A clone of row if possible, otherwise the original reference to row
createColumn()method 
public function createColumn(owner:IColumn = null, index:int = -1, width:Number = -1, minWidth:Number = -1, insets:IRectangle = null, style:INodeStyle = null, tag:Object = null):IColumn

Create a new column as the indexth child of owner with the given parameters.

Parameters

owner:IColumn (default = null) — The owner of the new column. If none is provided the column is added to the table's root column.
 
index:int (default = -1) — The position in the child list. An index of -1 (default) will add the new column at the end of the list.
 
width:Number (default = -1) — The actual width of the column. A height of -1 (default) will cause the table to get the width from its columnDefaults.
 
minWidth:Number (default = -1) — The minimal width of the column. A minimum width of -1 (default) will cause the table to get the minimal width from its columnDefaults.
 
insets:IRectangle (default = null) — The insets of the column. If none are provided they will be taken from the columnDefaults.
 
style:INodeStyle (default = null) — The style of the column. If none is provided it will be taken from the columnDefaults.
 
tag:Object (default = null) — The tag of the column.

Returns
IColumn — A new column instance.
createColumnDefaults()method 
protected function createColumnDefaults():IStripeDefaults

Callback method that creates the column defaults.

Returns
IStripeDefaults — A new instance of the StripeDefaults class that is populated using the return values of createDefaultColumnStyle, createDefaultColumnLabelStyle, createDefaultColumnLabelModelParameter and createDefaultColumnInsets.

See also

createDefaultColumnInsets()method 
protected function createDefaultColumnInsets():IRectangle

Factory method for the default column insets. This method will be called upon first access to the columnDefaults property.

Returns
IRectangle — The default insets (0,30,0,0)
createDefaultColumnLabelModelParameter()method 
protected function createDefaultColumnLabelModelParameter():ILabelModelParameter

Factory method that creates a ILabelModelParameter to use for a newly created column label.

This implementation returns the StretchStripeLabelModel.north parameter.

Returns
ILabelModelParameter — A model parameter instance to use for the newly created column label.
createDefaultColumnLabelStyle()method 
protected function createDefaultColumnLabelStyle():ILabelStyle

Factory method for the default column label style. This method will be called upon first access to the columnDefaults property.

Returns
ILabelStyle — A new instance of SimpleLabelStyle
createDefaultColumnStyle()method 
protected function createDefaultColumnStyle():INodeStyle

Factory method for the default column style. This method will be called upon first access to the columnDefaults property.

Returns
INodeStyle — A new instance of ShapeNodeStyle
createDefaultRowInsets()method 
protected function createDefaultRowInsets():IRectangle

Factory method for the default Row insets. This method will be called upon first access to the rowDefaults property.

Returns
IRectangle — The default insets (30,0,0,0)
createDefaultRowLabelModelParameter()method 
protected function createDefaultRowLabelModelParameter():ILabelModelParameter

Factory method that creates a ILabelModelParameter to use for a newly created row label.

This implementation returns the StretchStripeLabelModel.west parameter.

Returns
ILabelModelParameter — A model parameter instance to use for the newly created row label.
createDefaultRowLabelStyle()method 
protected function createDefaultRowLabelStyle():ILabelStyle

Factory method for the default row label style. This method will be called upon first access to the rowDefaults property.

Returns
ILabelStyle — A new instance of SimpleLabelStyle
createDefaultRowStyle()method 
protected function createDefaultRowStyle():INodeStyle

Factory method for the default row style. This method will be called upon first access to the rowDefaults property.

Returns
INodeStyle — A new instance of ShapeNodeStyle
createMarkupExtension()method 
public function createMarkupExtension(context:ILookup):MarkupExtension

Creates a markup extension that can be used instead of the original class.

Parameters

context:ILookup — The context that shall be considered when creating the markup extension.

Returns
MarkupExtension
createRow()method 
public function createRow(owner:IRow = null, index:int = -1, height:Number = -1, minHeight:Number = -1, insets:IRectangle = null, style:INodeStyle = null, tag:Object = null):IRow

Create a new row as the indexth child of owner with the given parameters.

Parameters

owner:IRow (default = null) — The owner of the new row. If none is provided the row is added to the table's root row.
 
index:int (default = -1) — The position in the child list. An index of -1 (default) will add the new row at the end of the list.
 
height:Number (default = -1) — The actual height of the row. A height of -1 (default) will cause the table to get the height from its rowDefaults.
 
minHeight:Number (default = -1) — The minimal height of the row. A height of -1 (default) will cause the table to get the minimal height from its rowDefaults.
 
insets:IRectangle (default = null) — The insets of the row. If none are provided they will be taken from the rowDefaults.
 
style:INodeStyle (default = null) — The style of the row. If none is provided it will be taken from the rowDefaults.
 
tag:Object (default = null) — The tag of the row. May be null

Returns
IRow — A new row instance.
createRowDefaults()method 
protected function createRowDefaults():IStripeDefaults

Callback method that creates the row defaults.

Returns
IStripeDefaults — A new instance of the StripeDefaults class that is populated using the return values of createDefaultRowStyle, createDefaultRowLabelStyle, createDefaultRowLabelModelParameter and createDefaultRowInsets.

See also

decorateGraph()method 
public function decorateGraph(g:IGraph):void

Register an IGraph instance on a concrete table instance.

Parameters

g:IGraph — The undo graph instance to add.

getUndoSupport()method 
protected function getUndoSupport():IUndoSupport

Allows to provide an own implementation of IUndoSupport for this table.

This implementation tries to find the IUndoSupport either directly in the table lookup or from a graph instance that is available through lookup. If this method returns null, undo is disabled for this table instance.

Returns
IUndoSupport — The IUndoSupport instance for this table or null.

See also

lookup()method 
public function lookup(type:Class):Object

Returns an instance that implements the given type or null.

Typically, this method will be called in order 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 reobtained for subsequent use.

Parameters

type:Class — the type for which an instance shall be returned

Returns
Object — an instance that is assignable to type or null
onLabelAdded()method 
protected function onLabelAdded(label:ILabel):void

Called after a label has been added to a stripe.

This method triggers the corresponding events.

Parameters

label:ILabel — The label that has been added.

onLabelChanged()method 
protected function onLabelChanged(label:ILabel):void

Called after a label has changed.

This method triggers the corresponding events.

Parameters

label:ILabel — The label that has been changed.

onLabelRemoved()method 
protected function onLabelRemoved(owner:IStripe, label:ILabel):void

Called after a label has been removed from a stripe.

This method triggers the corresponding events.

Parameters

owner:IStripe — The old owner of the label.
 
label:ILabel — The label that has been added.

onStripeAdded()method 
protected function onStripeAdded(stripe:IStripe):void

Called after a stripe has been added to the table.

This method triggers the corresponding events.

Parameters

stripe:IStripe — The stripe that has been added.

onStripeChanged()method 
protected function onStripeChanged(owner:IStripe, stripe:IStripe):void

Callback that is invoked after a stripe has changed.

This will trigger the StripeEvent.STRIPE_CHANGED event.

Parameters

owner:IStripe — The original owner.
 
stripe:IStripe — The stripe that has changed.

onStripeRemoved()method 
protected function onStripeRemoved(owner:IStripe, stripe:IStripe):void

Called after a stripe has been removed from its parent.

Parameters

owner:IStripe — The old owner of the stripe.
 
stripe:IStripe — The stripe that has been removed.

registerDynamicUndoSupport()method 
public static function registerDynamicUndoSupport(graph:IGraph):void

Register a dynamic IUndoSupport for use with all tables that are bound to nodes in the given graph.

This method retrieves the IUndoSupport implementation from graph dynamically whenever undo support is queried in the table.

Parameters

graph:IGraph — The graph where the nodes exist or will be created/changed and where the undo support should come from.

See also

registerStaticUndoSupport()method 
public static function registerStaticUndoSupport(graph:IGraph, undoSupport:IUndoSupport):void

Register a fixed undoSupport instance for use with all tables that are bound to nodes in graph.

This method registers undoSupport both for existing nodes in graph as well as for newly created or changed nodes.

Parameters

graph:IGraph — The graph where the nodes exist or will be created/changed.
 
undoSupport:IUndoSupport — The undo support that should be used for table nodes in the given graph.

See also

registerUndoSupport()method 
public function registerUndoSupport(support:IUndoSupport):void

Register an IUndoSupport instance on a concrete table instance.

Parameters

support:IUndoSupport — The undo support instance to add.

remove()method 
public function remove(stripe:IStripe):void

Removes the given stripe from its parent container.

This method reparents all children of stripe to the parent of the stripe.

Parameters

stripe:IStripe — The stripe to remove.

removeColumnWithoutEvents()method 
public function removeColumnWithoutEvents(defaultColumn:DefaultColumn):void

Parameters

defaultColumn:DefaultColumn

removeLabel()method 
public function removeLabel(label:ILabel):void

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

Parameters

label:ILabel — The label to remove.


Throws
flash.errors:IllegalOperationError — If the label is not associated with this table instance.
removeUndoSupport()method 
public function removeUndoSupport():void

Remove an IUndoSupport instance that has been previously registered with registerUndoSupport.

setInsets()method 
public function setInsets(stripe:IStripe, insets:IRectangle):void

Sets the insets of the given stripe.

Parameters

stripe:IStripe — The stripe to change.
 
insets:IRectangle — The new insets of the stripe.

setLabelModelParameter()method 
public function setLabelModelParameter(label:ILabel, parameter:ILabelModelParameter):void

Sets the label model parameter for the given label.

Parameters

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


Throws
flash.errors:IllegalOperationError — If the label is not associated with this table instance.

See also

setLabelStyle()method 
public function setLabelStyle(label:ILabel, style:ILabelStyle):void

Assigns the given style instance by reference to the label. Style instances can be shared.

Parameters

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


Throws
flash.errors:IllegalOperationError — If the label is not associated with this table instance.

See also

setLabelText()method 
public function setLabelText(label:ILabel, text:String):void

Sets the label text of the given label.

Parameters

label:ILabel — The label to modify.
 
text:String — The new text of the label.


Throws
flash.errors:IllegalOperationError — If the label is not associated with this table instance.

See also

setMinimumSize()method 
public function setMinimumSize(stripe:IStripe, newSize:Number):void

Sets the minimum size of the given stripe.

This method sets the IStripe.minimumSize of stripe.

Parameters

stripe:IStripe — The stripe to change.
 
newSize:Number — The new minimum size of the stripe.

setParentColumn()method 
public function setParentColumn(owner:IColumn, column:IColumn, index:int):void

Sets owner as new parent of column.

The column will be inseted at position index in the child list of the new parent.

Parameters

owner:IColumn — The new parent.
 
column:IColumn — The child column.
 
index:int — The position to insert the child column in the parent's child list.

setParentRow()method 
public function setParentRow(owner:IRow, row:IRow, index:int):void

Sets owner as new parent of row.

The row will be inseted at position index in the child list of the new parent.

Parameters

owner:IRow — The new parent.
 
row:IRow — The child row.
 
index:int — The position to insert the child row in the parent's child list.

setPreferredSize()method 
public function setPreferredSize(label:ILabel, width:Number, height:Number):void

Sets the preferred size of the label.

Parameters

label:ILabel — The label.
 
width:Number — The new preferred width.
 
height:Number — The new preferred height.


Throws
flash.errors:IllegalOperationError — If the label is not associated with this table instance.

See also

setSize()method 
public function setSize(stripe:IStripe, newSize:Number):void

Sets the actual size of the given stripe.

This method sets the IStripe.size of stripe.

Parameters

stripe:IStripe — The stripe to change.
 
newSize:Number — The new size of the stripe.

setStyle()method 
public function setStyle(stripe:IStripe, style:INodeStyle):void

Sets the style of the given stripe.

Parameters

stripe:IStripe — The stripe to change.
 
style:INodeStyle — The new style of the stripe.

undecorateGraph()method 
public function undecorateGraph():void

Remove an IGraph instance that has been previously registered with decorateGraph.

unregisterDynamicUndoSupport()method 
public static function unregisterDynamicUndoSupport(graph:IGraph):void

Unregisters an IUndoSupport implementation that has previously been registered with registerDynamicUndoSupport.

Parameters

graph:IGraph — The graph where the tables are installed for which the undo support should be cleared.

unregisterStaticUndoSupport()method 
public static function unregisterStaticUndoSupport(graph:IGraph):void

Unregisters an IUndoSupport implementation that has previously been registered with registerStaticUndoSupport.

Parameters

graph:IGraph — The graph where the tables are installed for which the undo support should be cleared.

Event Detail
labelAdded Event
Event Object Type: com.yworks.graph.model.StripeEvent
StripeEvent.type property = com.yworks.graph.model.StripeEvent.LABEL_ADDED

Dispatched when a new label has been added to a stripe (column or row).

The label can be retrieved from the event's label property, its new owner from the stripe property. The parent property is always null.

Event which is dispatched when a new label has been added to a stripe (column or row).
labelChanged Event  
Event Object Type: com.yworks.graph.model.StripeEvent
StripeEvent.type property = com.yworks.graph.model.StripeEvent.LABEL_CHANGED

Dispatched when the label of a stripe (column or row) has been changed.

The label can be retrieved from the event's label property, its owner from the stripe property. The parent property is always null.

Event which is dispatched when the label of a stripe (column or row) has been changed.
labelRemoved Event  
Event Object Type: com.yworks.graph.model.StripeEvent
StripeEvent.type property = com.yworks.graph.model.StripeEvent.LABEL_REMOVED

Dispatched when a label has been removed from its stripe (column or row).

The label can be retrieved from the event's label property, its former owner from the stripe property. The parent property is always null.

Event which is dispatched when a label has been removed from its stripe (column or row).
stripeChanged Event  
Event Object Type: com.yworks.graph.model.StripeEvent
StripeEvent.type property = com.yworks.graph.model.StripeEvent.STRIPE_CHANGED

Dispatched when a stripe (column or row) has been changed.

The new stripe can be retrieved from the event's stripe property, its owner from the parent property.

Event which is dispatched when a stripe (column or row) has been changed.
stripeCreated Event  
Event Object Type: com.yworks.graph.model.StripeEvent
StripeEvent.type property = com.yworks.graph.model.StripeEvent.STRIPE_CREATED

Dispatched when a new stripe (column or row) is created.

The new stripe can be retrieved from the event's stripe property, its new owner from the parent property.

Event which is dispatched when a new stripe (column or row) is created.
stripeRemoved Event  
Event Object Type: com.yworks.graph.model.StripeEvent
StripeEvent.type property = com.yworks.graph.model.StripeEvent.STRIPE_REMOVED

Dispatched when a stripe (column or row) is removed from its parent.

The new stripe can be retrieved from the event's stripe property, its former owner from the parent property.

Event which is dispatched when a stripe (column or row) is removed from its parent.