⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 biselectionmodel.html

📁 在流览器上仿CS界面的JAVASCRIPT脚本
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--
Generated using api.website.xsl version 2003-07-17
-->
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BiSelectionModel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript">

				function showDerivedClasses() {
					var ul = document.getElementById("api-derived-classes");
					var lis = ul.childNodes;
					var l = lis.length;
					for (var i = 1; i < l; i++)
						lis[i].style.display = "";
					lis[0].style.display = "none";
				}

			</script></head>
<body>
<h1 id="BiSelectionModel">BiSelectionModel</h1>
<p>
		This class handles provides a basic selection model<br>
<br>
This treats <code><a href="BiComponent.html#children">children</a></code> as
selectable items inside a <code><a href="BiComponent.html">component</a></code>. The items can
be of any type but if it they are not <code><a href="BiComponent.html">BiComponents</a></code> you
will have to override the following methods and properties: <code><a href="#first">first</a></code>,
<code><a href="#last">last</a></code>, <code><a href="#items">items</a></code>, <code><a href="#getNext">getNext</a></code>, <code><a href="#getPrevious">getPrevious</a></code>,
<code><a href="#getItemHashCode">getItemHashCode</a></code>, <code><a href="#scrollItemIntoView">scrollItemIntoView</a></code>,
<code><a href="#getItemLeft">getItemLeft</a></code>, <code><a href="#getItemTop">getItemTop</a></code>, <code><a href="#getItemWidth">getItemWidth</a></code>
and <code><a href="#getItemHeight">getItemHeight</a></code>.<br>
<br>
To update the visuals (to show what is selected) override the following
methods: <code><a href="#updateItemSelectionState">updateItemSelectionState</a></code>, <code><a href="#updateItemAnchorState">updateItemAnchorState</a></code>
and <code><a href="#updateItemLeadState">updateItemLeadState</a></code>.

	</p>
<p>This class extends
		<code><a href="BiEventTarget.html">BiEventTarget</a></code>
		and therefore all methods and fields available for
		<code><a href="BiEventTarget.html">BiEventTarget</a></code>
		are also available for <code>BiSelectionModel</code>.</p>
<ul class="partial-class-tree">
<li><code><a href="BiObject.html">BiObject</a></code><ul>
<li><code><a href="BiEventTarget.html">BiEventTarget</a></code><ul><li><code>BiSelectionModel</code><ul id="api-derived-classes"><li><code><a href="BiGridSelectionModel.html">BiGridSelectionModel</a></code></li><li><code><a href="BiListSelectionModel.html">BiListSelectionModel</a></code></li><li><code><a href="BiTreeSelectionModel.html">BiTreeSelectionModel</a></code></li><li><code><a href="BiTreeViewSelectionModel.html">BiTreeViewSelectionModel</a></code></li></ul></li></ul></li></ul>
</li>
</ul>
<h2>Constructor</h2>
<p><code>

	new BiSelectionModel(<span class="methodArgument">oOwner</span>)</code></p>
<h3>Parameters</h3>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>oOwner</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code></code></td>
<td class="optional-column"></td>
<td></td>
<td>
				This is the component the selection model is handling
			</td>
</tr>
</tbody>
</table>
<h2>Properties</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="get-header">get</td>
<td class="set-header">set</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><a name="anchorItem"></a><code>anchorItem</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>This item is used when doing multiple selection with the shift key</td>
</tr>
<tr>
<td><a name="first"></a><code>first</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"></td>
<td>Returns the first item</td>
</tr>
<tr>
<td><a name="items"></a><code>items</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent[]</a></code>/Object[]</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"></td>
<td>Returns an array containing the items</td>
</tr>
<tr>
<td><a name="last"></a><code>last</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"></td>
<td>Returns the last item</td>
</tr>
<tr>
<td><a name="leadItem"></a><code>leadItem</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>This item is used when doing multiple selection. This is the last item selected.</td>
</tr>
<tr>
<td><a name="multipleSelection"></a><code>multipleSelection</code></td>
<td><code class="type">Boolean</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>Whethert the selection model supports multiple selection</td>
</tr>
<tr>
<td><a name="owner"></a><code>owner</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"><img src="check.png" alt="checked"></td>
<td>This is the owner component that is
			containing the selectable objects. This should not be set after the
			selection model has been used</td>
