encodeAll(): override to perform encoding of the component. Call encodeChild() or encodeAllChildren() to encode children where necessary.

getClientConstructor(): provide the name of the client-side object representing this renderer. HINT: if you do not have a client-side object, you should not be subclassing RichRenderer! Subclass the Trinidad CoreRenderer class, or the ordinary JSF Renderer class; these Renderers will work with the Rich Client.

A variety of other methods may be overridden to affect decoding or encoding behavior. This class extends the Trinidad CoreRenderer API, which contains a number of useful utility methods.

decodeUnknownKey(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, org.apache.myfaces.trinidad.bean.FacesBean bean, java.lang.String name, java.lang.Object value)
Called when a key whose name is not known to the FacesBean has been synchronized.

getClientId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, ClientComponent client)
A convenience method to return a clientId, taking advantage of the cached value in the ClientComponent if it is available.

static java.lang.Iterable<java.lang.String>

getClientIdsToDecode(javax.faces.context.FacesContext context)
Returns an Iterable that identifies any client IDs that need to be decoded on this request, but have not yet been.

getDefaultableCharProperty(org.apache.myfaces.trinidad.bean.FacesBean bean, org.apache.myfaces.trinidad.bean.PropertyKey key)
Convenience for retrieving a char froma a Character or CharSequence PropertyKey

protected int

getDefaultableIntProperty(org.apache.myfaces.trinidad.bean.FacesBean bean, org.apache.myfaces.trinidad.bean.PropertyKey key)
Convenience for retrieving an int from a Number PropertyKey

protected

<S> S

getDefaultableProperty(org.apache.myfaces.trinidad.bean.FacesBean bean, org.apache.myfaces.trinidad.bean.PropertyKey key)
Retrieves the value of the key in the bean, defaulting the value if the key isn't present

getRichRenderingContext(org.apache.myfaces.trinidad.context.RenderingContext rc)
Return the current RichRenderingContext.

protected java.util.List<java.lang.String>

getRootStateStyleClasses(javax.faces.context.FacesContext context, org.apache.myfaces.trinidad.context.RenderingContext arc, org.apache.myfaces.trinidad.bean.FacesBean bean)Deprecated.Use the getRootStateStyleClasses that also takes a UIComponent as a parameter. Also, if you upgrade your code to use the new API, make sure all your superclasses also use the new API. We currently call the old api from renderRootStyleAttributes (so people have time to migrate to the new API).

makeNonEmpty(javax.faces.context.FacesContext context)
Forces some non-visible content to be rendered to give the containing content *some* space.

protected boolean

needsExplicitId(javax.faces.context.FacesContext context, org.apache.myfaces.trinidad.context.RenderingContext rc, javax.faces.component.UIComponent component, org.apache.myfaces.trinidad.bean.FacesBean bean)
Returns true if the component has an explicitly set ID that should be rendered/sent to the client.

renderAllRootAttributes(javax.faces.context.FacesContext context, org.apache.myfaces.trinidad.context.RenderingContext arc, ClientComponent client, org.apache.myfaces.trinidad.bean.FacesBean bean)
This should be called once on the root dom element.

RichRenderer

initialize

Called by the Trinidad RendererFactory to initialize Renderers that NeedsPostConstructionInitialization. This allows the Renderer To defer calls to findTypeConstants until after the Renderer subclasses have been constructed.

isTabStop - If true, the icon is rendered as tab stop and it can accept focus. Otherwise the icon is not tab stop and cannot accept focus.

targetURL - target URL when clicked.

styleClasses - Used to render style class names for the icon. If your style class uses background-image to display the icon, its attributes should ensure proper sizing in IE and FireFox. See ".AFClickableImageAnchor_16x16" in rich components-simple-desktop.css for an alias you may be able to use.

id - the html DOM id of the icon.

tooltipString - the tooltip for this element.

iconName - the icon name of the application skinned icon. It's normally used if you want a text-only icon or a accessible icon instead of a background-image on the styleClass.

Called when a key whose name is not known to the FacesBean has been synchronized. Generally, this will be programmer error, so the default behavior is to log a warning. If overriding this method, always call super.decodeUnknownKey() if you have not handled the property.

Render the main renderer-specific attributes: "title", "class", "style", and all the Javascript attributes. Takes a boolean to determine if renderRootStyleAttributes should be called, which renders "class", "style"

Deprecated.Use the getRootStateStyleClasses that also takes a UIComponent as a parameter. Also, if you upgrade your code to use the new API, make sure all your superclasses also use the new API. We currently call the old api from renderRootStyleAttributes (so people have time to migrate to the new API).

getDefaultStyleClass

Override to return the default style class for this renderer. For proper skinnability, this will usually be a constant value; any state-based values should be delivered by getRootStateStyleClasses().

This value is used as the component selector in the skin to retrieve skin properties like -tr-enable-themes and -tr-children-theme. Returning a different value will prevent a component from being themed.

Encode the flattened components. This should only be called in between a UIXComponent.setUpEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext) and UIXComponent.tearDownEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext) on the component.

Encode the flattened components. This should only be called in between a UIXComponent.setUpEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext) and UIXComponent.tearDownEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext) on the component.

Delegate to a child Renderer building attributes into the child's ClientComponent.

Throws:

java.io.IOException

getClientConstructor

protected abstract java.lang.String getClientConstructor()

Hook to provide the name of the client-side object representing this renderer. HINT: if you do not have a client-side object, you should not be subclassing RichRenderer! Subclass the Trinidad CoreRenderer class, or the ordinary JSF Renderer class; these Renderers will work with the Rich Client.

getClientComponentType

Hook to identify the state-dependent type of the client component. The default behavior will return CREATE_WITH_ALL_ATTRS if clientComponent="true"; otherwise, it will return getDefaultClientComponentType().

