XULTreeBuilder

This object is available to unprivileged JavaScript. It implements the following interfaces:

Constants

PRInt16 DROP_BEFORE = -1
PRInt16 DROP_ON = 0
PRInt16 DROP_AFTER = 1
The progress mode for a given cell. This method is only called for columns of type progressmeter.
PRInt16 PROGRESS_NORMAL = 1
PRInt16 PROGRESS_UNDETERMINED = 2
PRInt16 PROGRESS_NONE = 3
PRInt32 DROP_BEFORE = -1
PRInt32 DROP_ON = 0
PRInt32 DROP_AFTER = 1

Properties

readonly PRInt32 rowCount

The total number of rows in the tree (including the offscreen rows).

TreeSelection selection

The selection for this view.


Methods

boolean canDrop ( PRInt32 index , PRInt32 orientation ) void cycleCell ( PRInt32 row , TreeColumn col ) void cycleHeader ( TreeColumn col ) void drop ( PRInt32 row , PRInt32 orientation ) void getCellProperties ( PRInt32 row , TreeColumn col , nsISupportsArray properties ) AString getCellText ( PRInt32 row , TreeColumn col ) AString getCellValue ( PRInt32 row , TreeColumn col ) void getColumnProperties ( TreeColumn col , nsISupportsArray properties ) AString getImageSrc ( PRInt32 row , TreeColumn col ) PRInt32 getLevel ( PRInt32 index ) PRInt32 getParentIndex ( PRInt32 rowIndex ) PRInt32 getProgressMode ( PRInt32 row , TreeColumn col ) void getRowProperties ( PRInt32 index , nsISupportsArray properties ) boolean hasNextSibling ( PRInt32 rowIndex , PRInt32 afterIndex ) boolean isContainer ( PRInt32 index ) boolean isContainerEmpty ( PRInt32 index ) boolean isContainerOpen ( PRInt32 index ) boolean isEditable ( PRInt32 row , TreeColumn col ) boolean isSeparator ( PRInt32 index ) boolean isSorted ( ) void onCycleCell ( PRInt32 row , PRUnichar* colID ) void onCycleHeader ( PRUnichar* colID , Element elt ) void onDrop ( PRInt32 row , PRInt32 orientation ) void onPerformAction ( PRUnichar* action ) void onPerformActionOnCell ( PRUnichar* action , PRInt32 row , PRUnichar* colID ) void onPerformActionOnRow ( PRUnichar* action , PRInt32 row ) void onSelectionChanged ( ) void onToggleOpenState ( PRInt32 index ) void performAction ( PRUnichar* action ) void performActionOnCell ( PRUnichar* action , PRInt32 row , TreeColumn col ) void performActionOnRow ( PRUnichar* action , PRInt32 row ) void selectionChanged ( ) void setCellText ( PRInt32 row , TreeColumn col , AString value ) void setCellValue ( PRInt32 row , TreeColumn col , AString value ) void setTree ( TreeBoxObject tree ) void toggleOpenState ( PRInt32 index )

boolean canDrop ( PRInt32 index , PRInt32 orientation )

Methods used by the drag feedback code to determine if a drag is allowable at the current location. To get the behavior where drops are only allowed on items, such as the mailNews folder pane, always return false whe the orientation is not DROP_ON.

Arguments:
index
orientation

void cycleCell ( PRInt32 row , TreeColumn col )

Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.

Arguments:
row
col

void cycleHeader ( TreeColumn col )

Called on the view when a header is clicked.

Arguments:
col

void drop ( PRInt32 row , PRInt32 orientation )

Called when the user drops something on this view. The orientation param specifies before/on/after the given row.

Arguments:
row
orientation

void getCellProperties ( PRInt32 row , TreeColumn col , nsISupportsArray properties )

An atomized list of properties for a given cell. Each property, x, that the view gives back will cause the pseudoclass :moz-tree-cell-x to be matched on the ::moz-tree-cell pseudoelement.

Arguments:
row
col
properties

AString getCellText ( PRInt32 row , TreeColumn col )

The text for a given cell. If a column consists only of an image, then the empty string is returned.

Arguments:
row
col

AString getCellValue ( PRInt32 row , TreeColumn col )

The value for a given cell. This method is only called for columns of type other than text.

Arguments:
row
col

void getColumnProperties ( TreeColumn col , nsISupportsArray properties )

Called to get properties to paint a column background. For shading the sort column, etc.

Arguments:
col
properties

AString getImageSrc ( PRInt32 row , TreeColumn col )