</tr>
<tr>
<td><a name="selectedItems"></a><code>selectedItems</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent[]</a></code>/Object[]</code></td>
<td class="get-column"><img src="check.png" alt="checked"></td>
<td class="set-column"></td>
<td>Returns an array containing the selected items</td>
</tr>
</tbody>
</table>
<h2>Methods</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="#deselectAll">deselectAll</a></code></td>
<td>Deselects all items</td>
</tr>
<tr>
<td><code><a href="#getCtrlEnd">getCtrlEnd</a></code></td>
<td>
				Returns the item to navigate to when the end key and the control
				key is pressed. This should usually just return the last item.
			</td>
</tr>
<tr>
<td><code><a href="#getCtrlHome">getCtrlHome</a></code></td>
<td>
				Returns the item to navigate to when the home key and the
				control key is pressed. This should usually just return the first item.
			</td>
</tr>
<tr>
<td><code><a href="#getDown">getDown</a></code></td>
<td>
				Returns the item to navigate to when the down arrow key is pressed.
				This should usually just return the item below the current one.
			</td>
</tr>
<tr>
<td><code><a href="#getEnd">getEnd</a></code></td>
<td>
				Returns the item to navigate to when the end key is pressed.
				This should usually just return the last item.
			</td>
</tr>
<tr>
<td><code><a href="#getHome">getHome</a></code></td>
<td>
				Returns the item to navigate to when the home key is pressed.
				This should usually just return the first item.
			</td>
</tr>
<tr>
<td><code><a href="#getItemHashCode">getItemHashCode</a></code></td>
<td>
				Returns a unique identifier for the item. Override this if your
				items are not instances of <code><a href="BiObject.html">BiObject</a></code>.
			</td>
</tr>
<tr>
<td><code><a href="#getItemHeight">getItemHeight</a></code></td>
<td>
				Returns the height of the item
			</td>
</tr>
<tr>
<td><code><a href="#getItemLeft">getItemLeft</a></code></td>
<td>
				Returns the left position of the item
			</td>
</tr>
<tr>
<td><code><a href="#getItemSelected">getItemSelected</a></code></td>
<td>
				Returns whether the item is selected or not.
			</td>
</tr>
<tr>
<td><code><a href="#getItemTop">getItemTop</a></code></td>
<td>
				Returns the top position of the item
			</td>
</tr>
<tr>
<td><code><a href="#getItemToSelect">getItemToSelect</a></code></td>
<td>
				Returns the next item to select (move to) when using the keyboard.
				Usually it is enough to override the needed methods among these:
				getLeft, getRight, getUp, getDown, getHome, getCtrlHome, getEnd,
				getCtrlEnd, getpageUp and getPageDown.
			</td>
</tr>
<tr>
<td><code><a href="#getItemWidth">getItemWidth</a></code></td>
<td>
				Returns the width of the item
			</td>
</tr>
<tr>
<td><code><a href="#getLeft">getLeft</a></code></td>
<td>
				Returns the item to navigate to when the left arrow key is pressed.
				This should usually just return the item to the left of the current one.
			</td>
</tr>
<tr>
<td><code><a href="#getNext">getNext</a></code></td>
<td>Gets the item coming next after the item</td>
</tr>
<tr>
<td><code><a href="#getPageDown">getPageDown</a></code></td>
<td>
				Returns the item to navigate to when the page down is pressed.
			</td>
</tr>
<tr>
<td><code><a href="#getPageUp">getPageUp</a></code></td>
<td>
				Returns the item to navigate to when the page up key is pressed.
			</td>
</tr>
<tr>
<td><code><a href="#getPrevious">getPrevious</a></code></td>
<td>Gets the item coming before after the item</td>
</tr>
<tr>
<td><code><a href="#getRight">getRight</a></code></td>
<td>
				Returns the item to navigate to when the right arrow key is pressed.
				This should usually just return the item to the right of the current one.
			</td>
</tr>
<tr>
<td><code><a href="#getUp">getUp</a></code></td>
<td>
				Returns the item to navigate to when the up arrow key is pressed.
				This should usually just return the item above the current one.
			</td>
</tr>
<tr>
<td><code><a href="#handleClick">handleClick</a></code></td>
<td>
				This should be called when the user clicks on an item
			</td>
</tr>
<tr>
<td><code><a href="#handleDblClick">handleDblClick</a></code></td>
<td>
				This should be called when the user double clicks on an item
			</td>
</tr>
<tr>
<td><code><a href="#handleKeyDown">handleKeyDown</a></code></td>
<td>
				This should be called when the user presses down a key on the component
			</td>
</tr>
<tr>
<td><code><a href="#handleMouseDown">handleMouseDown</a></code></td>
<td>
				This should be called when the user pressed down the mouse button on an item
			</td>
</tr>
<tr>
<td><code><a href="#handleMouseUp">handleMouseUp</a></code></td>
<td>
				This should be called when the user releases the mouse button on an item
			</td>
