Class LayoutStylingService
java.lang.Object
io.meeds.layout.service.LayoutStylingService
Writes a styling description onto a layout element exactly as the editor's
styling inputs do, the inverse of LayoutDescriptionService.toStyling: the
vocabulary is checked block by block against the destination's matrix
before a field is written; a block, a text role or a text background the
call leaves null is not written at all, a block whose enabled flag is
false clears its fields, and a value outside the vocabulary is refused
naming its path. A caller that keeps an element merges the call's
description over the element's stored one first (
merge(StylingDescription, StylingDescription, boolean)), so a
value left null inside a block it turns on keeps what the element holds;
the one block the merge restates on its own is a solid background with a
scroll colour on an element that stops being sticky.
Images are not written here: an image block is accepted only when it
repeats the image the element already holds, which then stays as stored.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringvoidapplyDisplay(LayoutModel target, DisplayMode display, StylingDestination destination, String refusal) voidapplyStyling(LayoutModel target, StylingDescription styling, StylingDestination destination, boolean sticky, boolean plainColorOnly) voidapplyStyling(LayoutModel target, StylingDescription styling, StylingDestination destination, boolean sticky, boolean plainColorOnly, ImageConsumption images) static StylingDescriptionmerge(StylingDescription stored, StylingDescription input, boolean sticky) The description a call means for a kept element: a block the call leaves null stays null, so the element keeps it untouched; a block it turns off is off; a block it sends without the flag is on; and inside a block it turns on every value it leaves null is the stored value, a text role, a padding side or a corner included.static String
-
Field Details
-
REFUSAL_PREFIX
- See Also:
-
GRADIENT_BASE_COLOR
- See Also:
-
DEFAULT_COLOR
- See Also:
-
TEXT_BACKGROUND_DEFAULT_COLOR
- See Also:
-
SCROLL_COLOR_SEPARATOR
- See Also:
-
HIDE_MOBILE_TOKEN
- See Also:
-
HIDE_DESKTOP_TOKEN
- See Also:
-
TO_BOTTOM
- See Also:
-
TO_RIGHT
- See Also:
-
BOLD
- See Also:
-
ITALIC
- See Also:
-
NORMAL
- See Also:
-
CONTAINER_MARGIN_MIN
public static final int CONTAINER_MARGIN_MIN- See Also:
-
CONTAINER_MARGIN_MAX
public static final int CONTAINER_MARGIN_MAX- See Also:
-
APPLICATION_MARGIN_MIN
public static final int APPLICATION_MARGIN_MIN- See Also:
-
APPLICATION_MARGIN_MAX
public static final int APPLICATION_MARGIN_MAX- See Also:
-
APPLICATION_MARGIN_NEUTRAL
public static final int APPLICATION_MARGIN_NEUTRAL- See Also:
-
BORDER_SIZE_MAX
public static final int BORDER_SIZE_MAX- See Also:
-
DEFAULT_BORDER_SIZE
public static final int DEFAULT_BORDER_SIZE- See Also:
-
CORNER_MAX
public static final int CORNER_MAX- See Also:
-
TEXT_SIZE_MAX
public static final int TEXT_SIZE_MAX- See Also:
-
TEXT_PADDING_MAX
public static final int TEXT_PADDING_MAX- See Also:
-
TEXT_CORNER_MAX
public static final int TEXT_CORNER_MAX- See Also:
-
RATIO_MAX
public static final int RATIO_MAX- See Also:
-
DEFAULT_RATIO
public static final int DEFAULT_RATIO- See Also:
-
CUSTOM_HEIGHT_MIN
public static final int CUSTOM_HEIGHT_MIN- See Also:
-
CUSTOM_HEIGHT_MAX
public static final int CUSTOM_HEIGHT_MAX- See Also:
-
IMAGE_MARGIN_MAX
public static final int IMAGE_MARGIN_MAX- See Also:
-
IMAGE_CORNER_MAX
public static final int IMAGE_CORNER_MAX- See Also:
-
IMAGE_SIZE_COVER
- See Also:
-
IMAGE_SIZE_CONTAIN
- See Also:
-
IMAGE_POSITION_CENTER
- See Also:
-
IMAGE_REPEAT
- See Also:
-
IMAGE_NO_REPEAT
- See Also:
-
IMAGE_ATTACHMENT_SCROLL
- See Also:
-
IMAGE_ATTACHMENT_FIXED
- See Also:
-
-
Constructor Details
-
LayoutStylingService
public LayoutStylingService()
-
-
Method Details
-
merge
public static StylingDescription merge(StylingDescription stored, StylingDescription input, boolean sticky) The description a call means for a kept element: a block the call leaves null stays null, so the element keeps it untouched; a block it turns off is off; a block it sends without the flag is on; and inside a block it turns on every value it leaves null is the stored value, a text role, a padding side or a corner included. A stored gradient's effect is kept only while the call names neither a mode nor a colour, and a stored scroll colour only while the element stays sticky and solid: a solid background left untouched on an element that stops being sticky is restated without its scroll colour, as the editor does.- Parameters:
stored- the element's stored description, as the read answers itinput- the call's description, null for every block untouchedsticky- whether the element is sticky after the call- Returns:
- the description to write
-
applyStyling
public void applyStyling(LayoutModel target, StylingDescription styling, StylingDestination destination, boolean sticky, boolean plainColorOnly) - Parameters:
target- the element writtenstyling- the blocks, null for every block untoucheddestination- the element's place in the matrixsticky- whether the element is a sticky site container, the only one with a scroll colourplainColorOnly- whether the background takes a plain colour only, as the editor offers on a topbar
-
applyStyling
public void applyStyling(LayoutModel target, StylingDescription styling, StylingDestination destination, boolean sticky, boolean plainColorOnly, ImageConsumption images) throws org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
target- the element writtenstyling- the blocks, null for every block untoucheddestination- the element's place in the matrixsticky- whether the element is a sticky site container, the only one with a scroll colourplainColorOnly- whether the background takes a plain colour only, as the editor offers on a topbarimages- the call's image consumption, on which a block carrying an image_upload_id claims its id; the placeholder it answers stands in the image fields until the attachment is saved- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when an image_upload_id names no staged upload
-
applyDisplay
public void applyDisplay(LayoutModel target, DisplayMode display, StylingDestination destination, String refusal) - Parameters:
target- the element writtendisplay- the device visibility, null to leave it as it isdestination- the element's place in the matrixrefusal- the text answered when the destination does not offer the choice
-
strip
-
append
-