View | Details | Raw Unified | Return to bug 173217 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/birt/report/engine/emitter/html/HTMLReportEmitter.java (-1 / +67 lines)
Lines 30-36 Link Here
30
import java.util.logging.Logger;
30
import java.util.logging.Logger;
31
31
32
import org.eclipse.birt.core.exception.BirtException;
32
import org.eclipse.birt.core.exception.BirtException;
33
import org.eclipse.birt.report.engine.api.EngineConstants;
33
import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
34
import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
35
import org.eclipse.birt.report.engine.api.HTMLRenderContext;
34
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
36
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
35
import org.eclipse.birt.report.engine.api.IHTMLActionHandler;
37
import org.eclipse.birt.report.engine.api.IHTMLActionHandler;
36
import org.eclipse.birt.report.engine.api.IHTMLImageHandler;
38
import org.eclipse.birt.report.engine.api.IHTMLImageHandler;
Lines 69-74 Link Here
69
import org.eclipse.birt.report.engine.css.engine.value.birt.BIRTConstants;
71
import org.eclipse.birt.report.engine.css.engine.value.birt.BIRTConstants;
70
import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants;
72
import org.eclipse.birt.report.engine.css.engine.value.css.CSSConstants;
71
import org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter;
73
import org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter;
74
import org.eclipse.birt.report.engine.emitter.IEmitterRenderInfo;
72
import org.eclipse.birt.report.engine.emitter.IEmitterServices;
75
import org.eclipse.birt.report.engine.emitter.IEmitterServices;
73
import org.eclipse.birt.report.engine.emitter.html.util.HTMLEmitterUtil;
76
import org.eclipse.birt.report.engine.emitter.html.util.HTMLEmitterUtil;
74
import org.eclipse.birt.report.engine.executor.ExecutionContext.ElementExceptionInfo;
77
import org.eclipse.birt.report.engine.executor.ExecutionContext.ElementExceptionInfo;
Lines 149-155 Link Here
149
 * </table>
152
 * </table>
150
 * 
153
 * 
151
 */
154
 */
152
public class HTMLReportEmitter extends ContentEmitterAdapter
155
public class HTMLReportEmitter extends ContentEmitterAdapter implements IEmitterRenderInfo
153
{
156
{
154
157
155
	/**
158
	/**
Lines 256-261 Link Here
256
	protected IEmitterServices services;
259
	protected IEmitterServices services;
257
260
258
	/**
261
	/**
262
	 * rendered files 
263
	 */
264
	protected ArrayList renderedFiles = new ArrayList();
265
	
266
	/**
259
	 * The <code>tagStack</code> that stores the tag names to be closed in
267
	 * The <code>tagStack</code> that stores the tag names to be closed in
260
	 * <code>endContainer()</code>.
268
	 * <code>endContainer()</code>.
261
	 */
269
	 */
Lines 336-341 Link Here
336
	{
344
	{
337
		this.services = services;
345
		this.services = services;
338
346
347
		clearRenderedFiles();
348
		
339
		Object fd = services.getOption( RenderOptionBase.OUTPUT_FILE_NAME );
349
		Object fd = services.getOption( RenderOptionBase.OUTPUT_FILE_NAME );
340
		File file = null;
350
		File file = null;
341
		try
351
		try
Lines 349-354 Link Here
349
					parent.mkdirs( );
359
					parent.mkdirs( );
350
				}
360
				}
351
				out = new BufferedOutputStream( new FileOutputStream( file ) );
361
				out = new BufferedOutputStream( new FileOutputStream( file ) );
362
				
363
				addRenderedFile(file.getAbsolutePath());
352
			}
364
			}
353
		}
365
		}
354
		catch ( FileNotFoundException e )
366
		catch ( FileNotFoundException e )
Lines 362-367 Link Here
362
			if ( value != null && value instanceof OutputStream )
374
			if ( value != null && value instanceof OutputStream )
363
			{
375
			{
364
				out = (OutputStream) value;
376
				out = (OutputStream) value;
377
				addRenderedFile(null);
365
			}
378
			}
366
			else
379
			else
367
			{
380
			{
Lines 370-375 Link Here
370
					// FIXME
383
					// FIXME
371
					file = new File( REPORT_FILE );
384
					file = new File( REPORT_FILE );
372
					out = new BufferedOutputStream( new FileOutputStream( file ) );
385
					out = new BufferedOutputStream( new FileOutputStream( file ) );
386
					
387
					addRenderedFile(file.getAbsolutePath());
373
				}
388
				}
374
				catch ( FileNotFoundException e )
389
				catch ( FileNotFoundException e )
375
				{
390
				{
Lines 3437-3442 Link Here
3437
		writer.attribute( HTMLTags.ATTR_ID, group.getBookmark( ) );
3452
		writer.attribute( HTMLTags.ATTR_ID, group.getBookmark( ) );
3438
		writer.closeTag( HTMLTags.TAG_SPAN );
3453
		writer.closeTag( HTMLTags.TAG_SPAN );
3439
	}
3454
	}
3455
	protected Object getRenderContext(IReportContext context) {
3456
3457
		if (context == null) {
3458
			return null;
3459
		}
3460
3461
		Map appContext = context.getAppContext();
3462
		if (appContext != null) {
3463
			String renderContextKey = EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT;
3464
3465
			return appContext.get(renderContextKey);
3466
		}
3467
3468
		return null;
3469
	}
3470
	
3471
	protected void clearRenderedFiles()
3472
	{
3473
		renderedFiles.clear();
3474
	}
3475
	
3476
	protected void addRenderedFile(String file)
3477
	{
3478
		renderedFiles.add(file);
3479
	}
3480
	
3481
	public String[] getRenderedFiles() {
3482
		
3483
		if (reportContext != null)
3484
		{
3485
			Object context = getRenderContext(reportContext);
3486
			
3487
			if (context != null && context instanceof HTMLRenderContext )
3488
			{
3489
				HTMLRenderContext rcontext = (HTMLRenderContext)context;
3490
				String[] images = rcontext.getRenderedFiles();
3491
				for (int i=0; i<images.length; i++) {
3492
					renderedFiles.add(images[i]);
3493
				}
3494
			}
3495
		}
3496
		
3497
		int siz = renderedFiles.size();
3498
		String[] arr = null;
3499
		
3500
		if (siz > 0)
3501
		   arr = (String[]) renderedFiles.toArray(new String[siz]);
3502
		
3503
		return arr;
3504
	}
3505
	
3440
}
3506
}
3441
3507
3442
class IDGenerator
3508
class IDGenerator

Return to bug 173217