myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: MYFACES-4272 [perf] avoid FormInfo instances
Date Wed, 05 Dec 2018 16:35:23 GMT
This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ccbd3f  MYFACES-4272 [perf] avoid FormInfo instances
8ccbd3f is described below

commit 8ccbd3ff83fa5e0b3c80625f5a9c767441b730d7
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Wed Dec 5 17:35:19 2018 +0100

    MYFACES-4272 [perf] avoid FormInfo instances
---
 .../apache/myfaces/renderkit/RendererUtils.java    | 12 +----
 .../renderkit/html/HtmlCommandScriptRenderer.java  |  7 ++-
 .../html/base/HtmlButtonRendererBase.java          | 55 ++++++++-----------
 .../html/base/HtmlInputFileRendererBase.java       | 10 ++--
 .../renderkit/html/base/HtmlLinkRendererBase.java  | 61 +++++++++-------------
 .../renderkit/html/base/HtmlRadioRendererBase.java |  9 ++--
 .../renderkit/html/base/HtmlRendererUtils.java     | 17 ++----
 .../myfaces/renderkit/html/util/FormInfo.java      | 43 ---------------
 8 files changed, 64 insertions(+), 150 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java b/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java
index 2823aea..d30b39c 100755
--- a/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java
@@ -51,7 +51,6 @@ import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import javax.faces.model.SelectItem;
 
-import org.apache.myfaces.renderkit.html.util.FormInfo;
 import org.apache.myfaces.util.ComponentUtils;
 import org.apache.myfaces.util.HashMapUtils;
 import org.apache.myfaces.renderkit.html.util.SelectItemsIterator;
@@ -875,7 +874,7 @@ public final class RendererUtils
      * @param facesContext
      * @return FormInfo Information about the form - the form itself and its name.
      */
-    public static FormInfo findNestingForm(UIComponent uiComponent,
+    public static UIComponent findNestingForm(UIComponent uiComponent,
             FacesContext facesContext)
     {
         UIComponent parent = uiComponent.getParent();
@@ -884,14 +883,7 @@ public final class RendererUtils
             parent = parent.getParent();
         }
 
-        if (parent != null)
-        {
-            //link is nested inside a form
-            String formName = parent.getClientId(facesContext);
-            return new FormInfo(parent, formName);
-        }
-
-        return null;
+        return parent;
     }
 
     public static boolean getBooleanValue(String attribute, Object value,
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlCommandScriptRenderer.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlCommandScriptRenderer.java
index d44ec06..abb1ef1 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlCommandScriptRenderer.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlCommandScriptRenderer.java
@@ -45,7 +45,6 @@ import org.apache.myfaces.renderkit.html.util.HTML;
 import org.apache.myfaces.renderkit.html.base.HtmlRenderer;
 import org.apache.myfaces.renderkit.html.base.HtmlRendererUtils;
 import org.apache.myfaces.renderkit.html.util.JavascriptContext;
-import org.apache.myfaces.renderkit.html.util.FormInfo;
 import org.apache.myfaces.renderkit.html.util.JavascriptUtils;
 import org.apache.myfaces.renderkit.html.util.ResourceUtils;
 import org.apache.myfaces.util.SharedStringBuilder;
@@ -180,12 +179,12 @@ public class HtmlCommandScriptRenderer extends HtmlRenderer
             if (component.getClientId(facesContext).equals(clientId))
             {
                 boolean disabled = HtmlRendererUtils.isDisabled(component);
-                FormInfo formInfo = RendererUtils.findNestingForm(component, facesContext);
+                UIComponent form = RendererUtils.findNestingForm(component, facesContext);
                 boolean activateActionEvent = false;
-                if (formInfo != null && !disabled)
+                if (form != null && !disabled)
                 {
                     String reqValue = (String) facesContext.getExternalContext().getRequestParameterMap().get(
-                            HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo, facesContext));
+                            HtmlRendererUtils.getHiddenCommandLinkFieldName(form, facesContext));
                     activateActionEvent = reqValue != null && reqValue.equals(clientId)
                         || HtmlRendererUtils.isPartialOrBehaviorSubmit(facesContext, clientId);
                 }
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlButtonRendererBase.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlButtonRendererBase.java
index 1b5839b..37311a2 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlButtonRendererBase.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlButtonRendererBase.java
@@ -41,7 +41,6 @@ import javax.faces.event.ActionEvent;
 import org.apache.myfaces.renderkit.ClientBehaviorEvents;
 import org.apache.myfaces.renderkit.html.util.JSFAttr;
 import org.apache.myfaces.renderkit.RendererUtils;
