public class ServerEvent extends Event implements java.io.Externalizable
Keyboard.PROCEDURE_COMPLETE: raised when an async appserver request is finished
ServerEvent instance will be resolved
and the event will be executed, using the registered task.
In 4GL, is possible to add user-defined triggers or use the server-events in APPLY statements; testing showed that doing so results in abnormal behavior (as the i.e. parameters, procedure context or the SELF handle can't be resolved).
In current P2J implementation, any server-event names used when defining triggers or in APPLY
statements will be treated and will behave as any other UI event; their server-event "flavor"
will be hidden and is exposed only when the ServerEvent instances are posted to the
event queue via LogicalTerminal.postServerEvent(com.goldencode.p2j.ui.client.event.ServerEvent).
| Modifier and Type | Field and Description |
|---|---|
private boolean |
eventDrawing
Set to
true to run the event in event-drawing bracket. |
private static ContextLocal<java.util.Map<java.lang.Integer,ServerEvent>> |
events
A registry of server-side events which were posted to the client.
|
private int |
id
The id of the event.
|
private java.lang.String |
name
The name of this event.
|
private long |
resourceId
The resource ID which created the event.
|
private java.lang.Runnable |
task
The associated task which will be executed when the event is processed by the client-side.
|
| Constructor and Description |
|---|
ServerEvent()
Public c'tor added for deserialization purposes only.
|
ServerEvent(long resourceId,
java.lang.String name,
java.lang.Runnable task)
Create a new server-side event.
|
ServerEvent(long resourceId,
java.lang.String name,
java.lang.Runnable task,
boolean eventDrawing)
Create a new server-side event.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getName()
Get the name of this server-event.
|
int |
id()
Get the ID of this server-side event.
|
static void |
invoke(int id)
Resolve and invoke the event with the given ID.
|
boolean |
isComEvent()
Checks if the server event is a COM-EVENT.
|
boolean |
isEventDrawing()
Returns the event-drawing flag.
|
void |
print(PrintHelper printer)
Print all class-specific fields.
|
void |
readExternal(java.io.ObjectInput in)
Initialize this server event instance with the data received from the input source.
|
static void |
removeServerEvents(java.util.Set<java.lang.Integer> eventIds)
Remove from the server event queue all the events in the given set, identified by their id.
|
long |
resourceId()
Get the resource ID of this server-event.
|
void |
writeExternal(java.io.ObjectOutput out)
Send this server-event to the destination.
|
consume, isConsumed, merge, other, source, toStringprivate static ContextLocal<java.util.Map<java.lang.Integer,ServerEvent>> events
private int id
private long resourceId
private java.lang.String name
private java.lang.Runnable task
null if the instance is created on the server-side.private boolean eventDrawing
true to run the event in event-drawing bracket.public ServerEvent()
task field to be null.public ServerEvent(long resourceId,
java.lang.String name,
java.lang.Runnable task)
resourceId - The id of the resource which created the event.name - The name of this event.task - The task associated with this event.public ServerEvent(long resourceId,
java.lang.String name,
java.lang.Runnable task,
boolean eventDrawing)
resourceId - The id of the resource which created the event.name - The name of this event.task - The task associated with this event.eventDrawing - Set to true to run the event in event-drawing bracket. When true
the supplied resource id must represent a valid widget.public static void invoke(int id)
id - The event ID.public static void removeServerEvents(java.util.Set<java.lang.Integer> eventIds)
eventIds - The set of event IDs to be removed.public int id()
public java.lang.String getName()
public long resourceId()
public boolean isEventDrawing()
true the event is run in event-drawing bracket.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizableout - The output destination to which the server event will be sent.java.io.IOException - In case of I/O errors.public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablein - The input source from which server event will be restored.java.io.IOException - In case of I/O errors.java.lang.ClassNotFoundException - If payload can't be instantiated.public void print(PrintHelper printer)
public boolean isComEvent()
true if the event is a COM-EVENT