Class MarvinJSRenderer

java.lang.Object
jakarta.faces.render.Renderer
de.ipb_halle.molecularfaces.component.molplugin.MolPluginRenderer
de.ipb_halle.molecularfaces.component.molplugin.MarvinJSRenderer

public class MarvinJSRenderer extends MolPluginRenderer
This Renderer renders a chemical structure editor or viewer using the Marvin JS Javascript plugin.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    Name of the JavaScript global variable that represents a common ResourcesLoader instance for all rendered components of this plugin type.
    static final String
     
    private WebXml
     

    Fields inherited from class jakarta.faces.render.Renderer

    PASSTHROUGH_RENDERER_LOCALNAME_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    encodeBegin(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent component)
     
    private void
    encodeEditor(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin)
     
    private void
    encodeEditorHTML(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String iframeId, String hiddenInputId)
    Encodes the HTML part of the plugin editor into the writer.
    private void
    encodeEditorJS(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String iframeId, String hiddenInputId)
    Encodes the JavaScript part of the plugin editor into the writer.
    private void
    encodeViewer(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin)
     
    private void
    encodeViewerHTML(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String divId, String hiddenInputId)
    Encodes the HTML part of the plugin viewer into the writer.
    private void
    encodeViewerJS(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String divId, String hiddenInputId)
    Encodes the Javascript part of the plugin viewer into the writer.

    Methods inherited from class de.ipb_halle.molecularfaces.component.molplugin.MolPluginRenderer

    decode, generateDivStyle, getConvertedValue

    Methods inherited from class jakarta.faces.render.Renderer

    convertClientId, encodeChildren, encodeEnd, getRendersChildren

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RENDERER_TYPE

      public static final String RENDERER_TYPE
      See Also:
    • loaderJSVar

      private String loaderJSVar
      Name of the JavaScript global variable that represents a common ResourcesLoader instance for all rendered components of this plugin type. This variable is defined in MolecularFaces.js.
    • webXml

      private WebXml webXml
  • Constructor Details

    • MarvinJSRenderer

      public MarvinJSRenderer()
  • Method Details

    • encodeBegin

      public void encodeBegin(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent component) throws IOException
      Overrides:
      encodeBegin in class jakarta.faces.render.Renderer
      Throws:
      IOException
    • encodeViewer

      private void encodeViewer(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin) throws IOException
      Throws:
      IOException
    • encodeViewerHTML

      private void encodeViewerHTML(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String divId, String hiddenInputId) throws IOException
      Encodes the HTML part of the plugin viewer into the writer. It consists of a <div> element that the Javascript plugin uses as rendering target.
      Parameters:
      context -
      writer -
      plugin -
      divId - DOM id of the embedded <div> element
      hiddenInputId - DOM id of the embedded hidden <input> element
      Throws:
      IOException
    • encodeViewerJS

      private void encodeViewerJS(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String divId, String hiddenInputId) throws IOException
      Encodes the Javascript part of the plugin viewer into the writer.
      Parameters:
      context -
      writer -
      plugin -
      divId - DOM id of the <div> element
      hiddenInputId - DOM id of the embedded hidden <input> element
      Throws:
      IOException
    • encodeEditor

      private void encodeEditor(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin) throws IOException
      Throws:
      IOException
    • encodeEditorHTML

      private void encodeEditorHTML(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String iframeId, String hiddenInputId) throws IOException
      Encodes the HTML part of the plugin editor into the writer. It consists of an <iframe> and a hidden <input> element.
      Parameters:
      context -
      writer -
      plugin -
      iframeId - DOM id of the embedded <iframe> element
      hiddenInputId - DOM id of the embedded hidden <input> element
      Throws:
      IOException
    • encodeEditorJS

      private void encodeEditorJS(jakarta.faces.context.FacesContext context, jakarta.faces.context.ResponseWriter writer, MolPluginCore plugin, String iframeId, String hiddenInputId) throws IOException
      Encodes the JavaScript part of the plugin editor into the writer.

      Note: Different components of this plugin type will use one and the same JavaScript variable, which will be overwritten in case it already exists.

      Parameters:
      context -
      writer -
      plugin -
      iframeId - DOM id of the <iframe> element
      hiddenInputId - DOM id of the hidden <input> element
      Throws:
      IOException