Class ViewRender
java.lang.Object
com.developer.nefarious.zjoule.plugin.core.ui.ViewRender
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionbuild()
Builds the HTML content for the view.static IViewRender
create()
Factory method to create a newViewRender
instance.getResourceContent
(String filename) Reads the content of a resource file located in the plugin's bundle.
-
Method Details
-
create
Factory method to create a newViewRender
instance.- Returns:
- a new
IViewRender
instance.
-
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 interfaceIViewRender
- Returns:
- the complete HTML content as a
String
.
-
getResourceContent
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 interfaceIViewRender
- Parameters:
filename
- the name of the file to read from theresources/views
directory.- Returns:
- the content of the file as a
String
, or an empty string if an error occurs.
-