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 2010/05/23 02:19:48 UTC
svn commit: r947351 - in
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets:
AbstractFaceletContext.java TemplateManager.java
impl/DefaultFaceletContext.java tag/ui/CompositionHandler.java
tag/ui/InsertHandler.java
Author: lu4242
Date: Sun May 23 00:19:48 2010
New Revision: 947351
URL: http://svn.apache.org/viewvc?rev=947351&view=rev
Log:
MYFACES-2638 Fix PostAddToViewEvent and PreRemoveFromViewEvent publishing conditions (cleanup TemplateClient API use LinkedList on _clients structure, fix popClient/add popExtendedClient and add TemplateManager as public interface because it will be useful when we fix composite component algorithm)
Added:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateManager.java
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/AbstractFaceletContext.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/AbstractFaceletContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/AbstractFaceletContext.java?rev=947351&r1=947350&r2=947351&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/AbstractFaceletContext.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/AbstractFaceletContext.java Sun May 23 00:19:48 2010
@@ -66,10 +66,16 @@ public abstract class AbstractFaceletCon
public abstract void pushClient(TemplateClient client);
/**
- * Pop the last added TemplateClient
+ * Pop the last added pushed TemplateClient
* @see TemplateClient
*/
- public abstract void popClient(TemplateClient client);
+ public abstract TemplateManager popClient(TemplateClient client);
+
+ /**
+ * Pop the last added extended TemplateClient
+ * @param client
+ */
+ public abstract TemplateManager popExtendedClient(TemplateClient client);
public abstract void extendClient(TemplateClient client);
Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateManager.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateManager.java?rev=947351&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateManager.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateManager.java Sun May 23 00:19:48 2010
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.myfaces.view.facelets;
+
+
+/**
+ *
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 945454 $ $Date: 2010-05-17 20:40:21 -0500 (Lun, 17 May 2010) $
+ * @since 2.0
+ */
+public abstract class TemplateManager implements TemplateClient
+{
+
+}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java?rev=947351&r1=947350&r2=947351&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java Sun May 23 00:19:48 2010
@@ -47,6 +47,7 @@ import org.apache.myfaces.view.facelets.
import org.apache.myfaces.view.facelets.FaceletCompositionContext;
import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
import org.apache.myfaces.view.facelets.TemplateClient;
+import org.apache.myfaces.view.facelets.TemplateManager;
import org.apache.myfaces.view.facelets.el.DefaultVariableMapper;
import org.apache.myfaces.view.facelets.tag.jsf.core.AjaxHandler;
@@ -79,7 +80,7 @@ final class DefaultFaceletContext extend
private final StringBuilder _uniqueIdBuilder = new StringBuilder(30);
- private final List<TemplateManager> _clients;
+ private final LinkedList<TemplateManager> _clients;
private final boolean _isBuildingCompositeComponentMetadata;
@@ -130,7 +131,7 @@ final class DefaultFaceletContext extend
_ctx = faces.getELContext();
_ids = new HashMap<String, Integer>();
_prefixes = new HashMap<Integer, Integer>();
- _clients = new ArrayList<TemplateManager>(5);
+ _clients = new LinkedList<TemplateManager>();
_faces = faces;
_fnMapper = _ctx.getFunctionMapper();
_varMapper = _ctx.getVariableMapper();
@@ -358,54 +359,71 @@ final class DefaultFaceletContext extend
//Begin methods from AbstractFaceletContext
@Override
- public void popClient(TemplateClient client)
+ public TemplateManager popClient(TemplateClient client)
{
- if (!this._clients.isEmpty())
- {
- Iterator<TemplateManager> itr = this._clients.iterator();
- while (itr.hasNext())
- {
- if (itr.next().equals(client))
- {
- itr.remove();
- return;
- }
- }
- }
- throw new IllegalStateException(client + " not found");
+ //if (!this._clients.isEmpty())
+ //{
+ // Iterator<TemplateManager> itr = this._clients.iterator();
+ // while (itr.hasNext())
+ // {
+ // if (itr.next().equals(client))
+ // {
+ // itr.remove();
+ // return;
+ // }
+ // }
+ //}
+ //throw new IllegalStateException(client + " not found");
+ return _clients.removeFirst();
}
@Override
public void pushClient(final TemplateClient client)
{
- this._clients.add(0, new TemplateManager(this._facelet, client, true));
+ //this._clients.add(0, new TemplateManager(this._facelet, client, true));
+ this._clients.addFirst(new TemplateManagerImpl(this._facelet, client, true));
}
+ public TemplateManager popExtendedClient(TemplateClient client)
+ {
+ return _clients.removeLast();
+ }
+
@Override
public void extendClient(final TemplateClient client)
{
- this._clients.add(new TemplateManager(this._facelet, client, false));
+ //this._clients.add(new TemplateManager(this._facelet, client, false));
+ this._clients.addLast(new TemplateManagerImpl(this._facelet, client, false));
}
@Override
public boolean includeDefinition(UIComponent parent, String name)
throws IOException, FaceletException, FacesException, ELException
{
+ //boolean found = false;
+ //TemplateManager client;
+ //for (int i = 0, size = this._clients.size(); i < size && !found; i++)
+ //{
+ // client = ((TemplateManager) this._clients.get(i));
+ // if (client.equals(this._facelet))
+ // continue;
+ // found = client.apply(this, parent, name);
+ //}
+ //return found;
boolean found = false;
TemplateManager client;
-
- for (int i = 0, size = this._clients.size(); i < size && !found; i++)
+ Iterator<TemplateManager> itr = _clients.iterator();
+ while (itr.hasNext() && !found)
{
- client = ((TemplateManager) this._clients.get(i));
+ client = itr.next();
if (client.equals(this._facelet))
continue;
- found = client.apply(this, parent, name);
+ found = ((TemplateManagerImpl)client).apply(this, parent, name);
}
-
return found;
}
- private final static class TemplateManager implements TemplateClient
+ private final static class TemplateManagerImpl extends TemplateManager implements TemplateClient
{
private final DefaultFacelet _owner;
@@ -415,7 +433,7 @@ final class DefaultFaceletContext extend
private final Set<String> _names = new HashSet<String>();
- public TemplateManager(DefaultFacelet owner, TemplateClient target,
+ public TemplateManagerImpl(DefaultFacelet owner, TemplateClient target,
boolean root)
{
this._owner = owner;
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java?rev=947351&r1=947350&r2=947351&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/CompositionHandler.java Sun May 23 00:19:48 2010
@@ -141,7 +141,7 @@ public final class CompositionHandler ex
}
finally
{
- actx.popClient(this);
+ actx.popExtendedClient(this);
ctx.setVariableMapper(orig);
}
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java?rev=947351&r1=947350&r2=947351&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java Sun May 23 00:19:48 2010
@@ -94,7 +94,7 @@ public final class InsertHandler extends
}
finally
{
- actx.popClient(this);
+ actx.popExtendedClient(this);
}
if (!found)
{