OverviewSingleDeprecated

jsx3.util

interface EventDispatcher

jsx3.util.EventDispatcher

All Known Implementing Classes:

jsx3.EVT, jsx3.app.Cache, jsx3.app.DOM, jsx3.app.Model, jsx3.app.Server, jsx3.chart.AreaChart, jsx3.chart.AreaSeries, jsx3.chart.Axis, jsx3.chart.BCChart, jsx3.chart.BCSeries, jsx3.chart.BarChart, jsx3.chart.BarSeries, jsx3.chart.BubbleSeries, jsx3.chart.CartesianChart, jsx3.chart.CategoryAxis, jsx3.chart.Chart, jsx3.chart.ChartComponent, jsx3.chart.ChartLabel, jsx3.chart.ColumnChart, jsx3.chart.ColumnSeries, jsx3.chart.GridLines, jsx3.chart.Legend, jsx3.chart.LineChart, jsx3.chart.LineSeries, jsx3.chart.LinearAxis, jsx3.chart.LogarithmicAxis, jsx3.chart.PieChart, jsx3.chart.PieSeries, jsx3.chart.PlotChart, jsx3.chart.PlotSeries, jsx3.chart.PointSeries, jsx3.chart.RadialChart, jsx3.chart.Series, jsx3.gui.Block, jsx3.gui.BlockX, jsx3.gui.Button, jsx3.gui.CheckBox, jsx3.gui.ColorPicker, jsx3.gui.Column, jsx3.gui.DatePicker, jsx3.gui.Dialog, jsx3.gui.Grid, jsx3.gui.HotKey, jsx3.gui.IFrame, jsx3.gui.Image, jsx3.gui.ImageButton, jsx3.gui.LayoutGrid, jsx3.gui.List, jsx3.gui.Matrix, jsx3.gui.Matrix.Column, jsx3.gui.Menu, jsx3.gui.Painted, jsx3.gui.RadioButton, jsx3.gui.Select, jsx3.gui.Slider, jsx3.gui.Sound, jsx3.gui.Splitter, jsx3.gui.Stack, jsx3.gui.StackGroup, jsx3.gui.Tab, jsx3.gui.TabbedPane, jsx3.gui.Table, jsx3.gui.TextBox, jsx3.gui.TimePicker, jsx3.gui.ToolbarButton, jsx3.gui.Tree, jsx3.gui.Window, jsx3.gui.WindowBar, jsx3.net.Form, jsx3.net.Request, jsx3.net.Service, jsx3.vector.Block, jsx3.xml.CDF.Document, jsx3.xml.Document, jsx3.xml.XslDocument

interface EventDispatcher
An Event Dispatcher mixin interface, adds the ability to register event listeners and dispatch events to those listeners.

(Deprecated) Classes that implement this mixin must also implement a method getServer(), which returns the server in which to look for JSX ids.

Since:

3.0

Field Summary
static void
SUBJECT_ALL
Method Summary
int
publish(objEvent : Object)
Publishes an event to all subscribed objects.
void
subscribe(strEventId : String | Array<String>, objHandler : Object | String | function, objFunction : function | String)
Subscribes an object or function to a type of event published by this object.
void
unsubscribe(strEventId : String | Array<String>, objHandler : Object | String | function)
Unsubscribe an object or function from an event published by this object.
void
unsubscribeAll(strEventId : String)
Unsubscribes all subscribed objects to a type of event published by this object.
Field Detail

SUBJECT_ALL

static final ? SUBJECT_ALL
Method Detail

publish

int publish(objEvent : Object)
Publishes an event to all subscribed objects.

Parameters:

objEventthe event, should have at least a field 'subject' that is the event id, another common field is 'target' (target will default to this instance)

Throws:

{jsx3.lang.IllegalArgumentException}objEvent is not an object with a subject property

Returns:

the number of listeners to which the event was broadcast 

subscribe

void subscribe(strEventId : String | Array<String>, objHandler : Object | String | function, objFunction : function | String)
Subscribes an object or function to a type of event published by this object.

As of version 3.4 a string value for objHandler is deprecated.

Parameters:

strEventIdthe event type(s).
objHandlerif an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
objFunctionif objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance

Throws:

{jsx3.lang.IllegalArgumentException}if objHandler/objFunction are not a valid combination of types

unsubscribe

void unsubscribe(strEventId : String | Array<String>, objHandler : Object | String | function)
Unsubscribe an object or function from an event published by this object.

As of version 3.4 a string value for objHandler is deprecated.

Parameters:

strEventIdthe event type(s).
objHandlerthe value of objHandler passed to subscribe

unsubscribeAll

void unsubscribeAll(strEventId : String)
Unsubscribes all subscribed objects to a type of event published by this object.

Parameters:

strEventIdthe event type