You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bs...@apache.org on 2014/07/17 23:07:41 UTC
svn commit: r1611476 - in /myfaces/trinidad/trunk: ./ trinidad-api/src/main/
trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/
Author: bsullivan
Date: Thu Jul 17 21:07:41 2014
New Revision: 1611476
URL: http://svn.apache.org/r1611476
Log:
[TRINIDAD-2493] Allow subclasses of UIXCollection to hook processFlattenedChildrenBegin
Also passes the FacesContext to the IteratorRunners to avoid accessing FacesContext.currentInstance()
Modified:
myfaces/trinidad/trunk/ (props changed)
myfaces/trinidad/trunk/trinidad-api/src/main/ (props changed)
myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXIteratorTemplate.java
myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
Propchange: myfaces/trinidad/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jul 17 21:07:41 2014
@@ -20,3 +20,6 @@ relative mtr2 - install.app
relative mtr2 - jdev-jdev.app
relative mtr2 - jetty on demo and install.app
relative mtr2 - jetty on demo.app
+.data
+trin2493_2.1.diff
+trinTrunk2.jws
Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jul 17 21:07:41 2014
@@ -0,0 +1 @@
+webapp
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXIteratorTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXIteratorTemplate.java?rev=1611476&r1=1611475&r2=1611476&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXIteratorTemplate.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXIteratorTemplate.java Thu Jul 17 21:07:41 2014
@@ -86,13 +86,13 @@ public abstract class UIXIteratorTemplat
try
{
// Mimic what would normally happen in the non-flattening case for encodeBegin():
- __processFlattenedChildrenBegin();
-
+ processFlattenedChildrenBegin(cpContext);
+
setupFlattenedChildrenContext(context, cpContext);
try
{
- Runner runner = new IndexedRunner(cpContext)
+ Runner runner = new IndexedRunner(context, cpContext)
{
@Override
protected void process(UIComponent kid, ComponentProcessingContext cpContext) throws IOException
@@ -158,7 +158,7 @@ public abstract class UIXIteratorTemplat
{
if (!isRendered())
return;
-
+
// if this is the table there will be a rendererType:
if (getRendererType() != null)
{
@@ -170,7 +170,7 @@ public abstract class UIXIteratorTemplat
}
else // this is not the table. it must be the iterator
{
- Runner runner = new IndexedRunner()
+ Runner runner = new IndexedRunner(context)
{
@Override
protected void process(
@@ -264,7 +264,7 @@ public abstract class UIXIteratorTemplat
final FacesContext context,
final PhaseId phaseId)
{
- Runner runner = new IndexedRunner()
+ Runner runner = new IndexedRunner(context)
{
@Override
protected void process(UIComponent kid, ComponentProcessingContext cpContext)
@@ -309,7 +309,7 @@ public abstract class UIXIteratorTemplat
{
// we're processing all of the rows, so use the indexed runner (plus, we can't call size() on
// the ALL_IDS collection, so we don't have a whole lot of choice here
- runner = new IndexedRunner()
+ runner = new IndexedRunner(visitContext.getFacesContext())
{
@Override
protected void process(UIComponent kid, ComponentProcessingContext cpContext)
@@ -376,7 +376,7 @@ public abstract class UIXIteratorTemplat
return false;
// visit only the rows we need to
- runner = new KeyedRunner(rowsToVisit)
+ runner = new KeyedRunner(visitContext.getFacesContext(), rowsToVisit)
{
@Override
protected void process(
@@ -407,16 +407,17 @@ public abstract class UIXIteratorTemplat
*/
private abstract class Runner implements ComponentProcessor<Object>
{
- public Runner()
+ public Runner(FacesContext context)
{
- this(null);
+ this(context, null);
}
- public Runner(ComponentProcessingContext cpContext)
+ public Runner(FacesContext context, ComponentProcessingContext cpContext)
{
+ _context = context;
_cpContext = cpContext;
}
-
+
public abstract boolean run();
/**
@@ -461,6 +462,11 @@ public abstract class UIXIteratorTemplat
return _cpContext;
}
+ public final FacesContext getFacesContext()
+ {
+ return _context;
+ }
+
public final void setException(Exception e)
{
_exception = e;
@@ -468,6 +474,7 @@ public abstract class UIXIteratorTemplat
private Exception _exception = null;
+ private final FacesContext _context;
private final ComponentProcessingContext _cpContext;
}
@@ -476,19 +483,19 @@ public abstract class UIXIteratorTemplat
*/
private abstract class IndexedRunner extends Runner
{
- public IndexedRunner()
+ public IndexedRunner(FacesContext context)
{
- this(null);
+ this(context, null);
}
- public IndexedRunner(ComponentProcessingContext cpContext)
+ public IndexedRunner(FacesContext context, ComponentProcessingContext cpContext)
{
- super(cpContext);
+ super(context, cpContext);
}
public final boolean run()
{
- FacesContext context = FacesContext.getCurrentInstance();
+ FacesContext context = getFacesContext();
ComponentProcessingContext cpContext = getComponentProcessingContext();
List<UIComponent> stamps = getStamps();
@@ -535,16 +542,16 @@ public abstract class UIXIteratorTemplat
*/
private abstract class KeyedRunner extends Runner
{
- public KeyedRunner(Iterable<String> clientKeys)
+ public KeyedRunner(FacesContext context, Iterable<String> clientKeys)
{
- super();
+ super(context);
_clientKeys = clientKeys;
}
public final boolean run()
{
- FacesContext context = FacesContext.getCurrentInstance();
-
+ FacesContext context = getFacesContext();
+
List<UIComponent> stamps = getStamps();
int oldIndex = getRowIndex();
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?rev=1611476&r1=1611475&r2=1611476&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Thu Jul 17 21:07:41 2014
@@ -1944,7 +1944,7 @@ public abstract class UIXCollection exte
* This is to mimic what happens in the non flattening case where similar logic is invoked
* during encodeBegin().
*/
- void __processFlattenedChildrenBegin()
+ protected void processFlattenedChildrenBegin(ComponentProcessingContext cpContext)
{
// Call _init() since __flushCachedModel() assumes that
// selectedRowKeys and disclosedRowKeys are initialized to be non-null.