You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2018/05/08 12:48:26 UTC
[myfaces] 23/28: merge revisions 1410540, 1410553, 1410652, 1412781,
1412831, 1412932, 1417719, 1418586, 1418589 from trunk
This is an automated email from the ASF dual-hosted git repository.
deki pushed a commit to branch 2.1.x-client-window
in repository https://gitbox.apache.org/repos/asf/myfaces.git
commit d584bff3f254e4ca2e738e6df8533bbb06157df0
Merge: a3cd8db ba4906a
Author: Leonardo Uribe <lu...@apache.org>
AuthorDate: Wed Dec 12 20:02:51 2012 +0000
merge revisions 1410540,1410553,1410652,1412781,1412831,1412932,1417719,1418586,1418589 from trunk
.../java/javax/faces/component/UIViewRoot.java | 48 ++-
.../javax/faces/component/_ViewAttributeMap.java | 181 ++++++++++++
.../META-INF/resources/myfaces/_impl/_util/_Dom.js | 285 ++++++++++++++++--
.../myfaces/_impl/xhrCore/_AjaxResponse.js | 2 +-
impl/pom.xml | 16 -
.../myfaces/application/ApplicationImpl.java | 61 ++++
.../myfaces/application/ResourceHandlerImpl.java | 33 ++-
.../application/viewstate/CounterKeyFactory.java | 2 +-
.../CounterSessionViewStorageFactory.java | 6 +-
.../myfaces/application/viewstate/KeyFactory.java | 15 +-
.../application/viewstate/RandomKeyFactory.java | 6 +-
.../viewstate/RandomSessionViewStorageFactory.java | 6 +-
.../viewstate/ReferenceSerializedViewKey.java | 78 -----
.../viewstate/SecureRandomKeyFactory.java | 6 +-
.../viewstate/ServerSideStateCacheImpl.java | 6 +-
.../application/viewstate/SessionIdGenerator.java | 5 +-
.../viewstate/SessionViewStorageFactory.java | 12 +-
.../renderkit/html/HtmlResponseStateManager.java | 3 -
.../DefaultFaceletsStateManagementStrategy.java | 298 ++++++++++---------
.../tag/jsf/ComponentTagHandlerDelegate.java | 14 +
.../mc/test/core/AbstractMyFacesTestCase.java | 329 ++++++++++++++++++++-
.../pss/acid/AcidMyFacesRequestTestCase.java | 90 ++++++
.../facelets/pss/acid/component/UIRDComponent.java | 35 +++
.../pss/acid/managed/ComponentBindingBean.java | 75 +++++
.../pss/acid/managed/ResourceDependencyBean.java} | 42 ++-
.../pss/acid/WEB-INF/testcomponent.taglib.xml | 7 +
.../view/facelets/pss/acid/componentBinding1.xhtml | 28 ++
.../facelets/pss/acid/resourceDependency1.xhtml | 31 ++
.../view/facelets/pss/acid/resources/custom.css | 15 +
implee6/pom.xml | 93 ------
.../myfaces/ee6/MyFacesContainerInitializer.java | 288 ------------------
.../javax.servlet.ServletContainerInitializer | 1 -
parent/pom.xml | 13 +-
shaded-impl/pom.xml | 298 -------------------
34 files changed, 1406 insertions(+), 1022 deletions(-)
diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
index f946b19,c1f35eb..e12cdc0
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
@@@ -334,137 -344,135 +344,9 @@@ public class DefaultFaceletsStateManage
{
view.getAttributes().put(ComponentSupport.FACELET_STATE_INSTANCE, faceletViewState);
}
--
-- // TODO: handle dynamic add/removes as mandated by the spec. Not sure how to do handle this yet.
-- List<String> clientIdsRemoved = getClientIdsRemoved(view);
--
-- if (clientIdsRemoved != null)
-- {
-- Set<String> idsRemovedSet = new HashSet<String>(HashMapUtils.calcCapacity(clientIdsRemoved.size()));
-- context.getAttributes().put(FaceletViewDeclarationLanguage.REMOVING_COMPONENTS_BUILD, Boolean.TRUE);
-- try
-- {
-- // perf: clientIds are ArrayList: see method registerOnAddRemoveList(String)
-- for (int i = 0, size = clientIdsRemoved.size(); i < size; i++)
-- {
-- String clientId = clientIdsRemoved.get(i);
-- if (!idsRemovedSet.contains(clientId))
-- {
-- view.invokeOnComponent(context, clientId, new ContextCallback()
-- {
-- public void invokeContextCallback(FacesContext context,
-- UIComponent target)
-- {
-- if (target.getParent() != null)
-- {
-- if (!target.getParent().getChildren().remove(target))
-- {
-- String key = null;
-- if (target.getParent().getFacetCount() > 0)
-- {
-- for (Map.Entry<String, UIComponent> entry :
-- target.getParent().getFacets().entrySet())
-- {
-- if (entry.getValue()==target)
-- {
-- key = entry.getKey();
-- break;
-- }
-- }
-- }
-- if (key != null)
-- {
-- target.getParent().getFacets().remove(key);
-- }
-- }
-- }
-- }
-- });
-- idsRemovedSet.add(clientId);
-- }
-- }
-- clientIdsRemoved.clear();
-- clientIdsRemoved.addAll(idsRemovedSet);
-- }
-- finally
-- {
-- context.getAttributes().remove(FaceletViewDeclarationLanguage.REMOVING_COMPONENTS_BUILD);
-- }
-- }
-
-- List<String> clientIdsAdded = getClientIdsAdded(view);
-- if (clientIdsAdded != null)
-- {
-- Set<String> idsAddedSet = new HashSet<String>(HashMapUtils.calcCapacity(clientIdsAdded.size()));
-- // perf: clientIds are ArrayList: see method setClientsIdsAdded(String)
-- for (int i = 0, size = clientIdsAdded.size(); i < size; i++)
-- {
-- String clientId = clientIdsAdded.get(i);
-- if (!idsAddedSet.contains(clientId))
-- {
-- final AttachedFullStateWrapper wrapper = (AttachedFullStateWrapper) states.get(clientId);
-- if (wrapper != null)
-- {
-- final Object[] addedState = (Object[]) wrapper.getWrappedStateObject();
-- if (addedState != null)
-- {
-- if (addedState.length == 2)
-- {
-- view = (UIViewRoot)
-- internalRestoreTreeStructure((TreeStructComponent) addedState[0]);
-- view.processRestoreState(context, addedState[1]);
-- break;
-- }
-- else
-- {
-- final String parentClientId = (String) addedState[0];
-- view.invokeOnComponent(context, parentClientId, new ContextCallback()
-- {
-- public void invokeContextCallback(FacesContext context,
-- UIComponent target)
-- {
-- if (addedState[1] != null)
-- {
-- String facetName = (String) addedState[1];
-- UIComponent child
-- = internalRestoreTreeStructure((TreeStructComponent)
-- addedState[3]);
-- child.processRestoreState(context, addedState[4]);
-- target.getFacets().put(facetName,child);
-- }
-- else
-- {
-- Integer childIndex = (Integer) addedState[2];
-- UIComponent child
-- = internalRestoreTreeStructure((TreeStructComponent)
-- addedState[3]);
-- child.processRestoreState(context, addedState[4]);
-- try
-- {
-- target.getChildren().add(childIndex, child);
-- }
-- catch (IndexOutOfBoundsException e)
-- {
-- // We can't be sure about where should be this
-- // item, so just add it.
-- target.getChildren().add(child);
-- }
-- }
-- }
-- });
-- }
-- }
-- }
-- idsAddedSet.add(clientId);
-- }
-- }
-- // Reset this list, because it will be calculated later when the view is being saved
-- // in the right order, preventing duplicates (see COMPONENT_ADDED_AFTER_BUILD_VIEW for details).
-- clientIdsAdded.clear();
-- }
++ handleDynamicAddedRemovedComponents(context, view, states);
}
}
-
// Restore binding, because UIViewRoot.processRestoreState() is never called
//the event processing has to be enabled because of the restore view event triggers
//TODO ask the EG the this is a spec violation if we do it that way
@@@ -487,6 -495,6 +369,146 @@@
return view;
}
++ public void handleDynamicAddedRemovedComponents(FacesContext context, UIViewRoot view, Map<String, Object> states)
++ {
++ List<String> clientIdsRemoved = getClientIdsRemoved(view);
++
++ if (clientIdsRemoved != null)
++ {
++ Set<String> idsRemovedSet = new HashSet<String>(HashMapUtils.calcCapacity(clientIdsRemoved.size()));
++ context.getAttributes().put(FaceletViewDeclarationLanguage.REMOVING_COMPONENTS_BUILD, Boolean.TRUE);
++ try
++ {
++ // perf: clientIds are ArrayList: see method registerOnAddRemoveList(String)
++ for (int i = 0, size = clientIdsRemoved.size(); i < size; i++)
++ {
++ String clientId = clientIdsRemoved.get(i);
++ if (!idsRemovedSet.contains(clientId))
++ {
++ view.invokeOnComponent(context, clientId, new RemoveComponentCallback());
++ idsRemovedSet.add(clientId);
++ }
++ }
++ clientIdsRemoved.clear();
++ clientIdsRemoved.addAll(idsRemovedSet);
++ }
++ finally
++ {
++ context.getAttributes().remove(FaceletViewDeclarationLanguage.REMOVING_COMPONENTS_BUILD);
++ }
++ }
++ List<String> clientIdsAdded = getClientIdsAdded(view);
++ if (clientIdsAdded != null)
++ {
++ Set<String> idsAddedSet = new HashSet<String>(HashMapUtils.calcCapacity(clientIdsAdded.size()));
++ // perf: clientIds are ArrayList: see method setClientsIdsAdded(String)
++ for (int i = 0, size = clientIdsAdded.size(); i < size; i++)
++ {
++ String clientId = clientIdsAdded.get(i);
++ if (!idsAddedSet.contains(clientId))
++ {
++ final AttachedFullStateWrapper wrapper = (AttachedFullStateWrapper) states.get(clientId);
++ if (wrapper != null)
++ {
++ final Object[] addedState = (Object[]) wrapper.getWrappedStateObject();
++ if (addedState != null)
++ {
++ if (addedState.length == 2)
++ {
++ view = (UIViewRoot)
++ internalRestoreTreeStructure((TreeStructComponent) addedState[0]);
++ view.processRestoreState(context, addedState[1]);
++ break;
++ }
++ else
++ {
++ final String parentClientId = (String) addedState[0];
++ view.invokeOnComponent(context, parentClientId,
++ new AddComponentCallback(addedState));
++ }
++ }
++ }
++ idsAddedSet.add(clientId);
++ }
++ }
++ // Reset this list, because it will be calculated later when the view is being saved
++ // in the right order, preventing duplicates (see COMPONENT_ADDED_AFTER_BUILD_VIEW for details).
++ clientIdsAdded.clear();
++ }
++ }
++
++ public static class RemoveComponentCallback implements ContextCallback
++ {
++ public void invokeContextCallback(FacesContext context,
++ UIComponent target)
++ {
++ if (target.getParent() != null)
++ {
++ if (!target.getParent().getChildren().remove(target))
++ {
++ String key = null;
++ if (target.getParent().getFacetCount() > 0)
++ {
++ for (Map.Entry<String, UIComponent> entry :
++ target.getParent().getFacets().entrySet())
++ {
++ if (entry.getValue()==target)
++ {
++ key = entry.getKey();
++ break;
++ }
++ }
++ }
++ if (key != null)
++ {
++ target.getParent().getFacets().remove(key);
++ }
++ }
++ }
++ }
++ }
++
++ public static class AddComponentCallback implements ContextCallback
++ {
++ private final Object[] addedState;
++
++ public AddComponentCallback(Object[] addedState)
++ {
++ this.addedState = addedState;
++ }
++
++ public void invokeContextCallback(FacesContext context,
++ UIComponent target)
++ {
++ if (addedState[1] != null)
++ {
++ String facetName = (String) addedState[1];
++ UIComponent child
++ = internalRestoreTreeStructure((TreeStructComponent)
++ addedState[3]);
++ child.processRestoreState(context, addedState[4]);
++ target.getFacets().put(facetName,child);
++ }
++ else
++ {
++ Integer childIndex = (Integer) addedState[2];
++ UIComponent child
++ = internalRestoreTreeStructure((TreeStructComponent)
++ addedState[3]);
++ child.processRestoreState(context, addedState[4]);
++ try
++ {
++ target.getChildren().add(childIndex, child);
++ }
++ catch (IndexOutOfBoundsException e)
++ {
++ // We can't be sure about where should be this
++ // item, so just add it.
++ target.getChildren().add(child);
++ }
++ }
++ }
++ }
@Override
public Object saveView (FacesContext context)
@@@ -703,7 -715,7 +729,7 @@@
component.popComponentFromEL(context);
}
}
--
++
static List<String> getClientIdsAdded(UIViewRoot root)
{
return (List<String>) root.getAttributes().get(CLIENTIDS_ADDED);
@@@ -1201,7 -1213,7 +1227,7 @@@
}
}
-- private TreeStructComponent internalBuildTreeStructureToSave(UIComponent component)
++ private static TreeStructComponent internalBuildTreeStructureToSave(UIComponent component)
{
TreeStructComponent structComp = new TreeStructComponent(component.getClass().getName(),
component.getId());
@@@ -1248,7 -1260,7 +1274,7 @@@
return structComp;
}
-- private UIComponent internalRestoreTreeStructure(TreeStructComponent treeStructComp)
++ private static UIComponent internalRestoreTreeStructure(TreeStructComponent treeStructComp)
{
String compClass = treeStructComp.getComponentClass();
String compId = treeStructComp.getComponentId();
--
To stop receiving notification emails like this one, please contact
deki@apache.org.