nsISupports
Last changed in Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19)Implementing a nsITreeView in lieu of DOM methods for tree creation can improve performance dramatically, and removes the need to make changes to the tree manually when changes to the database occur.
Further information about creating treeviews is given in the XUL Tutorial.
boolean canDrop(in long index, in long orientation, in nsIDOMDataTransfer dataTransfer);  | 
  
boolean canDropBeforeAfter(in long index, in boolean before); Obsolete since Gecko 1.8 | 
  
boolean canDropOn(in long index); Obsolete since Gecko 1.8 | 
  
void cycleCell(in long row, in nsITreeColumn col); | 
  
void cycleHeader(in nsITreeColumn col); | 
  
void drop(in long row, in long orientation, in nsIDOMDataTransfer dataTransfer); | 
  
AString getCellProperties(in long row, in nsITreeColumn col, in nsISupportsArray properties Obsolete since Gecko 22); | 
  
AString getCellText(in long row, in nsITreeColumn col); | 
  
AString getCellValue(in long row, in nsITreeColumn col); | 
  
AString getColumnProperties(in nsITreeColumn col, in nsISupportsArray properties Obsolete since Gecko 22); | 
  
AString getImageSrc(in long row, in nsITreeColumn col); | 
  
long getLevel(in long index); | 
  
long getParentIndex(in long rowIndex); | 
  
long getProgressMode(in long row, in nsITreeColumn col); | 
  
AString getRowProperties(in long index, in nsISupportsArray properties Obsolete since Gecko 22); | 
  
boolean hasNextSibling(in long rowIndex, in long afterIndex); | 
  
boolean isContainer(in long index); | 
  
boolean isContainerEmpty(in long index); | 
  
boolean isContainerOpen(in long index); | 
  
boolean isEditable(in long row, in nsITreeColumn col); | 
  
boolean isSelectable(in long row, in nsITreeColumn col);  | 
  
boolean isSeparator(in long index); | 
  
boolean isSorted(); | 
  
void performAction(in wstring action); | 
  
void performActionOnCell(in wstring action, in long row, in nsITreeColumn col); | 
  
void performActionOnRow(in wstring action, in long row); | 
  
void selectionChanged(); | 
  
void setCellText(in long row, in nsITreeColumn col, in AString value); | 
  
void setCellValue(in long row, in nsITreeColumn col, in AString value);  | 
  
void setTree(in nsITreeBoxObject tree); | 
  
void toggleOpenState(in long index); | 
  
| Attribute | Type | Description | 
rowCount | 
   long | 
   The total number of rows in the tree (including the offscreen rows). Read only. | 
selection | 
    | 
   The selection for this view. | 
| Constant | Value | Description | 
PROGRESS_NORMAL | 
   1 | 
   
     Note: Renamed from  
   progressNormal in Gecko 1.8 | 
  
PROGRESS_UNDETERMINED | 
   2 | 
   
     Note: Renamed from  
   progressUndetermined in Gecko 1.8 | 
  
PROGRESS_NONE | 
   3 | 
   
     Note: Renamed from  
   progressNone in Gecko 1.8 | 
  
DROP_BEFORE | 
   -1 | 
   |
DROP_ON | 
   0 | 
   |
DROP_AFTER | 
   1 | 
   |
inDropBefore | 
   0 | 
   Obsolete since Gecko 1.8 | 
inDropOn | 
   1 | 
   Obsolete since Gecko 1.8 | 