-import org.apache.myfaces.renderkit.html.util.FormInfo;
 import org.apache.myfaces.renderkit.html.util.JavascriptUtils;
 import org.apache.myfaces.renderkit.html.util.ResourceUtils;
 import org.apache.myfaces.renderkit.html.util.HTML;
@@ -88,13 +87,13 @@ public class HtmlButtonRendererBase
     {
         String clientId = uiComponent.getClientId(facesContext);
         Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
-        FormInfo formInfo = RendererUtils.findNestingForm(uiComponent, facesContext);
+        UIComponent form = RendererUtils.findNestingForm(uiComponent, facesContext);
         String hiddenLink = null;
          
-        if (formInfo != null)
+        if (form != null)
         {
             hiddenLink = (String) facesContext.getExternalContext().getRequestParameterMap().get(
-                HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo, facesContext));
+                HtmlRendererUtils.getHiddenCommandLinkFieldName(form, facesContext));
         }
         return paramMap.containsKey(clientId) || paramMap.containsKey(clientId + IMAGE_BUTTON_SUFFIX_X)

             || paramMap.containsKey(clientId + IMAGE_BUTTON_SUFFIX_Y)
@@ -113,7 +112,7 @@ public class HtmlButtonRendererBase
         ResponseWriter writer = facesContext.getResponseWriter();
         
         // commandButton does not need to be nested in a form since JSF 2.0
-        FormInfo formInfo = findNestingForm(uiComponent, facesContext);
+        UIComponent form = RendererUtils.findNestingForm(uiComponent, facesContext);
 
         boolean reset = isReset(uiComponent);
         boolean button = isButton(uiComponent);
@@ -180,7 +179,7 @@ public class HtmlButtonRendererBase
             if (!reset && !button)
             {
                 String onClick = buildBehaviorizedOnClick(
-                        uiComponent, behaviors, facesContext, writer, formInfo, validParams);
+                        uiComponent, behaviors, facesContext, writer, form, validParams);
                 if (onClick.length() != 0)
                 {
                     writer.writeAttribute(HTML.ONCLICK_ATTR, onClick, null);
@@ -277,11 +276,11 @@ public class HtmlButtonRendererBase
 
         writer.endElement(HTML.INPUT_ELEM);
         
-        FormInfo formInfo = findNestingForm(uiComponent, facesContext);
-        if (formInfo != null)
+        UIComponent form = RendererUtils.findNestingForm(uiComponent, facesContext);
+        if (form != null)
         {
             HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(
-                    formInfo.getForm(), facesContext, writer);
+                    form, facesContext, writer);
         }
         
         // render the UIParameter children of the commandButton (since 2.0)
@@ -299,7 +298,7 @@ public class HtmlButtonRendererBase
 
     protected String buildBehaviorizedOnClick(UIComponent uiComponent, Map<String, List<ClientBehavior>>
behaviors, 
                                               FacesContext facesContext, ResponseWriter writer,

-                                              FormInfo nestedFormInfo, List<UIParameter>
validParams)
+                                              UIComponent form, List<UIParameter> validParams)
         throws IOException
     {
         //we can omit autoscroll here for now maybe we should check if it is an ajax 
@@ -316,7 +315,7 @@ public class HtmlButtonRendererBase
 
         StringBuilder rendererOnClick = new StringBuilder();
 
-        if (nestedFormInfo != null) 
+        if (form != null) 
         {
             // There is no clean way to detect if a "submit" behavior has been added to the
component, 
             // so to keep things simple, if the button is submit type, it is responsibility
of the 
@@ -331,11 +330,11 @@ public class HtmlButtonRendererBase
             //}
             //else
             //{
-                String formName = nestedFormInfo.getFormName();
                 if (JavascriptUtils.isRenderClearJavascriptOnButton(facesContext.getExternalContext()))
                 {
                     //call the script to clear the form (clearFormHiddenParams_<formName>)
method
-                    HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(rendererOnClick,
formName);
+                    HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(rendererOnClick,
+                            form.getClientId(facesContext));
                 }
             //}
         }
@@ -351,20 +350,17 @@ public class HtmlButtonRendererBase
     }
     
     protected String buildServerOnclick(FacesContext facesContext, UIComponent component,

-            String clientId, FormInfo formInfo, List<UIParameter> validParams) throws
IOException
+            String clientId, UIComponent form, List<UIParameter> validParams) throws
IOException
     {
-        UIComponent nestingForm = formInfo.getForm();
-        String formName = formInfo.getFormName();
-
         StringBuilder onClick = new StringBuilder();
 
-        StringBuilder params = addChildParameters(facesContext, nestingForm, validParams);
+        StringBuilder params = addChildParameters(facesContext, form, validParams);
 
         String target = getTarget(component);
 
         onClick.append("return ").
             append(HtmlRendererUtils.SUBMIT_FORM_FN_NAME_JSF2).append("('").
-            append(formName).append("','").
+            append(form.getClientId(facesContext)).append("','").
             append(component.getClientId(facesContext)).append('\'');
 
         if (params.length() > 2 || target != null)
@@ -477,22 +473,19 @@ public class HtmlButtonRendererBase
             onClick.append("var oamSF = function(){");
         }
         
