Object rap
Holds all global public methods of the RAP WebClient.
Constructor Attributes | Constructor Name and Description |
---|---|
Contains methods required for custom widget development and RWT Scripting.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
rap.getClient()
Returns an instance of Client object used for basic client detection.
|
<static> |
rap.getObject(id)
Returns the client object associated with the given id as returned
by
org.eclipse.rap.rwt.widget.WidgetUtil.getId and
org.eclipse.rap.rwt.remote.RemoteObject.getId . |
<static> |
rap.getRemoteObject(object)
Returns an instance of RemoteObject for the given client object.
|
<static> |
rap.off(type, listener)
De-register the function as a listener of the given type.
|
<static> |
rap.on(type, listener)
Register the function as a listener of the given type.
|
<static> |
rap.registerTypeHandler(type, handler)
Registers a RAP protocol type handler for a specific type of client objects.
|
Event Attributes | Event Name and Description |
---|---|
Sent after a message has been processed.
|
|
Sent right before a message is send to the server.
|
Object Detail
rap
Contains methods required for custom widget development and RWT Scripting.
- Since:
- 2.0
Method Detail
<static>
{Client}
rap.getClient()
Returns an instance of Client object used for basic client detection.
- Since:
- 3.2
- Returns:
- {Client}
<static>
{Object}
rap.getObject(id)
Returns the client object associated with the given id as returned
by
org.eclipse.rap.rwt.widget.WidgetUtil.getId
and
org.eclipse.rap.rwt.remote.RemoteObject.getId
.
If there is no object registered for the given id, null
is returned.
For custom widgets, that is the result of the type handler factory.
For SWT/RWT widgets (any Control or Item) a wrapper (instance of Widget) is returned that approximates
a subset of the API of its Java analog. Getting objects of other types is unsupported.
- Parameters:
- {string} id
- The protocol id for a client object.
- Returns:
- {Object} The client object associated with the id.
<static>
{RemoteObject}
rap.getRemoteObject(object)
Returns an instance of RemoteObject for the given client object.
A client object is any object that was created by an type handler factory method.
Multiple calls for the same object will return the same RemoteObject
instance.
- Parameters:
- {Object} object
- The client object.
- Returns:
- {RemoteObject}
<static>
rap.off(type, listener)
De-register the function as a listener of the given type.
- Parameters:
- {string} type
- The type of the event
- {Function} listener
- The callback function
<static>
rap.on(type, listener)
Register the function as a listener of the given type. Registering unknown
types throws an Error.
- Parameters:
- {string} type
- The type of the event (e.g. "send").
- {Function} listener
- The callback function. It is executed in global context.
<static>
rap.registerTypeHandler(type, handler)
Registers a RAP protocol type handler for a specific type of client objects.
The handler is used by the protocol message processor to process operations that target
any client object of this type. Example:
rap.registerTypeHandler( "project.MyWidget", { factory : function( properties ) { return new MyWidget(); }, properties : [ "propA", "propB" ] } );
- Parameters:
- {string} type
- {Object} handler
- The handler object.
- {Function} handler.factory
- Called for create operations. Is given a properties object as the first argument, which may contain any number for properties/fields set by the server. Has to return a "client object" representing an instance of the type of this handler. Required for all type handler.
- {string} handler.destructor
- Name of the method that is called for destroy operations. If the string is given, the client object has to implement a method with the given name. Optional
- {string[]} handler.properties
- List of properties supported by this type.
The order in the list controls the order in which the properties are applied by the message
processor. The client object has to implement a setter for each supported property.
For example, if the property is "bounds",
setBounds
will be called on the client object. Properties given by the server that are not in this list will be ignored. (One exception is the factory, which gets an object with all properties set by the server at that time.) If the property changes on the client, RemoteObject#set can be used to synchronize the value with the server. Optional. - {string[]} handler.methods
- List of methods supported by this type. The order in the list is meaningless, "call" operations are processed in the order in which they are given by the server. The client object has to implement a method of the same name. One argument will be given, which is a properties object with any number of properties/fields. A "call" operation given by the server for a method that is not in this list will be ignored. Optional.
- {string[]} handler.events
- List of event types supported by this type. The server may instruct the client object with "listen" operations to start or stop sending notifications when events of he given event type occur. Notifications may and can only be sent for types that are given in this list and are listened to by the server. See also RemoteObject#notify. Optional.
Event Detail
render
Sent after a message has been processed.
send
Sent right before a message is send to the server.