Package: | Roo.util |
Defined In: |
Roo/util/Observable.js.
|
Class: | Observable |
Subclasses: |
Roo.Ajax, Roo.BasicDialog, Roo.BasicLayoutRegion, Roo.BorderLayout, Roo.BoxComponent, Roo.Button, Roo.CalendarPanel, Roo.ColorPalette, Roo.Component, Roo.ContentPanel, Roo.DatePicker, Roo.Document, Roo.Editor, Roo.GridPanel, Roo.HtmlEditorCore, Roo.JsonView, Roo.LayoutDialog, Roo.LayoutManager, Roo.LayoutRegion, Roo.Login, Roo.NestedLayoutPanel, Roo.ReaderLayout, Roo.Resizable, Roo.SplitBar, Roo.SplitButton, Roo.SplitLayoutRegion, Roo.TabPanel, Roo.TabPanelItem, Roo.Toolbar.Button, Roo.Toolbar.SplitButton, Roo.TreePanel, Roo.UpdateManager, Roo.View, Roo.ViewPanel, Roo.XComponent, Roo.bootstrap.Alert, Roo.bootstrap.Body, Roo.bootstrap.Brick, Roo.bootstrap.Button, Roo.bootstrap.ButtonGroup, Roo.bootstrap.Calendar, Roo.bootstrap.CheckBox, Roo.bootstrap.Column, Roo.bootstrap.ComboBox, Roo.bootstrap.Component, Roo.bootstrap.Container, Roo.bootstrap.DateField, Roo.bootstrap.DateSplitField, Roo.bootstrap.DocumentManager, Roo.bootstrap.DocumentSlider, Roo.bootstrap.DocumentViewer, Roo.bootstrap.Element, Roo.bootstrap.FieldLabel, Roo.bootstrap.Form, Roo.bootstrap.Graph, Roo.bootstrap.Header, Roo.bootstrap.HtmlEditor, Roo.bootstrap.Img, Roo.bootstrap.Input, Roo.bootstrap.LayoutMasonry, Roo.bootstrap.LayoutMasonryAuto, Roo.bootstrap.Link, Roo.bootstrap.LocationPicker, Roo.bootstrap.MasonryBrick, Roo.bootstrap.Menu, Roo.bootstrap.MenuItem, Roo.bootstrap.MenuSeparator, Roo.bootstrap.MessageBar, Roo.bootstrap.Modal, Roo.bootstrap.MonthField, Roo.bootstrap.NavGroup, Roo.bootstrap.NavHeaderbar, Roo.bootstrap.NavItem, Roo.bootstrap.NavProgressBar, Roo.bootstrap.NavProgressItem, Roo.bootstrap.NavSidebar, Roo.bootstrap.NavSidebarItem, Roo.bootstrap.NavSimplebar, Roo.bootstrap.Navbar, Roo.bootstrap.NumberField, Roo.bootstrap.Pagination, Roo.bootstrap.PaginationItem, Roo.bootstrap.PagingToolbar, Roo.bootstrap.PhoneInput, Roo.bootstrap.Popover, Roo.bootstrap.Progress, Roo.bootstrap.ProgressBar, Roo.bootstrap.Radio, Roo.bootstrap.RadioSet, Roo.bootstrap.Row, Roo.bootstrap.SecurePass, Roo.bootstrap.Slider, Roo.bootstrap.SplitBar, Roo.bootstrap.TabGroup, Roo.bootstrap.TabPanel, Roo.bootstrap.Table, Roo.bootstrap.Table.AbstractSelectionModel, Roo.bootstrap.Table.RowSelectionModel, Roo.bootstrap.TableBody, Roo.bootstrap.TableCell, Roo.bootstrap.TableRow, Roo.bootstrap.TextArea, Roo.bootstrap.TimeField, Roo.bootstrap.TriggerField, Roo.bootstrap.UploadCropbox, Roo.bootstrap.dash.NumberBox, Roo.bootstrap.dash.TabBox, Roo.bootstrap.dash.TabPane, Roo.bootstrap.layout.Basic, Roo.bootstrap.layout.Border, Roo.bootstrap.layout.Manager, Roo.bootstrap.layout.Region, Roo.bootstrap.layout.Split, Roo.bootstrap.menu.Item, Roo.bootstrap.menu.Menu, Roo.bootstrap.menu.Separator, Roo.bootstrap.panel.Content, Roo.bootstrap.panel.Grid, Roo.bootstrap.panel.Nest, Roo.bootstrap.panel.TabItem, Roo.bootstrap.panel.Tabs, Roo.data.Connection, Roo.data.JsonStore, Roo.data.Node, Roo.data.SimpleStore, Roo.data.Store, Roo.data.Tree, Roo.dd.DD, Roo.dd.DDProxy, Roo.dd.DDTarget, Roo.dd.DragDrop, Roo.dd.DragSource, Roo.dd.DragZone, Roo.dd.DropTarget, Roo.dd.DropZone, Roo.doc.Book, Roo.doc.Entry, Roo.doc.Example, Roo.doc.NavCategory, Roo.doc.Para, Roo.doc.Param, Roo.doc.Section, Roo.doc.Synopsis, Roo.form.BasicForm, Roo.form.Checkbox, Roo.form.Column, Roo.form.ComboBox, Roo.form.ComboBoxArray, Roo.form.ComboBoxArray.Item, Roo.form.ComboCheck, Roo.form.DateField, Roo.form.DayPicker, Roo.form.DisplayField, Roo.form.FCKeditor, Roo.form.Field, Roo.form.FieldSet, Roo.form.Form, Roo.form.GridField, Roo.form.Hidden, Roo.form.HtmlEditor, Roo.form.Layout, Roo.form.MonthField, Roo.form.NumberField, Roo.form.Radio, Roo.form.Row, Roo.form.Select, Roo.form.Signature, Roo.form.TextArea, Roo.form.TextField, Roo.form.TriggerField, Roo.grid.AbstractSelectionModel, Roo.grid.CellSelectionModel, Roo.grid.ColumnModel, Roo.grid.EditorGrid, Roo.grid.Grid, Roo.grid.GridEditor, Roo.grid.GridView, Roo.grid.PropertyGrid, Roo.grid.RowSelectionModel, Roo.mailer.Block, Roo.mailer.Body, Roo.mailer.BodyContainer, Roo.mailer.Column, Roo.menu.Adapter, Roo.menu.BaseItem, Roo.menu.CheckItem, Roo.menu.ColorItem, Roo.menu.ColorMenu, Roo.menu.DateItem, Roo.menu.DateMenu, Roo.menu.Item, Roo.menu.Menu, Roo.menu.Separator, Roo.menu.TextItem, Roo.tree.AsyncTreeNode, Roo.tree.DefaultSelectionModel, Roo.tree.MultiSelectionModel, Roo.tree.TreeEditor, Roo.tree.TreeLoader, Roo.tree.TreeNode, Roo.tree.TreePanel, Roo.util.ClickRepeater, Roo.util.MixedCollection
|
Base class that provides a common interface for publishing events. Subclasses are expected to
to have a property "events" with all the events defined.
For example:
Employee = function(name){
this.name = name;
this.addEvents({
"fired" : true,
"quit" : true
});
}
Roo.extend(Employee, Roo.util.Observable);
Public Methods
|
new Roo.util.Observable
( Object config)
Create a new Roo.util.Observable
Create a new Roo.util.Observable
- Parameters:
-
Object config
- properties to use (incuding events / listeners)
|
|
|
Starts capture on the specified Observable.
Starts capture on the specified Observable. All events will be passed to the supplied function with the event name + standard signature of the event before the event is fired. If the supplied function returns false, the event will not fire.
- Parameters:
-
Observable o
- The Observable to capture
-
Function fn
- The function to call
-
Object scope
- (optional) The scope (this object) for the fn
|
Roo.util.Observable
|
|
Roo.util.Observable.releaseCapture
(Observable o)
Removes all added captures from the Observable.
Removes all added captures from the Observable.
- Parameters:
-
Observable o
- The Observable to release
|
Roo.util.Observable
|
|
Used to define events on this Observable
Used to define events on this Observable
- Parameters:
-
Object object
- The object with the events defined
|
Roo.util.Observable
|
|
Appends an event handler to this component
Appends an event handler to this component
- Parameters:
-
String eventName
- The type of event to listen for
-
Function handler
- The method the event invokes
-
Object scope
- (optional) The scope in which to execute the handler
function. The handler function's "this" context.
-
Object options
- (optional) An object containing handler configuration
properties. This may contain any of the following properties:
- scope {Object} The scope in which to execute the handler function. The handler function's "this" context.
- delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.
- single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.
- buffer {Number} Causes the handler to be scheduled to run in an {link Roo.util.DelayedTask} delayed
by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, forumId: 4 });
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
el.on({ 'click': { fn: this.onClick, scope: this, delay: 100 }, 'mouseover': { fn: this.onMouseOver, scope: this }, 'mouseout': { fn: this.onMouseOut, scope: this } });
Or a shorthand syntax which passes the same scope object to all handlers:
el.on({ 'click': this.onClick, 'mouseover': this.onMouseOver, 'mouseout': this.onMouseOut, scope: this });
|
Roo.util.Observable
|
|
Fires the specified event with the passed parameters (minus the event name).
Fires the specified event with the passed parameters (minus the event name).
- Parameters:
-
String eventName
-
Object... args
- Variable number of parameters are passed to handlers
- Returns:
- Boolean returns false if any of the handlers return false otherwise it returns true
|
Roo.util.Observable
|
|
Checks to see if this object has any listeners for a specified event
Checks to see if this object has any listeners for a specified event
- Parameters:
-
String eventName
- The name of the event to check for
- Returns:
- Boolean True if the event is being listened for, else false
|
Roo.util.Observable
|
|
Appends an event handler to this element (shorthand for addListener)
Appends an event handler to this element (shorthand for addListener)
- Parameters:
-
String eventName
- The type of event to listen for
-
Function handler
- The method the event invokes
-
Object scope
- (optional) The scope in which to execute the handler
function. The handler function's "this" context.
-
Object options
- (optional)
|
Roo.util.Observable
|
|
purgeListeners
()
Removes all listeners for this object
Removes all listeners for this object
|
Roo.util.Observable
|
|
Removes a listener
Removes a listener
- Parameters:
-
String eventName
- The type of event to listen for
-
Function handler
- The handler to remove
-
Object scope
- (optional) The scope (this object) for the handler
|
Roo.util.Observable
|
|
Removes a listener (shorthand for removeListener)
Removes a listener (shorthand for removeListener)
- Parameters:
-
String eventName
- The type of event to listen for
-
Function handler
- The handler to remove
-
Object scope
- (optional) The scope (this object) for the handler
|
Roo.util.Observable
|