Creating Event Listener Server
Event Listener Server needs to be created in order to receive the events fired by java components. Events can be added using addListenerToComponent method of either index based API or search path based API. The listeners can be removed using removeListenerToComponent method from the same classes.
The Event Server should be created with below details.
Need one method to be exposed by the server, which will be called from event listener at java side.
Syntax of the method will be as below.
public booleanEventDispatcher(String pid, String port, String eventType,
String eventDesc, String source, String value, String oldValue);
This method can return true always after processing event. This method is called asynchronously by the all event listeners from java.
The server should run on the below URL: http://localhost:<eventServerPort>/<eventServerRemURL>
Where, <eventServerPort> should be the value specified from wrapper side for every new instance of SE opened. eventServerRemURL is the value same as specified in proton.application.properties file with key as eventserverRemURL.
Method should be exposed as <eventServerHandler>.EventDispatcher, where <eventServerHandler> is the value same as specified in proton.application.proeprties file with key as eventServerHandler.
The sample example of the URL and method exposed can be as below.
URL: http://localhost:4567/EventServer
Handler: eventObj.EventDispatcher
Below table specified the list of events that are supported with sub-type (description).
Event Type |
Event Description |
Event occur situation |
mouseEvent |
mouseClicked |
When mouse is pressed and released |
mouseEntered |
when mouse pointer enters the component |
|
mouseExited |
when mouse pointer exits the component |
|
mousePressed |
when mouse is pressed on the component |
|
mouseReleased |
when mouse is released from the component |
|
focusEvent |
focusGained |
when component gains the focus |
focusLost |
when component loses the focus |
|
keyEvent |
keyPressed |
when key is hold down |
keyReleased |
when key is released |
|
keyTyped |
when key is hold down and released |
|
treeSelectionChangeEvent |
DESELECTED |
whenever tree node is deselected |
SELECTED |
whenever tree node is selected |
|
treeModifiedEvent |
treeNodesChanged |
when the tree node undergoes any changes |
treeNodesInserted |
when new tree node is inserted |
|
treeNodesRemoved |
when tree node is removed |
|
treeStructureChanged |
when tree structure is re-organized |
|
comboBoxSelectionChangeEvent |
DESELECTED |
when item is de-selected |
SELECTED |
when item in combo box is selected |
|
tableSelectionChangeEvent |
selectionChanged |
whenever table selection changes |
windowEvent |
windowActivated |
when window is activated |
windowClosed |
when window is closed |
|
windowClosing |
when window is closing |
|
windowDeactivated |
when window is deactivated |
|
windowDeiconified |
when window state change to maximize or restore |
|
windowIconified |
when window state is changed to minimized |
|
windowOpened |
when window is opened |
|
internalFrameEvent |
internalFrameActivated |
when frame is activated |
internalFrameClosed |
when frame is closed |
|
internalFrameClosing |
when frame is closing |
|
internalFrameDeactivated |
when frame is deactivated |
|
internalFrameDeiconified |
when window state change to maximize or restore |
|
internalFrameIconified |
when frame state is changed to minimized |
|
internalFrameOpened |
when frame is opened |
Note that, the events will be fired automatically by application, and we are just capturing the event information and sending it to .NET. If there are multiple events getting fired for single operation or some events are not getting fired, is according to applications behavior.