You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2008/01/19 03:55:12 UTC
svn commit: r613346 - in
/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component:
UIXComponentRefTemplate.java UIXDecorateCollectionTemplate.java
UIXMenuTemplate.java UIXSubformTemplate.java
Author: gcrawford
Date: Fri Jan 18 18:55:05 2008
New Revision: 613346
URL: http://svn.apache.org/viewvc?rev=613346&view=rev
Log:
TRINIDAD-908 optimize invokeOnComponent in a namingContainer
Avoid processing children based on id's in invokeOnComponent.
In UIXCollection it implements invokeOnComponent, and unless the client id passed in starts with the client id of the collection, it doesn't process the children. However not all our namingContainers are doing this.
NamingContainers that don't avoid processing children based on id's in invokeOnComponent
* UIXComponentRef
* UIXDecorateCollection
* UIXMenu
* UIXSubform
Added:
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXMenuTemplate.java
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXComponentRefTemplate.java
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXComponentRefTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXComponentRefTemplate.java?rev=613346&r1=613345&r2=613346&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXComponentRefTemplate.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXComponentRefTemplate.java Fri Jan 18 18:55:05 2008
@@ -6,9 +6,9 @@
* 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
@@ -25,6 +25,8 @@
import java.util.Map;
import java.util.Set;
+import javax.faces.FacesException;
+import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
@@ -37,8 +39,40 @@
*
*/
public abstract class UIXComponentRefTemplate extends UIXComponentBase
+ implements NamingContainer
{
/**/ public abstract String getVar();
+
+
+
+ @Override
+ public boolean invokeOnComponent(FacesContext context,
+ String clientId,
+ ContextCallback callback)
+ throws FacesException
+ {
+ String thisClientId = getClientId(context);
+
+ if (clientId.equals(thisClientId))
+ {
+ callback.invokeContextCallback(context, this);
+ return true;
+ }
+
+ // This component is a naming container. If the client id shows it's inside this naming container,
+ // then process further.
+ // Otherwise we know the client id we're looking for is not in this naming container,
+ // so for improved performance short circuit and return false.
+ else if (clientId.startsWith(thisClientId) &&
+ (clientId.charAt(thisClientId.length()) ==
+ NamingContainer.SEPARATOR_CHAR))
+ {
+
+ return super.invokeOnComponent(context, clientId, callback);
+ }
+
+ return false;
+ }
@Override
public void queueEvent(FacesEvent event)
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java?rev=613346&r1=613345&r2=613346&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java Fri Jan 18 18:55:05 2008
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.faces.FacesException;
+import javax.faces.component.ContextCallback;
import javax.faces.context.FacesContext;
import javax.faces.component.NamingContainer;
@@ -77,6 +79,38 @@
return id;
}
+
+
+
+ @Override
+ public boolean invokeOnComponent(FacesContext context,
+ String clientId,
+ ContextCallback callback)
+ throws FacesException
+ {
+ String thisClientId = getClientId(context);
+
+ if (clientId.equals(thisClientId))
+ {
+ callback.invokeContextCallback(context, this);
+ return true;
+ }
+
+ // This component is a naming container. If the client id shows it's inside this naming container,
+ // then process further.
+ // Otherwise we know the client id we're looking for is not in this naming container,
+ // so for improved performance short circuit and return false.
+ else if (clientId.startsWith(thisClientId) &&
+ (clientId.charAt(thisClientId.length()) ==
+ NamingContainer.SEPARATOR_CHAR))
+ {
+
+ return super.invokeOnComponent(context, clientId, callback);
+ }
+
+ return false;
+ }
+
private String _currencyString = null;
}
Added: myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXMenuTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXMenuTemplate.java?rev=613346&view=auto
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXMenuTemplate.java (added)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXMenuTemplate.java Fri Jan 18 18:55:05 2008
@@ -0,0 +1,64 @@
+/*
+ * 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.trinidad.component;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.component.ContextCallback;
+import javax.faces.component.NamingContainer;
+
+/**
+ * <p>
+ * @version $Name: $ ($Revision: 518820 $) $Date: 2007-03-15 18:02:36 -0700 (Thu, 15 Mar 2007) $
+ */
+abstract public class UIXMenuTemplate extends UIXComponentBase
+ implements NamingContainer
+{
+
+
+ @Override
+ public boolean invokeOnComponent(FacesContext context,
+ String clientId,
+ ContextCallback callback)
+ throws FacesException
+ {
+ String thisClientId = getClientId(context);
+
+ if (clientId.equals(thisClientId))
+ {
+ callback.invokeContextCallback(context, this);
+ return true;
+ }
+
+ // This component is a naming container. If the client id shows it's inside this naming container,
+ // then process further.
+ // Otherwise we know the client id we're looking for is not in this naming container,
+ // so for improved performance short circuit and return false.
+ else if (clientId.startsWith(thisClientId) &&
+ (clientId.charAt(thisClientId.length()) ==
+ NamingContainer.SEPARATOR_CHAR))
+ {
+
+ return super.invokeOnComponent(context, clientId, callback);
+ }
+
+ return false;
+ }
+
+}
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java?rev=613346&r1=613345&r2=613346&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java Fri Jan 18 18:55:05 2008
@@ -6,9 +6,9 @@
* 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
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.faces.FacesException;
+import javax.faces.component.ContextCallback;
import javax.faces.component.NamingContainer;
import javax.faces.context.FacesContext;
@@ -73,6 +75,38 @@
{
if (isSubmitted())
super.processUpdates(context);
+ }
+
+
+
+
+ @Override
+ public boolean invokeOnComponent(FacesContext context,
+ String clientId,
+ ContextCallback callback)
+ throws FacesException
+ {
+ String thisClientId = getClientId(context);
+
+ if (clientId.equals(thisClientId))
+ {
+ callback.invokeContextCallback(context, this);
+ return true;
+ }
+
+ // This component is a naming container. If the client id shows it's inside this naming container,
+ // then process further.
+ // Otherwise we know the client id we're looking for is not in this naming container,
+ // so for improved performance short circuit and return false.
+ else if (clientId.startsWith(thisClientId) &&
+ (clientId.charAt(thisClientId.length()) ==
+ NamingContainer.SEPARATOR_CHAR))
+ {
+
+ return super.invokeOnComponent(context, clientId, callback);
+ }
+
+ return false;
}
@SuppressWarnings("unchecked")