Class UIComponentWrapper

java.lang.Object
com.jk.web.faces.components.UIComponentWrapper

public class UIComponentWrapper extends Object
This class is a utility class for wrapping and working with Jakarta Server Faces (JSF) UIComponents.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Summary

    Constructors
    Constructor
    Description
    UIComponentWrapper(jakarta.faces.component.UIComponent componener)
    This method constructs a new UIComponentWrapper with the provided component.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAttribute(String key, Object value)
    This method adds an attribute value to the wrapped UIComponent if the attribute already exists.
    boolean
    getBooleanAttribute(String key, boolean defaultValue)
    This method retrieves a boolean attribute from the wrapped UIComponent with a default value.
    jakarta.faces.component.UIComponent
    This method retrieves the wrapped UI Component.
    void
    renderPassThruAttributes(jakarta.faces.context.FacesContext context)
    This method renders pass-through attributes of the wrapped UIComponent to the response.
    void
    setComponent(jakarta.faces.component.UIComponent component)
    This method sets the wrapped UI Component to the provided one.
    void
    writeAttribute(String key, Object defaultValue)
    This method writes an attribute to the response.
    void
    writeAttribute(String sourceKey, String targetKey, Object defaultValue)
    This method writes an attribute to the response, mapping it from a source key to a target key.
    void
    writerAttributes(jakarta.faces.context.FacesContext context, String style)
    This method writes various attributes to the response for rendering.

    Methods inherited from class java.lang.Object

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

    • UIComponentWrapper

      public UIComponentWrapper(jakarta.faces.component.UIComponent componener)
      This method constructs a new UIComponentWrapper with the provided component.
      Parameters:
      componener - Specifies the wrapped UIComponent.
  • Method Details

    • addAttribute

      public void addAttribute(String key, Object value)
      This method adds an attribute value to the wrapped UIComponent if the attribute already exists.
      Parameters:
      key - Specifies the name of the attribute to add.
      value - Specifies the value to set for the attribute.
    • getBooleanAttribute

      public boolean getBooleanAttribute(String key, boolean defaultValue)
      This method retrieves a boolean attribute from the wrapped UIComponent with a default value.
      Parameters:
      key - Specifies the name of the attribute to retrieve.
      defaultValue - Specifies the default value to return if the attribute is not found.
      Returns:
      the boolean attribute value.
    • getComponent

      public jakarta.faces.component.UIComponent getComponent()
      This method retrieves the wrapped UI Component.
      Returns:
      the wrapped UI Component.
    • renderPassThruAttributes

      public void renderPassThruAttributes(jakarta.faces.context.FacesContext context) throws IOException
      This method renders pass-through attributes of the wrapped UIComponent to the response.
      Parameters:
      context - Specifies the FacesContext for the current request.
      Throws:
      IOException - if an I/O exception has occurred.
    • setComponent

      public void setComponent(jakarta.faces.component.UIComponent component)
      This method sets the wrapped UI Component to the provided one.
      Parameters:
      component - Specifies the new wrapped UI Component.
    • writeAttribute

      public void writeAttribute(String key, Object defaultValue) throws IOException
      This method writes an attribute to the response.
      Parameters:
      key - Specifies the name of the attribute to write.
      defaultValue - Specifies the default value to use if the attribute is not set.
      Throws:
      IOException - if an I/O exception has occurred.
    • writeAttribute

      public void writeAttribute(String sourceKey, String targetKey, Object defaultValue) throws IOException
      This method writes an attribute to the response, mapping it from a source key to a target key.
      Parameters:
      sourceKey - Specifies the source key of the attribute.
      targetKey - Specifies the target key for writing the attribute.
      defaultValue - Specifies the default value to use if the attribute is not set.
      Throws:
      IOException - if an I/O exception has occurred.
    • writerAttributes

      public void writerAttributes(jakarta.faces.context.FacesContext context, String style) throws IOException
      This method writes various attributes to the response for rendering.
      Parameters:
      context - Specifies the FacesContext for the current request.
      style - Specifies the additional CSS style to apply.
      Throws:
      IOException - if an I/O exception has occurred.