nsITreeSelection 编辑

layout/xul/base/src/tree/public/nsITreeSelection.idlScriptable 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

AttributeTypeDescription
countlongThe number of rows currently selected in this tree. Read only.
currentColumnnsITreeColumnThe current column.
currentIndexlong

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.
selectEventsSuppressedboolean

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.
shiftSelectPivotlongThe selection "pivot". This is the first item the user selected as part of a ranged select. Read only.
singlebooleanThis attribute is a boolean indicating single selection. Read only.
treensITreeBoxObjectThe 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:112 次

字数:10361

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文