Class DefaultResourceUI

java.lang.Object
uno.anahata.asi.swing.agi.resources.DefaultResourceUI
All Implemented Interfaces:
ResourceUI
Direct Known Subclasses:
NbResourceUI

public class DefaultResourceUI extends Object implements ResourceUI
The standard, universal implementation of ResourceUI for Standalone and generic Swing environments.

It provides capability-based visualization (Text, Image, Audio) and basic OS-level actions with descriptive icons.

Author:
anahata
  • Constructor Details

    • DefaultResourceUI

      public DefaultResourceUI()
  • Method Details

    • createContent

      public JComponent createContent(Resource resource, AgiPanel agiPanel)
      Creates the primary content component for the given resource.

      Implementation details: Dispatches to RSyntaxTextAreaTextResourceViewer for text resources or a custom label for binary/media resources.

      Specified by:
      createContent in interface ResourceUI
      Parameters:
      resource - The resource to render.
      agiPanel - The parent AgiPanel.
      Returns:
      The JComponent representing the content view.
    • createMediaComponent

      private JComponent createMediaComponent(Resource resource, MediaView mv)
      Creates a Swing component for media-based resources.
      Parameters:
      resource - The resource instance.
      mv - The associated media view.
      Returns:
      The media JComponent.
    • populateActions

      public void populateActions(JPanel actionContainer, Resource resource, AgiPanel agiPanel)
      Injects host-specific actions into the provided container.

      Implementation details: Injects OS-level actions for physical resources.

      Specified by:
      populateActions in interface ResourceUI
      Parameters:
      actionContainer - The container (usually a toolbar or header panel).
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
    • createHandlePanel

      public JPanel createHandlePanel(Resource resource, AgiPanel agiPanel)
      Creates a specialized metadata panel for the resource's handle.

      Implementation details: Provides specialized metadata panels based on the handle's connectivity type.

      Specified by:
      createHandlePanel in interface ResourceUI
      Parameters:
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
      Returns:
      A JPanel configured to show handle-specific attributes.
    • createViewPanel

      public JPanel createViewPanel(Resource resource, AgiPanel agiPanel)
      Creates a specialized metadata panel for the resource's view.

      Implementation details: Provides specialized metadata panels based on the view's semantic interpreter type.

      Specified by:
      createViewPanel in interface ResourceUI
      Parameters:
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
      Returns:
      A JPanel configured to show view-specific attributes.
    • open

      public void open(Resource resource, AgiPanel agiPanel)
      Opens the resource in the host environment's preferred viewer or editor.

      Implementation details: Uses Desktop API to open physical or URL resources.

      Specified by:
      open in interface ResourceUI
      Parameters:
      resource - The resource to open.
      agiPanel - The parent AgiPanel.
    • openUri

      public void openUri(String uriString)
      Opens a generic URI using the host environment's preferred method.
      Specified by:
      openUri in interface ResourceUI
      Parameters:
      uriString - The URI string to open.
    • select

      public void select(Resource resource, AgiPanel agiPanel)
      Selects and highlights the resource in the host environment's navigation component (e.g., Projects tree).

      Implementation details: Standalone mode does not support project-level selection.

      Specified by:
      select in interface ResourceUI
      Parameters:
      resource - The resource to select.
      agiPanel - The parent AgiPanel.
    • createLinkButton

      protected JButton createLinkButton(String text, String tooltip, Icon icon)
      Helper for creating hyperlink-styled buttons with icons.
      Parameters:
      text - The button text.
      tooltip - The tooltip.
      icon - The icon.
      Returns:
      The configured JButton.