java.lang.Object
com.developer.nefarious.zjoule.plugin.core.ui.ViewRender
All Implemented Interfaces:
IViewRender

public class ViewRender extends Object implements IViewRender
Responsible for rendering an HTML-based view with embedded JavaScript and CSS resources.

The ViewRender class implements IViewRender and provides methods to build a complete HTML page dynamically by including JavaScript and CSS resources from the plugin's bundle.

  • Method Details

    • create

      public static IViewRender create()
      Factory method to create a new ViewRender instance.
      Returns:
      a new IViewRender instance.
    • build

      public String build()
      Builds the HTML content for the view.

      This method dynamically includes JavaScript and CSS resources by reading their contents from the plugin's resources. The generated HTML contains a placeholder for chat interactions and user instructions.

      Specified by:
      build in interface IViewRender
      Returns:
      the complete HTML content as a String.
    • getResourceContent

      public String getResourceContent(String filename)
      Reads the content of a resource file located in the plugin's bundle.

      This method resolves the file path using the plugin's bundle, reads the file content line by line, and returns the content as a single string.

      Specified by:
      getResourceContent in interface IViewRender
      Parameters:
      filename - the name of the file to read from the resources/views directory.
      Returns:
      the content of the file as a String, or an empty string if an error occurs.