Interface StudioPreviewEnvironment
public interface StudioPreviewEnvironment
Studio-side services available to
preview loaders.
Implemented by Studio via Proxy over the preview classloader,
therefore: JDK-only signatures, every method may return null, implementations never throw.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionAll application properties as a key-value map.default @Nullable StringA single application property value (application.propertiesmerged the way Studio sees it).default @Nullable StringentityProperties(@Nullable String dataContainerId, @Nullable String metaClass) Attributes of the entity behind a data container / meta class as a JSON array:[{"name": "...", "caption": "<localized>", "type": "<java or enum fqn>"}].default @Nullable StringConstants of a project enum class as a JSON array:[{"name": "...", "caption": "<localized or natural>"}].default @Nullable StringThe project's main menu (menu.xml) as a JSON array, recursive:[{"id": "...", "title": "<localized>", "icon": "<icon attr or null>", "items": [...]}].@Nullable StringpropertyCaption(@Nullable String dataContainerId, @Nullable String metaClass, String propertyPath) Resolves the localized caption of an entity property, e.g.default @Nullable StringresolveFragmentDescriptor(String fragmentClassFqn) The descriptor XML text of the fragment declared by the given controller class, for rendering fragment content inline.default @Nullable StringresolveIconSvg(String icon) SVG of an icon from a project custom icon set (anIconFactory+@JsModuleiconset invisible to the preview classloader), as adata:image/svg+xml;base64,...URL.@Nullable StringresolveMessage(String messageKey) Resolves a localized message reference (e.g.default @Nullable StringresolveStaticResource(String path) Resolves a project static resource (Spring conventions: resource root,META-INF/resources,static,public) to adata:<mime>;base64,...URL usable as an image/svg src.default @Nullable StringThe calling Studio's plugin version, e.g.default @Nullable StringThe localized title of a view identified by view id or controller class FQN.
-
Field Details
-
NOOP
-
-
Method Details
-
resolveMessage
Resolves a localized message reference (e.g.msg://key) using the IDE project messages. -
propertyCaption
@Nullable String propertyCaption(@Nullable String dataContainerId, @Nullable String metaClass, String propertyPath) Resolves the localized caption of an entity property, e.g. for a dataGrid column header. -
studioVersion
The calling Studio's plugin version, e.g."2.8.1", for loaders that must branch on it.nullwhen Studio is older than this method (its proxy returnsnullfor anything it doesn't implement) or when no environment was supplied at all.defaulton purpose: every method added here must stay optional so implementations — Studio's proxy included — keep compiling and behaving as "not supported" until they opt in. -
resolveStaticResource
Resolves a project static resource (Spring conventions: resource root,META-INF/resources,static,public) to adata:<mime>;base64,...URL usable as an image/svg src. -
resolveFragmentDescriptor
The descriptor XML text of the fragment declared by the given controller class, for rendering fragment content inline. -
mainMenuItems
The project's main menu (menu.xml) as a JSON array, recursive:[{"id": "...", "title": "<localized>", "icon": "<icon attr or null>", "items": [...]}]. -
entityProperties
default @Nullable String entityProperties(@Nullable String dataContainerId, @Nullable String metaClass) Attributes of the entity behind a data container / meta class as a JSON array:[{"name": "...", "caption": "<localized>", "type": "<java or enum fqn>"}]. Same resolution rules aspropertyCaption(java.lang.String, java.lang.String, java.lang.String). -
applicationProperty
A single application property value (application.propertiesmerged the way Studio sees it). -
applicationProperties
All application properties as a key-value map. Prefer this over repeatedapplicationProperty(java.lang.String)calls when several keys are needed — every environment call crosses the classloader boundary into a Studio read action. -
enumItems
Constants of a project enum class as a JSON array:[{"name": "...", "caption": "<localized or natural>"}]. Project enums are not on the preview classloader, so only Studio can enumerate them. -
viewTitle
The localized title of a view identified by view id or controller class FQN. -
resolveIconSvg
SVG of an icon from a project custom icon set (anIconFactory+@JsModuleiconset invisible to the preview classloader), as adata:image/svg+xml;base64,...URL.nullfor standard/unknown icons.
-