
package org.eclipse.birt.report.engine.internal.executor.dom;

import java.util.Iterator;

import org.eclipse.birt.report.engine.content.IContent;
import org.eclipse.birt.report.engine.extension.IReportItemExecutor;
import org.eclipse.birt.report.engine.extension.ReportItemExecutorBase;

public class DOMReportItemExecutor extends ReportItemExecutorBase
{

	IContent content;
	DOMReportItemExecutorManager manager;

	DOMReportItemExecutor( DOMReportItemExecutorManager manager )
	{
		this.manager = manager;
	}
	
	public DOMReportItemExecutor(IContent content)
	{
		this.content = content;
		this.manager = new DOMReportItemExecutorManager();
	}

	void setContent( IContent content )
	{
		this.content = content;
	}

	public void close( )
	{
		manager.releaseExecutor( this );
	}

	public IContent execute( )
	{
		childIterator = content.getChildren( ).iterator( );
		return content;
	}

	Iterator childIterator;

	public IReportItemExecutor getNextChild( )
	{
		if ( childIterator.hasNext( ) )
		{
			IContent child = (IContent) childIterator.next( );
			return manager.createExecutor( child );
		}
		return null;
	}

	public boolean hasNextChild( )
	{
		return childIterator.hasNext( );
	}

}

@@ -807,16 +807,65 @@
 e( )%0A%09%7B%0A
+%09%09if ( null == content )%0A%09%09%7B%0A%09%09%09return null;%0A%09%09%7D%0A
 %09%09childI
@@ -910,16 +910,16 @@
 tor( );%0A
-
 %09%09return
@@ -1011,16 +1011,41 @@
 %7B%0A%09%09if (
+ null != childIterator &&
  childIt
@@ -1220,19 +1220,75 @@
 hild( )%0A
-
 %09%7B%0A
+%09%09if ( null == childIterator )%0A%09%09%7B%0A%09%09%09return false;%0A%09%09%7D%0A
 %09%09return

Fix Bugzilla  Bug 198479