BiTreeViewDataModel

This defines the interface that is needed for a data model for a BiTreeView. This actually implements a dummy data model. Extend this class to create more useful data models

This class extends BiEventTarget and therefore all methods and fields available for BiEventTarget are also available for BiTreeViewDataModel .

Constructor

new BiTreeViewDataModel ( )

Parameters

No parameters.

Properties

NameTypegetsetDescripton
allExpandedvoidcheckedSets all available rows expanded.
columnCountNumbercheckedThe number of columns in the model.
rowCountNumbercheckedThe number of rows in the model. In case the data model is a tree then this should take collapsed subtrees into account
sortAscendingBooleancheckedWhether the currently sorted column is sorted ascending or descending
sortColumnNumbercheckedThe column that the model is currently sorted by. Return -1 if no sorting is done.

Methods

NameDescription
getCanSortColumnThis returns whether the data model can be sorted by column
getCellIsAnchorReturns whether the cell is acting as the anchor item in the selection
getCellIsLeadReturns whether the cell is acting as the lead item in the selection
getCellSelectedReturns whether the cell is selected
getCellStyleThis allows a custom CSS text to be applied to a cell. This allows more detailed control over the rendering of the cell.
getCellTextThis should return the text (HTML string) to show for the cell at (x,y)
getContextMenuThis allows a context menu to be shown when the user invokes the context menu on the cell
getDepthThe depth of the current row. If the data model describes a tree structure the depth is used to indent the row
getDropDataTypesReturns the supported data types for the cell. Return [] or null if no drop is desired on the cll
getExpandedReturns whether the row is expanded
getHasChildrenReturns whether the row has any children
getHasIconReturns whether the cell should display an icon. If this is the case the actual image URI is returned using getIcon
getHeaderCellStyleThis allows a custom CSS text to be applied to a header cell. This allows more detailed control over the rendering of the header cell.
getHeaderCellTextThis should return the text (HTML string) to show for the header cell at x
getIconReturns the path to the image to show on the cell. This is only called for cells that should have an icon accordingly to getHasIcon
getIconStyleUse this to specify some custom CSS to use for the icon image.
getParentReturns the row index for the parent. If this represents a flat structure and the the row has no parent then this should return -1
getRowHeaderCellStyleThis allows a custom CSS text to be applied to a row header cell. This allows more detailed control over the rendering of the row header cell.
getRowHeaderCellTextThis should return the text (HTML string) to show for the row header cell at y
getRowIsAnchorReturns whether the row is acting as the anchor item in the selection
getRowIsLeadReturns whether the row is acting as the lead item in the selection
getRowSelectedReturns whether the row at y is selected
getRowStyleThis allows a custom CSS text to be applied to the row. This allows more detailed control over the rendering of the row.
getShownChildrenCountReturns the number of shown descendants. If the data model represents a tree then this is the sum all descendants that are shown.
getSortFunctionReturns a function that compares two rows, looking at column x. The returned function should take 2 arguments and return a number depending on the relative order of the arguments.
getToolTipThis should return the tool tip to use for the cell
setExpandedSets whether the row is expanded. The data model is responsible for taking care of the expanded state. The data model should fire the following BiTreeViewDataModelEvent events, "beforeexpand", "beforecollapse", "expand" and "collapse" so that the BiTreeView can be updated
sortThis sorts the data model by column x. This should fire a BiTreeViewDataModelEvent called "datachanged" if the data changed (or was reordered) so that the BiTreeView is correctly redrawn

Events

NameTypeBubblesDescripton
datachangedBiTreeViewDataModelEventThis event is fired when the data has changed.

Static Methods

None.

Static Fields

None.

Remarks

None.

Method Details

getCanSortColumn

This returns whether the data model can be sorted by column

Syntax

object.getCanSortColumn ( x )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index

Return Type

Boolean

getCellIsAnchor

Returns whether the cell is acting as the anchor item in the selection

Syntax

object.getCellIsAnchor ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

Boolean

getCellIsLead

Returns whether the cell is acting as the lead item in the selection

Syntax

object.getCellIsLead ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

Boolean

getCellSelected

Returns whether the cell is selected

Syntax

object.getCellSelected ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

Boolean

getCellStyle

This allows a custom CSS text to be applied to a cell. This allows more detailed control over the rendering of the cell.

