Class HtmlBasicRenderer

    • Constructor Detail

      • HtmlBasicRenderer

        public HtmlBasicRenderer()
    • Method Detail

      • convertClientId

        public String convertClientId​(FacesContext context,
                                      String clientId)
        Description copied from class: Renderer

        Convert the component generated client id to a form suitable for transmission to the client.

        The default implementation returns the argument clientId unchanged.

        Overrides:
        convertClientId in class Renderer
        Parameters:
        context - FacesContext for the current request
        clientId - the client identifier to be converted to client a specific format.
        Returns:
        the converted clientId
      • decode

        public void decode​(FacesContext context,
                           UIComponent component)
        Description copied from class: Renderer

        Decode any new state of the specified UIComponent from the request contained in the specified FacesContext, and store that state on the UIComponent.

        During decoding, events may be enqueued for later processing (by event listeners that have registered an interest), by calling queueEvent() on the associated UIComponent.

        Overrides:
        decode in class Renderer
        Parameters:
        context - FacesContext for the request we are processing
        component - UIComponent to be decoded.
      • encodeEnd

        public void encodeEnd​(FacesContext context,
                              UIComponent component)
                       throws IOException
        Description copied from class: Renderer

        Render the ending of the current state of the specified UIComponent, following the rules described for encodeBegin() to acquire the appropriate value to be rendered.

        Overrides:
        encodeEnd in class Renderer
        Parameters:
        context - FacesContext for the response we are creating
        component - UIComponent to be rendered
        Throws:
        IOException - if an input/output error occurs while rendering
      • getRendersChildren

        public boolean getRendersChildren()
        Description copied from class: Renderer

        Return a flag indicating whether this Renderer is responsible for rendering the children the component it is asked to render. The default implementation returns false.

        Overrides:
        getRendersChildren in class Renderer
        Returns:
        the current value of the flag
      • isBehaviorSource

        protected boolean isBehaviorSource​(FacesContext ctx,
                                           String behaviorSourceId,
                                           String componentClientId)
        Parameters:
        ctx - the FacesContext for the current request
        behaviorSourceId - the ID of the behavior source
        componentClientId - the client ID of the component being decoded
        Returns:
        true if the behavior source is for the component being decoded, otherwise false
      • augmentIdReference

        protected String augmentIdReference​(String forValue,
                                            UIComponent fromComponent)

        Conditionally augment an id-reference value.

        If the forValue doesn't already include a generated suffix, but the id of the fromComponent does include a generated suffix, then append the suffix from the fromComponent to the forValue. Otherwise just return the forValue as is.

        Parameters:
        forValue - - the basic id-reference value.
        fromComponent - - the component that holds the forValue.
        Returns:
        the (possibly augmented) forValue.
      • encodeRecursive

        protected void encodeRecursive​(FacesContext context,
                                       UIComponent component)
                                throws IOException

        Render nested child components by invoking the encode methods on those components, but only when the rendered property is true.

        Parameters:
        context - FacesContext for the current request
        component - the component to recursively encode
        Throws:
        IOException - if an error occurrs during the encode process
      • getChildren

        protected Iterator<UIComponent> getChildren​(UIComponent component)
        Parameters:
        component - UIComponent for which to extract children
        Returns:
        an Iterator over the children of the specified component, selecting only those that have a rendered property of true.
      • getCurrentValue

        protected String getCurrentValue​(FacesContext context,
                                         UIComponent component)
        Parameters:
        context - the FacesContext for the current request
        component - the UIComponent whose value we're interested in
        Returns:
        the value to be rendered and formats it if required. Sets to empty string if value is null.
      • getEndTextToRender

        protected void getEndTextToRender​(FacesContext context,
                                          UIComponent component,
                                          String currentValue)
                                   throws IOException
        Renderers override this method to write appropriate HTML content into the buffer.
        Parameters:
        context - the FacesContext for the current request
        component - the UIComponent of interest
        currentValue - component's current value
        Throws:
        IOException - if an error occurs rendering the text
      • getFacet

        protected UIComponent getFacet​(UIComponent component,
                                       String name)
        Parameters:
        component - Component from which to return a facet
        name - Name of the desired facet
        Returns:
        the specified facet from the specified component, but only if its rendered property is set to true.
      • getForComponent

        protected UIComponent getForComponent​(FacesContext context,
                                              String forComponent,
                                              UIComponent component)
        Locates the component identified by forComponent
        Parameters:
        context - the FacesContext for the current request
        forComponent - - the component to search for
        component - - the starting point in which to begin the search
        Returns:
        the component with the the id that matches forComponent otherwise null if no match is found.
      • getFormattedValue

        protected String getFormattedValue​(FacesContext context,
                                           UIComponent component,
                                           Object currentValue,
                                           Converter converter)
                                    throws ConverterException
        Overloads getFormattedValue to take a advantage of a previously obtained converter.
        Parameters:
        context - the FacesContext for the current request
        component - UIComponent of interest
        currentValue - the current value of component
        converter - the component's converter
        Returns:
        the currentValue after any associated Converter has been applied
        Throws:
        ConverterException - if the value cannot be converted
      • getFormattedValue

        protected String getFormattedValue​(FacesContext context,
                                           UIComponent component,
                                           Object currentValue)
                                    throws ConverterException
        Parameters:
        context - the FacesContext for the current request
        component - UIComponent of interest
        currentValue - the current value of component
        Returns:
        the currentValue after any associated Converter has been applied
        Throws:
        ConverterException - if the value cannot be converted
      • getParamList

        protected HtmlBasicRenderer.Param[] getParamList​(UIComponent command)
        Parameters:
        command - the command which may have parameters
        Returns:
        an array of parameters
      • getBehaviorParameters

        protected Collection<ClientBehaviorContext.Parameter> getBehaviorParameters​(UIComponent command)
        Collections parameters for use with Behavior script rendering. Similar to getParamList(), but returns a collection of ClientBehaviorContext.Parameter instances.
        Parameters:
        command - the command which may have parameters
        Returns:
        a collection of ClientBehaviorContext.Parameter instances.
      • setSubmittedValue

        protected void setSubmittedValue​(UIComponent component,
                                         Object value)
        Renderers override this method to store the previous value of the associated component.
        Parameters:
        component - the target component to which the submitted value will be set
        value - the value to set
      • shouldWriteIdAttribute

        protected boolean shouldWriteIdAttribute​(UIComponent component)
        Parameters:
        component - the component of interest
        Returns:
        true if this renderer should render an id attribute.
      • shouldEncode

        protected boolean shouldEncode​(UIComponent component)
      • shouldDecode

        protected boolean shouldDecode​(UIComponent component)
      • shouldEncodeChildren

        protected boolean shouldEncodeChildren​(UIComponent component)
      • getPassThruBehaviors

        protected static Map<String,​List<ClientBehavior>> getPassThruBehaviors​(UIComponent component,
                                                                                     String domEventName,
                                                                                     String componentEventName)
        When rendering pass thru attributes, we need to take any attached Behaviors into account. The presence of a non-empty Behaviors map can cause us to switch from optimized pass thru attribute rendering to the unoptimized code path. However, in two very common cases - attaching action behaviors to commands and attaching value change behaviors to editable value holders - the behaviors map is populated with behaviors that are not handled by the pass thru attribute code - ie. the behaviors are handled locally by the renderer. In order to optimize such cases, we check to see whether the component's behaviors map actually contains behaviors only for these non-pass thru attributes. If so, we can pass a null behavior map into renderPassThruAttributes(), thus ensuring that we can take advantage of the optimized pass thru rendering logic. Note that in all cases where we use this method, we actually have two behavior events that we want to check for - a low-level/dom event (eg. "click", or "change") plus a high-level component event (eg. "action", or "valueChange").
        Parameters:
        component - the component that we are rendering
        domEventName - the name of the dom-level event
        componentEventName - the name of the component-level event