You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2006/05/31 13:44:10 UTC
svn commit: r410499 - in
/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component:
ContextCallback.java UIComponent.java UIComponentBase.java
Author: matzew
Date: Wed May 31 04:44:09 2006
New Revision: 410499
URL: http://svn.apache.org/viewvc?rev=410499&view=rev
Log:
some JSF 1.2 stuff
Modified:
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/ContextCallback.java
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponent.java
myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/ContextCallback.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/ContextCallback.java?rev=410499&r1=410498&r2=410499&view=diff
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/ContextCallback.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/ContextCallback.java Wed May 31 04:44:09 2006
@@ -25,5 +25,10 @@
*/
public interface ContextCallback {
- public void invokeContextCallback(FacesContext context, UIComponent target);
+ /**
+ *
+ * @param context <code>FacesContext</code> for the current request
+ * @param target <code>UIComponent</code> on which the <code>UIComponent.invokeOnComponent()</code> will be called
+ */
+ void invokeContextCallback(FacesContext context, UIComponent target);
}
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponent.java?rev=410499&r1=410498&r2=410499&view=diff
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponent.java Wed May 31 04:44:09 2006
@@ -15,7 +15,11 @@
*/
package javax.faces.component;
+import java.util.Iterator;
+import java.util.List;
+
import javax.el.ValueExpression;
+import javax.faces.FacesException;
import javax.faces.event.AbortProcessingException;
/**
@@ -48,6 +52,46 @@
public abstract void setValueExpression(String name, ValueExpression binding);
+ /**
+ *
+ * @param context <code>FacesContext</code> for the current request
+ * @param clientId
+ * @param callback
+ * @return
+ * @throws javax.faces.FacesException
+ */
+ public boolean invokeOnComponent(javax.faces.context.FacesContext context, String clientId, javax.faces.component.ContextCallback callback) throws javax.faces.FacesException
+ {
+ //java.lang.NullPointerException - if any of the arguments are null
+ if(context == null || clientId == null || callback == null)
+ {
+ throw new NullPointerException();
+ }
+
+ //searching for this component?
+ boolean returnValue = this.getClientId(context).equals(clientId);
+ if(returnValue)
+ {
+ try
+ {
+ callback.invokeContextCallback(context, this);
+ } catch(Exception e)
+ {
+ throw new FacesException(e);
+ }
+ return returnValue;
+ }
+ //Searching for this component's children/facets
+ else
+ {
+ for (Iterator<UIComponent> it = this.getFacetsAndChildren(); !returnValue && it.hasNext();)
+ returnValue = it.next().invokeOnComponent(context, clientId, callback);
+ }
+
+ }
+ return returnValue;
+ }
+
public abstract java.lang.String getClientId(javax.faces.context.FacesContext context);
public abstract java.lang.String getFamily();
@@ -99,7 +143,39 @@
throws java.io.IOException;
public abstract void encodeEnd(javax.faces.context.FacesContext context)
- throws java.io.IOException;
+ throws java.io.IOException;
+
+ public void encodeAll(javax.faces.context.FacesContext context) throws java.io.IOException
+ {
+ if(context == null)
+ {
+ throw new NullPointerException();
+ }
+
+ if(isRendered())
+ {
+ this.encodeBegin(context);
+
+ //rendering children
+ if(this.getRendersChildren())
+ {
+ this.encodeChildren(context);
+ }
+ //let children render itself
+ else
+ {
+ List comps = this.getChildren();
+ for (Iterator<UIComponent> iter = comps.iterator(); iter.hasNext();)
+ {
+ iter.next().encodeAll(context);;
+ }
+ }
+
+ this.encodeEnd(context);
+ }
+ }
+
+
protected abstract void addFacesListener(javax.faces.event.FacesListener listener);
Modified: myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=410499&r1=410498&r2=410499&view=diff
==============================================================================
--- myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/UIComponentBase.java Wed May 31 04:44:09 2006
@@ -26,6 +26,7 @@
import javax.el.ValueExpression;
import javax.faces.FacesException;
+import javax.faces.FacesException;
import javax.faces.FactoryFinder;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
@@ -289,6 +290,14 @@
public String getId()
{
return _id;
+ }
+
+
+ /**
+ * <code>invokeOnComponent</code> must be implemented in <code>UIComponentBase</code> too...
+ */
+ public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException{
+ return super.invokeOnComponent(context, clientId, callback);
}
/**