-        FormInfo nestedFormInfo = findNestingForm(uiComponent, facesContext);
+        UIComponent form = RendererUtils.findNestingForm(uiComponent, facesContext);
         
-        if (nestedFormInfo != null)
+        if (form != null)
         {
-            String formName = nestedFormInfo.getFormName();
-            
             if (validParams != null && !validParams.isEmpty() )
             {
-                StringBuilder params = addChildParameters(
-                        facesContext, nestedFormInfo.getForm(), validParams);
+                StringBuilder params = addChildParameters(facesContext, form, validParams);
 
                 String target = getTarget(uiComponent);
 
                 onClick.append("return ").
                     append(HtmlRendererUtils.SUBMIT_FORM_FN_NAME_JSF2).append("('").
-                    append(formName).append("','").
+                    append(form.getClientId(facesContext)).append("','").
                     append(uiComponent.getClientId(facesContext)).append('\'');
 
                 if (params.length() > 2 || target != null)
@@ -509,7 +502,8 @@ public class HtmlButtonRendererBase
                 if (JavascriptUtils.isRenderClearJavascriptOnButton(facesContext.getExternalContext()))
                 {
                     //call the script to clear the form (clearFormHiddenParams_<formName>)
method
-                    HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(onClick,
formName);
+                    HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(onClick,
+                            form.getClientId(facesContext));
                 }
             }
         }
@@ -524,13 +518,6 @@ public class HtmlButtonRendererBase
         return onClick;
     }
 
