You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2009/07/15 23:29:25 UTC

svn commit: r794421 - in /myfaces/trinidad/trunk: ./ trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/ trinidad-sandbox/sandbox-api/src/main/java-te...

Author: arobinson74
Date: Wed Jul 15 21:29:19 2009
New Revision: 794421

URL: http://svn.apache.org/viewvc?rev=794421&view=rev
Log:
TRINIDAD-1483
Applied patch

Modified:
    myfaces/trinidad/trunk/   (props changed)
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/FocusEvent.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java
    myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component/   (props changed)
    myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event/   (props changed)

Propchange: myfaces/trinidad/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 15 21:29:19 2009
@@ -1,4 +1,5 @@
 /myfaces/trinidad/branches/1.2.11.3-branch:770843-770856,771372,785365
+/myfaces/trinidad/branches/1.2.11.4-branch:794062
 /myfaces/trinidad/branches/1.2.9.1-branch:697924,699406,699496
 /myfaces/trinidad/branches/TRINIDAD-1402:745675
 /myfaces/trinidad/branches/jwaldman_StyleMap:754977-770778

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/FocusEvent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/FocusEvent.java?rev=794421&r1=794420&r2=794421&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/FocusEvent.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/FocusEvent.java Wed Jul 15 21:29:19 2009
@@ -25,21 +25,46 @@
 
 
 /**
- * Event delivered when focusing on a node in a tree. 
- * Currently this event doesn't deliver
- * much useful information as it doesn't
- * tell which node is getting focus.
- * This will provide more useful information in a later release.
+ * Event delivered when focusing on a node in a tree. The event includes information
+ * about the old and the new focus row keys.
  * <p>
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/event/FocusEvent.java#0 $) $Date: 10-nov-2005.19:09:01 $
  */
 public class FocusEvent extends FacesEvent
 {
-  public FocusEvent(UIComponent source)
+  /**
+   * Creates a new FocusEvent
+   * @param source source component
+   * @param oldKey old focus row key
+   * @param newKey new focus row key
+   */
+  public FocusEvent(UIComponent source, Object oldKey, Object  newKey)
   {
     super(source);
+    _oldKey  = oldKey;
+    _newKey  = newKey;    
+  }
+
+  /**
+   * The constructor with no key info is currently need for backwards compatibility.
+   * Will be remove at a later time.  
+   * @param source
+   */
+  public FocusEvent(UIComponent source)
+  {
+    this(source, null, null);
   }
   
+  public Object getOldKey()
+  {
+    return _oldKey;
+  }
+
+  public Object getNewKey()
+  {
+    return _newKey;
+  }
+
   @Override
   public void processListener(FacesListener listener)
   {
@@ -77,10 +102,16 @@
     sb.append(getClass().getName());
     sb.append("[component=");
     sb.append(getComponent());
+    sb.append(",oldKey=");
+    sb.append(getOldKey());
+    sb.append(",newKey=");
+    sb.append(getNewKey());
     sb.append(']');
     return sb.toString();
   }
 
+  private final Object _oldKey;
+  private final Object _newKey;
   private static final long serialVersionUID = 1L;
 }
 

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java?rev=794421&r1=794420&r2=794421&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java Wed Jul 15 21:29:19 2009
@@ -293,10 +293,13 @@
             // this must be a root level range change:
             startParam = parameters.get(XhtmlConstants.VALUE_PARAM);
             newStart = Integer.parseInt(startParam) - 1; // value is based at one.
-            tree.setRowKey(tree.getFocusRowKey());
+            Object focusRowKey = tree.getFocusRowKey();
+            tree.setRowKey(focusRowKey);
             tree.setRowIndex(newStart);
-            // queue a focusChange event as well as range change event:
-            new FocusEvent(tree).queue();
+            // queue a focusChange event as well as range change event.
+            // TODO - The FocusRowKey has not changed only the start row index has changed.
+            // Is queueing a FocusEvent really necessary?
+            new FocusEvent(tree, focusRowKey,  focusRowKey).queue();
           }
           else // large record set navigation
           {
@@ -322,8 +325,13 @@
         @Override
         protected void process(UIXHierarchy tree)
         {
+          // if the current focusRowKey is null,  and the FocusRowKey attribute
+          // of the component is EL-bound,  this will call the EL getter, otherwise
+          // we get the "local" FocusRowKey set on the component
+          Object oldKey = tree.getFocusRowKey();
           _restorePathFromParam(parameters, tree);
-          new FocusEvent(tree).queue();
+          Object newKey = tree.getRowKey();
+          new FocusEvent(tree, oldKey, newKey).queue();
         }
       };
       preserve.run((UIXHierarchy) tree);

Propchange: myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 15 21:29:19 2009
@@ -1,3 +1,4 @@
 /myfaces/trinidad/branches/1.2.11.3-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:785365
+/myfaces/trinidad/branches/1.2.11.4-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:794062
 /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:699406,699496
 /myfaces/trinidad/branches/TRINIDAD-1402/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:745675

Propchange: myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 15 21:29:19 2009
@@ -1,3 +1,4 @@
 /myfaces/trinidad/branches/1.2.11.3-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:785365
+/myfaces/trinidad/branches/1.2.11.4-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:794062
 /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:699406,699496
 /myfaces/trinidad/branches/TRINIDAD-1402/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:745675