inDropAfter | 
   2 | 
   Obsolete since Gecko 1.8 | 
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 when the orientation is not DROP_ON.
boolean canDrop( in long index, in long orientation, in nsIDOMDataTransfer dataTransfer );
indexorientationdataTransfer true if a drop is allowed at the current location; otherwise false.
Method 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 from canDropBeforeAfter().
boolean canDropBeforeAfter( in long index, in boolean before );
indexbeforetrue to test drop before. false to test drop after.true if a drop event can occur. Otherwise false.
Method 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 from canDropBeforeAfter().
boolean canDropOn( in long index );
indextrue if a drop event can occur. Otherwise false.
Called on the view when a cell in a non-selectable cycling column (for example, unread/flag/and so on.) is clicked.
void cycleCell( in long row, in nsITreeColumn col );
rowcolCalled on the view when a header is clicked.
void cycleHeader( in nsITreeColumn col );
colCalled when the user drops something on this view. The orientation paramater specifies before/on/after the given row.
void drop( in long row, in long orientation, in nsIDOMDataTransfer dataTransfer );
roworientationdataTransfer An atomized list of properties for a given cell. Each property, x, that the view gives back will cause the CSS ::moz-tree-cell-*(x) pseudoelement to be matched on the treechildren element.
See getRowProperties() for an example.
AString getCellProperties( in long row, in nsITreeColumn col, in nsISupportsArray properties );
rowcolpropertiesA string of space-separated property names.
The text for a given cell. If a column consists only of an image, then the empty string is returned.
AString getCellText( in long row, in nsITreeColumn col );
rowcolThe text of the cell.
The value for a given cell. This method is only called for columns of type other than text.
AString getCellValue( in long row, in nsITreeColumn col );
rowcolThe value of the cell.
Called to get properties to paint a column background. For shading the sort column, and so on. Each property, x, that the view gives back will cause the CSS  ::moz-tree-column(x) to be matched on the treechildren element.
See getRowProperties() for an example.
void getColumnProperties( in nsITreeColumn col, in nsISupportsArray properties );
colpropertiesA string of space-separated property names.
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.
AString getImageSrc( in long row, in nsITreeColumn col );
rowcolThe image path of the cell.
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 indentation.
long getLevel( in long index );
indexThe level of indentation.
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.
long getParentIndex( in long rowIndex );
rowIndexThe row index of the parent row.
The progress mode for a given cell. This method is only called for columns of type progressmeter. See the constants section for possible modes.
long getProgressMode( in long row, in nsITreeColumn col );
rowcolThe progress mode for the cell.
An atomized list of properties for a given row. Each property, x, that the view gives back will cause the CSS ::moz-tree-row(x) pseudoelement to be matched on the treechildren element.
void getRowProperties( in long index, in nsISupportsArray properties );
indexpropertiesA string of space-separated property names.
 Your function will not be provided with a properties array. (This is one way of detecting the version at run-time). Simply return a string of space-separated property names. For example:
getRowProperties: function(index) {
  return "dummy";
}
  Obsolete since Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
nsIAtomService to create an nsIAtom string, which can then be appended to the array to alter the style (see also Styling a Tree)
getRowProperties: function(index, properties) {
  var atomService = Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
  var atom = atomService.getAtom("dummy");
  properties.AppendElement(atom);
}
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.
boolean hasNextSibling( in long rowIndex, in long afterIndex );
rowIndexafterIndextrue if the row has a next sibling. Otherwise false
Whether the row has the potential to hold other rows within it. This does not determine whether a twisty is actually drawn; that's left up to isContainerEmpty. For very simple tree views, such as those without multi-level data, you might want to consider using something simpler than a tree view, such as a listbox.
For tree views with multi-level data, it's advisable to distinguish between a row which is an empty container (i.e., a row with the potential to hold children but that currently has none), and a non-empty container (i.e., a row that positively does currently have children). The tree frame code that handles drag and drop, for example, uses this method to determine how to interpret the drop position.
nsITreeView implementations must be prepared to handle a call to toggleOpenState for any row index which returns true for a call to isContainer, even if isContainerEmpty returns true.boolean isContainer( in long index );
indextrue if the row is a container. Otherwise false.
One of the 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.
boolean isContainerEmpty( in long index );
indextrue if the item is an empty container. Otherwise false.
One of the 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.
boolean isContainerOpen( in long index );
indextrue if the item is an open container. Otherwise false.
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.
boolean isEditable( in long row, in nsITreeColumn col );
rowcolCalled to ask the view if the cell is selectable. This method is only called if the selection type is cell or text.
boolean isSelectable( in long row, in nsITreeColumn col );
rowcoltrue if the cell is selectable. Otherwise false.
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 pseudoelement to draw the separator.
boolean isSeparator( in long index );
indextrue if the row is a separator. Otherwise false.
Specifies if there is currently a sort on any column. Used mostly by dragdrop to affect drop feedback.
boolean isSorted();
None.
true if the column is sorted. Otherwise false.
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.
void performAction( in wstring action );
actionA command API that can be used to invoke commands on a specific cell.
void performActionOnCell( in wstring action, in long row, in nsITreeColumn col );
actionrowcolA command API that can be used to invoke commands on a specific row.
void performActionOnRow( in wstring action, in long row );
actionrowShould be called from a XUL onselect handler whenever the selection changes.
void selectionChanged();
None.
setCellText is called when the contents of the cell have been edited by the user.
void setCellText( in long row, in nsITreeColumn col, in AString value );
rowcolvaluesetCellValue 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.
void setCellValue( in long row, in nsITreeColumn col, in AString value );
rowcolvalueCalled when setting or clearing the view on the tree to link the view to or disconnect the front end box object.
void setTree( in nsITreeBoxObject tree );
treensITreeBoxObject to attach this view to, or null if the view is being removed from the tree.Called on the view when an item is opened or closed, e.g., by clicking the twisty, keyboard access, et cetera.
nsITreeView implementations must be prepared to handle a call to toggleOpenState for any row index which returns true for a call to isContainer, regardless of whether the container is empty.void toggleOpenState( in long index );
indexWhen working with tree views, the tree box object may also be useful