CRecordWebNotifyClick2
The CRecordWebNotifyClick2 message is a notification when an html element has been clicked.
To receive this message,
- a listener must be installed for the HTML element: CRecordWebListenOnClick2
- your target address must be linked to the element ID: CRecordWebRegisterWidgetOwner
The message is part of the RemoteSkin Web API.
The API is located in the plugin NY_RemoteSkinWebProtocolAPI.
{
"id": "56c079ec-3726-4ccc-9ac1-e42a5b6b450a",
"name": "WEB_NOTIFY_CLICK2",
"description": "A widget has been clicked. Deliver the ID of the widget.",
"slots": [
{
"key": "1",
"name": "ID",
"direction": "REQUEST",
"presenceConstraint": "MANDATORY",
"type": "STRING",
"description": "The id of the widget which has been clicked."
},
{
"key": "2",
"name": "HOW",
"direction": "REQUEST",
"presenceConstraint": "MANDATORY",
"type": "STRING",
"description": "left, right."
}
]
}
Arguments
- ID : The ID of the html element to which the message belongs.
- HOW : "left" or "right".
Usage
Register your target address for this ID. You need to have the RemoteSkin address.
final CWebApi webApi = new CWebApi(this, // your target
mRemoteSkinAddress);
webApi.registerWidgets(new String[]{"myElementId"});
Register a listener for an element ID.
webApi.addClickListener2(new String[]{"myElementId"});
Register a message handler for this message.
// constructor:
addMessageHandler(CRecordWebNotifyClick2.ID,
this::asyncNotifyClick2);
Implement the message handler.
private boolean asyncNotifyClick2(@NotNull final CEnvelope aEnvelope,
@NotNull final CRecord aRecord) throws CException
{
if (aEnvelope.isAnswer())
{
return false;
}
else
{
final String id = CRecordWebNotifyClick2.getId(aRecord,
"");
final String how = CRecordWebNotifyClick2.getHow(aRecord,
"");
// ...
aEnvelope.setResultSuccess();
return true;
}
}