myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r925324 - in /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago: component/ComponentUtil.java component/UIDatePicker.java util/EncodeAjaxCallback.java
Date Fri, 19 Mar 2010 16:56:54 GMT
Author: lofwyr
Date: Fri Mar 19 16:56:53 2010
New Revision: 925324

URL: http://svn.apache.org/viewvc?rev=925324&view=rev
Log:
TOBAGO-134: z-index calculation needed
 - managing z-index in request map, also in the ajax case.

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?rev=925324&r1=925323&r2=925324&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
Fri Mar 19 16:56:53 2010
@@ -22,37 +22,11 @@ package org.apache.myfaces.tobago.compon
  * $Id$
  */
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_LINK;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALIGN;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CONVERTER;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CREATE_SPAN;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ESCAPE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOR;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HOVER;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARKUP;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDERED_PARTIALLY;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDER_RANGE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDER_RANGE_EXTERN;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SORTABLE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
-import static org.apache.myfaces.tobago.TobagoConstants.COMMAND_TYPE_NAVIGATE;
-import static org.apache.myfaces.tobago.TobagoConstants.COMMAND_TYPE_RESET;
-import static org.apache.myfaces.tobago.TobagoConstants.COMMAND_TYPE_SCRIPT;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_ITEMS;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_SELECT_BOOLEAN_CHECKBOX;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_SELECT_ONE_RADIO;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.TobagoConstants;
 import org.apache.myfaces.tobago.context.TransientStateHolder;
 import org.apache.myfaces.tobago.el.ConstantMethodBinding;
 import org.apache.myfaces.tobago.event.PopupActionListener;
@@ -66,17 +40,10 @@ import org.apache.myfaces.tobago.util.To
 import javax.faces.FactoryFinder;
 import javax.faces.application.Application;
 import javax.faces.application.FacesMessage;
-import javax.faces.component.ActionSource;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.NamingContainer;
+import javax.faces.component.*;
 import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIGraphic;
 import javax.faces.component.UIOutput;
-import javax.faces.component.UIParameter;
 import javax.faces.component.UISelectItem;
-import javax.faces.component.UISelectItems;
-import javax.faces.component.ValueHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.el.MethodBinding;
@@ -91,14 +58,9 @@ import javax.faces.render.RenderKitFacto
 import javax.faces.render.Renderer;
 import javax.faces.webapp.UIComponentTag;
 import javax.servlet.jsp.JspException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
+
+import static org.apache.myfaces.tobago.TobagoConstants.*;
 
 public class ComponentUtil {
 
@@ -1304,6 +1266,7 @@ public class ComponentUtil {
     }
     Collections.reverse(list);
     invokeOrPrepare(facesContext, list, clientId, callback);
+    facesContext.getExternalContext().getRequestMap().remove(TobagoConstants.ATTR_ZINDEX);
   }
 
   private static void invokeOrPrepare(FacesContext facesContext, List<UIComponent>
list, String clientId,
@@ -1314,6 +1277,8 @@ public class ComponentUtil {
       prepareOnUIData(facesContext, list, clientId, callback);
     } else if (list.get(0) instanceof UIForm) {
       prepareOnUIForm(facesContext, list, clientId, callback);
+    } else if (list.get(0) instanceof UIPopup) {
+      prepareOnUIPopup(facesContext, list, clientId, callback);
     } else {
       prepareOnUIComponent(facesContext, list, clientId, callback);
     }
@@ -1338,8 +1303,24 @@ public class ComponentUtil {
 
   }
 
-  private static void prepareOnUIComponent(FacesContext facesContext, List<UIComponent>
list, String clientId,
-      Callback callback) {
+  private static void prepareOnUIComponent(
+      FacesContext facesContext, List<UIComponent> list, String clientId, Callback
callback) {
+    list.remove(0);
+    invokeOrPrepare(facesContext, list, clientId, callback);
+  }
+
+  private static void prepareOnUIPopup(
+      FacesContext facesContext, List<UIComponent> list, String clientId, Callback
callback) {
+    if (callback instanceof TobagoCallback
+        && PhaseId.RENDER_RESPONSE.equals(((TobagoCallback) callback).getPhaseId()))
{
+      Integer zIndex = (Integer) facesContext.getExternalContext().getRequestMap().get(TobagoConstants.ATTR_ZINDEX);
+      if (zIndex == null) {
+        zIndex = 0;
+      } else {
+        zIndex += 10;
+      }
+      facesContext.getExternalContext().getRequestMap().put(TobagoConstants.ATTR_ZINDEX,
zIndex);
+    }
     list.remove(0);
     invokeOrPrepare(facesContext, list, clientId, callback);
   }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=925324&r1=925323&r2=925324&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
Fri Mar 19 16:56:53 2010
@@ -17,24 +17,6 @@ package org.apache.myfaces.tobago.compon
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.TobagoConstants;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALT;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CALENDAR_DATE_INPUT_ID;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BOX;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BUTTON;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_CALENDAR;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_GRID_LAYOUT;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_HIDDEN;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_IMAGE;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_PANEL;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_POPUP;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_TIME;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
 
@@ -44,6 +26,8 @@ import javax.faces.context.FacesContext;
 import javax.faces.event.FacesEvent;
 import java.util.Map;
 
+import static org.apache.myfaces.tobago.TobagoConstants.*;
+
 /*
  * Date: 30.05.2006
  * Time: 19:22:40
@@ -146,8 +130,6 @@ public class UIDatePicker extends UILink
     final UIPopup popup =
         (UIPopup) ComponentUtil.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
             RENDERER_TYPE_POPUP, (linkId != null ? linkId + "popup" : viewRoot.createUniqueId()));
-    popup.getAttributes().put(TobagoConstants.ATTR_ZINDEX, 10);
-
     link.getFacets().put(FACET_PICKER_POPUP, popup);
 
     popup.setRendered(false);

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java?rev=925324&r1=925323&r2=925324&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
Fri Mar 19 16:56:53 2010
@@ -20,12 +20,13 @@ package org.apache.myfaces.tobago.util;
 
 import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
 
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
 import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
 import java.io.IOException;
 
-public class EncodeAjaxCallback implements Callback {
+public class EncodeAjaxCallback implements TobagoCallback {
 
   public void execute(FacesContext facesContext, UIComponent component) {
     try {
@@ -34,4 +35,8 @@ public class EncodeAjaxCallback implemen
       throw new FacesException(e);
     }
   }
+
+  public PhaseId getPhaseId() {
+    return PhaseId.RENDER_RESPONSE;
+  }
 }



Mime
View raw message