webgui/www/extras/extjs/docs/output/Ext.util.ClickRepeater.html

478 lines
No EOL
29 KiB
HTML

<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Ext.util.ClickRepeater</title>
<link rel="stylesheet" type="text/css" href="../resources/reset.css"/>
<link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="../resources/print.css" media="print">
<!-- GC -->
</head>
<body>
<div class="body-wrap">
<div class="top-tools">
<img src="../resources/print.gif" width="16" height="16" align="absmiddle">&nbsp;<a href="Ext.util.ClickRepeater.html" target="_blank">Print Friendly</a><br/>
</div>
<h1>Class Ext.util.ClickRepeater</h1>
<table cellspacing="0">
<tr><td class="label">Package:</td><td>Ext.util</td></tr>
<tr><td class="label">Class:</td><td>ClickRepeater</td></tr>
<tr><td class="label">Extends:</td><td><a href="Ext.util.Observable.html">Observable</a></td></tr>
<tr><td class="label">Defined In:</td><td><a href="ClickRepeater.jss.html">ClickRepeater.js</a></td></tr>
</table>
<div class="description">
A wrapper class which can be applied to any element. Fires a "click" event while the
mouse is pressed. The interval between firings may be specified in the config but
defaults to 10 milliseconds.
Optionally, a CSS class may be applied to the element during the time it is pressed. </div>
<br />
<a href="#properties">Properties</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#methods">Methods</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#events">Events</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#configs">Config Options</a>
<hr />
<a name="properties"></a>
<h2>Public Properties</h2>
<div class="no-members">This class has no public properties.</div> <a name="methods"></a>
<h2>Public Methods</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Method</th>
<th class="msource-header">Defined By</th>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#ClickRepeater">ClickRepeater</a>(<code>String/HTMLElement/Element el</code>, <code>Object config</code>)</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr>
<td class="mdesc"></td>
</tr>
<tr class="alt">
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#addEvents">addEvents</a>(<code>Object object</code>) : void</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#addEvents">Observable</a></td>
</tr>
<tr class="alt">
<td class="mdesc">Copies any events from the passed object onto this object if they do not already exist. The passed object
must also ...</td>
</tr>
<tr>
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#addListener">addListener</a>(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>, <span class="optional" title="Optional">[<code>Object options</code>]</span>) : void</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#addListener">Observable</a></td>
</tr>
<tr>
<td class="mdesc">Appends an event handler to this component</td>
</tr>
<tr class="alt">
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#fireEvent">fireEvent</a>(<code>String eventName</code>, <code>Object... args</code>) : Boolean</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#fireEvent">Observable</a></td>
</tr>
<tr class="alt">
<td class="mdesc">Fires the specified event with the passed parameters (minus the event name).</td>
</tr>
<tr>
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#hasListener">hasListener</a>(<code>String eventName</code>) : Boolean</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#hasListener">Observable</a></td>
</tr>
<tr>
<td class="mdesc">Checks to see if this object is currently listening for a specified event</td>
</tr>
<tr class="alt">
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#on">on</a>(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object options</code>]</span>) : void</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#on">Observable</a></td>
</tr>
<tr class="alt">
<td class="mdesc">Appends an event handler to this element (shorthand for addListener)</td>
</tr>
<tr>
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#purgeListeners">purgeListeners</a>() : void</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#purgeListeners">Observable</a></td>
</tr>
<tr>
<td class="mdesc">Removes all listeners for this object</td>
</tr>
<tr class="alt">
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#removeListener">removeListener</a>(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>) : void</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#removeListener">Observable</a></td>
</tr>
<tr class="alt">
<td class="mdesc">Removes a listener</td>
</tr>
<tr>
<td class="micon inherited" title="Inherited" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#un">un</a>(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>) : void</td>
<td class="msource" rowspan="2"><a href="Ext.util.Observable.html#un">Observable</a></td>
</tr>
<tr>
<td class="mdesc">Removes a listener (shorthand for removeListener)</td>
</tr>
</table>
<a name="events"></a>
<h2>Public Events</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Event</th>
<th class="msource-header">Defined By</th>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#event-click">click</a> : (<code>Ext.util.ClickRepeater this</code>)</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr>
<td class="mdesc">Fires on a specified interval during the time the element is pressed.</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#event-mousedown">mousedown</a> : (<code>Ext.util.ClickRepeater this</code>)</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr class="alt">
<td class="mdesc">Fires when the mouse button is depressed.</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#event-mouseup">mouseup</a> : (<code>Ext.util.ClickRepeater this</code>)</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr>
<td class="mdesc">Fires when the mouse key is released.</td>
</tr>
</table>
<a name="configs"></a>
<h2>Config Options</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Config Options</th>
<th class="msource-header">Defined By</th>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-accelerate">accelerate</a> : Boolean</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr>
<td class="mdesc">True if autorepeating should start slowly and accelerate. "interval" and "delay" are ignored. "immediate" is honored.</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-delay">delay</a> : Number</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr class="alt">
<td class="mdesc">The initial delay before the repeating event begins firing. Similar to an autorepeat key delay.</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-el">el</a> : String/HTMLElement/Element</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr>
<td class="mdesc">The element to act as a button.</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-interval">interval</a> : Number</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr class="alt">
<td class="mdesc">The interval between firings of the "click" event. Default 10 ms.</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-pressClass">pressClass</a> : String</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr>
<td class="mdesc">A CSS class name to be applied to the element while pressed.</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-preventDefault">preventDefault</a> : Boolean</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr class="alt">
<td class="mdesc">True to prevent the default click event</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#config-stopDefault">stopDefault</a> : Boolean</td>
<td class="msource" rowspan="2">ClickRepeater</td>
</tr>
<tr>
<td class="mdesc">True to stop the default click event</td>
</tr>
</table>
<a name="ClickRepeater"></a>
<h2 class="mdetail-head">Constructor Details</h2>
<div class="detail-wrap">
<div class="mdetail">
<h3>ClickRepeater</i></h3>
<code>public function ClickRepeater(<code>String/HTMLElement/Element el</code>, <code>Object config</code>)</code>
<div class="mdetail-desc">
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>el</code> : String/HTMLElement/Element<div class="sub-desc">The element to listen on</div></li><li><code>config</code> : Object<div class="sub-desc"></div></li> </ul>
</div>
</div>
</div>
</div>
<h2 class="mdetail-head">Method Details</h2>
<div class="detail-wrap">
<a name="addEvents"></a>
<div class="mdetail">
<h3>addEvents</i></h3>
<code>public function addEvents(<code>Object object</code>)</code>
<div class="mdetail-desc">
Copies any events from the passed object onto this object if they do not already exist. The passed object
must also inherit from Observable for this method to have any effect.
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>object</code> : Object<div class="sub-desc">The object from which to copy events</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#addEvents">Observable</a>.</div>
</div>
<a name="addListener"></a>
<div class="mdetail alt">
<h3>addListener</i></h3>
<code>public function addListener(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>, <span class="optional" title="Optional">[<code>Object options</code>]</span>)</code>
<div class="mdetail-desc">
Appends an event handler to this component
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The method the event invokes</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the handler function. The handler function's "this" context.</div></li><li><code>options</code> : Object<div class="sub-desc">(optional) An object containing handler configuration properties. This may contain any of the following properties:<ul> <li>scope {Object} The scope in which to execute the handler function. The handler function's "this" context.</li> <li>delegate {String} A simple selector to filter the target or look for a descendant of the target</li> <li>stopEvent {Boolean} True to stop the event. That is stop propagation, and prevent the default action.</li> <li>preventDefault {Boolean} True to prevent the default action</li> <li>stopPropagation {Boolean} True to prevent event propagation</li> <li>normalized {Boolean} False to pass a browser event to the handler function instead of an Ext.EventObject</li> <li>delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.</li> <li>single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.</li> <li>buffer {Number} Causes the handler to be scheduled to run in an <a href="Ext.util.DelayedTask.html">Ext.util.DelayedTask</a> delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is <em>not</em> invoked, but the new handler is scheduled in its place.</li> </ul> <p> <b>Combining Options</b><br> Using the options argument, it is possible to combine different types of listeners:<br> <br> A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)<div style="margin: 5px 20px 20px;"> Code: <pre><code>el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 });</pre> <p> The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers. <p> <b>Attaching multiple handlers in 1 call</b><br> Code: <pre><code>el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } });</pre> <p> Or a shorthand syntax:<br> Code: <pre><code>el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });</pre></div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#addListener">Observable</a>.</div>
</div>
<a name="fireEvent"></a>
<div class="mdetail">
<h3>fireEvent</i></h3>
<code>public function fireEvent(<code>String eventName</code>, <code>Object... args</code>)</code>
<div class="mdetail-desc">
Fires the specified event with the passed parameters (minus the event name).
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>eventName</code> : String<div class="sub-desc"></div></li><li><code>args</code> : Object...<div class="sub-desc">Variable number of parameters are passed to handlers</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Boolean</code><div class="sub-desc">returns false if any of the handlers return false otherwise it returns true</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#fireEvent">Observable</a>.</div>
</div>
<a name="hasListener"></a>
<div class="mdetail alt">
<h3>hasListener</i></h3>
<code>public function hasListener(<code>String eventName</code>)</code>
<div class="mdetail-desc">
Checks to see if this object is currently listening for a specified event
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>eventName</code> : String<div class="sub-desc">The name of the event to check for</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Boolean</code><div class="sub-desc">True if the event is being listened for, else false</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#hasListener">Observable</a>.</div>
</div>
<a name="on"></a>
<div class="mdetail">
<h3>on</i></h3>
<code>public function on(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object options</code>]</span>)</code>
<div class="mdetail-desc">
Appends an event handler to this element (shorthand for addListener)
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The method the event invokes</div></li><li><code>options</code> : Object<div class="sub-desc">(optional)</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#on">Observable</a>.</div>
</div>
<a name="purgeListeners"></a>
<div class="mdetail alt">
<h3>purgeListeners</i></h3>
<code>public function purgeListeners()</code>
<div class="mdetail-desc">
Removes all listeners for this object
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li>None.</li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#purgeListeners">Observable</a>.</div>
</div>
<a name="removeListener"></a>
<div class="mdetail">
<h3>removeListener</i></h3>
<code>public function removeListener(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>)</code>
<div class="mdetail-desc">
Removes a listener
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The handler to remove</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (this object) for the handler</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#removeListener">Observable</a>.</div>
</div>
<a name="un"></a>
<div class="mdetail alt">
<h3>un</i></h3>
<code>public function un(<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>)</code>
<div class="mdetail-desc">
Removes a listener (shorthand for removeListener)
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The handler to remove</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (this object) for the handler</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by <a href="Ext.util.Observable.html#un">Observable</a>.</div>
</div>
</div>
<h2 class="mdetail-head">Event Details</h2>
<div class="detail-wrap">
<a name="event-click"></a>
<div class="mdetail">
<h3>click</i></h3>
<code>public event click</code>
<div class="mdetail-desc">
Fires on a specified interval during the time the element is pressed.
<div class="mdetail-params">
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
<ul><li><code>this</code> : Ext.util.ClickRepeater<div class="sub-desc"></div></li> </ul>
</div>
</div>
<div class="mdetail-def">This event is defined by ClickRepeater.</div>
</div>
<a name="event-mousedown"></a>
<div class="mdetail alt">
<h3>mousedown</i></h3>
<code>public event mousedown</code>
<div class="mdetail-desc">
Fires when the mouse button is depressed.
<div class="mdetail-params">
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
<ul><li><code>this</code> : Ext.util.ClickRepeater<div class="sub-desc"></div></li> </ul>
</div>
</div>
<div class="mdetail-def">This event is defined by ClickRepeater.</div>
</div>
<a name="event-mouseup"></a>
<div class="mdetail">
<h3>mouseup</i></h3>
<code>public event mouseup</code>
<div class="mdetail-desc">
Fires when the mouse key is released.
<div class="mdetail-params">
<strong style="font-weight:normal;">Subscribers will be called with the following parameters:</strong>
<ul><li><code>this</code> : Ext.util.ClickRepeater<div class="sub-desc"></div></li> </ul>
</div>
</div>
<div class="mdetail-def">This event is defined by ClickRepeater.</div>
</div>
</div>
<h2 class="mdetail-head">Config Details</h2>
<div class="detail-wrap">
<a name="config-accelerate"></a>
<div class="mdetail">
<h3>accelerate</i></h3>
<code>accelerate : Boolean</code>
<div class="mdetail-desc">
True if autorepeating should start slowly and accelerate. "interval" and "delay" are ignored. "immediate" is honored. </div>
<div class="mdetail-def">This config option is defined by ClickRepeater.</div>
</div>
<a name="config-delay"></a>
<div class="mdetail alt">
<h3>delay</i></h3>
<code>delay : Number</code>
<div class="mdetail-desc">
The initial delay before the repeating event begins firing. Similar to an autorepeat key delay. </div>
<div class="mdetail-def">This config option is defined by ClickRepeater.</div>
</div>
<a name="config-el"></a>
<div class="mdetail">
<h3>el</i></h3>
<code>el : String/HTMLElement/Element</code>
<div class="mdetail-desc">
The element to act as a button. </div>
<div class="mdetail-def">This config option is defined by ClickRepeater.</div>
</div>
<a name="config-interval"></a>
<div class="mdetail alt">
<h3>interval</i></h3>
<code>interval : Number</code>
<div class="mdetail-desc">
The interval between firings of the "click" event. Default 10 ms. </div>
<div class="mdetail-def">This config option is defined by ClickRepeater.</div>
</div>
<a name="config-pressClass"></a>
<div class="mdetail">
<h3>pressClass</i></h3>
<code>pressClass : String</code>
<div class="mdetail-desc">
A CSS class name to be applied to the element while pressed. </div>
<div class="mdetail-def">This config option is defined by ClickRepeater.</div>
</div>
<a name="config-preventDefault"></a>
<div class="mdetail alt">
<h3>preventDefault</i></h3>
<code>preventDefault : Boolean</code>
<div class="mdetail-desc">
True to prevent the default click event </div>
<div class="mdetail-def">This config option is defined by ClickRepeater.</div>
</div>
<a name="config-stopDefault"></a>
<div class="mdetail">
<h3>stopDefault</i></h3>
<code>stopDefault : Boolean</code>
<div class="mdetail-desc">
True to stop the default click event </div>
<div class="mdetail-def">This config option is defined by ClickRepeater.</div>
</div>
</div>
</div>
<hr>
<div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
</body>
</html>