Syntax

object.getCellStyle ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

String

getCellText

This should return the text (HTML string) to show for the cell at (x,y)

Syntax

object.getCellText ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

String

getContextMenu

This allows a context menu to be shown when the user invokes the context menu on the cell

Syntax

object.getContextMenu ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

BiMenu

getDepth

The depth of the current row. If the data model describes a tree structure the depth is used to indent the row

Syntax

object.getDepth ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Number

getDropDataTypes

Returns the supported data types for the cell. Return [] or null if no drop is desired on the cll

Syntax

object.getDropDataTypes ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

String[]

getExpanded

Returns whether the row is expanded

Syntax

object.getExpanded ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Boolean

getHasChildren

Returns whether the row has any children

Syntax

object.getHasChildren ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Boolean

getHasIcon

Returns whether the cell should display an icon. If this is the case the actual image URI is returned using getIcon

Syntax

object.getHasIcon ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

Boolean

getHeaderCellStyle

This allows a custom CSS text to be applied to a header cell. This allows more detailed control over the rendering of the header cell.

Syntax

object.getHeaderCellStyle ( x )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the header cell

Return Type

String

getHeaderCellText

This should return the text (HTML string) to show for the header cell at x

Syntax

object.getHeaderCellText ( x )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the header cell

Return Type

String

getIcon

Returns the path to the image to show on the cell. This is only called for cells that should have an icon accordingly to getHasIcon

Syntax

object.getIcon ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

String

getIconStyle

Use this to specify some custom CSS to use for the icon image.

Syntax

object.getIconStyle ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell containing the icon
yNumberThe row index for the cell row containing the icon

Return Type

String

getParent

Returns the row index for the parent. If this represents a flat structure and the the row has no parent then this should return -1

Syntax

object.getParent ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Number

getRowHeaderCellStyle

This allows a custom CSS text to be applied to a row header cell. This allows more detailed control over the rendering of the row header cell.

Syntax

object.getRowHeaderCellStyle ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe row index for the row header cell

Return Type

String

getRowHeaderCellText

This should return the text (HTML string) to show for the row header cell at y

Syntax

object.getRowHeaderCellText ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe row index for the row header cell

Return Type

String

getRowIsAnchor

Returns whether the row is acting as the anchor item in the selection

Syntax

object.getRowIsAnchor ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Boolean

getRowIsLead

Returns whether the row is acting as the lead item in the selection

Syntax

object.getRowIsLead ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Boolean

getRowSelected

Returns whether the row at y is selected

Syntax

object.getRowSelected ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Boolean

getRowStyle

This allows a custom CSS text to be applied to the row. This allows more detailed control over the rendering of the row.

Syntax

object.getRowStyle ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

String

getShownChildrenCount

Returns the number of shown descendants. If the data model represents a tree then this is the sum all descendants that are shown.

Syntax

object.getShownChildrenCount ( y )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row

Return Type

Number

getSortFunction

Returns a function that compares two rows, looking at column x. The returned function should take 2 arguments and return a number depending on the relative order of the arguments.

Syntax

object.getSortFunction ( x )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe index of the column to compare the rows by

Return Type

Function

getToolTip

This should return the tool tip to use for the cell

Syntax

object.getToolTip ( x,y )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index for the cell
yNumberThe row index for the cell

Return Type

BiToolTip

setExpanded

Sets whether the row is expanded. The data model is responsible for taking care of the expanded state. The data model should fire the following BiTreeViewDataModelEvent events, "beforeexpand", "beforecollapse", "expand" and "collapse" so that the BiTreeView can be updated

Syntax

object.setExpanded ( y,b )

Parameters

NameTypeOptionalDefaultDescripton
yNumberThe index for the row
bBooleanWhether the row is expanded or collapsed

Return Type

void

sort

This sorts the data model by column x. This should fire a BiTreeViewDataModelEvent called "datachanged" if the data changed (or was reordered) so that the BiTreeView is correctly redrawn

Syntax

object.sort ( x,bAscending )

Parameters

NameTypeOptionalDefaultDescripton
xNumberThe column index
bAscendingBooleanOptional. Whether to sort ascending. If left out this toggles the current sort or sorts ascending if the column was not sorted before

Return Type

void