Class SunEditorRenderer


  • public class SunEditorRenderer
    extends org.primefaces.renderkit.InputRenderer
    SunEditor component.
    Since:
    12.0.6
    Author:
    Matthieu Valente
    • Field Summary

      • Fields inherited from class org.primefaces.renderkit.InputRenderer

        ARIA_FILTER
      • Fields inherited from class javax.faces.render.Renderer

        PASSTHROUGH_RENDERER_LOCALNAME_KEY
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String capitalize​(java.lang.String name)
      Capitalizes the first character of the given string.
      void decode​(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)  
      void encodeEnd​(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)  
      protected void encodeMarkup​(javax.faces.context.FacesContext context, SunEditor editor)  
      protected void encodeScript​(javax.faces.context.FacesContext context, SunEditor editor)  
      protected java.lang.String fixFontFamily​(java.lang.String valueToRender)
      DIRTY HACK: Fixes the font-family declaration in the given HTML/CSS string by replacing any font name enclosed in `'...'` with its properly capitalized version.
      java.lang.Object getConvertedValue​(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object submittedValue)  
      protected java.lang.String sanitizeHtml​(javax.faces.context.FacesContext context, SunEditor editor, java.lang.String value)
      If security is enabled sanitize the HTML string to prevent XSS.
      • Methods inherited from class org.primefaces.renderkit.InputRenderer

        createStyleClass, createStyleClass, isDisabled, isReadOnly, renderAccessibilityAttributes, renderAccessibilityAttributes, renderAccessibilityAttributesHidden, renderARIACombobox, renderARIAInvalid, renderARIARequired, renderRTLDirection, shouldDecode
      • Methods inherited from class org.primefaces.renderkit.CoreRenderer

        buildAjaxRequest, buildAjaxRequest, buildAjaxRequest, buildDomEvent, buildNonAjaxRequest, buildNonAjaxRequest, decodeBehaviors, encodeClientBehaviors, encodeIndexedId, endsWithLenghtUnit, getEventBehaviors, getHighlighter, getIconOnlyButtonText, getResourceRequestPath, getResourceURL, getStyleBuilder, getStyleClassBuilder, getWidgetBuilder, isGrouped, isValueBlank, logDevelopmentWarning, preConfiguredAjaxRequestBuilder, preConfiguredAjaxRequestBuilder, renderAttribute, renderButtonValue, renderChild, renderChildren, renderDomEvent, renderDomEvents, renderDummyMarkup, renderDynamicPassThruAttributes, renderHiddenInput, renderOnchange, renderOnclick, renderPassThruAttributes, renderPassThruAttributes, renderPassThruAttributes, renderValidationMetadata, shouldRenderAttribute, shouldWriteId
      • Methods inherited from class javax.faces.render.Renderer

        convertClientId, encodeBegin, encodeChildren, getRendersChildren
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SunEditorRenderer

        public SunEditorRenderer()
    • Method Detail

      • decode

        public void decode​(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component)
        Overrides:
        decode in class javax.faces.render.Renderer
      • encodeEnd

        public void encodeEnd​(javax.faces.context.FacesContext context,
                              javax.faces.component.UIComponent component)
                       throws java.io.IOException
        Overrides:
        encodeEnd in class javax.faces.render.Renderer
        Throws:
        java.io.IOException
      • encodeMarkup

        protected void encodeMarkup​(javax.faces.context.FacesContext context,
                                    SunEditor editor)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • fixFontFamily

        protected java.lang.String fixFontFamily​(java.lang.String valueToRender)
        DIRTY HACK: Fixes the font-family declaration in the given HTML/CSS string by replacing any font name enclosed in `'...'` with its properly capitalized version.

        Example:

         Input:  font-family:'courier new'
         Output: font-family: Courier New
         
        Parameters:
        valueToRender - the input string containing font-family declarations
        Returns:
        the modified string with font names properly capitalized and single quotes replaced
        See Also:
        OWASP Bug #232
      • encodeScript

        protected void encodeScript​(javax.faces.context.FacesContext context,
                                    SunEditor editor)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getConvertedValue

        public java.lang.Object getConvertedValue​(javax.faces.context.FacesContext context,
                                                  javax.faces.component.UIComponent component,
                                                  java.lang.Object submittedValue)
        Overrides:
        getConvertedValue in class org.primefaces.renderkit.InputRenderer
      • sanitizeHtml

        protected java.lang.String sanitizeHtml​(javax.faces.context.FacesContext context,
                                                SunEditor editor,
                                                java.lang.String value)
        If security is enabled sanitize the HTML string to prevent XSS.
        Parameters:
        context - the FacesContext
        editor - the TextEditor instance
        value - the value to sanitize
        Returns:
        the sanitized value
      • capitalize

        public static java.lang.String capitalize​(java.lang.String name)
        Capitalizes the first character of the given string.
        Parameters:
        name - The string to capitalize.
        Returns:
        The capitalized string if the input is not blank; otherwise, returns the input string unchanged.