-    /**
-     * find nesting form
-     */
-    protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext)
-    {
-        return RendererUtils.findNestingForm(uiComponent, facesContext);
-    }
 
     protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent)
     {
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlInputFileRendererBase.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlInputFileRendererBase.java
index c05d3ab..d8155f4 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlInputFileRendererBase.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlInputFileRendererBase.java
@@ -44,7 +44,6 @@ import javax.faces.component.html.HtmlForm;
 import javax.faces.component.html.HtmlInputText;
 
 import org.apache.myfaces.renderkit.RendererUtils;
-import org.apache.myfaces.renderkit.html.util.FormInfo;
 import org.apache.myfaces.renderkit.html.util.HttpPartWrapper;
 import org.apache.myfaces.renderkit.html.util.HTML;
 import org.apache.myfaces.renderkit.html.util.JSFAttr;
@@ -97,12 +96,11 @@ public class HtmlInputFileRendererBase extends HtmlRenderer
              (facesContext.getPartialViewContext().isPartialRequest() ||
               facesContext.getPartialViewContext().isAjaxRequest()))
         {
-            FormInfo formInfo = RendererUtils.findNestingForm(component, facesContext);
-            if (formInfo != null && formInfo.getForm() instanceof HtmlForm)
+            UIComponent form = RendererUtils.findNestingForm(component, facesContext);
+            if (form != null && form instanceof HtmlForm)
             {
-                HtmlForm form = (HtmlForm) formInfo.getForm();
-                String content = form.getEnctype();
-                if (content==null || !content.contains("multipart/form-data"))
+                String content = ((HtmlForm) form).getEnctype();
+                if (content == null || !content.contains("multipart/form-data"))
                 {
                      FacesMessage message = new FacesMessage("file upload requires a form
with"+
                             " enctype equal to multipart/form-data");
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlLinkRendererBase.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlLinkRendererBase.java
index 7b24af3..e5e53e4 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlLinkRendererBase.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlLinkRendererBase.java
@@ -48,7 +48,6 @@ import org.apache.myfaces.config.MyfacesConfig;
 import org.apache.myfaces.renderkit.ClientBehaviorEvents;
 import org.apache.myfaces.renderkit.html.util.JSFAttr;
 import org.apache.myfaces.renderkit.RendererUtils;
-import org.apache.myfaces.renderkit.html.util.FormInfo;
 import org.apache.myfaces.renderkit.html.util.ResourceUtils;
 import org.apache.myfaces.renderkit.html.util.HTML;
 
@@ -59,6 +58,7 @@ public abstract class HtmlLinkRendererBase
     public static final String END_LINK_OUTCOME_AS_SPAN = 
         "oam.shared.HtmlLinkRendererBase.END_LINK_OUTCOME_AS_SPAN";
 
+    @Override
     public boolean getRendersChildren()
     {
         // We must be able to render the children without a surrounding anchor
@@ -66,6 +66,7 @@ public abstract class HtmlLinkRendererBase
         return true;
     }
 
+    @Override
     public void decode(FacesContext facesContext, UIComponent component)
     {
         super.decode(facesContext, component);  //check for NP
@@ -73,14 +74,14 @@ public abstract class HtmlLinkRendererBase
         if (component instanceof UICommand)
         {
             String clientId = component.getClientId(facesContext);
-            FormInfo formInfo = findNestingForm(component, facesContext);
+            UIComponent form = RendererUtils.findNestingForm(component, facesContext);
             boolean disabled = HtmlRendererUtils.isDisabled(component);
             // MYFACES-3960 Decode, decode client behavior and queue action event at the
end
             boolean activateActionEvent = false;
-            if (formInfo != null && !disabled)
+            if (form != null && !disabled)
             {
                 String reqValue = (String) facesContext.getExternalContext().getRequestParameterMap().get(
-                        HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo, facesContext));
+                        HtmlRendererUtils.getHiddenCommandLinkFieldName(form, facesContext));
                 activateActionEvent = reqValue != null && reqValue.equals(clientId)
                     || HtmlRendererUtils.isPartialOrBehaviorSubmit(facesContext, clientId);
             }
@@ -108,7 +109,7 @@ public abstract class HtmlLinkRendererBase
         }
     }
 
-
+    @Override
     public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException
     {
         super.encodeBegin(facesContext, component);  //check for NP
@@ -174,11 +175,13 @@ public abstract class HtmlLinkRendererBase
 
     }
 
+    @Override
     public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException
     {
         RendererUtils.renderChildren(facesContext, component);
     }
 
+    @Override
     public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
     {
         super.encodeEnd(facesContext, component);  //check for NP
@@ -187,12 +190,12 @@ public abstract class HtmlLinkRendererBase
         {
             renderCommandLinkEnd(facesContext, component);
 
-            FormInfo formInfo = findNestingForm(component, facesContext);
+            UIComponent form = RendererUtils.findNestingForm(component, facesContext);
             
-            if (formInfo != null)
+            if (form != null)
             {
                 HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(
-                        formInfo.getForm(), facesContext, facesContext.getResponseWriter());
+                        form, facesContext, facesContext.getResponseWriter());
             }
         }
         else if (component instanceof UIOutcomeTarget)
@@ -220,11 +223,11 @@ public abstract class HtmlLinkRendererBase
         Map<String, List<ClientBehavior>> behaviors = null;
 
         // h:commandLink can be rendered outside a form, but with warning (jsf 2.0 TCK)
-        FormInfo formInfo = findNestingForm(component, facesContext);
+        UIComponent form = RendererUtils.findNestingForm(component, facesContext);
         
         boolean disabled = HtmlRendererUtils.isDisabled(component);
         
-        if (disabled || formInfo == null)
+        if (disabled || form == null)
         {
             writer.startElement(HTML.SPAN_ELEM, component);
             if (component instanceof ClientBehaviorHolder)
@@ -334,7 +337,7 @@ public abstract class HtmlLinkRendererBase
             {
                 behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
                 renderBehaviorizedJavaScriptAnchorStart(
-                        facesContext, writer, component, clientId, behaviors, formInfo);
+                        facesContext, writer, component, clientId, behaviors, form);
                 if (!behaviors.isEmpty())
                 {
                     HtmlRendererUtils.writeIdAndName(writer, component, facesContext);
@@ -396,7 +399,7 @@ public abstract class HtmlLinkRendererBase
             }
             else
             {
-                renderJavaScriptAnchorStart(facesContext, writer, component, clientId, formInfo);
+                renderJavaScriptAnchorStart(facesContext, writer, component, clientId, form);
                 HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
                 if (isCommonPropertiesOptimizationEnabled(facesContext))
                 {
@@ -426,7 +429,7 @@ public abstract class HtmlLinkRendererBase
         }
         
         // render warning message for a h:commandLink with no nesting form
-        if (formInfo == null)
+        if (form == null)
         {
             writer.writeText(": This link is deactivated, because it is not embedded in a
JSF form.", null);
         }
@@ -436,12 +439,9 @@ public abstract class HtmlLinkRendererBase
                                                ResponseWriter writer,
                                                UIComponent component,
                                                String clientId,
-                                               FormInfo formInfo)
+                                               UIComponent form)
         throws IOException
     {
-        UIComponent nestingForm = formInfo.getForm();
-        String formName = formInfo.getFormName();
-
         StringBuilder onClick = new StringBuilder();
 
         String commandOnclick;
@@ -462,13 +462,13 @@ public abstract class HtmlLinkRendererBase
             onClick.append("var oamSF = function(){");
         }
 
-        StringBuilder params = addChildParameters(facesContext, component, nestingForm);
+        StringBuilder params = addChildParameters(facesContext, component, form);
 
         String target = getTarget(component);
 
         onClick.append("return ").
             append(HtmlRendererUtils.SUBMIT_FORM_FN_NAME_JSF2).append("('").
-            append(formName).append("','").
+            append(form.getClientId(facesContext)).append("','").
             append(clientId).append('\'');
 
         if (params.length() > 2 || target != null)
@@ -498,8 +498,7 @@ public abstract class HtmlLinkRendererBase
             UIComponent component,
             String clientId,
             Map<String, List<ClientBehavior>> behaviors,
-            FormInfo formInfo)
-    throws IOException
+            UIComponent formInfo) throws IOException
     {
         String commandOnclick;
         if (component instanceof HtmlCommandLink)
@@ -582,20 +581,17 @@ public abstract class HtmlLinkRendererBase
     }
 
     protected String buildServerOnclick(FacesContext facesContext, UIComponent component,

-            String clientId, FormInfo formInfo) throws IOException
+            String clientId, UIComponent form) throws IOException
     {
-        UIComponent nestingForm = formInfo.getForm();
-        String formName = formInfo.getFormName();
-
         StringBuilder onClick = new StringBuilder();
 
-        StringBuilder params = addChildParameters(facesContext, component, nestingForm);
+        StringBuilder params = addChildParameters(facesContext, component, form);
 
         String target = getTarget(component);
 
         onClick.append("return ").
             append(HtmlRendererUtils.SUBMIT_FORM_FN_NAME_JSF2).append("('").
-            append(formName).append("','").
+            append(form.getClientId(facesContext)).append("','").
             append(clientId).append('\'');
 
         if (params.length() > 2 || target != null)
@@ -701,13 +697,6 @@ public abstract class HtmlLinkRendererBase
         return params;
     }
 
