You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2006/10/11 08:38:18 UTC
svn commit: r462712 -
/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/submitOnEvent/SubmitOnEventRenderer.java
Author: imario
Date: Tue Oct 10 23:38:17 2006
New Revision: 462712
URL: http://svn.apache.org/viewvc?view=rev&rev=462712
Log:
do not render if our input component we are attaced to is not rendered too
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/submitOnEvent/SubmitOnEventRenderer.java
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/submitOnEvent/SubmitOnEventRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/submitOnEvent/SubmitOnEventRenderer.java?view=diff&rev=462712&r1=462711&r2=462712
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/submitOnEvent/SubmitOnEventRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/submitOnEvent/SubmitOnEventRenderer.java Tue Oct 10 23:38:17 2006
@@ -38,15 +38,11 @@
{
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
- AddResourceFactory.getInstance(facesContext).addJavaScriptAtPosition(
- facesContext, AddResource.HEADER_BEGIN, SubmitOnEventRenderer.class,
- "submitOnEvent.js");
-
SubmitOnEvent submitOnEvent = (SubmitOnEvent) uiComponent;
UIComponent forComponent = null;
- UIComponent triggerComponent = null;
+ UIComponent triggerComponent = null;
UIComponent parent = uiComponent.getParent();
if (parent != null)
{
@@ -60,7 +56,13 @@
}
}
- if (forComponent == null)
+ if (triggerComponent != null && !triggerComponent.isRendered())
+ {
+ // the component we are attaced to is not being rendered, so we can quit now ...
+ return;
+ }
+
+ if (forComponent == null)
{
String forComponentId = submitOnEvent.getFor();
if (forComponentId == null)
@@ -74,6 +76,10 @@
throw new IllegalArgumentException("SubmitOnEvent: can't find 'for'-component '" + forComponentId + "'");
}
}
+
+ AddResourceFactory.getInstance(facesContext).addJavaScriptAtPosition(
+ facesContext, AddResource.HEADER_BEGIN, SubmitOnEventRenderer.class,
+ "submitOnEvent.js");
StringBuffer js = new StringBuffer(80);
js.append("setTimeout(\"");