Class StudioGrapesJsPreviewLoader
java.lang.Object
io.jmix.messagetemplatesflowui.kit.meta.loader.StudioGrapesJsPreviewLoader
- All Implemented Interfaces:
StudioPreviewComponentLoader
Studio preview loader for the
msgtmp:grapesJs component: instantiates an empty
GrapesJs with its pure-XML attributes and declared <blocks> applied, instead of
the reflection-fallback placeholder.
<plugins> is intentionally skipped: resolving a plugin/@name to a
GrapesJsPlugin instance goes through the (Spring-bean) GrapesJsPluginRegistry in
messagetemplates-flowui, which this spring-free kit module has no access to.
Studio has no block-specific post-processing to duplicate, so blocks are built unconditionally
(no StudioPreviewEnvironment handshake gate, unlike StudioGridPreviewLoader's
columns).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from interface io.jmix.flowui.kit.meta.component.preview.StudioPreviewComponentLoader
FRAGMENT_SCHEMA, MAIN_VIEW_SCHEMA, MAIN_VIEW_TAB_MODE_SCHEMA, VIEW_OR_FRAGMENT_SCHEMAS, VIEW_SCHEMA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisSupported(org.dom4j.Element element) Define the element that this loader can load.@Nullable com.vaadin.flow.component.Componentload(org.dom4j.Element componentElement, org.dom4j.Element viewElement) Create vaadin component from component xml element.@Nullable com.vaadin.flow.component.Componentload(org.dom4j.Element componentElement, org.dom4j.Element viewElement, StudioPreviewEnvironment environment) Create vaadin component from component xml element, with access to Studio-resolved context (e.g.protected voidloadBlock(GrapesJs grapesJs, org.dom4j.Element blockElement, StudioPreviewEnvironment environment) Builds a block from a<block>element.loadStringOrText(org.dom4j.Element element, String childName) LoadschildNameas the trimmed text of a child element if present (the XSD modelscontent/attributesas mixed-content elements), falling back to the same-named attribute otherwise.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.flowui.kit.meta.component.preview.StudioPreviewComponentLoader
hasViewOrFragmentSchema, loadBoolean, loadBoolean, loadClassNames, loadComponentBaseAttributes, loadDouble, loadDouble, loadEnabled, loadEnum, loadEnum, loadFieldAttributes, loadHeight, loadInteger, loadInteger, loadLocalizedString, loadMaxHeight, loadMaxWidth, loadMinHeight, loadMinWidth, loadSizeAttributes, loadString, loadString, loadString, loadThemeNames, loadTooltip, loadWidth, propertyCaption, split, split
-
Field Details
-
MESSAGETEMPLATES_SCHEMA
- See Also:
-
GRAPES_JS_ELEMENT
- See Also:
-
BLOCKS_ELEMENT
- See Also:
-
BLOCK_ELEMENT
- See Also:
-
-
Constructor Details
-
StudioGrapesJsPreviewLoader
public StudioGrapesJsPreviewLoader()
-
-
Method Details
-
isSupported
public boolean isSupported(org.dom4j.Element element) Description copied from interface:StudioPreviewComponentLoaderDefine the element that this loader can load.- Specified by:
isSupportedin interfaceStudioPreviewComponentLoader
-
load
public @Nullable com.vaadin.flow.component.Component load(org.dom4j.Element componentElement, org.dom4j.Element viewElement) Description copied from interface:StudioPreviewComponentLoaderCreate vaadin component from component xml element.- Specified by:
loadin interfaceStudioPreviewComponentLoader- Parameters:
componentElement- xml element of componentviewElement- xml element of view containingcomponentElement- See Also:
-
load
public @Nullable com.vaadin.flow.component.Component load(org.dom4j.Element componentElement, org.dom4j.Element viewElement, StudioPreviewEnvironment environment) Description copied from interface:StudioPreviewComponentLoaderCreate vaadin component from component xml element, with access to Studio-resolved context (e.g. localized messages, entity property captions).- Specified by:
loadin interfaceStudioPreviewComponentLoader- Parameters:
componentElement- xml element of componentviewElement- xml element of view containingcomponentElementenvironment- Studio-side environment;StudioPreviewEnvironment.NOOPwhen unavailable- See Also:
-
loadBlock
protected void loadBlock(GrapesJs grapesJs, org.dom4j.Element blockElement, StudioPreviewEnvironment environment) Builds a block from a<block>element. Silently skips it whenidis missing: the runtime loader throws in that case, but a preview should degrade gracefully rather than fail the whole component. -
loadStringOrText
LoadschildNameas the trimmed text of a child element if present (the XSD modelscontent/attributesas mixed-content elements), falling back to the same-named attribute otherwise.
-