Class RenderControlsJsonSerializer
java.lang.Object
com.levigo.jadice.web.client.rendercontrols.RenderControlsJsonSerializer
Utility class that is responsible to serialize
RenderControls to json and the other way
round, i.e. parse the json and restore RenderControls from that json.
The specification of the json file is taken from the following example:
{
"name": "jadice-render-presets",
"version": 2,
"inventoryKit": {
"name": "<document-id>",
"controlsKits": [
{
"name": "document",
"settingsUnits": [
{
"name": "BaseRenderSettings",
"parts": [
{
"name": "rotation",
"value": "<one of com.levigo.jadice.web.shared.model.settings.BaseRenderSettings.Rotation>"
}
]
}
]
},
{
"name": "page<index>",
"settingsUnits": [
{
"name": "BaseRenderSettings",
"parts": [
{
"name": "rotation",
"value": "<one of com.levigo.jadice.web.shared.model.settings.BaseRenderSettings.Rotation>"
}
]
}
]
}
]
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.levigo.jadice.web.client.rendercontrols.internal.WritableRenderPresetscreateRenderPresets(PageView pageView, Document document, ControlsKitFilter filter) static voiddeSerializeRenderControls(String json, PageView pageView) static voiddeSerializeRenderControls(String json, List<Page> pages, PageView pageView) Take a json object and restoreRenderControlson the givenpagescurrently present inPageViewsDocument.static StringserializeRenderControls(PageView pageView, Document document) Take both theRenderControlsthat are applied document-wide and page-wide and create a json objectstatic StringserializeRenderControls(PageView pageView, Document document, ControlsKitFilter filter) Take both theRenderControlsthat are applied document-wide and page-wide and create a json objectstatic StringserializeRenderControls(PageView pageView, List<Page> pages) Take pageRenderControlsand create a json object for them.static StringserializeRenderControls(PageView pageView, List<Page> pages, ControlsKitFilter filter) Take pageRenderControlsand create a json object for them.
-
Constructor Details
-
RenderControlsJsonSerializer
public RenderControlsJsonSerializer()
-
-
Method Details
-
serializeRenderControls
Take both theRenderControlsthat are applied document-wide and page-wide and create a json object- Parameters:
pageView- thePageViewthat holds itsRenderSettingslike the rotation.document- theDocumentcontainingpages. We can haveRenderControlsthat define that the whole document is rotated, but we can have those settings also individually per page.FilteredDocumentsare not supported.- Returns:
- the whole json object containing both document and page render settings / rotations.
-
serializeRenderControls
public static String serializeRenderControls(PageView pageView, Document document, ControlsKitFilter filter) Take both theRenderControlsthat are applied document-wide and page-wide and create a json object- Parameters:
pageView- thePageViewthat holds itsRenderSettingslike the rotation.document- theDocumentcontainingpages. We can haveRenderControlsthat define that the whole document is rotated, but we can have those settings also individually per page.FilteredDocumentsare not supported.filter- aControlsKitFilterto restrict the serialization output. If the filter is null, a ControlsKitAllowAllFilter will be created.- Returns:
- the whole json object containing both document and page render settings / rotations.
-
createRenderPresets
public static com.levigo.jadice.web.client.rendercontrols.internal.WritableRenderPresets createRenderPresets(PageView pageView, Document document, ControlsKitFilter filter) -
serializeRenderControls
Take pageRenderControlsand create a json object for them.- Parameters:
pageView- thePageViewthat holds itsRenderSettingslike the rotation.pages- a List ofpagesto serialize render controls for.- Returns:
- a json object containing all pages render settings / rotations.
-
serializeRenderControls
public static String serializeRenderControls(PageView pageView, List<Page> pages, ControlsKitFilter filter) Take pageRenderControlsand create a json object for them.- Parameters:
pageView- thePageViewthat holds itsRenderSettingslike the rotation.pages- a List ofpagesto serialize render controls for.filter- aControlsKitFilterto restrict the serialization output. If the filter is null, a ControlsKitAllowAllFilter will be created.- Returns:
- a json object containing all pages render settings / rotations.
-
deSerializeRenderControls
Take a json object and restore
RenderControlsfor the wholeDocumentcurrently set inPageView.RenderControlswil be applied to the givenPageView.- Parameters:
json- the json string containing theRenderControlsinfo.pageView- hold the document and getsRenderControlsapplied to.
-
deSerializeRenderControls
Take a json object and restore
RenderControlson the givenpagescurrently present inPageViewsDocument.RenderControlswil be applied to the givenPageView.- Parameters:
json- the json string containing theRenderControlsinfo.pages- Pages for which theRenderControlsare applied for.pageView- hold a document containing the given Pages and getsRenderControlsapplied to.
-