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.WritableRenderPresets
createRenderPresets
(PageView pageView, Document document, ControlsKitFilter filter) static void
deSerializeRenderControls
(String json, PageView pageView) static void
deSerializeRenderControls
(String json, List<Page> pages, PageView pageView) Take a json object and restoreRenderControls
on the givenpages
currently present inPageViews
Document
.static String
serializeRenderControls
(PageView pageView, Document document) Take both theRenderControls
that are applied document-wide and page-wide and create a json objectstatic String
serializeRenderControls
(PageView pageView, Document document, ControlsKitFilter filter) Take both theRenderControls
that are applied document-wide and page-wide and create a json objectstatic String
serializeRenderControls
(PageView pageView, List<Page> pages) Take pageRenderControls
and create a json object for them.static String
serializeRenderControls
(PageView pageView, List<Page> pages, ControlsKitFilter filter) Take pageRenderControls
and create a json object for them.
-
Constructor Details
-
RenderControlsJsonSerializer
public RenderControlsJsonSerializer()
-
-
Method Details
-
serializeRenderControls
Take both theRenderControls
that are applied document-wide and page-wide and create a json object- Parameters:
pageView
- thePageView
that holds itsRenderSettings
like the rotation.document
- theDocument
containingpages
. We can haveRenderControls
that define that the whole document is rotated, but we can have those settings also individually per page.FilteredDocuments
are 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 theRenderControls
that are applied document-wide and page-wide and create a json object- Parameters:
pageView
- thePageView
that holds itsRenderSettings
like the rotation.document
- theDocument
containingpages
. We can haveRenderControls
that define that the whole document is rotated, but we can have those settings also individually per page.FilteredDocuments
are not supported.filter
- aControlsKitFilter
to 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 pageRenderControls
and create a json object for them.- Parameters:
pageView
- thePageView
that holds itsRenderSettings
like the rotation.pages
- a List ofpages
to 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 pageRenderControls
and create a json object for them.- Parameters:
pageView
- thePageView
that holds itsRenderSettings
like the rotation.pages
- a List ofpages
to serialize render controls for.filter
- aControlsKitFilter
to 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
RenderControls
for the wholeDocument
currently set inPageView
.RenderControls
wil be applied to the givenPageView
.- Parameters:
json
- the json string containing theRenderControls
info.pageView
- hold the document and getsRenderControls
applied to.
-
deSerializeRenderControls
Take a json object and restore
RenderControls
on the givenpages
currently present inPageViews
Document
.RenderControls
wil be applied to the givenPageView
.- Parameters:
json
- the json string containing theRenderControls
info.pages
- Pages for which theRenderControls
are applied for.pageView
- hold a document containing the given Pages and getsRenderControls
applied to.
-