-    /**
-     * find nesting form<p>
-     */
-    protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext)
-    {
-        return RendererUtils.findNestingForm(uiComponent, facesContext);
-    }
 
     private void addChildParametersToHref(FacesContext facesContext,
                                           UIComponent linkComponent,
@@ -1168,10 +1157,10 @@ public abstract class HtmlLinkRendererBase
     protected void renderCommandLinkEnd(FacesContext facesContext, UIComponent component)
             throws IOException
     {
-        FormInfo formInfo = findNestingForm(component, facesContext);
+        UIComponent form = RendererUtils.findNestingForm(component, facesContext);
         
         ResponseWriter writer = facesContext.getResponseWriter();
-        if (HtmlRendererUtils.isDisabled(component) || formInfo == null)
+        if (HtmlRendererUtils.isDisabled(component) || form == null)
         {
 
             writer.endElement(HTML.SPAN_ELEM);
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java
index 474d817..ccd786d 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java
@@ -50,7 +50,6 @@ import javax.faces.model.SelectItemGroup;
 
 import org.apache.myfaces.renderkit.html.util.JSFAttr;
 import org.apache.myfaces.renderkit.RendererUtils;
-import org.apache.myfaces.renderkit.html.util.FormInfo;
 import org.apache.myfaces.renderkit.html.util.ResourceUtils;
 import org.apache.myfaces.renderkit.html.util.HTML;
 import org.apache.myfaces.util.ComponentUtils;
@@ -143,9 +142,9 @@ public class HtmlRadioRendererBase
             else
             {
                 // Deferred case: find real component with attached selectItems
-                FormInfo formInfo = RendererUtils.findNestingForm(uiComponent, facesContext);
+                UIComponent form = RendererUtils.findNestingForm(uiComponent, facesContext);
                 GetSelectItemListCallback callback = new GetSelectItemListCallback(selectOne,
group);
-                formInfo.getForm().visitTree(
+                form.visitTree(
                         VisitContext.createVisitContext(facesContext, null, FIND_SELECT_LIST_HINTS),
                         callback);                
                 renderGroupOrItemRadio(facesContext, selectOne, callback.getSelectItem(),
@@ -410,8 +409,8 @@ public class HtmlRadioRendererBase
         String group = uiComponent instanceof HtmlSelectOneRadio ? ((HtmlSelectOneRadio)
uiComponent).getGroup() : null;
         if (group != null && !group.isEmpty())
         {
-            FormInfo formInfo = RendererUtils.findNestingForm(uiComponent, facesContext);
-            writer.writeAttribute(HTML.NAME_ATTR, formInfo.getFormName()+
+            UIComponent form = RendererUtils.findNestingForm(uiComponent, facesContext);
+            writer.writeAttribute(HTML.NAME_ATTR, form.getClientId(facesContext) +
                     facesContext.getNamingContainerSeparatorChar() + group, null);
         }
         else
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRendererUtils.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRendererUtils.java
index b881845..0fb054d 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRendererUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRendererUtils.java
@@ -66,7 +66,6 @@ import javax.faces.model.SelectItemGroup;
 import org.apache.myfaces.renderkit.ClientBehaviorEvents;
 import org.apache.myfaces.renderkit.html.util.JSFAttr;
 import org.apache.myfaces.renderkit.RendererUtils;
-import org.apache.myfaces.renderkit.html.util.FormInfo;
 import org.apache.myfaces.renderkit.html.util.HTMLEncoder;
 import org.apache.myfaces.renderkit.html.util.OutcomeTargetUtils;
 import org.apache.myfaces.util.ComponentUtils;
@@ -257,8 +256,8 @@ public final class HtmlRendererUtils
             String group = ((UISelectOne) component).getGroup();
             if (group != null && !group.isEmpty())
             {
-                FormInfo formInfo = RendererUtils.findNestingForm(component, facesContext);
-                String fullGroupId = formInfo.getFormName() +
+                UIComponent form = RendererUtils.findNestingForm(component, facesContext);
+                String fullGroupId = form.getClientId(facesContext) +
                         facesContext.getNamingContainerSeparatorChar() + group;
                 if (paramMap.containsKey(fullGroupId))
                 {
@@ -273,7 +272,7 @@ public final class HtmlRendererUtils
                                         submittedValue,
                                         component.getClientId(facesContext),
                                         component.getValueExpression("value") != null);
-                        formInfo.getForm().visitTree(
+                        form.visitTree(
                                 VisitContext.createVisitContext(facesContext, null, FIND_SELECT_LIST_HINTS),
callback);
                     }
                 }
@@ -1333,15 +1332,9 @@ public final class HtmlRendererUtils
      * both necessary and sufficient to determine the full name of the
      * field.</p>
      */
-    public static String getHiddenCommandLinkFieldName(FormInfo formInfo)
+    public static String getHiddenCommandLinkFieldName(UIComponent form, FacesContext facesContext)
     {
-        return formInfo.getFormName() + ':' + HIDDEN_COMMANDLINK_FIELD_NAME;
-    }
-    
-    public static String getHiddenCommandLinkFieldName(
-            FormInfo formInfo, FacesContext facesContext)
-    {
-        return formInfo.getFormName() + ':' + HIDDEN_COMMANDLINK_FIELD_NAME;
+        return form.getClientId(facesContext) + ':' + HIDDEN_COMMANDLINK_FIELD_NAME;
     }
 
     public static boolean isPartialOrBehaviorSubmit(FacesContext facesContext,
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/FormInfo.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/FormInfo.java
deleted file mode 100644
index ef85786..0000000
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/FormInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.renderkit.html.util;
-
-import javax.faces.component.UIComponent;
-
-public class FormInfo
-{
-    private final UIComponent form;
-    private final String formName;
-    
-    public FormInfo(final UIComponent form, final String formName)
-    {
-        this.form = form;
-        this.formName = formName;
-    }
-
-    public UIComponent getForm()
-    {
-        return form;
-    }
-
-    public String getFormName()
-    {
-        return formName;
-    }
-}


Mime
View raw message