org.apache.myfaces.trinidad.context

## Class RenderingContext

- java.lang.Object
- - org.apache.myfaces.trinidad.context.RenderingContext

-     public abstract class RenderingContext
      extends Object

  The RenderingContext holds context information about the current rendering. The RenderingContext is useful for Renderers. The RenderingContext is passed in to the CoreRenderer. For example, a renderer may need to render differently if it is rendering to a browser in right-to-left mode, or if accessibility mode is on, etc. Some values are promoted up from RequestContext for ease of use while rendering.
  See Also:
    `CoreRenderer.encodeAll(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext, javax.faces.component.UIComponent, org.apache.myfaces.trinidad.bean.FacesBean)`, `RequestContext`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RenderingContext()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `attach()` Attaches an RenderingContext to the current thread.
    `abstract void` | `clearFormData()` Clear the FormData that is on the RenderingContext
    `abstract RequestContext.Accessibility` | `getAccessibilityMode()` Get the accessibility mode (e.g., DEFAULT, INACCESSIBLE, etc) that is attached to this RenderingContext
    `abstract AccessibilityProfile` | `getAccessibilityProfile()` Get the AccessibilityProfile (a set of accessibility-related properties that are applied to the current request, e.g., color contrast, font size, etc) that is attached to this RenderingContext.
    `abstract Agent` | `getAgent()` Get the Agent attached to the RenderingContext.
    `String` | `getCurrentClientId()` Get the current client id for this RenderingContext
    `static RenderingContext` | `getCurrentInstance()` Retrieves the RenderingContext active for the current thread.
    `javax.faces.context.FacesContext` | `getFacesContext()` Access to FacesContext.
    `abstract FormData` | `getFormData()` Get the FormData that is on the RenderingContext.
    `abstract Icon` | `getIcon(String iconName)` Get the Icon attached to this RenderingContext, give the iconName.
    `abstract LocaleContext` | `getLocaleContext()` Get the LocaleContext attached to the RenderingContext
    `abstract String` | `getOutputMode()` Returns the output mode for this RenderingContext.
    `abstract PartialPageContext` | `getPartialPageContext()` Get the ParialPageContext that is attached to this RenderingContext
    `abstract Map<Object,Object>` | `getProperties()` Get a map of properties specific to rendering.
    `RequestContext` | `getRequestContext()` Access to RequestContext
    `abstract Skin` | `getSkin()` Get the Skin that is attached to this RenderingContext.
    `abstract Map<String,String>` | `getSkinResourceKeyMap()` Get the skin resource key map that is attached to the RenderingContext.
    `abstract String` | `getStyleClass(String styleClass)` Get a styleClass given a styleClass.
    `Styles` | `getStyles()` Get the Styles object that is attached to this RenderingContext.
    `String` | `getTranslatedString(String key)` Get the translated String given a translation key.
    `abstract boolean` | `isAnimationEnabled()` Returns true or false for whether animation is enabled.
    `boolean` | `isDesignTime()` Returns true if the current request is a design-time request.
    `abstract boolean` | `isRightToLeft()` Returns a boolean to indicate whether or not the RenderingContext is in right-to-left reading direction mode.
    `void` | `release()`
    `void` | `setCurrentClientId(String currentClientId)` Set the current client id for this RenderingContext
    `abstract void` | `setFormData(FormData data)` Set FormData on the RenderingContext.
    `abstract void` | `setSkinResourceKeyMap(Map<String,String> mapping)` Set the skin resource key map on the RenderingContext.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RenderingContext

          public RenderingContext()

  - ### Method Detail

    - #### getCurrentInstance

          public static RenderingContext getCurrentInstance()

      Retrieves the RenderingContext active for the current thread.

    - #### getProperties

          public abstract Map<Object,Object> getProperties()

      Get a map of properties specific to rendering. You can then call the Map's put to save things on the RenderingContext for later retrieval.

    - #### getAgent

          public abstract Agent getAgent()

      Get the Agent attached to the RenderingContext.
      Returns:
        the Agent attached to the RenderingContext

    - #### getLocaleContext

          public abstract LocaleContext getLocaleContext()

      Get the LocaleContext attached to the RenderingContext
      Returns:
        the LocaleContext attached to the RenderingContext

    - #### getFormData

          public abstract FormData getFormData()

      Get the FormData that is on the RenderingContext. You can then add more form data once you have the FormData object. This is a way to render hidden fields form data.
      Returns:
        returns the FormData that is on the RenderingContext. This could return null if there is no FormData

    - #### setFormData

          public abstract void setFormData(FormData data)

      Set FormData on the RenderingContext. This is a way to render hidden fields form data. This is a cleaner way to handle form data than using the getProperties.put mechanism.
      Parameters:
        `data` -

    - #### clearFormData

          public abstract void clearFormData()

      Clear the FormData that is on the RenderingContext

    - #### getSkin

          public abstract Skin getSkin()

      Get the Skin that is attached to this RenderingContext. Icons, properties, etc. should never be retrieved directly from the skin, but always through the RenderingContext so they can be properly transformed.
      Returns:
        the Skin object attached to this RenderingContext

    - #### getTranslatedString

          public String getTranslatedString(String key)

      Get the translated String given a translation key. The default implementation gets the string from the Skin for the current LocaleContext that is used during this rendering.
      Parameters:
        `key` -
      Returns:
        the translated String attached to this RenderingContext

    - #### getIcon

          public abstract Icon getIcon(String iconName)

      Get the Icon attached to this RenderingContext, give the iconName. This could be the Icon that is on the Skin objec that is on the current RenderingContext.
      Parameters:
        `iconName,` - should not contain the '.' prefix or ':alias' suffix even though the selector name contained it
      Returns:
        the Icon attached to this RenderingContext

    - #### getStyleClass

          public abstract String getStyleClass(String styleClass)

      Get a styleClass given a styleClass. With other information that is on the RenderingContext, the styleClass may be transformed. For example, you might want to return a compressed styleclass given the full styleClass. e.g., getStyleClass("SomLongName") could return "x1" You should always run your styleClass through this method before rendering it out.
      Parameters:
        `styleClass` - the styleClass name that you want to render
      Returns:
        the StyleClass that may be the given styleClass transformed to be suitable for this rendering context.

    - #### getStyles

          public Styles getStyles()

      Get the Styles object that is attached to this RenderingContext. Styles is a useful object if you need to know the css properties for a given selector. (For backward compatibility this is not an abstract method.)
      Returns:
        Styles or null if there are no Styles.

    - #### setSkinResourceKeyMap

          public abstract void setSkinResourceKeyMap(Map<String,String> mapping)

      Set the skin resource key map on the RenderingContext. Store a Map that maps a skin's resource keys from one key to another on the RenderingContext. This way we can share Rendering code, but use unique skinning keys for the Renderer. For example, we can use tree's rendering code for treeTable, but we want to be sure to use tree skinning keys (aka selectors) for tree and treeTable skinning keys for the treeTable component. You can create a map of tree's selectors to treeTable's selectors, and then save off the current map (getSkinResourceKeyMap), set the new map, render using the tree's renderer code, then set back the original map.
      Parameters:
        `mapping` -
      See Also:
        `getSkinResourceKeyMap()`

    - #### getSkinResourceKeyMap

          public abstract Map<String,String> getSkinResourceKeyMap()

      Get the skin resource key map that is attached to the RenderingContext. This will usually be a Map of Skinning selectors. The key is the selector that the renderer code is rendering, and the value is the selector that that will be the actual selector to render. This facilitates sharing renderer code between components but render unique selectors for each component. The convention is to have each component have their own unique skinning selectors. Tree has af|tree selectors, treeTable has af|treeTable selectors, for example.
      Returns:
        a Map of selector to selector to faciliate renderer-code sharing.
      See Also:
        `setSkinResourceKeyMap(java.util.Map<java.lang.String, java.lang.String>)`

    - #### isRightToLeft

          public abstract boolean isRightToLeft()

      Returns a boolean to indicate whether or not the RenderingContext is in right-to-left reading direction mode. This can be true if the browser requesting rendering is set to a right-to-left language.
      Returns:
        true if right-to-left is true

    - #### getOutputMode

          public abstract String getOutputMode()

      Returns the output mode for this RenderingContext. Example output-modes are printable and portlet.
      Returns:
        the outputMode for this RenderingContext.

    - #### getAccessibilityMode

          public abstract RequestContext.Accessibility getAccessibilityMode()

      Get the accessibility mode (e.g., DEFAULT, INACCESSIBLE, etc) that is attached to this RenderingContext
      Returns:
        RequestContext.Accessibility enum attached to this RenderingContext

    - #### getAccessibilityProfile

          public abstract AccessibilityProfile getAccessibilityProfile()

      Get the AccessibilityProfile (a set of accessibility-related properties that are applied to the current request, e.g., color contrast, font size, etc) that is attached to this RenderingContext.
      Returns:
        AccessibilityProfile attached to this RenderingContext

    - #### isAnimationEnabled

          public abstract boolean isAnimationEnabled()

      Returns true or false for whether animation is enabled.
      Returns:
        true if animation is enabled for this RenderingContext

    - #### isDesignTime

          public boolean isDesignTime()

      Returns true if the current request is a design-time request.
      Returns:
        true if the current request is a design-time request.

    - #### getFacesContext

          public javax.faces.context.FacesContext getFacesContext()

      Access to FacesContext.

    - #### getRequestContext

          public RequestContext getRequestContext()

      Access to RequestContext

    - #### getCurrentClientId

          public String getCurrentClientId()

      Get the current client id for this RenderingContext
      Returns:

    - #### setCurrentClientId

          public void setCurrentClientId(String currentClientId)

      Set the current client id for this RenderingContext
      Parameters:
        `currentClientId` -

    - #### getPartialPageContext

          public abstract PartialPageContext getPartialPageContext()

      Get the ParialPageContext that is attached to this RenderingContext
      Returns:

    - #### release

          public void release()

    - #### attach

          protected void attach()

      Attaches an RenderingContext to the current thread. This method is protected, and therefore can only be called by an RenderingContext object itself.

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.