Interface ResourceUI

All Known Implementing Classes:
DefaultResourceUI, IntellijResourceUI

public interface ResourceUI
The definitive strategy interface for providing a host-aware user interface for V2 Resources.

Implementations are responsible for creating the content visualization, injecting environment-specific actions, and providing modular metadata panels for handles and views.

This interface also defines the Edit/Save lifecycle, allowing the UI to transition between read-only previews and full-file editing.

Author:
anahata
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    canEdit(Resource resource)
    Determines if the given resource can be edited in this environment.
    createContent(Resource resource, AgiPanel agiPanel)
    Creates the primary content component for the given resource.
    createHandlePanel(Resource resource, AgiPanel agiPanel)
    Creates a specialized metadata panel for the resource's handle.
    createViewPanel(Resource resource, AgiPanel agiPanel)
    Creates a specialized metadata panel for the resource's view.
    default String
    Retrieves the current content from the editor component for saving.
    void
    open(Resource resource, AgiPanel agiPanel)
    Opens the resource in the host environment's preferred viewer or editor.
    default void
    openUri(String uriString)
    Opens a generic URI using the host environment's preferred method.
    void
    populateActions(JPanel actionContainer, Resource resource, AgiPanel agiPanel)
    Injects host-specific actions into the provided container.
    void
    select(Resource resource, AgiPanel agiPanel)
    Selects and highlights the resource in the host environment's navigation component (e.g., Projects tree).
    default void
    setEditing(JComponent viewer, boolean editing)
    Signals the active viewer component for this resource to enter or exit edit mode.
  • Method Details

    • createContent

      JComponent createContent(Resource resource, AgiPanel agiPanel)
      Creates the primary content component for the given resource.
      Parameters:
      resource - The resource to render.
      agiPanel - The parent AgiPanel.
      Returns:
      The JComponent representing the content view.
    • populateActions

      void populateActions(JPanel actionContainer, Resource resource, AgiPanel agiPanel)
      Injects host-specific actions into the provided container.
      Parameters:
      actionContainer - The container (usually a toolbar or header panel).
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
    • createHandlePanel

      JPanel createHandlePanel(Resource resource, AgiPanel agiPanel)
      Creates a specialized metadata panel for the resource's handle.
      Parameters:
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
      Returns:
      A JPanel configured to show handle-specific attributes.
    • createViewPanel

      JPanel createViewPanel(Resource resource, AgiPanel agiPanel)
      Creates a specialized metadata panel for the resource's view.
      Parameters:
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
      Returns:
      A JPanel configured to show view-specific attributes.
    • open

      void open(Resource resource, AgiPanel agiPanel)
      Opens the resource in the host environment's preferred viewer or editor.
      Parameters:
      resource - The resource to open.
      agiPanel - The parent AgiPanel.
    • select

      void select(Resource resource, AgiPanel agiPanel)
      Selects and highlights the resource in the host environment's navigation component (e.g., Projects tree).
      Parameters:
      resource - The resource to select.
      agiPanel - The parent AgiPanel.
    • canEdit

      default boolean canEdit(Resource resource)
      Determines if the given resource can be edited in this environment.
      Parameters:
      resource - The resource instance.
      Returns:
      true if editing is supported.
    • openUri

      default void openUri(String uriString)
      Opens a generic URI using the host environment's preferred method.
      Parameters:
      uriString - The URI string to open.
    • setEditing

      default void setEditing(JComponent viewer, boolean editing)
      Signals the active viewer component for this resource to enter or exit edit mode.
      Parameters:
      viewer - The component returned by createContent(Resource, AgiPanel).
      editing - true to enable editing.
    • getEditorContent

      default String getEditorContent(JComponent viewer)
      Retrieves the current content from the editor component for saving.
      Parameters:
      viewer - The component returned by createContent(Resource, AgiPanel).
      Returns:
      The current content string, or null if not available.