The image path for a given cell. For defining an icon for a cell. If the empty string is returned, the :moz-tree-image pseudoelement will be used.

Arguments:
row
col

PRInt32 getLevel ( PRInt32 index )

The level is an integer value that represents the level of indentation. It is multiplied by the width specified in the :moz-tree-indentation pseudoelement to compute the exact indendation.

Arguments:
index

PRInt32 getParentIndex ( PRInt32 rowIndex )

Methods used by the tree to draw thread lines in the tree. getParentIndex is used to obtain the index of a parent row. If there is no parent row, getParentIndex returns -1.

Arguments:
rowIndex

PRInt32 getProgressMode ( PRInt32 row , TreeColumn col )

Arguments:
row
col

void getRowProperties ( PRInt32 index , nsISupportsArray properties )

An atomized list of properties for a given row. Each property, x, that the view gives back will cause the pseudoclass :moz-tree-row-x to be matched on the pseudoelement ::moz-tree-row.

Arguments:
index
properties

boolean hasNextSibling ( PRInt32 rowIndex , PRInt32 afterIndex )

HasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs *after* the index specified by afterIndex. Code that is forced to march down the view looking at levels can optimize the march by starting at afterIndex+1.

Arguments:
rowIndex
afterIndex

boolean isContainer ( PRInt32 index )

Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.

Arguments:
index

boolean isContainerEmpty ( PRInt32 index )

Arguments:
index

boolean isContainerOpen ( PRInt32 index )

Arguments:
index

boolean isEditable ( PRInt32 row , TreeColumn col )

IsEditable is called to ask the view if the cell contents are editable. A value of true will result in the tree popping up a text field when the user tries to inline edit the cell.

Arguments:
row
col

boolean isSeparator ( PRInt32 index )

IsSeparator is used to determine if the row at index is a separator. A value of true will result in the tree drawing a horizontal separator. The tree uses the ::moz-tree-separator pseudoclass to draw the separator.

Arguments:
index

boolean isSorted ( )

Specifies if there is currently a sort on any column. Used mostly by dragdrop to affect drop feedback.


void onCycleCell ( PRInt32 row , PRUnichar* colID )

Called when a cell in a non-selectable cycling column (e.g. unread/flag/etc.) is clicked.

Arguments:
row
colID

void onCycleHeader ( PRUnichar* colID , Element elt )

Called when a header is clicked.

Arguments:
colID
elt

void onDrop ( PRInt32 row , PRInt32 orientation )

Called when the user drops something on this view. The orientation param specifies before/on/after the given row.

Arguments:
row
orientation

void onPerformAction ( PRUnichar* action )

A command API that can be used to invoke commands on the selection. The tree will automatically invoke this method when certain keys are pressed. For example, when the DEL key is pressed, performAction will be called with the "delete" string.

Arguments:
action

void onPerformActionOnCell ( PRUnichar* action , PRInt32 row , PRUnichar* colID )

A command API that can be used to invoke commands on a specific cell.

Arguments:
action
row
colID

void onPerformActionOnRow ( PRUnichar* action , PRInt32 row )

A command API that can be used to invoke commands on a specific row.

Arguments:
action
row

void onSelectionChanged ( )

Called when selection in the tree changes


void onToggleOpenState ( PRInt32 index )

Called when an item is opened or closed.

Arguments:
index

void performAction ( PRUnichar* action )

A command API that can be used to invoke commands on the selection. The tree will automatically invoke this method when certain keys are pressed. For example, when the DEL key is pressed, performAction will be called with the "delete" string.

Arguments:
action

void performActionOnCell ( PRUnichar* action , PRInt32 row , TreeColumn col )

A command API that can be used to invoke commands on a specific cell.

Arguments:
action
row
col

void performActionOnRow ( PRUnichar* action , PRInt32 row )

A command API that can be used to invoke commands on a specific row.

Arguments:
action
row

void selectionChanged ( )

Should be called from a XUL onselect handler whenever the selection changes.


void setCellText ( PRInt32 row , TreeColumn col , AString value )

SetCellText is called when the contents of the cell have been edited by the user.

Arguments:
row
col
value

void setCellValue ( PRInt32 row , TreeColumn col , AString value )

SetCellValue is called when the value of the cell has been set by the user. This method is only called for columns of type other than text.

Arguments:
row
col
value

void setTree ( TreeBoxObject tree )

Called during initialization to link the view to the front end box object.

Arguments:
tree

void toggleOpenState ( PRInt32 index )

Called on the view when an item is opened or closed.

Arguments:
index

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com