Class RagMessagePanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class RagMessagePanel extends AbstractMessagePanel<AbstractMessage> implements Scrollable
A specialized message panel for rendering messages in non-history UI components. It suppresses pruning and removal controls by default and supports scrolling.
Author:
anahata
See Also:
  • Field Details

    • renderPruneButtons

      private final boolean renderPruneButtons
      Whether to render pruning controls.
    • renderRemoveButtons

      private final boolean renderRemoveButtons
      Whether to render remove controls.
  • Constructor Details

    • RagMessagePanel

      public RagMessagePanel(@NonNull @NonNull AgiPanel agiPanel, @NonNull @NonNull AbstractMessage message, boolean renderPruneButtons, boolean renderRemoveButtons)
      Constructs a new RagMessagePanel.
      Parameters:
      agiPanel - The parent agi panel.
      message - The message to render.
      renderPruneButtons - Whether to render pruning controls.
      renderRemoveButtons - Whether to render remove controls.
  • Method Details

    • isRenderPruneButtons

      public boolean isRenderPruneButtons()
      If true, the pruning toggle button is rendered in the header.

      Returns whether pruning buttons should be rendered.

      Overrides:
      isRenderPruneButtons in class AbstractMessagePanel<AbstractMessage>
      Returns:
      true by default.
    • isRenderRemoveButtons

      public boolean isRenderRemoveButtons()
      If true, the remove button is rendered in the header.

      Returns whether remove buttons should be rendered.

      Overrides:
      isRenderRemoveButtons in class AbstractMessagePanel<AbstractMessage>
      Returns:
      true by default.
    • getPreferredScrollableViewportSize

      public Dimension getPreferredScrollableViewportSize()

      Returns the preferred size for the scrollable viewport.

      Specified by:
      getPreferredScrollableViewportSize in interface Scrollable
      Overrides:
      getPreferredScrollableViewportSize in class org.jdesktop.swingx.JXPanel
    • getScrollableUnitIncrement

      public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)

      Returns the unit increment for scrolling.

      Specified by:
      getScrollableUnitIncrement in interface Scrollable
      Overrides:
      getScrollableUnitIncrement in class org.jdesktop.swingx.JXPanel
    • getScrollableBlockIncrement

      public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)

      Returns the block increment for scrolling.

      Specified by:
      getScrollableBlockIncrement in interface Scrollable
      Overrides:
      getScrollableBlockIncrement in class org.jdesktop.swingx.JXPanel
    • getScrollableTracksViewportWidth

      public boolean getScrollableTracksViewportWidth()

      Returns whether the scrollable tracks viewport width.

      Specified by:
      getScrollableTracksViewportWidth in interface Scrollable
      Overrides:
      getScrollableTracksViewportWidth in class org.jdesktop.swingx.JXPanel
    • getScrollableTracksViewportHeight

      public boolean getScrollableTracksViewportHeight()

      Returns whether the scrollable tracks viewport height.

      Specified by:
      getScrollableTracksViewportHeight in interface Scrollable
      Overrides:
      getScrollableTracksViewportHeight in class org.jdesktop.swingx.JXPanel
    • getHeaderSuffix

      protected String getHeaderSuffix()
      Gets the suffix for the header, typically metadata like depth.

      Returns an empty string for the header suffix, as RAG messages are not part of the tracked history depth.

      Overrides:
      getHeaderSuffix in class AbstractMessagePanel<AbstractMessage>
      Returns:
      The header suffix HTML.
    • getHeaderStartColor

      protected Color getHeaderStartColor()
      Gets the start color for the header gradient.

      Returns the header start color from the theme.

      Specified by:
      getHeaderStartColor in class AbstractMessagePanel<AbstractMessage>
      Returns:
      The start color.
    • getHeaderEndColor

      protected Color getHeaderEndColor()
      Gets the end color for the header gradient.

      Returns the header end color from the theme.

      Specified by:
      getHeaderEndColor in class AbstractMessagePanel<AbstractMessage>
      Returns:
      The end color.
    • getHeaderForegroundColor

      protected Color getHeaderForegroundColor()
      Gets the foreground color for the header text.

      Returns the header foreground color from the theme.

      Specified by:
      getHeaderForegroundColor in class AbstractMessagePanel<AbstractMessage>
      Returns:
      The foreground color.
    • getMessageBorder

      protected Border getMessageBorder()
      Gets the border for the message panel.

      Returns the message border from the theme.

      Specified by:
      getMessageBorder in class AbstractMessagePanel<AbstractMessage>
      Returns:
      The border.