You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2010/11/09 22:41:51 UTC
svn commit: r1033247 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/util/
tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/
Author: bommel
Date: Tue Nov 9 21:41:50 2010
New Revision: 1033247
URL: http://svn.apache.org/viewvc?rev=1033247&view=rev
Log:
TOBAGO-929 fixed invokeOnComponent for the jsf 1.2 version of tobago
Added:
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesInvokeOnComponent12.java
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIToolBar.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java?rev=1033247&r1=1033246&r2=1033247&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java Tue Nov 9 21:41:50 2010
@@ -17,12 +17,8 @@ package org.apache.myfaces.tobago.intern
* limitations under the License.
*/
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.FacesEvent;
@@ -30,7 +26,7 @@ import javax.faces.event.PhaseId;
import java.util.Iterator;
public abstract class AbstractUICommandBase extends javax.faces.component.UICommand
- implements InvokeOnComponent, SupportsRenderedPartially {
+ implements SupportsRenderedPartially {
public void processDecodes(FacesContext context) {
if (context == null) {
@@ -69,11 +65,6 @@ public abstract class AbstractUICommandB
}
}
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
- }
-
public abstract boolean isJsfResource();
public abstract String getResource();
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java?rev=1033247&r1=1033246&r2=1033247&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java Tue Nov 9 21:41:50 2010
@@ -19,7 +19,6 @@ package org.apache.myfaces.tobago.intern
import org.apache.commons.collections.KeyValue;
import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.component.CreateComponentUtils;
@@ -41,9 +40,7 @@ import org.apache.myfaces.tobago.util.De
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
-import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.servlet.ServletRequest;
@@ -55,7 +52,7 @@ import java.util.List;
import java.util.StringTokenizer;
public abstract class AbstractUIPage extends AbstractUIForm
- implements OnComponentPopulated, InvokeOnComponent, LayoutContainer, DeprecatedDimension {
+ implements OnComponentPopulated, LayoutContainer, DeprecatedDimension {
private static final Logger LOG = LoggerFactory.getLogger(AbstractUIPage.class);
@@ -293,11 +290,6 @@ public abstract class AbstractUIPage ext
this.defaultActionId = defaultActionId;
}
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
- }
-
public void onComponentPopulated(FacesContext facesContext, UIComponent parent) {
if (getLayoutManager() == null) {
setLayoutManager(CreateComponentUtils.createAndInitLayout(
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java?rev=1033247&r1=1033246&r2=1033247&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java Tue Nov 9 21:41:50 2010
@@ -17,19 +17,7 @@ package org.apache.myfaces.tobago.intern
* limitations under the License.
*/
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
+public abstract class AbstractUIPanelBase extends javax.faces.component.UIPanel {
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
-import javax.faces.context.FacesContext;
-public abstract class AbstractUIPanelBase extends javax.faces.component.UIPanel
- implements InvokeOnComponent {
-
-
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
- }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java?rev=1033247&r1=1033246&r2=1033247&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java Tue Nov 9 21:41:50 2010
@@ -18,7 +18,6 @@ package org.apache.myfaces.tobago.intern
*/
import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.component.CreateComponentUtils;
@@ -37,8 +36,6 @@ import org.apache.myfaces.tobago.util.Co
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
import javax.faces.component.NamingContainer;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
@@ -48,7 +45,7 @@ import java.util.Iterator;
import java.util.List;
public abstract class AbstractUIPopup extends AbstractUIPanelBase
- implements OnComponentCreated, OnComponentPopulated, NamingContainer, InvokeOnComponent,
+ implements OnComponentCreated, OnComponentPopulated, NamingContainer,
DeprecatedDimension, Position, LayoutContainer {
private static final Logger LOG = LoggerFactory.getLogger(AbstractUIPopup.class);
@@ -178,12 +175,6 @@ public abstract class AbstractUIPopup ex
activated = false;
}
- @Override
- public boolean invokeOnComponent(FacesContext facesContext, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(facesContext, this, clientId, callback);
- }
-
public LayoutManager getLayoutManager() {
return (LayoutManager) getFacet(Facets.LAYOUT);
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIToolBar.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIToolBar.java?rev=1033247&r1=1033246&r2=1033247&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIToolBar.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIToolBar.java Tue Nov 9 21:41:50 2010
@@ -17,16 +17,10 @@ package org.apache.myfaces.tobago.intern
* limitations under the License.
*/
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.layout.LayoutComponent;
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
-import javax.faces.context.FacesContext;
-
public abstract class AbstractUIToolBar extends javax.faces.component.UIPanel
- implements InvokeOnComponent, LayoutComponent {
+ implements LayoutComponent {
public static final String LABEL_BOTTOM = "bottom";
public static final String LABEL_RIGHT = "right";
@@ -39,9 +33,4 @@ public abstract class AbstractUIToolBar
public static final String ORIENTATION_LEFT = "left";
public static final String ORIENTATION_RIGHT = "right";
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
- }
-
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java?rev=1033247&r1=1033246&r2=1033247&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java Tue Nov 9 21:41:50 2010
@@ -22,6 +22,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.internal.layout.LayoutContext;
import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import javax.faces.FacesException;
@@ -46,7 +47,16 @@ public class EncodeAjaxCallback implemen
}
}
if (component instanceof LayoutContainer) {
- new LayoutContext((LayoutContainer) component).layout();
+ LayoutContainer layoutContainer = (LayoutContainer) component;
+ Measure width = layoutContainer.getCurrentWidth();
+ Measure height = layoutContainer.getCurrentHeight();
+ Measure oldWidth = layoutContainer.getWidth();
+ Measure oldHeight = layoutContainer.getHeight();
+ layoutContainer.setWidth(width);
+ layoutContainer.setHeight(height);
+ new LayoutContext(layoutContainer).layout();
+ layoutContainer.setWidth(oldWidth);
+ layoutContainer.setHeight(oldHeight);
}
prepareRendererAll(facesContext, component);
encodeAll(facesContext, component);
Added: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesInvokeOnComponent12.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesInvokeOnComponent12.java?rev=1033247&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesInvokeOnComponent12.java (added)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesInvokeOnComponent12.java Tue Nov 9 21:41:50 2010
@@ -0,0 +1,64 @@
+package org.apache.myfaces.tobago.compat;
+
+/*
+ * 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.
+ */
+
+import javax.faces.component.ContextCallback;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+public class FacesInvokeOnComponent12 {
+
+ public static boolean invokeOnComponent(
+ FacesContext context, UIComponent component, String clientId, ContextCallback callback) {
+ String thisClientId = component.getClientId(context);
+
+ if (clientId.equals(thisClientId)) {
+ callback.invokeContextCallback(context, component);
+ return true;
+ } else if (component instanceof NamingContainer) {
+ // 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.
+ if (clientId.startsWith(thisClientId)
+ && (clientId.charAt(thisClientId.length()) == NamingContainer.SEPARATOR_CHAR)) {
+ if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
+ return true;
+ }
+ }
+ } else {
+ if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static boolean invokeOnComponentFacetsAndChildren(
+ FacesContext context, UIComponent component, String clientId, ContextCallback callback) {
+ for (java.util.Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();) {
+ UIComponent child = it.next();
+ if (child.invokeOnComponent(context, clientId, callback)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java?rev=1033247&r1=1033246&r2=1033247&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java Tue Nov 9 21:41:50 2010
@@ -63,28 +63,30 @@ public class FacesUtils {
public static boolean invokeOnComponent(
FacesContext context, UIComponent component, String clientId, ContextCallback callback) {
String thisClientId = component.getClientId(context);
-
- if (clientId.equals(thisClientId)) {
- callback.invokeContextCallback(context, component);
- return true;
- } else if (component instanceof NamingContainer) {
- // 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.
- if (clientId.startsWith(thisClientId)
- && (clientId.charAt(thisClientId.length()) == NamingContainer.SEPARATOR_CHAR)) {
+ if (binding) {
+ if (clientId.equals(thisClientId)) {
+ callback.invokeContextCallback(context, component);
+ return true;
+ } else if (component instanceof NamingContainer) {
+ // 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.
+ if (clientId.startsWith(thisClientId)
+ && (clientId.charAt(thisClientId.length()) == NamingContainer.SEPARATOR_CHAR)) {
+ if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
+ return true;
+ }
+ }
+ } else {
if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
return true;
}
}
+ return false;
} else {
- if (invokeOnComponentFacetsAndChildren(context, component, clientId, callback)) {
- return true;
- }
+ return FacesInvokeOnComponent12.invokeOnComponent(context, component, clientId, callback);
}
-
- return false;
}
private static boolean invokeOnComponentFacetsAndChildren(