Note that Components should never override the default value of clientComponent to be true, but should instead return CREATE_WITH_ATTRS from this function (which is the default behavior)

getDefaultableBooleanProperty

Convenience for retrieving a boolean from a Boolean PropertyKey. If the Boolean value isn't set, the default value of the PropertyKey is used. If no default value is specified, the backupDefault is returned.

Parameters:

bean - FacesBean to retrieve boolean value from

key - PropertyKey used to retrieve boolean value and provide the default value

backupDefault - Value to return if no value is specified and the PropertyKey has no default.

getCheckedUnsecurePropertyNames

Retrieves unsecure property from the bean, also checks that the unsecure key names don't contain properties that are always secure. We ignore properties that are never secure and let them pass back to the client. If it does, an IllegalArgumentException will be thrown.

Parameters:

bean - FacesBean instance

Returns:

the set of property names that is marked unsecure on this component instance.

Encodes the specified child including the additional styling to enable CSS stretching of the child. We use the CSS top/left/bottom/right properties to stretch the child to fill all of the parent's available space. We need to explicitly exclude the parent's padding - the caller must pass this in via the parentPadding value. For the moment, we assume that top/left/bottom/right padding are all the same. Note that on some browsers additional work must be performed on the client to fully implement stretching. See the client-side AdfAgent.prepareStretchedChild() and AdfAgent.resizeStretchedChild() APIs.

Prepares the FacesContext/ResponseWriter for encoding of a stretched child. Returns the ResponseWriter which is used to insert any stretching-related styles on the child content. All calls to encodeStretchedChildBegin() must be followed by a matching call to encodeStretchedChildEnd(). Important usage note: If you use encodeStretchedChildBegin() before writing an element and then subsequently you encode a child component that may be conditionally stretched, then you must ensure that the element written after you call this API has an explicit "style" attribute written to it by the ResponseWriter (even just a style with a value of "") or else the child component may render incorrectly because isNextElementToBeStretched() will return an invalid result.

Prepares the FacesContext/ResponseWriter for encoding of a stretched child. Returns the ResponseWriter which is used to insert any stretching-related styles on the child content. All calls to encodeStretchedChildBegin() must be followed by a matching call to encodeStretchedChildEnd().

encodeStretchedChildEnd

Completes the stretched child encoding which was initiated via a call to encodeStretchedChildBegin(). The ResponseWriter that was returned by encodeStretchedChildBegin must be passed into encodeStretchedChildEnd().

Throws:

java.io.IOException

isNextElementToBeStretched

Determines whether the next written element will have element stretching styles added to it. Important usage note: To guarantee safe use of this API, it must be invoked after starting the root element of your Renderer. In some cases it may be impossible to invoke this API after starting your root element because the result of this API is what determines what your root element needs to be. Some elements can never be stretched consistently across web browsers and some stretchable elements do not flow in a manner that is important for your component's design; you need to know which root element to use. In order for you to get an accurate result from this API prior to staring your root element, you are at the mercy of the Renderer of your parent component. The cases where this API could incorrectly return true is if that parent component's Renderer meets one of the following criteria: 1.) it is using RichRenderer.encodeStretchedChildBegin() on an element that surrounds your component, or 2.) it is only generating a root element (no other internal elements are rendered). Renderers that meet this criteria can guarantee that they play well with children components by simply ensuring that they write an explicit style to the ResponseWriter on the element that surrounds a child component (even just a style with a value of ""). This will notify the ResponseWriter that this parent element has consumed the stretched styles and resets the stretching state for the next component thus making this API return the correct value both before and immediately after that child component's root element has been started.

Parameters:

context - the FacesContext

Returns:

true if the next written element will have stretching styles added, false otherwise

isTabStop - If true, the icon is rendered as tab stop and it can accept focus. Otherwise the icon is not tab stop and cannot accept focus.

styleClasses - Used to render style class names for the icon. If your style class uses background-image to display the icon, its attributes should ensure proper sizing in IE and FireFox. See ".AFClickableImageAnchor_16x16" in rich components-simple-desktop.css for an alias you may be able to use.

id - the html DOM id of the icon.

tooltipTextBundleKey - the key for the translated string to be displayed as tooltip.

iconName - the icon name of the application skinned icon. It's normally used as text only icon. If a valid icon name is passed in, that icon will be displayed and background-image style in styleClasses will have no effect in UI.

Throws:

java.io.IOException

makeNonEmpty

Forces some non-visible content to be rendered to give the containing content *some* space. This method is intended for use by Renderers which generate an outer div which contains only absolutely positioned contents. This causes problems for IE when the width/height is 100%, since IE will not automatically stretch these contents. In particular, IE will not stretch these contents if they are inserted into the page via ppr, but instead only stretches such contents after the first browser resize event. Since we expect that clients will need to set width/height to 100% on geometry managing components such as panelStretchLayout and panelSplitter when embedding these inside showDetailItem, we need to make sure that these components produce some content. This can be assured by calling makeNonEmpty() somewhere after the root div is rendered.

Check if the component supports theming. If a component supports themeing, then theme HTML attributes are added to the HTML written by the renderer for this component when a style class is added to the output.

Note that this is not related to if a component changes the theme by pushing the current theme onto the RichRenderingContext.

Renders style classes with the current theme, if available. This method uses CoreRenderer.renderStyleClasses(FacesContext, RenderingContext, String[]) to render a style classes. If there is a current theme, it is appended to the array of style classes.

Renders a style class with the current theme, if available. This method uses CoreRenderer.renderStyleClass(FacesContext, RenderingContext, String) to render a style class. If there is a current theme, CoreRenderer.renderStyleClasses(FacesContext, RenderingContext, String[]) is used with the theme as the second style class in the array.