Class StudioAiChatPreviewLoader
- All Implemented Interfaces:
StudioPreviewComponentLoader
The components themselves are out of reach here: every one of them is built on the
Spring-coupled io.jmix.flowui and this loader runs on Studio's spring-free preview
classloader, which carries nothing but flowui-kit and this module. Plain-Vaadin stubs
of the matching shape are used instead, so the designer shows a box of the right kind, in the
right place, at the declared size.
Source loaders: io.jmix.aichat.xml.layout.loader.AiChatLoader and its siblings in
that package.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringThe stub picked per tag.protected 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 voidloadCode(com.vaadin.flow.component.html.Pre codeBlock, org.dom4j.Element element, StudioPreviewEnvironment environment) MirrorsAiCodeBlockLoader#loadCode: the nestedcodeelement wins over thecodeattribute.protected voidloadInputPlaceholder(com.vaadin.flow.component.textfield.TextArea textArea, org.dom4j.Element element, StudioPreviewEnvironment environment) Carries the placeholder declared in the nestedi18nelement onto the composer stub.protected voidloadUploadTrigger(com.vaadin.flow.component.button.Button button, org.dom4j.Element element, StudioPreviewEnvironment environment) Loads the trigger's owntextandicon.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
-
AICHAT_SCHEMA
- See Also:
-
AI_CHAT
- See Also:
-
AI_UPLOAD_TRIGGER
- See Also:
-
AI_CODE_BLOCK
- See Also:
-
AI_MESSAGE_INPUT
- See Also:
-
AI_MESSAGE_LIST
- See Also:
-
CODE_ELEMENT_NAME
- See Also:
-
I18N_ELEMENT_NAME
- See Also:
-
TEXT_ATTRIBUTE_NAME
- See Also:
-
PLACEHOLDER_ATTRIBUTE_NAME
- See Also:
-
EMPTY_CODE_BLOCK_MIN_HEIGHT
- See Also:
-
FACTORIES
The stub picked per tag.aiMessageInputis aTextArearather than a bare box on purpose: it is the composer's shape, and it isHasPrefix/HasSuffix, which is what lets Studio's slot processor put the declaredprefix/suffixcontent where it belongs.
-
-
Constructor Details
-
StudioAiChatPreviewLoader
public StudioAiChatPreviewLoader()
-
-
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:
-
loadCode
protected void loadCode(com.vaadin.flow.component.html.Pre codeBlock, org.dom4j.Element element, StudioPreviewEnvironment environment) MirrorsAiCodeBlockLoader#loadCode: the nestedcodeelement wins over thecodeattribute. Where the runtime rejects a present-but-blank element, the preview keeps the empty block instead — a descriptor being edited is blank half the time.- Parameters:
codeBlock- the preview stub to load intoelement- the descriptor element being previewedenvironment- the preview environment resolving localized strings
-
loadInputPlaceholder
protected void loadInputPlaceholder(com.vaadin.flow.component.textfield.TextArea textArea, org.dom4j.Element element, StudioPreviewEnvironment environment) Carries the placeholder declared in the nestedi18nelement onto the composer stub. The field pass above finds nothing to apply on its own: the runtime component reads its placeholder fromAiMessageInputI18n, and the schema has noplaceholderattribute on the component element forloadFieldAttributesto pick up.The chat's
i18nreaches a placeholder too, through its nestedmessageInputelement, but the chat's stub is aVerticalLayoutwith no composer inside, so there is nothing there to put it on.- Parameters:
textArea- the composer stub to load intoelement- the descriptor element being previewedenvironment- the preview environment resolving localized strings
-
loadUploadTrigger
protected void loadUploadTrigger(com.vaadin.flow.component.button.Button button, org.dom4j.Element element, StudioPreviewEnvironment environment) Loads the trigger's owntextandicon. Both are carried because an upload trigger routinely declares only one of them, and a button with neither is an empty sliver.The icon is parsed defensively:
ComponentUtils#parseIconthrows on a name that is not aVaadinIconconstant or a two-partset:name, which a half-typedicon="PAPERCLI"is. Dropping the icon and keeping the button follows the preview's own rule — render what you can and stay silent.- Parameters:
button- the preview stub to load intoelement- the descriptor element being previewedenvironment- the preview environment resolving localized strings
-