Author: nbelaevski
Date: 2009-07-07 08:32:38 -0400 (Tue, 07 Jul 2009)
New Revision: 14806
Added:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/EventValueExpression.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/RenderPhaseUIDataAdaptorVisitor.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
Log:
Reintegrated community/3.3.x into JSF 2.0 branch
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateHolder.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.ajax4jsf.application;
@@ -28,12 +45,12 @@
private static final long serialVersionUID = 6414488517358423537L;
private static final String STATE_HOLDER = AjaxStateHolder.class.getName();
- private final LRUMap<String,LRUMap<String, Object[]>> views;
+ private final LRUMap<String, LRUMap<String, StateReference>> views;
private final int numberOfViews;
private AjaxStateHolder(int capacity, int numberOfViews) {
- views = new LRUMap<String,LRUMap<String, Object[]>>(capacity);
+ views = new LRUMap<String, LRUMap<String, StateReference>>(capacity+1);
this.numberOfViews = numberOfViews;
}
@@ -44,67 +61,96 @@
}
ExternalContext externalContext = context.getExternalContext();
Object session = externalContext.getSession(true);
- Map<String,Object> sessionMap = externalContext.getSessionMap();
+ Map<String, Object> sessionMap = externalContext.getSessionMap();
if (_log.isDebugEnabled()) {
_log.debug("Request for a view states holder instance");
}
- StateHolder instance = null;
- synchronized (session) {
- instance = (StateHolder) sessionMap.get(STATE_HOLDER);
- if (null == instance) {
- // Create and store in session new state holder.
- int numbersOfViewsInSession = ContextInitParameters
- .getNumbersOfViewsInSession(context);
- int numbersOfLogicalViews = ContextInitParameters
- .getNumbersOfLogicalViews(context);
- if (_log.isDebugEnabled()) {
- _log
- .debug("No AjaxStateHolder instance in session, create new for hold "
- + numbersOfViewsInSession
- + " viewId and "
- + numbersOfLogicalViews
- + " logical views for each");
+ StateHolder instance = (StateHolder) sessionMap.get(STATE_HOLDER);
+ if (instance == null) {
+ synchronized (session) {
+ instance = (StateHolder) sessionMap.get(STATE_HOLDER);
+ if (null == instance) {
+ // Create and store in session new state holder.
+ int numbersOfViewsInSession = ContextInitParameters
+ .getNumbersOfViewsInSession(context);
+ int numbersOfLogicalViews = ContextInitParameters
+ .getNumbersOfLogicalViews(context);
+ if (_log.isDebugEnabled()) {
+ _log
+ .debug("No AjaxStateHolder instance in session, create new for hold "
+ + numbersOfViewsInSession
+ + " viewId and "
+ + numbersOfLogicalViews
+ + " logical views for each");
+ }
+ instance = new AjaxStateHolder(numbersOfViewsInSession,
+ numbersOfLogicalViews);
+ sessionMap.put(STATE_HOLDER, instance);
}
- instance = new AjaxStateHolder(numbersOfViewsInSession,
- numbersOfLogicalViews);
- sessionMap.put(STATE_HOLDER, instance);
}
}
+
return instance;
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.application.StateHolder#getState(java.lang.String,
java.lang.Object)
+ /**
+ * Updates instance of AjaxStateHolder saved in session in order
+ * to force replication in clustered environment
+ *
+ * @param context
*/
- public Object[] getState(String viewId, String sequence) {
+ protected void updateInstance(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+ Object session = externalContext.getSession(true);
+ Map<String, Object> sessionMap = externalContext.getSessionMap();
+
+ synchronized (session) {
+ sessionMap.put(STATE_HOLDER, this);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.application.StateHolder#getState(java.lang.String,
+ * java.lang.Object)
+ */
+ public Object[] getState(FacesContext context, String viewId, String sequence) {
if (null == viewId) {
throw new NullPointerException(
"viewId parameter for get saved view state is null");
}
Object state[] = null;
synchronized (views) {
- LRUMap<String,Object[]> viewVersions = views.get(viewId);
+ LRUMap<String, StateReference> viewVersions = views.get(viewId);
if (null != viewVersions) {
if (null != sequence) {
- state = viewVersions.get(sequence);
+ StateReference stateReference = viewVersions.get(sequence);
+ if (null != stateReference) {
+ state = stateReference.getState();
+ }
}
if (null == state) {
if (_log.isDebugEnabled()) {
- _log.debug("No saved view state for sequence "+sequence);
+ _log.debug("No saved view state for sequence "
+ + sequence);
}
-// state = viewVersions.getMostRecent();
+ // state = viewVersions.getMostRecent();
}
} else if (_log.isDebugEnabled()) {
- _log.debug("No saved view states for viewId "+viewId);
+ _log.debug("No saved view states for viewId " + viewId);
}
}
return state;
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.application.StateHolder#saveState(java.lang.String,
java.lang.Object, java.lang.Object)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.application.StateHolder#saveState(java.lang.String,
+ * java.lang.Object, java.lang.Object)
*/
- public void saveState(String viewId, String sequence, Object[] state) {
+ public void saveState(FacesContext context, String viewId, String sequence, Object[]
state) {
if (null == viewId) {
throw new NullPointerException(
"viewId parameter for save view state is null");
@@ -115,23 +161,37 @@
}
if (null != state) {
if (_log.isDebugEnabled()) {
- _log.debug("Save new viewState in session for viewId "+viewId+" and
sequence "+sequence);
+ _log.debug("Save new viewState in session for viewId " + viewId
+ + " and sequence " + sequence);
}
synchronized (views) {
- LRUMap<String,Object[]> viewVersions = views.get(viewId);
+ LRUMap<String, StateReference> viewVersions = views.get(viewId);
+ StateReference stateReference = null;
if (null == viewVersions) {
// TODO - make size parameter configurable
- viewVersions = new LRUMap<String,Object[]>(this.numberOfViews);
+ viewVersions = new LRUMap<String, StateReference>(
+ this.numberOfViews+1);
views.put(viewId, viewVersions);
+ stateReference = new StateReference(state);
+ viewVersions.put(sequence, stateReference);
+ } else {
+ stateReference = viewVersions.get(sequence);
+ if(null == stateReference){
+ stateReference = new StateReference(state);
+ viewVersions.put(sequence, stateReference);
+ } else {
+ stateReference.setState(state);
+ }
}
- viewVersions.put(sequence, state);
}
+ //serialization is synchronized in writeObject()
+ updateInstance(context);
}
}
-
+
private void writeObject(java.io.ObjectOutputStream stream)
- throws IOException {
+ throws IOException {
synchronized (views) {
stream.defaultWriteObject();
@@ -139,8 +199,29 @@
}
private void readObject(java.io.ObjectInputStream stream)
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException {
stream.defaultReadObject();
}
+
+ @SuppressWarnings("serial")
+ private static class StateReference implements Serializable {
+ private Object[] state;
+
+ public Object[] getState() {
+ return state;
+ }
+
+ public void setState(Object[] state) {
+ this.state = state;
+ }
+
+ /**
+ * @param state
+ */
+ public StateReference(Object[] state) {
+ super();
+ this.state = state;
+ }
+ }
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -39,7 +39,6 @@
import javax.faces.FacesException;
import javax.faces.FactoryFinder;
import javax.faces.application.StateManager;
-import javax.faces.application.StateManager.SerializedView;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
@@ -327,7 +326,22 @@
return matcher.group(1);
}
- private static final Object handleRestoreState(FacesContext context, Object state) {
+ private static final Map<String,Class<?>> PRIMITIVE_CLASSES =
+ new HashMap<String,Class<?>>(9, 1.0F);
+
+ static {
+ PRIMITIVE_CLASSES.put("boolean", boolean.class);
+ PRIMITIVE_CLASSES.put("byte", byte.class);
+ PRIMITIVE_CLASSES.put("char", char.class);
+ PRIMITIVE_CLASSES.put("short", short.class);
+ PRIMITIVE_CLASSES.put("int", int.class);
+ PRIMITIVE_CLASSES.put("long", long.class);
+ PRIMITIVE_CLASSES.put("float", float.class);
+ PRIMITIVE_CLASSES.put("double", double.class);
+ PRIMITIVE_CLASSES.put("void", void.class);
+ }
+
+ private static final Object handleRestoreState(FacesContext context, Object state) {
if (ContextInitParameters.isSerializeServerState(context)) {
ObjectInputStream ois = null;
try {
@@ -335,8 +349,18 @@
@Override
protected Class<?> resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException {
- return Class.forName(desc.getName(), true,
- Thread.currentThread().getContextClassLoader());
+ String name = desc.getName();
+ try {
+ return Class.forName(name, true,
+ Thread.currentThread().getContextClassLoader());
+ } catch (ClassNotFoundException cnfe) {
+ Class<?> clazz = PRIMITIVE_CLASSES.get(name);
+ if (clazz != null) {
+ return clazz;
+ } else {
+ throw cnfe;
+ }
+ }
}
};
return ois.readObject();
@@ -454,7 +478,12 @@
String viewId, String renderKitId) {
String id = restoreLogicalViewId(context, viewId, renderKitId);
StateHolder stateHolder = getStateHolder(context);
- Object[] restoredState = stateHolder.getState(viewId, id);
+ Object[] restoredState = stateHolder.getState(context, viewId, id);
+
+ if (restoredState != null && id != null) {
+ context.getExternalContext().getRequestMap().put(AJAX_VIEW_SEQUENCE, id);
+ }
+
return restoredState;
}
@@ -491,7 +520,7 @@
UIViewRoot viewRoot = context.getViewRoot();
StateHolder stateHolder = getStateHolder(context);
String id = getLogicalViewId(context);
- stateHolder.saveState(viewRoot.getViewId(), id, new Object[] {
+ stateHolder.saveState(context, viewRoot.getViewId(), id, new Object[] {
treeStructure, state });
serializedView = new Object[]{id, null};
return serializedView;
@@ -569,9 +598,6 @@
String id = (String) getRenderKit(context, renderKitId)
.getResponseStateManager().getTreeStructureToRestore(context,
viewId);
- if (null != id) {
- context.getExternalContext().getRequestMap().put(AJAX_VIEW_SEQUENCE, id);
- }
return id;
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/AjaxViewHandler.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -39,6 +39,7 @@
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.webapp.BaseFilter;
+import org.ajax4jsf.webapp.FilterServletResponseWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.event.RenderPhaseComponentListener;
@@ -128,27 +129,6 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see
org.ajax4jsf.framework.ViewHandlerWrapper#restoreView(javax.faces.context.FacesContext,
- * java.lang.String)
- */
-// public UIViewRoot restoreView(FacesContext context, String viewId) {
-// UIViewRoot viewRoot = super.restoreView(context, viewId);
-// ExternalContext externalContext = context.getExternalContext();
-// Map<String, Object> requestMap = externalContext.getRequestMap();
-// if (null == viewRoot) {
-// requestMap.put(VIEW_EXPIRED, Messages
-// .getMessage(Messages.AJAX_VIEW_EXPIRED));
-// if (_log.isDebugEnabled()) {
-// _log
-// .debug("Detect session expiration in AJAX request - view don't restored
for a viewId "
-// + viewId);
-// }
-// }
-// return viewRoot;
-// }
/*
* (non-Javadoc)
@@ -200,19 +180,25 @@
}
Map<String,Object> requestMap = context.getExternalContext().getRequestMap();
- if (null != requestMap.get(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE)) {
- if (!Boolean.TRUE.equals(requestMap.get(RESOURCES_PROCESSED))) {
- ViewResources viewResources = new ViewResources();
-
- viewResources.initialize(context);
- viewResources.processHeadResources(context);
-
- requestMap.put(AjaxContext.HEAD_EVENTS_PARAMETER, viewResources.getHeadEvents());
-
- // Mark as processed.
- requestMap.put(RESOURCES_PROCESSED, Boolean.TRUE);
+ FilterServletResponseWrapper filterServletResponseWrapper =
(FilterServletResponseWrapper)
+ requestMap.get(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE);
+ if (null != filterServletResponseWrapper) {
+ if (!filterServletResponseWrapper.isError()) {
+ if (!Boolean.TRUE.equals(requestMap.get(RESOURCES_PROCESSED))) {
+
+ ViewResources viewResources = new ViewResources();
+
+ viewResources.initialize(context);
+ viewResources.processHeadResources(context);
+
+ requestMap.put(AjaxContext.HEAD_EVENTS_PARAMETER, viewResources.getHeadEvents());
+
+ // Mark as processed.
+ requestMap.put(RESOURCES_PROCESSED, Boolean.TRUE);
+ }
}
+
// Save viewId for a parser selection
requestMap.put(AjaxViewHandler.VIEW_ID_KEY, context.getViewRoot().getViewId());
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoader.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.ajax4jsf.application;
import javax.faces.component.UIComponent;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/ComponentsLoaderImpl.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,81 +1,83 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.ajax4jsf.application;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-import org.apache.commons.collections.Transformer;
-import org.apache.commons.collections.map.LazyMap;
-
/**
* @author asmirnov
*
*/
-public class ComponentsLoaderImpl implements Transformer, ComponentsLoader {
+public class ComponentsLoaderImpl implements ComponentsLoader {
- private volatile Map classes;
+ private Map<String, Class<? extends UIComponent>> classes;
- private ClassLoader loader;
+ private ClassLoader loader;
- public ComponentsLoaderImpl() {
- classes = Collections.synchronizedMap(LazyMap.decorate(new HashMap(),
- this));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
org.ajax4jsf.portlet.application.ComponentsLoader#createComponent(java.lang.String)
- */
- public UIComponent createComponent(String type) {
- // Classes is a lazy Map, new object will be create on the fly.
- Class componentClass = (Class) classes.get(type);
- try {
- return (UIComponent) componentClass.newInstance();
- } catch (InstantiationException e) {
- throw new FacesException(
- "Error on create new instance of the component with class "
- + type, e);
- } catch (IllegalAccessException e) {
- throw new FacesException(
- "IllegalAccess on attempt to create new instance of the component with class
"
- + type, e);
+ public ComponentsLoaderImpl() {
+ classes = new ConcurrentHashMap<String, Class<? extends UIComponent>>(
+ 64);
+ loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null) {
+ loader = ComponentsLoaderImpl.class.getClassLoader();
+ }
}
- }
- public Object transform(Object input) {
- if (null == input) {
- throw new NullPointerException(
- "Name for a UIComponent class to restore is null");
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.ajax4jsf.portlet.application.ComponentsLoader#createComponent(java
+ * .lang.String)
+ */
+ public UIComponent createComponent(String type) {
+ // Classes is a lazy Map, new object will be create on the fly.
+ Class<? extends UIComponent> componentClass = classes.get(type);
+ if(null == componentClass){
+ try {
+ componentClass = loader.loadClass(type).asSubclass(UIComponent.class);
+ classes.put(type, componentClass);
+ } catch (ClassNotFoundException e) {
+ throw new FacesException("Can't load class " + type, e);
+ }
+
+ }
+ try {
+ return componentClass.newInstance();
+ } catch (InstantiationException e) {
+ throw new FacesException(
+ "Error on create new instance of the component with class "
+ + type, e);
+ } catch (IllegalAccessException e) {
+ throw new FacesException(
+ "IllegalAccess on attempt to create new instance of the component with class
"
+ + type, e);
+ }
}
- ClassLoader loader = getClassLoader();
- Class componentClass = null;
- try {
- componentClass = loader.loadClass(input.toString());
- } catch (ClassNotFoundException e) {
- throw new FacesException("Can't load class " + input.toString(), e);
- }
- return componentClass;
- }
- /**
- * lazy create ClassLoader instance.
- * @return
- */
- protected synchronized ClassLoader getClassLoader() {
- if (loader == null) {
- loader = Thread.currentThread().getContextClassLoader();
- if (loader == null) {
- loader = this.getClass().getClassLoader();
- }
-
+ ClassLoader getClassLoader() {
+ return loader;
}
- return loader;
- }
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/application/TreeStructureNode.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.ajax4jsf.application;
@@ -7,6 +24,7 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -20,17 +38,17 @@
/**
* @author asmirnov
- *
+ *
*/
final class TreeStructureNode implements Externalizable {
/**
* TODO - implement Externalizable to reduce serialized state.
*/
- private static final long serialVersionUID = -9038742487716977911L;
+ private static final long serialVersionUID = -9038742487716977912L;
private static final String NULL_ID = "";
- private Map<String, TreeStructureNode> facets = null;
+ private List<FacetEntry> facets = null;
private List<TreeStructureNode> children = null;
@@ -51,27 +69,30 @@
+ clientId);
}
Map<String, UIComponent> componentFacets = component.getFacets();
- for (Iterator<Entry<String,UIComponent>> i =
componentFacets.entrySet().iterator(); i
- .hasNext();) {
- Entry<String,UIComponent> element = i.next();
+ for (Iterator<Entry<String, UIComponent>> i = componentFacets
+ .entrySet().iterator(); i.hasNext();) {
+ Entry<String, UIComponent> element = i.next();
UIComponent f = element.getValue();
if (!f.isTransient()) {
TreeStructureNode facet = new TreeStructureNode();
facet.apply(context, f, uniqueIds);
if (null == facets) {
- facets = new HashMap<String, TreeStructureNode>();
+ facets = new ArrayList<FacetEntry>(componentFacets.size());
}
- facets.put(element.getKey(), facet);
+ facets.add(new FacetEntry(element.getKey(), facet));
}
}
- for (Iterator<UIComponent> i = component.getChildren().iterator(); i.hasNext();)
{
+ List<UIComponent> componentChildren = component.getChildren();
+ for (Iterator<UIComponent> i = componentChildren.iterator(); i
+ .hasNext();) {
UIComponent child = i.next();
if (!child.isTransient()) {
TreeStructureNode t = new TreeStructureNode();
t.apply(context, child, uniqueIds);
if (null == children) {
- children = new ArrayList<TreeStructureNode>();
+ children = new ArrayList<TreeStructureNode>(
+ componentChildren.size());
}
children.add(t);
@@ -84,16 +105,16 @@
component = loader.createComponent(type);
component.setId(id);
if (null != facets) {
- for (Iterator<Entry<String, TreeStructureNode>> i =
facets.entrySet().iterator(); i.hasNext();) {
- Entry<String, TreeStructureNode> element = i.next();
- UIComponent facet = ( element.getValue())
- .restore(loader);
- component.getFacets().put(element.getKey(), facet);
+ for (Iterator<FacetEntry> i = facets.iterator(); i.hasNext();) {
+ FacetEntry element = i.next();
+ UIComponent facet = (element.getNode()).restore(loader);
+ component.getFacets().put(element.getName(), facet);
}
}
if (null != children) {
- for (Iterator<TreeStructureNode> i = children.iterator(); i.hasNext();) {
+ for (Iterator<TreeStructureNode> i = children.iterator(); i
+ .hasNext();) {
TreeStructureNode node = i.next();
UIComponent child = node.restore(loader);
component.getChildren().add(child);
@@ -106,17 +127,10 @@
/**
* @return the facets
*/
- public Map<String, TreeStructureNode> getFacets() {
+ public List<FacetEntry> getFacets() {
return facets;
}
- /**
- * @param facets
- * the facets to set
- */
- public void setFacets(Map<String, TreeStructureNode> facets) {
- this.facets = facets;
- }
/**
* @return the children
@@ -125,13 +139,6 @@
return children;
}
- /**
- * @param children
- * the children to set
- */
- public void setChildren(List<TreeStructureNode> children) {
- this.children = children;
- }
/**
* @return the type
@@ -172,12 +179,12 @@
}
int facetsSize = in.readInt();
if (facetsSize > 0) {
- facets = new HashMap<String, TreeStructureNode>(facetsSize);
+ facets = new ArrayList<FacetEntry>(facetsSize);
for (int i = 0; i < facetsSize; i++) {
String facetName = in.readUTF();
TreeStructureNode facet = new TreeStructureNode();
facet.readExternal(in);
- facets.put(facetName, facet);
+ facets.add(new FacetEntry(facetName, facet));
}
}
int childrenSize = in.readInt();
@@ -196,10 +203,10 @@
out.writeUTF(null == id ? NULL_ID : id);
if (null != facets) {
out.writeInt(facets.size());
- for (Iterator<Map.Entry<String, TreeStructureNode>> i =
facets.entrySet().iterator(); i.hasNext();) {
- Map.Entry<String, TreeStructureNode> entry = i.next();
- out.writeUTF(entry.getKey());
- TreeStructureNode node = entry.getValue();
+ for (Iterator<FacetEntry> i = facets.iterator(); i.hasNext();) {
+ FacetEntry entry = i.next();
+ out.writeUTF(entry.getName());
+ TreeStructureNode node = entry.getNode();
node.writeExternal(out);
}
@@ -208,7 +215,8 @@
}
if (null != children) {
out.writeInt(children.size());
- for (Iterator<TreeStructureNode> i = children.iterator(); i.hasNext();) {
+ for (Iterator<TreeStructureNode> i = children.iterator(); i
+ .hasNext();) {
TreeStructureNode child = i.next();
child.writeExternal(out);
}
@@ -217,4 +225,40 @@
out.writeInt(0);
}
}
+
+ @SuppressWarnings("serial")
+ static final class FacetEntry implements Externalizable {
+ private String name;
+ private TreeStructureNode node;
+
+ public String getName() {
+ return name;
+ }
+
+ public TreeStructureNode getNode() {
+ return node;
+ }
+
+ /**
+ * @param name
+ * @param node
+ */
+ public FacetEntry(String name, TreeStructureNode node) {
+ super();
+ this.name = name;
+ this.node = node;
+ }
+
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.name = in.readUTF();
+ this.node = new TreeStructureNode();
+ this.node.readExternal(in);
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeUTF(name);
+ node.writeExternal(out);
+ }
+ }
}
\ No newline at end of file
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/CacheManager.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,3 +1,19 @@
+/*
+ * Copyright [yyyy] [name of copyright owner].
+ *
+ * Licensed 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.ajax4jsf.cache;
import java.io.BufferedReader;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -70,8 +70,6 @@
public static final String ROOT_ID = "_viewRoot";
- public static final String JS_NULL = "null";
-
private Lifecycle lifecycle;
private AjaxRegionBrige _brige;
@@ -217,9 +215,8 @@
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
String submittedRegionClientId = ajaxContext
.getSubmittedRegionClientId();
- // !submittedRegionClientId.equals(JS_NULL) - fix for myfaces 1.2.4
if (ajaxContext.isAjaxRequest() && submittedRegionClientId != null &&
- !submittedRegionClientId.equals(JS_NULL)
+ !submittedRegionClientId.equals(ROOT_ID)
&& !submittedRegionClientId.equals(getClientId(context))) {
invokeOnComponent(context, submittedRegionClientId, new
InvokerCallbackWrapper(callback));
} else {
@@ -526,7 +523,7 @@
}
}
processPhaseListeners(context, PhaseId.RENDER_RESPONSE, false);
- super.encodeEnd(context);
+// super.encodeEnd(context);
}
/*
* (non-Javadoc)
@@ -539,8 +536,8 @@
String submittedRegionClientId = ajaxContext
.getSubmittedRegionClientId();
boolean invoked = false;
- if (submittedRegionClientId != null &&
!submittedRegionClientId.equals(JS_NULL) &&
!submittedRegionClientId.equals(getClientId(context))) {
- invoked = invokeOnComponent(context, submittedRegionClientId, new
ContextCallbackWrapper(_ajaxInvoker));
+ if (submittedRegionClientId != null &&
!submittedRegionClientId.equals(ROOT_ID) &&
!submittedRegionClientId.equals(getClientId(context))) {
+ invoked = invokeOnComponent(context, submittedRegionClientId, _ajaxInvoker);
}
// if container not found, use Root for encode.
//
https://jira.jboss.org/jira/browse/RF-3975
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.ajax4jsf.component;
import java.util.ArrayList;
@@ -9,38 +29,31 @@
/**
* @author Anton Belevich
- *
+ *
*/
public class ContextCallbackWrapper implements ContextCallback {
-
- ContextCallback callback;
-
- public ContextCallbackWrapper(ContextCallback callback) {
- this.callback = callback;
- }
-
- public void invokeContextCallback(FacesContext context, UIComponent target) {
- if(isParentRendered(target)) {
- callback.invokeContextCallback(context, target);
+
+ ContextCallback callback;
+
+ public ContextCallbackWrapper(ContextCallback callback) {
+ this.callback = callback;
}
- }
-
- public boolean isParentRendered( UIComponent target) {
- List <UIComponent> componentsList = new ArrayList<UIComponent>();
- UIComponent component = target;
-
- while (component != null) {
- componentsList.add(component);
- component = component.getParent();
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ if (isParentRendered(target)) {
+ callback.invokeContextCallback(context, target);
+ }
}
-
- for (int i = componentsList.size() - 1; i >= 0; i--) {
- UIComponent processComponent = componentsList.get(i);
- if(!processComponent.isRendered()) {
- return false;
- }
+
+ public boolean isParentRendered(UIComponent target) {
+ UIComponent component = target;
+
+ while (component != null) {
+ if (!component.isRendered()) {
+ return false;
+ }
+ component = component.getParent();
+ }
+ return true;
}
-
- return true;
- }
}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/EventValueExpression.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/EventValueExpression.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/EventValueExpression.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.ajax4jsf.component;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.ajax4jsf.component;
Copied:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java
(from rev 14238,
trunk/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java)
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java
(rev 0)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/QueueRegistry.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -0,0 +1,88 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+package org.ajax4jsf.component;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class QueueRegistry {
+
+ private static final String REGISTRY_ATTRIBUTE_NAME = QueueRegistry.class.getName();
+
+ private boolean shouldCreateDefaultGlobalQueue = false;
+
+ private Map<String, Object> queuesData = new LinkedHashMap<String,
Object>();
+
+ private QueueRegistry() {
+ }
+
+ public static QueueRegistry getInstance(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+
+ QueueRegistry registry = (QueueRegistry)
+ requestMap.get(REGISTRY_ATTRIBUTE_NAME);
+
+ if (registry == null) {
+ registry = new QueueRegistry();
+ requestMap.put(REGISTRY_ATTRIBUTE_NAME, registry);
+ }
+
+ return registry;
+ }
+
+ public void registerQueue(FacesContext context, String clientName, Object data) {
+ if (!containsQueue(clientName)) {
+ queuesData.put(clientName, data);
+ } else {
+ context.getExternalContext().log("Queue with name '" + clientName +
"' has already been registered");
+ }
+ }
+
+ public boolean containsQueue(String name) {
+ return queuesData.containsKey(name);
+ }
+
+ public Map<String, Object> getRegisteredQueues(FacesContext context) {
+ return queuesData;
+ }
+
+ public void setShouldCreateDefaultGlobalQueue() {
+ this.shouldCreateDefaultGlobalQueue = true;
+ }
+
+ public boolean isShouldCreateDefaultGlobalQueue() {
+ return shouldCreateDefaultGlobalQueue;
+ }
+
+ public boolean hasQueuesToEncode() {
+ return shouldCreateDefaultGlobalQueue || !queuesData.isEmpty();
+ }
+}
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/RenderPhaseUIDataAdaptorVisitor.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/RenderPhaseUIDataAdaptorVisitor.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/RenderPhaseUIDataAdaptorVisitor.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.ajax4jsf.component;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/SequenceDataAdaptor.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.ajax4jsf.component;
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
---
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2009-07-07
12:28:28 UTC (rev 14805)
+++
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2009-07-07
12:32:38 UTC (rev 14806)
@@ -977,14 +977,12 @@
}
// continue hack
- Iterator<UIComponent> itr = c.getChildren().iterator();
- while (itr.hasNext()) {
- restoreChildState(faces, (UIComponent) itr.next(), childState);
- }
- itr = c.getFacets().values().iterator();
- while (itr.hasNext()) {
- restoreChildState(faces, (UIComponent) itr.next(), childState);
- }
+ for (UIComponent child : c.getChildren()) {
+ restoreChildState(faces, child, childState);
+ }
+ for (UIComponent facet : c.getFacets().values()) {
+ restoreChildState(faces, facet, childState);
+ }
}
/**
@@ -998,21 +996,6 @@
// For an any validation errors, children components state should be preserved
FacesMessage.Severity sev = context.getMaximumSeverity();
return (sev != null && (FacesMessage.SEVERITY_ERROR.compareTo(sev) >= 0));
-
-
-// Iterator<String> clientIds = this.getChildState(context).keySet().iterator();
-// while (clientIds.hasNext()) {
-// String clientId = clientIds.next();
-// Iterator<FacesMessage> messages = context.getMessages(clientId);
-// while (messages.hasNext()) {
-// FacesMessage message = messages.next();
-// if (message.getSeverity()
-// .compareTo(FacesMessage.SEVERITY_ERROR) >= 0) {
-// return (true);
-// }
-// }
-// }
-// return false;
}
/**
@@ -1056,8 +1039,7 @@
* @return segment containing row key or <code>null</code>
*/
protected String extractKeySegment(FacesContext context, String tailId) {
- int indexOfSecondColon = tailId.indexOf(
- NamingContainer.SEPARATOR_CHAR);
+ int indexOfSecondColon = tailId.indexOf(NamingContainer.SEPARATOR_CHAR);
return (indexOfSecondColon > 0 ? tailId.substring(0, indexOfSecondColon) : null);
}
@@ -1103,7 +1085,7 @@
}
}
} else {
- String baseId = baseClientId+NamingContainer.SEPARATOR_CHAR;
+ String baseId = baseClientId + NamingContainer.SEPARATOR_CHAR;
if (clientId.startsWith(baseId)) {
Object newRowKey = null;
// Call for a child component - try to detect row key
@@ -1135,8 +1117,8 @@
}
}
}
- //
- return found;
+
+ return found;
}
/**
@@ -1331,6 +1313,15 @@
}
+ protected void addAjaxKeyEvent(FacesEvent event) {
+ Object eventRowKey = getRowKey();
+ if (null != eventRowKey) {
+ this._ajaxRowKey = eventRowKey;
+ this._ajaxRowKeysMap.put(getBaseClientId(getFacesContext()),
+ eventRowKey);
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -1340,27 +1331,20 @@
if (event.getComponent() != this) {
// For Ajax events, keep row value.
if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
- Object eventRowKey = getRowKey();
- if (null != eventRowKey) {
- this._ajaxRowKey = eventRowKey;
- this._ajaxRowKeysMap.put(getBaseClientId(getFacesContext()),
- eventRowKey);
- }
+ addAjaxKeyEvent(event);
}
event = new IndexedEvent(this, event, getRowKey());
}
// Send event directly to parent, to avoid wrapping in superclass.
UIComponent parent = getParent();
if (parent == null) {
- throw new IllegalStateException(
- "No parent component for queue event");
+ throw new IllegalStateException("No parent component for queue event");
} else {
parent.queueEvent(event);
}
}
public void broadcast(FacesEvent event) throws AbortProcessingException {
-
if (!(event instanceof IndexedEvent)) {
if (!broadcastLocal(event)) {
super.broadcast(event);
@@ -1376,11 +1360,11 @@
Object eventRowKey = revent.getKey();
setRowKey(faces, eventRowKey);
FacesEvent rowEvent = revent.getTarget();
+
rowEvent.getComponent().broadcast(rowEvent);
+
setRowKey(faces, oldRowKey);
restoreOrigValue(faces);
- // }
- return;
}
/**