myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r831832 - /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
Date Mon, 02 Nov 2009 09:20:11 GMT
Author: bommel
Date: Mon Nov  2 09:20:00 2009
New Revision: 831832

URL: http://svn.apache.org/viewvc?rev=831832&view=rev
Log:
(TOBAGO-811) Dublicate id excepiton in ri 1.1

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java?rev=831832&r1=831831&r2=831832&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
Mon Nov  2 09:20:00 2009
@@ -21,8 +21,10 @@
 import org.apache.myfaces.tobago.context.ResourceManagerImpl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.util.FacesVersion;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.FacesEvent;
@@ -48,6 +50,8 @@
 
   private ClientProperties clientProperties;
 
+  private int nextUniqueId;
+
   public static final int ANY_PHASE_ORDINAL = PhaseId.ANY_PHASE.getOrdinal();
 
 
@@ -219,4 +223,33 @@
     }
     return events;
   }
+
+  public Object saveState(FacesContext facesContext) {
+    if (FacesVersion.supports12()) {
+      return super.saveState(facesContext);
+    } else {
+      Object[] state = new Object[2];
+      state[0] = super.saveState(facesContext);
+      state[1] = nextUniqueId;
+      return state;
+    }
+  }
+
+  public void restoreState(FacesContext facesContext, Object o) {
+    Object[] state = (Object[]) o;
+    super.restoreState(facesContext, state[0]);
+    if (!FacesVersion.supports12()) {
+      nextUniqueId = (Integer) state[1];
+    }
+  }
+
+  public String createUniqueId() {
+    if (FacesVersion.supports12()) {
+      return super.createUniqueId();
+    } else {
+      ExternalContext extCtx = FacesContext.getCurrentInstance().getExternalContext();
+      return extCtx.encodeNamespace(UNIQUE_ID_PREFIX + nextUniqueId++);
+    }
+  }
+
 }



Mime
View raw message