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
    Modifier and Type
    Field
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default @Nullable Map<String,String>
    All application properties as a key-value map.
    default @Nullable String
    A single application property value (application.properties merged the way Studio sees it).
    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>"}].
    default @Nullable String
    enumItems(String enumClassFqn)
    Constants of a project enum class as a JSON array: [{"name": "...", "caption": "<localized or natural>"}].
    default @Nullable String
    The project's main menu (menu.xml) as a JSON array, recursive: [{"id": "...", "title": "<localized>", "icon": "<icon attr or null>", "items": [...]}].
    @Nullable String
    propertyCaption(@Nullable String dataContainerId, @Nullable String metaClass, String propertyPath)
    Resolves the localized caption of an entity property, e.g.
    default @Nullable String
    The descriptor XML text of the fragment declared by the given controller class, for rendering fragment content inline.
    default @Nullable String
    SVG of an icon from a project custom icon set (an IconFactory + @JsModule iconset invisible to the preview classloader), as a data:image/svg+xml;base64,... URL.
    @Nullable String
    resolveMessage(String messageKey)
    Resolves a localized message reference (e.g.
    default @Nullable String
    Resolves a project static resource (Spring conventions: resource root, META-INF/resources, static, public) to a data:<mime>;base64,... URL usable as an image/svg src.
    default @Nullable String
    The calling Studio's plugin version, e.g.
    default @Nullable String
    viewTitle(String viewIdOrClassFqn)
    The localized title of a view identified by view id or controller class FQN.
  • Field Details

  • Method Details

    • resolveMessage

      @Nullable String resolveMessage(String messageKey)
      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

      default @Nullable String studioVersion()
      The calling Studio's plugin version, e.g. "2.8.1", for loaders that must branch on it. null when Studio is older than this method (its proxy returns null for anything it doesn't implement) or when no environment was supplied at all.

      default on 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

      default @Nullable String resolveStaticResource(String path)
      Resolves a project static resource (Spring conventions: resource root, META-INF/resources, static, public) to a data:<mime>;base64,... URL usable as an image/svg src.
    • resolveFragmentDescriptor

      default @Nullable String resolveFragmentDescriptor(String fragmentClassFqn)
      The descriptor XML text of the fragment declared by the given controller class, for rendering fragment content inline.
    • 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 as propertyCaption(java.lang.String, java.lang.String, java.lang.String).
    • applicationProperty

      default @Nullable String applicationProperty(String key)
      A single application property value (application.properties merged the way Studio sees it).
    • applicationProperties

      default @Nullable Map<String,String> applicationProperties()
      All application properties as a key-value map. Prefer this over repeated applicationProperty(java.lang.String) calls when several keys are needed — every environment call crosses the classloader boundary into a Studio read action.
    • enumItems

      default @Nullable String enumItems(String enumClassFqn)
      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

      default @Nullable String viewTitle(String viewIdOrClassFqn)
      The localized title of a view identified by view id or controller class FQN.
    • resolveIconSvg

      default @Nullable String resolveIconSvg(String icon)
      SVG of an icon from a project custom icon set (an IconFactory + @JsModule iconset invisible to the preview classloader), as a data:image/svg+xml;base64,... URL. null for standard/unknown icons.