You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mb...@apache.org on 2005/09/06 23:01:00 UTC
svn commit: r279106 - in /myfaces:
api/trunk/src/java/javax/faces/component/UIData.java
tomahawk/trunk/src/java/org/apache/myfaces/component/html/ext/HtmlDataTableHack.java
tomahawk/trunk/src/java/org/apache/myfaces/custom/crosstable/UIColumns.java
Author: mbr
Date: Tue Sep 6 14:00:50 2005
New Revision: 279106
URL: http://svn.apache.org/viewcvs?rev=279106&view=rev
Log:
fix for MYFACES-520
Modified:
myfaces/api/trunk/src/java/javax/faces/component/UIData.java
myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/ext/HtmlDataTableHack.java
myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/crosstable/UIColumns.java
Modified: myfaces/api/trunk/src/java/javax/faces/component/UIData.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/java/javax/faces/component/UIData.java?rev=279106&r1=279105&r2=279106&view=diff
==============================================================================
--- myfaces/api/trunk/src/java/javax/faces/component/UIData.java (original)
+++ myfaces/api/trunk/src/java/javax/faces/component/UIData.java Tue Sep 6 14:00:50 2005
@@ -207,31 +207,34 @@
UIComponent component = (UIComponent) childIterator.next();
// reset the client id (see spec 3.1.6)
component.setId(component.getId());
- Object childState = null;
- Object descendantState = null;
- if (descendantStateIterator != null
- && descendantStateIterator.hasNext())
+ if(!component.isTransient())
{
- Object[] object = (Object[]) descendantStateIterator.next();
- childState = object[0];
- descendantState = object[1];
+ Object childState = null;
+ Object descendantState = null;
+ if (descendantStateIterator != null
+ && descendantStateIterator.hasNext())
+ {
+ Object[] object = (Object[]) descendantStateIterator.next();
+ childState = object[0];
+ descendantState = object[1];
+ }
+ if (component instanceof EditableValueHolder)
+ {
+ ((EditableValueHolderState) childState)
+ .restoreState((EditableValueHolder) component);
+ }
+ Iterator childsIterator;
+ if (restoreChildFacets)
+ {
+ childsIterator = component.getFacetsAndChildren();
+ }
+ else
+ {
+ childsIterator = component.getChildren().iterator();
+ }
+ restoreDescendantComponentStates(childsIterator, descendantState,
+ true);
}
- if (component instanceof EditableValueHolder)
- {
- ((EditableValueHolderState) childState)
- .restoreState((EditableValueHolder) component);
- }
- Iterator childsIterator;
- if (restoreChildFacets)
- {
- childsIterator = component.getFacetsAndChildren();
- }
- else
- {
- childsIterator = component.getChildren().iterator();
- }
- restoreDescendantComponentStates(childsIterator, descendantState,
- true);
}
}
@@ -246,24 +249,27 @@
childStates = new ArrayList();
}
UIComponent child = (UIComponent) childIterator.next();
- Iterator childsIterator;
- if (saveChildFacets)
- {
- childsIterator = child.getFacetsAndChildren();
- }
- else
- {
- childsIterator = child.getChildren().iterator();
- }
- Object descendantState = saveDescendantComponentStates(
- childsIterator, true);
- Object state = null;
- if (child instanceof EditableValueHolder)
+ if(!child.isTransient())
{
- state = new EditableValueHolderState(
- (EditableValueHolder) child);
+ Iterator childsIterator;
+ if (saveChildFacets)
+ {
+ childsIterator = child.getFacetsAndChildren();
+ }
+ else
+ {
+ childsIterator = child.getChildren().iterator();
+ }
+ Object descendantState = saveDescendantComponentStates(
+ childsIterator, true);
+ Object state = null;
+ if (child instanceof EditableValueHolder)
+ {
+ state = new EditableValueHolderState(
+ (EditableValueHolder) child);
+ }
+ childStates.add(new Object[] { state, descendantState });
}
- childStates.add(new Object[] { state, descendantState });
}
return childStates;
}
@@ -344,12 +350,12 @@
public void encodeBegin(FacesContext context) throws IOException
{
+ _initialDescendantComponentState = null;
if (_isValidChilds)
{
//Refresh DataModel for rendering:
_dataModelMap.clear();
_rowStates.clear();
- _initialDescendantComponentState = null;
}
super.encodeBegin(context);
}
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/ext/HtmlDataTableHack.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/ext/HtmlDataTableHack.java?rev=279106&r1=279105&r2=279106&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/ext/HtmlDataTableHack.java (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/component/html/ext/HtmlDataTableHack.java Tue Sep 6 14:00:50 2005
@@ -228,31 +228,34 @@
UIComponent component = (UIComponent) childIterator.next();
// reset the client id (see spec 3.1.6)
component.setId(component.getId());
- Object childState = null;
- Object descendantState = null;
- if (descendantStateIterator != null
- && descendantStateIterator.hasNext())
+ if(!component.isTransient())
{
- Object[] object = (Object[]) descendantStateIterator.next();
- childState = object[0];
- descendantState = object[1];
+ Object childState = null;
+ Object descendantState = null;
+ if (descendantStateIterator != null
+ && descendantStateIterator.hasNext())
+ {
+ Object[] object = (Object[]) descendantStateIterator.next();
+ childState = object[0];
+ descendantState = object[1];
+ }
+ if (component instanceof EditableValueHolder)
+ {
+ ((EditableValueHolderState) childState)
+ .restoreState((EditableValueHolder) component);
+ }
+ Iterator childsIterator;
+ if (restoreChildFacets)
+ {
+ childsIterator = component.getFacetsAndChildren();
+ }
+ else
+ {
+ childsIterator = component.getChildren().iterator();
+ }
+ restoreDescendantComponentStates(childsIterator, descendantState,
+ true);
}
- if (component instanceof EditableValueHolder)
- {
- ((EditableValueHolderState) childState)
- .restoreState((EditableValueHolder) component);
- }
- Iterator childsIterator;
- if (restoreChildFacets)
- {
- childsIterator = component.getFacetsAndChildren();
- }
- else
- {
- childsIterator = component.getChildren().iterator();
- }
- restoreDescendantComponentStates(childsIterator, descendantState,
- true);
}
}
@@ -267,24 +270,27 @@
childStates = new ArrayList();
}
UIComponent child = (UIComponent) childIterator.next();
- Iterator childsIterator;
- if (saveChildFacets)
- {
- childsIterator = child.getFacetsAndChildren();
- }
- else
- {
- childsIterator = child.getChildren().iterator();
- }
- Object descendantState = saveDescendantComponentStates(
- childsIterator, true);
- Object state = null;
- if (child instanceof EditableValueHolder)
+ if(!child.isTransient())
{
- state = new EditableValueHolderState(
- (EditableValueHolder) child);
+ Iterator childsIterator;
+ if (saveChildFacets)
+ {
+ childsIterator = child.getFacetsAndChildren();
+ }
+ else
+ {
+ childsIterator = child.getChildren().iterator();
+ }
+ Object descendantState = saveDescendantComponentStates(
+ childsIterator, true);
+ Object state = null;
+ if (child instanceof EditableValueHolder)
+ {
+ state = new EditableValueHolderState(
+ (EditableValueHolder) child);
+ }
+ childStates.add(new Object[] { state, descendantState });
}
- childStates.add(new Object[] { state, descendantState });
}
return childStates;
}
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/crosstable/UIColumns.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/crosstable/UIColumns.java?rev=279106&r1=279105&r2=279106&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/crosstable/UIColumns.java (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/crosstable/UIColumns.java Tue Sep 6 14:00:50 2005
@@ -60,7 +60,7 @@
private UIData _parentUIData;
private Map _dataModelMap = new HashMap();
-
+
/**
*
*/
@@ -112,10 +112,8 @@
}
else
{
- _cellStates
- .put(
- getClientId(facesContext),
- saveDescendantComponentStates(getFacetsAndChildren()));
+ _cellStates.put(getClientId(facesContext),
+ saveDescendantComponentStates(getFacetsAndChildren()));
}
_colIndex = colIndex;
@@ -139,12 +137,12 @@
{
Object rowData = dataModel.getRowData();
facesContext.getExternalContext().getRequestMap().put(var,
- rowData);
+ rowData);
}
else
{
facesContext.getExternalContext().getRequestMap().remove(
- var);
+ var);
}
}
}
@@ -152,7 +150,7 @@
if (_colIndex == -1)
{
restoreDescendantComponentStates(getFacetsAndChildren(),
- _initialDescendantComponentState);
+ _initialDescendantComponentState);
}
else
{
@@ -160,18 +158,18 @@
if (rowState == null)
{
restoreDescendantComponentStates(getFacetsAndChildren(),
- _initialDescendantComponentState);
+ _initialDescendantComponentState);
}
else
{
restoreDescendantComponentStates(getFacetsAndChildren(),
- rowState);
+ rowState);
}
}
}
protected void restoreDescendantComponentStates(Iterator childIterator,
- Object state)
+ Object state)
{
Iterator descendantStateIterator = null;
while (childIterator.hasNext())
@@ -183,22 +181,25 @@
UIComponent component = (UIComponent) childIterator.next();
// reset the client id (see spec 3.1.6)
component.setId(component.getId());
- Object childState = null;
- Object descendantState = null;
- if (descendantStateIterator != null
- && descendantStateIterator.hasNext())
- {
- Object[] object = (Object[]) descendantStateIterator.next();
- childState = object[0];
- descendantState = object[1];
- }
- if (component instanceof EditableValueHolder)
+ if (!component.isTransient())
{
- ((EditableValueHolderState) childState)
- .restoreState((EditableValueHolder) component);
+ Object childState = null;
+ Object descendantState = null;
+ if (descendantStateIterator != null
+ && descendantStateIterator.hasNext())
+ {
+ Object[] object = (Object[]) descendantStateIterator.next();
+ childState = object[0];
+ descendantState = object[1];
+ }
+ if (component instanceof EditableValueHolder)
+ {
+ ((EditableValueHolderState) childState)
+ .restoreState((EditableValueHolder) component);
+ }
+ restoreDescendantComponentStates(component
+ .getFacetsAndChildren(), descendantState);
}
- restoreDescendantComponentStates(component.getFacetsAndChildren(),
- descendantState);
}
}
@@ -212,19 +213,22 @@
childStates = new ArrayList();
}
UIComponent child = (UIComponent) childIterator.next();
- Object descendantState = saveDescendantComponentStates(child
- .getFacetsAndChildren());
- Object state = null;
- if (child instanceof EditableValueHolder)
+ if (!child.isTransient())
{
- state = new EditableValueHolderState(
- (EditableValueHolder) child);
+ Object descendantState = saveDescendantComponentStates(child
+ .getFacetsAndChildren());
+ Object state = null;
+ if (child instanceof EditableValueHolder)
+ {
+ state = new EditableValueHolderState(
+ (EditableValueHolder) child);
+ }
+ childStates.add(new Object[] { state, descendantState });
}
- childStates.add(new Object[] {state, descendantState});
}
return childStates;
}
-
+
/**
* @see javax.faces.component.UIData#setValue(java.lang.Object)
*/
@@ -256,7 +260,7 @@
protected DataModel getDataModel()
{
String clientID = getParentUIData().getParent().getClientId(
- getFacesContext());
+ getFacesContext());
DataModel dataModel = (DataModel) _dataModelMap.get(clientID);
if (dataModel == null)
{
@@ -269,7 +273,7 @@
protected void setDataModel(DataModel dataModel)
{
_dataModelMap.put(getParentUIData().getParent().getClientId(
- getFacesContext()), dataModel);
+ getFacesContext()), dataModel);
}
/**
@@ -346,7 +350,7 @@
if (obj == null)
return; //Clearing is allowed
throw new UnsupportedOperationException(this.getClass().getName()
- + " UnsupportedOperationException");
+ + " UnsupportedOperationException");
}
};
@@ -400,7 +404,7 @@
if (isRowAvailable())
{
for (Iterator facetsIter = getFacets().values().iterator(); facetsIter
- .hasNext();)
+ .hasNext();)
{
UIComponent facet = (UIComponent) facetsIter.next();
process(context, facet, processAction);
@@ -450,7 +454,7 @@
if (!(parent instanceof UIData))
{
throw new IllegalStateException(
- "UIColumns component must be a child of a UIData component");
+ "UIColumns component must be a child of a UIData component");
}
_parentUIData = (UIData) parent;
}
@@ -477,10 +481,10 @@
if (isRowAvailable())
{
for (Iterator columnChildIter = getChildren().iterator(); columnChildIter
- .hasNext();)
+ .hasNext();)
{
UIComponent columnChild = (UIComponent) columnChildIter
- .next();
+ .next();
process(context, columnChild, processAction);
}
}
@@ -531,19 +535,19 @@
}
private void process(FacesContext context, UIComponent component,
- int processAction)
+ int processAction)
{
switch (processAction)
{
- case PROCESS_DECODES:
- component.processDecodes(context);
- break;
- case PROCESS_VALIDATORS:
- component.processValidators(context);
- break;
- case PROCESS_UPDATES:
- component.processUpdates(context);
- break;
+ case PROCESS_DECODES:
+ component.processDecodes(context);
+ break;
+ case PROCESS_VALIDATORS:
+ component.processValidators(context);
+ break;
+ case PROCESS_UPDATES:
+ component.processUpdates(context);
+ break;
}
}