You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "glynn leininiger (Jira)" <de...@myfaces.apache.org> on 2022/04/29 17:15:00 UTC
[jira] [Created] (MYFACES-4434) HtmlTextareaRendererBase, separate "begin tag" code from "end tag"
glynn leininiger created MYFACES-4434:
-----------------------------------------
Summary: HtmlTextareaRendererBase, separate "begin tag" code from "end tag"
Key: MYFACES-4434
URL: https://issues.apache.org/jira/browse/MYFACES-4434
Project: MyFaces Core
Issue Type: Improvement
Affects Versions: 2.3.9
Reporter: glynn leininiger
This ticket is very similar to MYFACES-4428 and MYFACES-4430 except it applies to HtmlTextareaRendererBase.
As with the others, we're trying to implement a few JSF components that extend from the generic JSF components/renderers. This particular component is extending javax.faces.component.html.HtmlTextareaRendererBase.
The problem is HtmlTextareaRendererBase does not have an encodeBegin() method, instead it does all of the "Start tag" encoding in the encodeEnd() method. This makes it impossible to create custom components that wrap the functionality of the default render kit.
I propose adding an `encodeBegin()` method that still calls `renderTextAreaBegin()`
```
@Override
public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
throws IOException
{
RendererUtils.checkParamValidity(facesContext, uiComponent, UIInput.class);
Map<String, List<ClientBehavior>> behaviors = null;
if (uiComponent instanceof ClientBehaviorHolder)
{
behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
if (!behaviors.isEmpty())
{
ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext,
facesContext.getResponseWriter());
}
}
renderTextAreaBegin(facesContext, uiComponent);
}
```
and then leaving `renderTextAreaValue()` and `renderTextAreaEnd()` in the encode end
```
@Override
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
throws IOException
{
renderTextAreaValue(facesContext, uiComponent);
renderTextAreaEnd(facesContext, uiComponent);
}
```
These changes will split the logic of encodeBegin and encodeEnd into separate methods and allow for the creation of custom components.
Im open to any feedback on this proposed change. Thanks!
h4.
Thanks
--
This message was sent by Atlassian Jira
(v8.20.7#820007)