CRecordWebSetStylesForElements
The CRecordWebSetStylesForElements message sets individual styles for HTML elements.
The message is part of the RemoteSkin Web API.
The API is located in the plugin NY_RemoteSkinWebProtocolAPI.
{
"id": "8a6a97e6-e628-49e4-a8ed-936b82779bff",
"name": "WEB_SET_STYLES_FOR_ELEMENTS",
"description": "Set a style for all elements matching the selector.",
"slots": [
{
"key": "1",
"name": "SELECTOR",
"direction": "REQUEST",
"presenceConstraint": "MANDATORY",
"type": "STRING",
"description": "The selector for searching elements, like .myClasses or #myId."
},
{
"key": "2",
"name": "STYLES",
"direction": "REQUEST",
"presenceConstraint": "MANDATORY",
"type": "STRING_PROPERTIES",
"description": "The styles to set."
}
]
}
Arguments
-
SELECTOR : The selector to find HTML elements.
Example: ".example".
Find more examples here -
HTML : The styles to set for each matching HTML element.
Usage with the helper class CWebApi
The easiest way is to call the corresponding method in the CWebApi class. The use of the class is described there.
mWebApi.setStylesForElements(@NotNull final String aSelector,
@NotNull final CStringProperties aStyles);
Usage as message
The RemoteSkin target address is also required.
public void setStylesForElements(@NotNull final CTargetAddress aRemoteSkinAddress,
@NotNull final String aSelector,
@NotNull final CStringProperties aStyles) throws CException
{
// Envelope
final CEnvelope env = CEnvelope.forSingleTarget(mRemoteSkinAddress);
// Record
final CRecord record = CRecordWebSetStylesForElements.create();
CRecordWebSetStylesForElements.setSelector(record,
aSelector);
CRecordWebSetStylesForElements.setStyles(record,
aStyles);
// send message
sendNotification(env,
record);
}