Class FullTextFileCreateRenderer
- All Implemented Interfaces:
ParameterRenderer<FullTextFileCreate>
This renderer manages the entire UI for a FullTextFileCreate parameter.
It leverages the V2 ResourceUI strategy to provide high-fidelity
editing by wrapping the proposed file in a virtual StringHandle.
Authoritative Navigation: Once a file is created, the header provides a clickable hyperlink to the real resource and an 'Edit' toggle to refine the proposal.
- Author:
- anahata
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JPanelThe toolbar for post-execution actions (Open/Edit).private AgiPanelThe agi panel instance providing session context.private AbstractToolCall<?, ?> The tool call containing the parameter being rendered.private final JPanelThe main container panel for the renderer.private StringHandleThe virtual handle used to simulate the file before it exists on disk.private ToolExecutionStatusCache of the last rendered status to track transitions (Proposed -> Created).private FullTextFileCreateCache of the last rendered state to prevent redundant UI updates.private StringThe technical name of the parameter.private FullTextFileCreateThe current creation DTO containing path and content.private AbstractTextResourceViewerThe high-fidelity text viewer component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate JPanelcreateHeaderPanel(ToolExecutionStatus status, Resource resource) Creates the header panel including status label and post-execution actions.Returns the Swing component that performs the rendering.voidinit(AgiPanel agiPanel, AbstractToolCall<?, ?> call, String paramName, FullTextFileCreate value) Initializes the renderer with its context.private voidInitializes the host-native high-fidelity viewer via a virtual StringHandle.booleanrender()Triggers the rendering logic.private voidrenderError(String message) Renders an error message in the center of the container.voidupdateContent(FullTextFileCreate value) Updates the renderer with a new value.private booleanPerforms authoritative pre-flight validation using the DTO's internal logic.
-
Field Details
-
agiPanel
The agi panel instance providing session context. -
call
The tool call containing the parameter being rendered. -
paramName
The technical name of the parameter. -
value
The current creation DTO containing path and content. -
container
The main container panel for the renderer. -
actionPanel
The toolbar for post-execution actions (Open/Edit). -
viewer
The high-fidelity text viewer component. -
ephemeralHandle
The virtual handle used to simulate the file before it exists on disk. -
lastRenderedValue
Cache of the last rendered state to prevent redundant UI updates. -
lastRenderedStatus
Cache of the last rendered status to track transitions (Proposed -> Created).
-
-
Constructor Details
-
FullTextFileCreateRenderer
public FullTextFileCreateRenderer()
-
-
Method Details
-
init
public void init(AgiPanel agiPanel, AbstractToolCall<?, ?> call, String paramName, FullTextFileCreate value) Initializes the renderer with its context.Implementation details: Initializes the renderer with the necessary session and tool call context. Configures the container panels for role-neutral rendering.
- Specified by:
initin interfaceParameterRenderer<FullTextFileCreate>- Parameters:
agiPanel- The parent agi panel.call- The tool call being rendered.paramName- The name of the parameter.value- The initial value.
-
getComponent
Returns the Swing component that performs the rendering.Implementation details: Returns the main container panel which will host either the high-fidelity editor or a validation error message.
- Specified by:
getComponentin interfaceParameterRenderer<FullTextFileCreate>- Returns:
- The rendering component.
-
updateContent
Updates the renderer with a new value.Implementation details: Updates the underlying DTO and pushes the new content into the ephemeral virtual resource to support bit-by-bit streaming in the UI.
- Specified by:
updateContentin interfaceParameterRenderer<FullTextFileCreate>- Parameters:
value- The new value to render.
-
validatePreFlight
private boolean validatePreFlight()Performs authoritative pre-flight validation using the DTO's internal logic.- Returns:
- true if valid.
-
render
public boolean render()Triggers the rendering logic.Implementation details: Executes the main render logic. It performs pre-flight validation, initializes the high-fidelity viewer if necessary, and assembles the final UI with host-specific actions and clickable file hyperlinks.
- Specified by:
renderin interfaceParameterRenderer<FullTextFileCreate>- Returns:
- True if a visual update occurred.
-
initViewer
private void initViewer()Initializes the host-native high-fidelity viewer via a virtual StringHandle. -
createHeaderPanel
Creates the header panel including status label and post-execution actions.- Parameters:
status- The current execution status.resource- The ephemeral resource instance.- Returns:
- The configured header JPanel.
-
renderError
Renders an error message in the center of the container.- Parameters:
message- The error text.
-