</tr>
<tr>
<td><code><a href="#isBefore">isBefore</a></code></td>
<td>
				Returns whether the first item is before the second item in the component.
			</td>
</tr>
<tr>
<td><code><a href="#isEqual">isEqual</a></code></td>
<td>
				Compares two items and returns true if they are equal. Override this
			</td>
</tr>
<tr>
<td><code><a href="#scrollItemIntoView">scrollItemIntoView</a></code></td>
<td>
				Scrolls the owner so that the item becomes visible.
			</td>
</tr>
<tr>
<td><code><a href="#selectAll">selectAll</a></code></td>
<td>Selects all items</td>
</tr>
<tr>
<td><code><a href="#selectItemRange">selectItemRange</a></code></td>
<td>
				Selects the items passed as arguments and all the items between them
			</td>
</tr>
<tr>
<td><code><a href="#setItemSelected">setItemSelected</a></code></td>
<td>
				Sets the item as selected (or deselected) and also updates the
				selected items collection.
			</td>
</tr>
<tr>
<td><code><a href="#updateItemAnchorState">updateItemAnchorState</a></code></td>
<td>
				This is called when the anchor state of the item has changed.
				Override this to update the visuals to reflect the anchor state.
			</td>
</tr>
<tr>
<td><code><a href="#updateItemLeadState">updateItemLeadState</a></code></td>
<td>
				This is called when the lead state of the item has changed.
				Override this to update the visuals to reflect the lead state.
			</td>
</tr>
<tr>
<td><code><a href="#updateItemSelectionState">updateItemSelectionState</a></code></td>
<td>
				This is called when the selection state of the item has changed.
				Override this to update the visuals to reflect the selected state.
			</td>
</tr>
</tbody>
</table>
<h2>Events</h2>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="bubbles-header">Bubbles</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><a name="change"></a><code>change</code></td>
<td><code class="type"><code><a href="BiEvent.html">BiEvent</a></code></code></td>
<td class="bubbles-column"></td>
<td>Fires when the selected items are changed</td>
</tr>
</tbody>
</table>
<h2>Static Methods</h2>
<p>None.</p>
<h2>Static Fields</h2>
<p>None.</p>
<h2>Remarks</h2>
<p>
		You need to add event listeners to the owner that calls
		<code><a href="#handleKeyDown">handleKeyDown</a></code>, <code><a href="#handleMouseDown">handleMouseDown</a></code>,
		<code><a href="#handleMouseUp">handleMouseUp</a></code>, <code><a href="#handleClick">handleClick</a></code> and
		<code><a href="#handleDblClick">handleDblClick</a></code>.
	</p>
<h2>Method Details</h2>
<h3><a name="deselectAll"></a>deselectAll</h3>
<p>Deselects all items</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.deselectAll()</pre>
<h4>Parameters</h4>
<p>No arguments.</p>
<h4>Return Type</h4>
<p><code class="type">void</code></p>
<h3><a name="getCtrlEnd"></a>getCtrlEnd</h3>
<p>
				Returns the item to navigate to when the end key and the control
				key is pressed. This should usually just return the last item.
			</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.getCtrlEnd(<span class="methodArgument">oItem</span>)</pre>
<h4>Parameters</h4>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>oItem</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></td>
<td class="optional-column"></td>
<td></td>
<td>The item that we want to get the new item relative to</td>
</tr>
</tbody>
</table>
<h4>Return Type</h4>
<p><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></p>
<h3><a name="getCtrlHome"></a>getCtrlHome</h3>
<p>
				Returns the item to navigate to when the home key and the
				control key is pressed. This should usually just return the first item.
			</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.getCtrlHome(<span class="methodArgument">oItem</span>)</pre>
<h4>Parameters</h4>
<table>
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td class="optional-header">Optional</td>
<td>Default</td>
<td>Descripton</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>oItem</code></td>
<td><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></td>
<td class="optional-column"></td>
<td></td>
<td>The item that we want to get the new item relative to</td>
</tr>
</tbody>
</table>
<h4>Return Type</h4>
<p><code class="type"><code><a href="BiComponent.html">BiComponent</a></code>/Object</code></p>
<h3><a name="getDown"></a>getDown</h3>
<p>
				Returns the item to navigate to when the down arrow key is pressed.
				This should usually just return the item below the current one.
			</p>
<h4>Syntax</h4>
<pre class="method-syntax">object.getDown(<span class="methodArgument">oItem</span>)</pre>
<h4>Parameters</h4>
<table>
<thead>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -