You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/01/15 17:58:56 UTC
svn commit: r1433517 - in /myfaces/core/branches/2.1.x-client-window: ./
api/src/main/java/javax/faces/component/
api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/
api/src/main/javascript/META-INF/resources/myfaces/_impl/core/ impl/src/ma...
Author: lu4242
Date: Tue Jan 15 16:58:55 2013
New Revision: 1433517
URL: http://svn.apache.org/viewvc?rev=1433517&view=rev
Log:
merge revisions 1423194-1432818 from trunk
Modified:
myfaces/core/branches/2.1.x-client-window/ (props changed)
myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIForm.java
myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js
myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js
myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheImpl.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/SessionIdGenerator.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheFactoryImpl.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/resources/META-INF/faces-config20.vm (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheTest.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheTest.java (props changed)
myfaces/core/branches/2.1.x-client-window/parent/pom.xml (props changed)
myfaces/core/branches/2.1.x-client-window/parent/src/ (props changed)
myfaces/core/branches/2.1.x-client-window/shared/ (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/pom.xml (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/ (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/TagUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/renderkit/ (props changed)
Propchange: myfaces/core/branches/2.1.x-client-window/
------------------------------------------------------------------------------
Merged /myfaces/core/trunk:r1423194-1432818
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIForm.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIForm.java?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIForm.java (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIForm.java Tue Jan 15 16:58:55 2013
@@ -55,7 +55,11 @@ public class UIForm extends UIComponentB
{
StringBuilder bld = null;
- if (!isPrependId())
+ // When prependId is set to false, it is necessary to append an unique
+ // prefix to ensure the generated ids are unique, but that's only necessary
+ // when no seed is provided. If a seed is provided, that one is already unique
+ // for all the view, so the following logic is not necessary.
+ if (!isPrependId() && seed==null )
{
bld = new StringBuilder();
UniqueIdVendor parentUniqueIdVendor = _ComponentUtils.findParentUniqueIdVendor(this);
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js Tue Jan 15 16:58:55 2013
@@ -635,7 +635,7 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object,
newFocusElement.focus();
}
}
- if (caretPosition) {
+ if (newFocusElement && caretPosition) {
//zero caret position is set automatically on focus
this.setCaretPosition(newFocusElement, caretPosition);
}
@@ -690,8 +690,6 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object,
}
},
-
-
/**
* checks if the provided element is a subelement of a table element
* @param item
@@ -793,8 +791,9 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object,
* this method builds an assertion for those methods to reduce code
*
* @param item the item to be tested
- * @param markup the mark
- * @param caller
+ * @param markup the markup
+ * @param caller caller function
+ * @param {optional} params array of assertion param names
*/
_assertStdParams: function(item, markup, caller, params) {
//internal error
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js Tue Jan 15 16:58:55 2013
@@ -325,9 +325,9 @@ if (_MF_SINGLTN) {
if (!this._isTableElement(childNode)) { //table elements cannot be deleted
childNode.innerHTML = "";
}
- if (b.isIE && b.isIE < 8 && 'undefined' != childNode.outerHTML)
+ if (b.isIE && b.isIE < 8 && 'undefined' != typeof childNode.outerHTML) {
childNode.outerHTML = '';
- else {
+ } else {
node.removeChild(childNode);
}
if (!b.isIEMobile) {
@@ -582,8 +582,7 @@ if (_MF_SINGLTN) {
this.insertFirst(evalDiv);
//we remap it into a real boolean value
- if (window.Range
- && typeof Range.prototype.createContextualFragment == 'function') {
+ if (this.isDomCompliant()) {
this._outerHTMLCompliant(evalDiv, markup);
} else {
//will not be called placeholder for quirks class
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js Tue Jan 15 16:58:55 2013
@@ -758,17 +758,77 @@ if (!myfaces._impl.core._Runtime) {
//implemented in extruntime
this.singletonDelegateObj = function() {};
- //for modern browsers we do not need it anymore
- //there we can rely on browser capabilities checks
- //we only have one xml special case so webkit and opera is the
- //only detection we still need for the minimal case
- //TODO determine how to eliminate this check
- //minimal modern should be able to cope without any browser checks
- //at all
- //with a direct capabilities check
- _T.browser = {};
- var d = _T.browser;
- d.isWebKit = parseFloat(navigator.userAgent.split("WebKit/")[1]) || undefined;
+ /**
+ * browser detection code
+ * cross ported from dojo 1.2
+ *
+ * dojos browser detection code is very sophisticated
+ * hence we port it over it allows a very fine grained detection of
+ * browsers including the version number
+ * this however only can work out if the user
+ * does not alter the user agent, which they normally dont!
+ *
+ * the exception is the ie detection which relies on specific quirks in ie
+ */
+ var n = navigator;
+ var dua = n.userAgent,
+ dav = n.appVersion,
+ tv = parseFloat(dav);
+ var _T = this;
+ _T.browser = {};
+ myfaces._impl.core._EvalHandlers.browser = _T.browser;
+ var d = _T.browser;
+
+ if (dua.indexOf("Opera") >= 0) {
+ _T.isOpera = tv;
+ }
+ if (dua.indexOf("AdobeAIR") >= 0) {
+ d.isAIR = 1;
+ }
+ if (dua.indexOf("BlackBerry") >= 0) {
+ d.isBlackBerry = tv;
+ }
+ d.isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : 0;
+ d.isWebKit = parseFloat(dua.split("WebKit/")[1]) || undefined;
+ d.isChrome = parseFloat(dua.split("Chrome/")[1]) || undefined;
+
+ // safari detection derived from:
+ // http://developer.apple.com/internet/safari/faq.html#anchor2
+ // http://developer.apple.com/internet/safari/uamatrix.html
+ var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
+ if (index && !d.isChrome) {
+ // try to grab the explicit Safari version first. If we don't get
+ // one, look for less than 419.3 as the indication that we're on something
+ // "Safari 2-ish".
+ d.isSafari = parseFloat(dav.split("Version/")[1]);
+ if (!d.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3) {
+ d.isSafari = 2;
+ }
+ }
+
+ //>>excludeStart("webkitMobile", kwArgs.webkitMobile);
+
+ if (dua.indexOf("Gecko") >= 0 && !d.isKhtml && !d.isWebKit) {
+ d.isMozilla = d.isMoz = tv;
+ }
+ if (d.isMoz) {
+ //We really need to get away from _T. Consider a sane isGecko approach for the future.
+ d.isFF = parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1] || dua.split("Shiretoko/")[1]) || undefined;
+ }
+
+ if (document.all && !d.isOpera && !d.isBlackBerry) {
+ d.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
+ d.isIEMobile = parseFloat(dua.split("IEMobile")[1]);
+ //In cases where the page has an HTTP header or META tag with
+ //X-UA-Compatible, then it is in emulation mode, for a previous
+ //version. Make sure isIE reflects the desired version.
+ //document.documentMode of 5 means quirks mode.
+
+ /** @namespace document.documentMode */
+ if (d.isIE >= 8 && document.documentMode != 5) {
+ d.isIE = document.documentMode;
+ }
+ }
};
}
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_RuntimeQuirks.js Tue Jan 15 16:58:55 2013
@@ -13,17 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-if (!document.querySelectorAll) {
+if (!document.querySelectorAll || !window.XMLHttpRequest) {
//initial browser detection, we encapsule it in a closure
//to drop all temporary variables from ram as soon as possible
+ //we run into the quirks fallback if XMLHttpRequest is not enabled
(function() {
var _T = myfaces._impl.core._Runtime;
-
-
-
-
_T.getXHRObject = function() {
//since this is a global object ie hates it if we do not check for undefined
if (window.XMLHttpRequest) {
@@ -49,76 +46,6 @@ if (!document.querySelectorAll) {
return new ActiveXObject('Microsoft.XMLHTTP');
};
- /**
- * browser detection code
- * cross ported from dojo 1.2
- *
- * dojos browser detection code is very sophisticated
- * hence we port it over it allows a very fine grained detection of
- * browsers including the version number
- * this however only can work out if the user
- * does not alter the user agent, which they normally dont!
- *
- * the exception is the ie detection which relies on specific quirks in ie
- */
- var n = navigator;
- var dua = n.userAgent,
- dav = n.appVersion,
- tv = parseFloat(dav);
- var _T = myfaces._impl.core._Runtime;
- _T.browser = {};
- myfaces._impl.core._EvalHandlers.browser = _T.browser;
- var d = _T.browser;
-
- if (dua.indexOf("Opera") >= 0) {
- _T.isOpera = tv;
- }
- if (dua.indexOf("AdobeAIR") >= 0) {
- d.isAIR = 1;
- }
- if (dua.indexOf("BlackBerry") >= 0) {
- d.isBlackBerry = tv;
- }
- d.isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : 0;
- d.isWebKit = parseFloat(dua.split("WebKit/")[1]) || undefined;
- d.isChrome = parseFloat(dua.split("Chrome/")[1]) || undefined;
-
- // safari detection derived from:
- // http://developer.apple.com/internet/safari/faq.html#anchor2
- // http://developer.apple.com/internet/safari/uamatrix.html
- var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
- if (index && !d.isChrome) {
- // try to grab the explicit Safari version first. If we don't get
- // one, look for less than 419.3 as the indication that we're on something
- // "Safari 2-ish".
- d.isSafari = parseFloat(dav.split("Version/")[1]);
- if (!d.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3) {
- d.isSafari = 2;
- }
- }
-
- //>>excludeStart("webkitMobile", kwArgs.webkitMobile);
- if (dua.indexOf("Gecko") >= 0 && !d.isKhtml && !d.isWebKit) {
- d.isMozilla = d.isMoz = tv;
- }
- if (d.isMoz) {
- //We really need to get away from _T. Consider a sane isGecko approach for the future.
- d.isFF = parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1] || dua.split("Shiretoko/")[1]) || undefined;
- }
-
- if (document.all && !d.isOpera && !d.isBlackBerry) {
- d.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
- d.isIEMobile = parseFloat(dua.split("IEMobile")[1]);
- //In cases where the page has an HTTP header or META tag with
- //X-UA-Compatible, then it is in emulation mode, for a previous
- //version. Make sure isIE reflects the desired version.
- //document.documentMode of 5 means quirks mode.
-
- /** @namespace document.documentMode */
- if (d.isIE >= 8 && document.documentMode != 5) {
- d.isIE = document.documentMode;
- }
- }
})();
}
\ No newline at end of file
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js Tue Jan 15 16:58:55 2013
@@ -41,7 +41,7 @@ if (!window.jsf) {
_ls("#{resource['org.apache.myfaces.core.impl.util:_HtmlStripper.js']}", null, null, "UTF-8", false);
_ls("#{resource['org.apache.myfaces.core.impl.util:_OamSubmit.js']}", null, null, "UTF-8", false);
- _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_FinalizeableObj.js']}", null, null, "UTF-8", false);
+ //_ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_FinalizeableObj.js']}", null, null, "UTF-8", false);
_ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxUtils.js']}", null, null, "UTF-8", false);
_ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequestQueue.js']}", null, null, "UTF-8", false);
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheImpl.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheImpl.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/SessionIdGenerator.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/SessionIdGenerator.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheFactoryImpl.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheFactoryImpl.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheUtils.java:r1423194-1432818
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java Tue Jan 15 16:58:55 2013
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
import javax.faces.component.UniqueIdVendor;
import javax.faces.context.FacesContext;
import javax.faces.view.AttachedObjectHandler;
@@ -336,6 +337,33 @@ abstract public class FaceletComposition
* UIComponent to finalize
*/
public abstract void finalizeForDeletion(UIComponent component);
+
+ public void removeComponentForDeletion(UIComponent component)
+ {
+ }
+
+ /**
+ * Marks the given resource for deletion. Is to be used for relocatable
+ * components instead of {@link #markForDeletion(UIComponent)}.
+ *
+ * @since 2.0.17 2.1.11
+ * @param component
+ * UIComponent to finalize
+ */
+ public void markRelocatableResourceForDeletion(UIComponent component)
+ {
+ }
+
+ /**
+ * Used to clean up all unused relocatable components on the root component.
+ *
+ * @since 2.0.17 2.1.11
+ * @param component
+ * UIComponent to finalize (root component)
+ */
+ public void finalizeRelocatableResourcesForDeletion(UIViewRoot root)
+ {
+ }
/**
* Add a method expression as targeted for the provided composite component
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java Tue Jan 15 16:58:55 2013
@@ -40,6 +40,7 @@ import javax.el.ExpressionFactory;
import javax.faces.FacesException;
import javax.faces.application.Resource;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
import javax.faces.component.UniqueIdVendor;
import javax.faces.context.FacesContext;
import javax.faces.view.facelets.FaceletContext;
@@ -177,6 +178,23 @@ final class DefaultFacelet extends Abstr
this.refresh(parent);
myFaceletContext.markForDeletion(parent);
_root.apply(ctx, parent);
+ if (faceletCompositionContextInitialized &&
+ parent instanceof UIViewRoot)
+ {
+ UIComponent metadataFacet = parent.getFacet(UIViewRoot.METADATA_FACET_NAME);
+ if (metadataFacet != null)
+ {
+ // Ensure metadata facet is removed from deletion, so if by some reason
+ // is not refreshed, its content will not be removed from the component tree.
+ // This behavior is preferred, even if the spec suggest to include it using
+ // a trick with the template client.
+ myFaceletContext.removeComponentForDeletion(metadataFacet);
+ }
+ if (myFaceletContext.isRefreshingTransientBuild())
+ {
+ myFaceletContext.finalizeRelocatableResourcesForDeletion((UIViewRoot) parent);
+ }
+ }
myFaceletContext.finalizeForDeletion(parent);
this.markApplied(parent);
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java Tue Jan 15 16:58:55 2013
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
import javax.faces.component.UniqueIdVendor;
import javax.faces.context.FacesContext;
import javax.faces.view.AttachedObjectHandler;
@@ -81,6 +82,8 @@ public class FaceletCompositionContextIm
public static final String INIT_PARAM_WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE
= "org.apache.myfaces.WRAP_TAG_EXCEPTIONS_AS_CONTEXT_AWARE";
+ private static final String JAVAX_FACES_LOCATION_PREFIX = "javax_faces_location_";
+
private FacesContext _facesContext;
private FaceletFactory _factory;
@@ -113,6 +116,8 @@ public class FaceletCompositionContextIm
private List<Map<String, UIComponent>> _componentsMarkedForDeletion;
+ private Map<String, UIComponent> _relocatableResourceForDeletion;
+
private int _deletionLevel;
private Map<UIComponent, List<AttachedObjectHandler>> _attachedObjectHandlers;
@@ -147,6 +152,7 @@ public class FaceletCompositionContextIm
_factory = factory;
_facesContext = facesContext;
_componentsMarkedForDeletion = new ArrayList<Map<String,UIComponent>>();
+ _relocatableResourceForDeletion = new HashMap<String, UIComponent>();
_deletionLevel = -1;
_sectionUniqueIdCounter = new SectionUniqueIdCounter();
//Cached at facelet view
@@ -237,6 +243,7 @@ public class FaceletCompositionContextIm
_uniqueIdVendorStack = null;
_validationGroupsStack = null;
_componentsMarkedForDeletion = null;
+ _relocatableResourceForDeletion = null;
_sectionUniqueIdCounter = null;
_sectionUniqueNormalIdCounter = null;
_sectionUniqueMetadataIdCounter = null;
@@ -820,6 +827,32 @@ public class FaceletCompositionContextIm
}
}
+ @Override
+ public void removeComponentForDeletion(UIComponent component)
+ {
+ String id = (String) component.getAttributes().get(ComponentSupport.MARK_CREATED);
+ if (id != null)
+ {
+ removeComponentForDeletion(id);
+ }
+ else if (id == null
+ && Boolean.TRUE.equals(component.getAttributes().get(ComponentSupport.FACET_CREATED_UIPANEL_MARKER)))
+ {
+ if (component.getChildCount() > 0)
+ {
+ for (int i = 0, size = component.getChildCount(); i < size; i++)
+ {
+ UIComponent child = component.getChildren().get(i);
+ id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED);
+ if (id != null)
+ {
+ removeComponentForDeletion(id);
+ }
+ }
+ }
+ }
+ }
+
public void finalizeForDeletion(UIComponent component)
{
String id = (String) component.getAttributes().get(ComponentSupport.MARK_CREATED);
@@ -885,6 +918,61 @@ public class FaceletCompositionContextIm
decreaseComponentLevelMarkedForDeletion();
}
+ @Override
+ public void markRelocatableResourceForDeletion(UIComponent component)
+ {
+ // The idea is keep track of the component resources that can be relocated
+ // to later check which resources were not refreshed and delete them.
+ String id = (String) component.getAttributes().get(ComponentSupport.MARK_CREATED);
+ if (id != null)
+ {
+ _relocatableResourceForDeletion.put(id, component);
+ }
+ }
+
+ @Override
+ public void finalizeRelocatableResourcesForDeletion(UIViewRoot root)
+ {
+ String id = null;
+ //Check facets
+ if (root.getFacetCount() > 0)
+ {
+ Map<String, UIComponent> facets = root.getFacets();
+ for (Iterator<UIComponent> itr = facets.values().iterator(); itr.hasNext();)
+ {
+ UIComponent fc = itr.next();
+ // It is necessary to check only the facets that are used as holder for
+ // component resources. To do that, the best way is check the ones that
+ // has id starting with "javax_faces_location_"
+ if (fc.getId() != null && fc.getId().startsWith(JAVAX_FACES_LOCATION_PREFIX))
+ {
+ // Check all children with MARK_CREATED and if one is found, check if it was
+ // refreshed by the algorithm.
+ int childCount = fc.getChildCount();
+ if (childCount > 0)
+ {
+ for (int i = 0; i < childCount; i ++)
+ {
+ UIComponent child = fc.getChildren().get(i);
+ id = (String) child.getAttributes().get(ComponentSupport.MARK_CREATED);
+ if (id != null && finalizeRelocatableResourcesForDeletion(id) == null)
+ {
+ fc.getChildren().remove(i);
+ i--;
+ childCount--;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private UIComponent finalizeRelocatableResourcesForDeletion(String id)
+ {
+ return _relocatableResourceForDeletion.remove(id);
+ }
+
public String startComponentUniqueIdSection()
{
_level++;
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java Tue Jan 15 16:58:55 2013
@@ -114,8 +114,15 @@ public class RenderFacetHandler extends
}
facetList.add(facetName);
+
+ // Do not call super.apply(ctx, parent), because it forces component creation,
+ // and in this step it is not necessary. Also, it changes the order of
+ // the generated ids.
+ }
+ else
+ {
+ super.apply(ctx, parent);
}
- super.apply(ctx, parent);
}
@Override
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java?rev=1433517&r1=1433516&r2=1433517&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java Tue Jan 15 16:58:55 2013
@@ -226,7 +226,16 @@ public class ComponentTagHandlerDelegate
{
log.fine(_delegate.getTag() + " Component[" + id + "] Found, marking children for cleanup");
}
+
+ // The call for mctx.markForDeletion(c) is always necessary, because
+ // component resource relocation occur as an effect of PostAddToViewEvent,
+ // so at this point it is unknown if the component was relocated or not.
mctx.markForDeletion(c);
+
+ if (_relocatableResourceHandler != null)
+ {
+ mctx.markRelocatableResourceForDeletion(c);
+ }
}
else
{
@@ -285,6 +294,11 @@ public class ComponentTagHandlerDelegate
// hook method
_delegate.onComponentCreated(ctx, c, parent);
+
+ if (mctx.isRefreshingTransientBuild() && _relocatableResourceHandler != null)
+ {
+ mctx.markRelocatableResourceForDeletion(c);
+ }
}
c.pushComponentToEL(facesContext, c);
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/resources/META-INF/faces-config20.vm
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/resources/META-INF/faces-config20.vm:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheTest.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheTest.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheTest.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheTest.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/parent/pom.xml
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/parent/pom.xml:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/parent/src/
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/parent/src:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared/
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/pom.xml
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/pom.xml:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/src/
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/TagUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/TagUtils.java:r1423194-1432818
Propchange: myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/renderkit/
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/renderkit:r1423194-1432818