nsITreeSelection

This interface is used by the tree widget to get information about what is selected.
Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Method overview

void adjustSelection(in long index, in long count);
void clearRange(in long startIndex, in long endIndex);
void clearSelection();
void getRangeAt(in long i, out long min, out long max);
long getRangeCount();
void invalidateSelection();
void invertSelection();
boolean isSelected(in long index);
void rangedSelect(in long startIndex, in long endIndex, in boolean augment);
void select(in long index);
void selectAll();
void timedSelect(in long index, in long delay);
void toggleSelect(in long index);

Attributes

Attribute Type Description
count long The number of rows currently selected in this tree. Read only.
currentColumn nsITreeColumn The current column.
currentIndex long

The current item (the one with focus).

Note: This property indicates only the index of the row with tree cursor around it. This is not a reliable method of determining the selected row, as the selection may include multiple rows, or the focused row may not even be selected.
selectEventsSuppressed boolean

This attribute is a boolean indicating whether or not the "select" event should fire when the selection is changed using one of our methods. A view can use this to temporarily suppress the selection while manipulating all of the indices, for example, on a sort.

Note: Setting this attribute to false will fire a select event.
shiftSelectPivot long The selection "pivot". This is the first item the user selected as part of a ranged select. Read only.
single boolean This attribute is a boolean indicating single selection. Read only.
tree nsITreeBoxObject The tree widget for this selection.

Methods

adjustSelection()

Called when the row count changes to adjust selection indices.

void adjustSelection(
  in long index,
  in long count
);
Parameters
index
Index of the change.
count
Number of rows changed.

clearRange()

Clears the range.

void clearRange(
  in long startIndex,
  in long endIndex
);
Parameters
startIndex
Index to clearing at.
endIndex
Index to stop clearing at.

clearSelection()

Clears the selection.

void clearSelection();
Parameters

None.

getRangeAt()

Returns two objects whose value properties represent the minimum and maximum indices of the given selection range. See the Tree Selection tutorial.

void getRangeAt(
  in long i,
  out long min,
  out long max
);
Parameters
i
Index of range to get (0 <= i < getRangeCount())
 
min
Index of first object in range.
max
Index of last object in this range.  For single selections, min == max.
 

getRangeCount()

Returns a count of selection ranges.

long getRangeCount();
Parameters

None.

Return value

long - number of selection ranges

invalidateSelection()

Can be used to invalidate the selection.

void invalidateSelection();
Parameters

None.

invertSelection()

Inverts the selection.

void invertSelection();
Parameters

None.

isSelected()

Indicates whether or not the row at the specified index is part of the selection.

boolean isSelected(
  in long index
);
Parameters
index
Index of the row to check.
Return value

 

rangedSelect()

Select the range specified by the indices.

void rangedSelect(
  in long startIndex,
  in long endIndex,
  in boolean augment
);
Parameters
startIndex
Index to start selecting at.
endIndex
Index to stop selecting at. This parameter is inclusive; to select one item, set endIndex == startIndex.
augment
If true, the range is added to the selection without clearing out anything else. If false, everything is cleared except for the specified range.

select()

Deselect all rows and select the row at the specified index.

void select(
  in long index
);
Parameters
index
Index of the row to select.

selectAll()

Selects all rows.

void selectAll();
Parameters

None.

timedSelect()

Perform a timed select.

void timedSelect(
  in long index,
  in long delay
);
Parameters
index
Index of the row to select.
delay
Time in miliseconds to delay selection.

toggleSelect()

Toggle the selection state of the row at the specified index.

void toggleSelect(
  in long index
);
Parameters
index
Row to toggle.

Document Tags and Contributors

 Last updated by: Allasso,