You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ma...@apache.org on 2006/10/31 00:58:56 UTC

svn commit: r469330 - in /incubator/adffaces/trunk/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/ trinidad-impl/src/main/java/org/a...

Author: matzew
Date: Mon Oct 30 16:58:55 2006
New Revision: 469330

URL: http://svn.apache.org/viewvc?view=rev&rev=469330
Log:
UIXCollection api cleanup - rename get/setCurrencyString to get/setClientRowKey (see ADFFACES-270). Thanx to Arjuna (again)

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/TreeRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?view=diff&rev=469330&r1=469329&r2=469330
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Mon Oct 30 16:58:55 2006
@@ -512,17 +512,39 @@
   }
 
   /**
-   * Gets a short currency string that can be used to setup this component later.
-   * All the information needed to restore the rowData on this component
-   * (for example: rowkey) is encoded on this currency string.
-   * However, this currency string is very short. As a result, its lifetime is
-   * also very short. Currency strings are valid across one request only.
-   * They come into existence during the encode phase, and they are cleared before
-   * the start of the encode phase on the next request.
-   * @see #setCurrencyString
+   * @deprecated use getClientRowKey
+   * @see #getClientRowKey
    */
   public String getCurrencyString()
   {
+    return getClientRowKey();  
+  }
+  
+  /**
+   * @deprecated use setClientRowKey
+   * @see #setClientRowKey
+   */
+  public void setCurrencyString(String currency)
+  {
+    setClientRowKey(currency);
+  }
+
+
+  /**
+   * Gets a String version of the current rowkey.
+   * The contents of the String are controlled by the current
+   * {@link ClientRowKeyManager}.
+   * This String can be passed into the {@link #setClientRowKey} method
+   * to restore the current rowData.
+   * The lifetime of this String is short and it may not be valid during
+   * future requests; however, it is guaranteed to be valid
+   * for the next subsequent request.
+   * @see UIXCollection#setClientRowKey(java.lang.String)
+   * @see UIXCollection#getClientRowKeyManager()
+   * @see ClientRowKeyManager#getClientRowKey
+   */
+  public String getClientRowKey()
+  {
     // only call getCurrencyKey if we already have a dataModel.
     // otherwise behave as though no currency was set.
     // we need to do this because we don't want dataModel created for components
@@ -567,53 +589,43 @@
   }
 
   /**
-   * Restores this component's rowData to be what it was when the given
-   * currency string was created.
-   * <P>
-   * All the information needed to restore the rowData on this component
-   * (for example: rowkey) is encoded on the given currency string.
-   * However, this currency string is very short. As a result, its lifetime is
-   * also very short. Currency strings are valid across one request only.
-   * They come into existence during the encode phase, and they are cleared before
-   * the start of the encode phase on the next request.
-   * <P>
-   * This method gets the corresponding currencyKey and passes it to
-   * {@link #setRowKey}
-   * @see #getCurrencyString
-   */
-  public void setCurrencyString(String currency)
+     * Restores this component's rowData to be what it was when the given
+     * client rowKey string was created.
+     * @see UIXCollection#getClientRowKey()
+     */
+  public void setClientRowKey(String clientRowKey)
   {
-    if (currency == null)
+    if (clientRowKey == null)
     {
       setRowKey(_getCurrencyKeyForInitialStampState());
       return;
     }
 
     FacesContext fc = FacesContext.getCurrentInstance();
-    Object rowkey = getClientRowKeyManager().getRowKey(fc, this, currency);
+    Object rowkey = getClientRowKeyManager().getRowKey(fc, this, clientRowKey);
 
     if (rowkey == null)
     {
-      _LOG.severe("Could not restore currency for currencyString:"+currency);
+      _LOG.severe("Could not find rowKey for clientRowKey:"+clientRowKey);
     }
     else
       setRowKey(rowkey);
   }
 
   /**
-   * Gets the client-id of this component, without any NamingContainers.
-   * This id changes depending on the currency Object.
-   * Because this implementation uses currency strings, the local client ID is
-   * not stable for very long. Its lifetime is the same as that of a
-   * currency string.
-   * @see #getCurrencyString
-   * @return the local clientId
-   */
+     * Gets the client-id of this component, without any NamingContainers.
+     * This id changes depending on the currency Object.
+     * Because this implementation uses currency strings, the local client ID is
+     * not stable for very long. Its lifetime is the same as that of a
+     * currency string.
+     * @see UIXCollection#getClientRowKey()
+     * @return the local clientId
+     */
   @Override
   protected final String getLocalClientId()
   {
     String id = super.getLocalClientId();
-    String key = getCurrencyString();
+    String key = getClientRowKey();
     if (key != null)
     {
       id += NamingContainer.SEPARATOR_CHAR + key;

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java?view=diff&rev=469330&r1=469329&r2=469330
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectManyRenderer.java Mon Oct 30 16:58:55 2006
@@ -144,7 +144,7 @@
     {
       String currencyStr = entry.getKey();
       boolean select = (Boolean.TRUE == entry.getValue());
-      table.setCurrencyString(currencyStr);
+      table.setClientRowKey(currencyStr);
 
       // TODO: do not mutate the component's selectedRowKeys here.
       // instead mutate when the SelectionEvent is broadcast:
@@ -232,7 +232,7 @@
                              NamingContainer.SEPARATOR_CHAR +
                              UNSELECTED_KEY);
     String value = ((UIXCollection) tContext.getCollectionComponent()).
-                getCurrencyString();
+                getClientRowKey();
 
     OutputUtils.renderHiddenField(context,
                                   unsuccessfulId,

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java?view=diff&rev=469330&r1=469329&r2=469330
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java Mon Oct 30 16:58:55 2006
@@ -88,7 +88,7 @@
         else
           state = ((UIXTree) table).getSelectedRowKeys();
 
-        table.setCurrencyString(selection);
+        table.setClientRowKey(selection);
         if (!state.isContained())
         {
           RowKeySet unselected = state.clone();
@@ -257,7 +257,7 @@
       TableRenderingContext tContext =
         TableRenderingContext.getCurrentInstance();
       return ((UIXCollection) tContext.getCollectionComponent()).
-                getCurrencyString();
+                getClientRowKey();
     }
 
     @Override

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java?view=diff&rev=469330&r1=469329&r2=469330
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TreeUtils.java Mon Oct 30 16:58:55 2006
@@ -325,12 +325,12 @@
       UIXHierarchy tree)
   {
     String currencyString = parameters.get(_PATH_PARAM);
-    tree.setCurrencyString(currencyString);
+    tree.setClientRowKey(currencyString);
   }
 
   private static String _getPathParam(UIXHierarchy tree)
   {
-    String currencyString = tree.getCurrencyString();
+    String currencyString = tree.getClientRowKey();
     return currencyString;
   }
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/TreeRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/TreeRenderer.java?view=diff&rev=469330&r1=469329&r2=469330
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/TreeRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/uix/TreeRenderer.java Mon Oct 30 16:58:55 2006
@@ -61,7 +61,7 @@
     {
       UIXTree tree = (UIXTree) component;
       Object oldPath = tree.getRowKey();
-      tree.setCurrencyString(currencyStr);
+      tree.setClientRowKey(currencyStr);
       tree.getSelectedRowKeys().clear();
       tree.getSelectedRowKeys().add();
       tree.setRowKey(oldPath);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java?view=diff&rev=469330&r1=469329&r2=469330
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java Mon Oct 30 16:58:55 2006
@@ -402,7 +402,7 @@
 
   private static String _callJSSelect(UIXHierarchy tree, String jsVarName)
   {
-    String currencyStr = tree.getCurrencyString();
+    String currencyStr = tree.getClientRowKey();
     return jsVarName+".select(this,'"+currencyStr+"');";
   }