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 2011/04/28 02:23:57 UTC
svn commit: r1097297 - in /myfaces/trinidad/branches/2.0.0.1-branch: ./
trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/
Author: arobinson74
Date: Thu Apr 28 00:23:56 2011
New Revision: 1097297
URL: http://svn.apache.org/viewvc?rev=1097297&view=rev
Log:
Merge of trunk SVN revisions 1096803, 1096816 and 1096825 for TRINIDAD-2047
Modified:
myfaces/trinidad/branches/2.0.0.1-branch/ (props changed)
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Propchange: myfaces/trinidad/branches/2.0.0.1-branch/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 28 00:23:56 2011
@@ -8,4 +8,4 @@
/myfaces/trinidad/branches/jwaldman_StyleMap:754977-770778
/myfaces/trinidad/branches/trinidad-1.2.x:923447,923460,929241
/myfaces/trinidad/branches/trinidad-2.0.x:823098-895949
-/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461
+/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461,1096803,1096816,1096825
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java?rev=1097297&r1=1097296&r2=1097297&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java Thu Apr 28 00:23:56 2011
@@ -54,6 +54,15 @@ import org.apache.myfaces.trinidad.model
abstract public class UIXTableTemplate extends UIXIteratorTemplate
implements CollectionComponent
{
+/**/ static public final FacesBean.Type TYPE = new FacesBean.Type(UIXIterator.TYPE);
+
+ // These are "fake" properties that allow the table to get the disclosed row keys and the
+ // selected row key without triggering the call to getCollectionModel from the
+ // RowKeyFacesBeanWrapper class. See the stamp state saving code for its usage.
+ static private final PropertyKey _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY =
+ TYPE.registerKey("disclosedRowKeysWithoutModel", RowKeySet.class);
+ static private final PropertyKey _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY =
+ TYPE.registerKey("selectedRowKeysWithoutModel", RowKeySet.class);
/**
@@ -422,8 +431,17 @@ abstract public class UIXTableTemplate e
state[1] = super.__getMyStampState();
state[2] = Integer.valueOf(getFirst());
state[3] = Boolean.valueOf(isShowAll());
- state[4] = getSelectedRowKeys();
- state[5] = getDisclosedRowKeys();
+
+ // Use "hidden" property keys to allow the row key sets to be retrieved without the
+ // RowKeyFacesBeanWrapper trying to resolve the collection model to be set into the row key
+ // set. This is needed to stop the unnecessary lookup of the collection model when it is not
+ // needed during stamp state saving of the table.
+ RowKeySet selectedRowKeys = (RowKeySet)getProperty(_SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY);
+ RowKeySet disclosedRowKeys = (RowKeySet)getProperty(_DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY);
+
+ state[4] = selectedRowKeys;
+ state[5] = disclosedRowKeys;
+
return state;
}
@@ -536,6 +554,25 @@ abstract public class UIXTableTemplate e
@Override
public Object getProperty(PropertyKey key)
{
+ if (key == _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY)
+ {
+ // This case is only true if the table is trying to serialize the disclosed row keys to
+ // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+ // get the collection model during stamp state saving. This should be permissible as the
+ // state saving code does not need the collection model to be set in the row key set in
+ // order to save its state.
+ return super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+ }
+ else if (key == _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY)
+ {
+ // This case is only true if the table is trying to serialize the selected row keys to
+ // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+ // get the collection model during stamp state saving. This should be permissible as the
+ // state saving code does not need the collection model to be set in the row key set in
+ // order to save its state.
+ return super.getProperty(SELECTED_ROW_KEYS_KEY);
+ }
+
Object value = super.getProperty(key);
if (key == DISCLOSED_ROW_KEYS_KEY)
{
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java?rev=1097297&r1=1097296&r2=1097297&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java Thu Apr 28 00:23:56 2011
@@ -62,6 +62,16 @@ abstract public class UIXTreeTemplate ex
/**/ static public final PropertyKey DISCLOSED_ROW_KEYS_KEY = null;
/**/ static public final PropertyKey SELECTED_ROW_KEYS_KEY = null;
+/**/ static public final FacesBean.Type TYPE = new FacesBean.Type(org.apache.myfaces.trinidad.component.UIXHierarchy.TYPE);
+
+ // These are "fake" properties that allow the table to get the disclosed row keys and the
+ // selected row key without triggering the call to getCollectionModel from the
+ // RowKeyFacesBeanWrapper class. See the stamp state saving code for its usage.
+ static private final PropertyKey _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY =
+ TYPE.registerKey("disclosedRowKeysWithoutModel", RowKeySet.class);
+ static private final PropertyKey _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY =
+ TYPE.registerKey("selectedRowKeysWithoutModel", RowKeySet.class);
+
@Deprecated
public void setRowDisclosureListener(MethodBinding binding)
{
@@ -202,8 +212,17 @@ abstract public class UIXTreeTemplate ex
Object[] state = new Object[4];
state[0] = super.__getMyStampState();
state[1] = getFocusRowKey();
- state[2] = getSelectedRowKeys();
- state[3] = getDisclosedRowKeys();
+
+ // Use "hidden" property keys to allow the row key sets to be retrieved without the
+ // RowKeyFacesBeanWrapper trying to resolve the collection model to be set into the row key
+ // set. This is needed to stop the unnecessary lookup of the collection model when it is not
+ // needed during stamp state saving of the table.
+ RowKeySet selectedRowKeys = (RowKeySet)getProperty(_SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY);
+ RowKeySet disclosedRowKeys = (RowKeySet)getProperty(_DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY);
+
+ state[2] = selectedRowKeys;
+ state[3] = disclosedRowKeys;
+
return state;
}
@@ -242,6 +261,25 @@ abstract public class UIXTreeTemplate ex
@Override
public Object getProperty(PropertyKey key)
{
+ if (key == _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY)
+ {
+ // This case is only true if the table is trying to serialize the disclosed row keys to
+ // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+ // get the collection model during stamp state saving. This should be permissible as the
+ // state saving code does not need the collection model to be set in the row key set in
+ // order to save its state.
+ return super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+ }
+ else if (key == _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY)
+ {
+ // This case is only true if the table is trying to serialize the selected row keys to
+ // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+ // get the collection model during stamp state saving. This should be permissible as the
+ // state saving code does not need the collection model to be set in the row key set in
+ // order to save its state.
+ return super.getProperty(SELECTED_ROW_KEYS_KEY);
+ }
+
Object value = super.getProperty(key);
if (key == DISCLOSED_ROW_KEYS_KEY)
{
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?rev=1097297&r1=1097296&r2=1097297&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Thu Apr 28 00:23:56 2011
@@ -874,6 +874,11 @@ public abstract class UIXCollection exte
/**
* Gets the currencyObject to setup the rowData to use to build initial
* stamp state.
+ * <p>
+ * This allows the collection model to have an initial row key outside of the UIComponent.
+ * Should the model be at a row that is not the first row, the component will restore the row
+ * back to the initial row key instead of a null row key once stamping is done.
+ * </p>
*/
private Object _getCurrencyKeyForInitialStampState()
{
@@ -1851,11 +1856,15 @@ public abstract class UIXCollection exte
FacesContext context = getFacesContext();
Object currencyObj = getRowKey();
- // TRINIDAD-2047: we do not need to save stamp state if there is no active stamp
- if (currencyObj == null)
- {
- return;
- }
+ // Note: even though the currencyObj may be null, we still need to save the state. The reason
+ // is that the code does not clear out the state when it is saved, instead, the un-stamped
+ // state is saved. Once the row key is set back to null, this un-stamped state is restored
+ // onto the children components. This restoration allows editable value holders, show detail
+ // items and nested UIXCollections to clear their state.
+ // For nested UIXCollections, this un-stamped state is required to set the nested collection's
+ // _state (internal state containing the stamp state) to null when not on a row key. Without
+ // that call, the nested UIXCollection components would end up sharing the same stamp state
+ // across parent rows.
int position = 0;
for(UIComponent stamp : getStamps())