You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2006/05/24 09:54:14 UTC

svn commit: r409088 - in /beehive/trunk/netui/src: pageflow/org/apache/beehive/netui/pageflow/requeststate/NameService.java tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java tags-html/org/apache/beehive/netui/tags/tree/Tree.java

Author: crogers
Date: Wed May 24 00:54:10 2006
New Revision: 409088

URL: http://svn.apache.org/viewvc?rev=409088&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-1112 - Make NameSevice implement Serializable. Also includes a minor change to the tree and div panel so that after a session serialization a page refresh will allow the named INameable object to be put back into the NameService.

tests: NetUI BVT (winXP pass)
 

Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/NameService.java
    beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java
    beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/NameService.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/NameService.java?rev=409088&r1=409087&r2=409088&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/NameService.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/NameService.java Wed May 24 00:54:10 2006
@@ -26,7 +26,7 @@
  * <code>INameable</code> interface.  The typical use of this class is in the XmlHttpRequest
  * request processing to lookup the object that should handle the request.
  */
-final public class NameService
+final public class NameService implements java.io.Serializable
 {
     private static final String NAME_SERVICE = "netui.nameService";
 
@@ -40,7 +40,7 @@
     // static value for situation where this is not stored in the session.
     private static NameService _nameService;
 
-    final private HashMap/*<String,WeakReference>*/ _nameMap = new HashMap();
+    final private transient HashMap/*<String,WeakReference>*/ _nameMap = new HashMap();
     private int _nextValue;
     private ArrayList _listeners;
 

Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java?rev=409088&r1=409087&r2=409088&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/divpanel/DivPanel.java Wed May 24 00:54:10 2006
@@ -166,8 +166,15 @@
 
                 // name the divPanel so we can post state back to this state object.
                 NameService ns = NameService.instance(pageContext.getSession());
-                ns.nameObject("DivPanel", state);
-                ns.put(state);
+                String name = state.getObjectName();
+                if (name == null) {
+                    ns.nameObject("DivPanel", state);
+                    ns.put(state);
+                }
+                else if (ns.get(name) == null) {
+                    // no longer stored in the NameService, add it.
+                    ns.put(state);
+                }
             }
         }
 

Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java?rev=409088&r1=409087&r2=409088&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/tree/Tree.java Wed May 24 00:54:10 2006
@@ -813,11 +813,15 @@
             }
 
             // name the tree if it hasn't been named already
+            // or if no longer stored in the NameService, add it.
             INameable in = (INameable) treeRoot;
             String o = in.getObjectName();
+            NameService ns = NameService.instance(pageContext.getSession());
             if (o == null) {
-                NameService ns = NameService.instance(pageContext.getSession());
                 ns.nameObject("Tree", in);
+                ns.put(in);
+            }
+            else if (ns.get(o) == null) {
                 ns.put(in);
             }
         }