CRecordWebAddStyleSheet

The message adds a stylesheet to the web page. It is part of the RemoteSkin Web API.

{
  "id": "ae327d0d-989e-4431-a8ea-285d437c254f",
  "name": "WEB_ADD_STYLE_SHEET",
  "description": "Add a stylesheet.",
  "slots": [
    {
      "key": "1",
      "name": "ID",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "STRING",
      "description": "The style sheet ID."
    },
    {
      "key": "2",
      "name": "CONTENT",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "STRING",
      "description": "The content of the style sheet."
    }
  ]
}
    

Arguments

  • ID :The ID of the stylesheet. It is required to remove the stylesheet again later.
  • CONTENT :The content of the stylesheet (the rules).

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.

final String css = CUtilJson.loadJson(getClass(),
                                      "/html/my_stylesheet.css");
mWebApi.addCss("id_of_my_stylesheet",
               css);
    

Usage as message

public void addCss(@NotNull final String aStyleSheetId,
                   @NotNull final String aCss) throws CException
{
    final CEnvelope env = CEnvelope.forSingleTarget(mRemoteSkinAddress);
    final CRecord record = CRecordWebAddStyleSheet.create();
    CRecordWebAddStyleSheet.setId(record,
                                  aStyleSheetId);
    CRecordWebAddStyleSheet.setContent(record,
                                       aCss);
    CTarget.sendNotification(env,
                             record);
}
    

nyssr.net - Innovative Distributed System